Adjusted code for determining the revision in order to hopefully work on FreeBSD, too

* convert determine_haiku_revision to only contain functions and now pass the arguments 
  via function call


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41539 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Tappe 2011-05-16 16:11:42 +00:00
parent b6ba1daaac
commit 2fe19bf6ac
2 changed files with 37 additions and 37 deletions

View File

@ -335,8 +335,9 @@ actions CopySetHaikuRevision1
{
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
. $(HAIKU_TOP)/build/scripts/determine_haiku_revision $(HAIKU_TOP) \
$(HAIKU_BUILD_OUTPUT_DIR)
. $(HAIKU_TOP)/build/scripts/determine_haiku_revision
determineHaikuRevision $(HAIKU_TOP) $(HAIKU_BUILD_OUTPUT_DIR)
$(2[1]) --data $(2[3]) $(1) &&
$(2[2]) $(1) ${revision}
}

View File

@ -1,19 +1,12 @@
#!/bin/sh
# get and check the parameters
if [ $# -lt 2 ]; then
echo Usage: $0 '<haiku top> <haiku build output dir>' >&2
exit 1
fi
HAIKU_TOP=$1
HAIKU_BUILD_OUTPUT_DIR=$2
determineGitRevision()
{
revision=`cat ${HAIKU_BUILD_OUTPUT_DIR}/haiku-revision 2>/dev/null`
lastBuiltRevision=`cat ${HAIKU_BUILD_OUTPUT_DIR}/last-built-revision \
haikuTop=$1
haikuBuildOutputDir=$2
revision=`cat ${haikuBuildOutputDir}/haiku-revision 2>/dev/null`
lastBuiltRevision=`cat ${haikuBuildOutputDir}/last-built-revision \
2>/dev/null`
localRev=`git rev-list -n1 HEAD`
@ -68,30 +61,36 @@ determineGitRevision()
$haikuBaseRev`
revision="$revision [$haikuBaseRevDescr]"
fi
echo $localRev >${HAIKU_BUILD_OUTPUT_DIR}/last-built-revision
echo $localRev >${haikuBuildOutputDir}/last-built-revision
fi
}
originalDir=`pwd`
cd ${HAIKU_TOP}
export LC_ALL=C
if [ -d .svn ]; then
revision=`svn info 2>/dev/null | grep Revision | awk '{printf $2}'`
elif [ -d .git/svn ]; then
revision=`git svn info 2>/dev/null | grep Revision | awk '{printf $2}'`
elif [ -d .git ]; then
determineGitRevision
elif [ -d .hg ]; then
# Try searching hg log for last svn commit
# Extract from "(svn r12345) ..." line
revision=`(cd ${HAIKU_TOP} &&
hg log --no-merges --template "{desc|firstline}\n") 2> /dev/null |
grep --max-count=1 "(svn r" |
sed -n -e 's,(svn r\(.*\)).*,\1,p'`
fi
if [ "$revision" = "" ]; then
revision=0
fi
echo $revision >${HAIKU_BUILD_OUTPUT_DIR}/haiku-revision
cd $originalDir
determineHaikuRevision()
{
haikuTop=$1
haikuBuildOutputDir=$2
originalDir=`pwd`
cd ${haikuTop}
export LC_ALL=C
if [ -d .svn ]; then
revision=`svn info 2>/dev/null | grep Revision | awk '{printf $2}'`
elif [ -d .git/svn ]; then
revision=`git svn info 2>/dev/null | grep Revision | awk '{printf $2}'`
elif [ -d .git ]; then
determineGitRevision $haikuTop $haikuBuildOutputDir
elif [ -d .hg ]; then
# Try searching hg log for last svn commit
# Extract from "(svn r12345) ..." line
revision=`(cd ${haikuTop} &&
hg log --no-merges --template "{desc|firstline}\n") 2> /dev/null |
grep --max-count=1 "(svn r" |
sed -n -e 's,(svn r\(.*\)).*,\1,p'`
fi
if [ "$revision" = "" ]; then
revision=0
fi
echo $revision >${haikuBuildOutputDir}/haiku-revision
cd $originalDir
}