Files
OpenCellular/scripts/getversion.sh
Mike Frysinger d574f070c5 avoid git status
When trying to build out-of-tree, running `git status` will attempt to
write to the .git/ dir which causes a sandbox violation.

Since this code doesn't seem to actually do anything, drop it.

BUG=chromium:466499
TEST=precq still passes
TEST=build now passes when building out of tree
TEST=`./scripts/getversion.sh` produces good output with clean & dirty trees
BRANCH=None

Change-Id: Ia722fedef692876ffc87109b3a1d2e4a76235532
Reviewed-on: https://chromium-review.googlesource.com/259541
Trybot-Ready: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2015-03-13 07:04:19 +00:00

34 lines
952 B
Bash
Executable File

#!/bin/bash
#
# Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# Generate version information
if ghash=$(git rev-parse --short --verify HEAD 2>/dev/null); then
if gdesc=$(git describe --dirty --match='v*' 2>/dev/null); then
IFS="-" fields=($gdesc)
tag="${fields[0]}"
IFS="." vernum=($tag)
numcommits=$((${vernum[2]}+${fields[1]:-0}))
ver_major="${vernum[0]}"
ver_branch="${vernum[1]}"
else
numcommits=$(git rev-list HEAD | wc -l)
ver_major="v0"
ver_branch="0"
fi
# avoid putting the -dirty attribute if only the timestamp
# changed
dirty=$(sh -c "[ '$(git diff-index --name-only HEAD)' ] \
&& echo '-dirty'")
ver="${ver_major}.${ver_branch}.${numcommits}-${ghash}${dirty}"
else
ver="unknown"
fi
date=$(date '+%F %T')
echo "const char futility_version[] = \"${ver} ${date} ${USER}\";";