Improve handling of Haiku clone without any tags.

* Error out early with a hint about how to solve the problem (by setting
  HAIKU_REVISION explicitly).
This commit is contained in:
Oliver Tappe 2014-05-31 15:32:44 +02:00
parent e1594b1775
commit d4563ace72
2 changed files with 11 additions and 3 deletions

View File

@ -373,7 +373,7 @@ rule DetermineHaikuRevision
# root directory, so it gets updated when the revision changes due to
# commits or merges.
local gitIndex = <haiku-rootdir-git>index ;
local revisionFile = <haiku-rootdir-git>haiku-revision ;
local revisionFile = <haiku-rootdir>haiku-revision ;
if ! [ on $(gitIndex) return $(HAIKU_GIT_REVISION_DETERMINED) ] {
HAIKU_GIT_REVISION_DETERMINED on $(gitIndex) = 1 ;
MakeLocate $(revisionFile) : $(HAIKU_BUILD_OUTPUT_DIR) ;
@ -424,6 +424,12 @@ rule DetermineEffectiveHaikuRevision
actions DetermineEffectiveHaikuRevision1
{
revision=`sed -n 's,^\(hrev[0-9]*\).*,\1,p' "$(2:E=unknown-revision)"`
if [ -z "$revision" ]; then
echo "Error: unable to determine the effective Haiku revision."
echo " If you are using a Haiku clone without tags, you can set"
echo " the revision tag to use with e.g. HAIKU_REVISION=hrev43210"
exit 1
fi
echo "${revision:-0}" > "$(1)"
}

View File

@ -31,8 +31,10 @@ if [ -z "$revision" -o "$lastBuiltRevision" != "$localRev" ]; then
# last reachable hrev-(haiku-revision-)tag
revision=`git describe --dirty --tags --match=hrev*`
if [ -z "$revision" ]; then
# failed to find any hrev tags, use short hash instead
revision=`git rev-parse --short HEAD`
# 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
elif echo "$revision" | grep -- '-' >/dev/null; then
# HEAD is not directly a changeset from Haiku's central repo, so we
# add the current branch name as additional info