2011-05-16 02:45:43 +04:00
|
|
|
#!/bin/sh
|
|
|
|
|
2013-08-26 18:38:50 +04:00
|
|
|
haikuTop=$1
|
|
|
|
revisionFile=$2
|
|
|
|
haikuBuildOutputDir=`dirname $revisionFile`
|
|
|
|
lastBuiltRevisionFile=${haikuBuildOutputDir}/last-built-revision
|
2011-05-16 20:11:42 +04:00
|
|
|
|
2013-08-26 18:38:50 +04:00
|
|
|
case `uname` in
|
|
|
|
Darwin)
|
|
|
|
SED=gsed
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
SED=sed
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
export SED
|
2011-05-16 02:45:43 +04:00
|
|
|
|
2013-08-26 18:38:50 +04:00
|
|
|
revision=`cat ${revisionFile} 2>/dev/null`
|
|
|
|
lastBuiltRevision=`cat $lastBuiltRevisionFile 2>/dev/null`
|
2011-05-16 02:45:43 +04:00
|
|
|
|
2013-08-26 18:38:50 +04:00
|
|
|
originalDir=`pwd`
|
|
|
|
cd ${haikuTop}
|
|
|
|
export LC_ALL=C
|
2011-05-16 20:11:42 +04:00
|
|
|
|
2013-08-26 18:38:50 +04:00
|
|
|
localRev=`git rev-parse HEAD`
|
2011-05-24 23:23:56 +04:00
|
|
|
|
2018-09-16 03:00:02 +03:00
|
|
|
# only determine the haiku-revision if anything has changed from the
|
2013-08-26 18:38:50 +04:00
|
|
|
# last build
|
|
|
|
if [ -z "$revision" -o "$lastBuiltRevision" != "$localRev" ]; then
|
|
|
|
# the revision we use is the description of HEAD with respect to the
|
|
|
|
# last reachable hrev-(haiku-revision-)tag
|
2018-09-16 03:00:02 +03:00
|
|
|
revision=`git describe --dirty --tags --match=hrev* --abbrev=1`
|
2013-01-15 04:37:56 +04:00
|
|
|
if [ -z "$revision" ]; then
|
2014-05-31 17:32:44 +04:00
|
|
|
# failed to find any hrev tags, bail out
|
|
|
|
echo "Error: you are using a Haiku clone without tags, please set"
|
|
|
|
echo " the revision tag to use (e.g. HAIKU_REVISION=hrev43210)"
|
|
|
|
exit 1
|
2018-09-16 03:00:02 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
revision=`echo $revision | sed 's/-g.....//' | sed 's/-/+/g'`
|
|
|
|
if echo "$revision" | grep -- '-' >/dev/null; then
|
2013-08-26 18:38:50 +04:00
|
|
|
# HEAD is not directly a changeset from Haiku's central repo, so we
|
|
|
|
# add the current branch name as additional info
|
|
|
|
branchName=`git branch | grep '*' | cut -b 3-`
|
|
|
|
revision="$revision [$branchName]"
|
2011-05-16 20:11:42 +04:00
|
|
|
fi
|
2013-08-26 18:38:50 +04:00
|
|
|
fi
|
|
|
|
|
|
|
|
cd $originalDir
|
|
|
|
|
|
|
|
if [ -z "$revision" ]; then
|
|
|
|
revision=0
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo $localRev >${lastBuiltRevisionFile}
|
|
|
|
echo $revision >${revisionFile}
|