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) $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
. $(HAIKU_TOP)/build/scripts/determine_haiku_revision $(HAIKU_TOP) \ . $(HAIKU_TOP)/build/scripts/determine_haiku_revision
$(HAIKU_BUILD_OUTPUT_DIR) determineHaikuRevision $(HAIKU_TOP) $(HAIKU_BUILD_OUTPUT_DIR)
$(2[1]) --data $(2[3]) $(1) && $(2[1]) --data $(2[3]) $(1) &&
$(2[2]) $(1) ${revision} $(2[2]) $(1) ${revision}
} }

View File

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