[haiku-commits] r41539 - in haiku/trunk/build: jam scripts

  • From: zooey@xxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 16 May 2011 18:11:43 +0200 (CEST)

Author: zooey
Date: 2011-05-16 18:11:42 +0200 (Mon, 16 May 2011)
New Revision: 41539
Changeset: https://dev.haiku-os.org/changeset/41539

Modified:
   haiku/trunk/build/jam/FileRules
   haiku/trunk/build/scripts/determine_haiku_revision
Log:
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


Modified: haiku/trunk/build/jam/FileRules
===================================================================
--- haiku/trunk/build/jam/FileRules     2011-05-16 16:00:18 UTC (rev 41538)
+++ haiku/trunk/build/jam/FileRules     2011-05-16 16:11:42 UTC (rev 41539)
@@ -335,8 +335,9 @@
 {
        $(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}
 }

Modified: haiku/trunk/build/scripts/determine_haiku_revision
===================================================================
--- haiku/trunk/build/scripts/determine_haiku_revision  2011-05-16 16:00:18 UTC 
(rev 41538)
+++ haiku/trunk/build/scripts/determine_haiku_revision  2011-05-16 16:11:42 UTC 
(rev 41539)
@@ -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 @@
                                $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
+}


Other related posts: