]> code.ossystems Code Review - openembedded-core.git/commitdiff
scripts/bitbake: Check the git-native version and build it if necessary
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 17 Jul 2012 11:59:28 +0000 (12:59 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 18 Jul 2012 13:28:44 +0000 (14:28 +0100)
We require git version 1.7.5 or later for the git remote --mirror=xxx syntax.
If we have an older version of git, this patch ensure we build git-replacement-native.
We add an alternative PROVIDES in the same way as tar-native to allow this script
to trigger the build whilst still allowing git-native in ASSUME_PROVIDED.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
meta/recipes-devtools/git/git.inc
scripts/bitbake

index ce2f5742f1a926f1b0e3e5f99defd79dd3c3c679..6748b70d24173097a6b8e74e638820cdc3f09110 100644 (file)
@@ -3,6 +3,8 @@ SECTION = "console/utils"
 LICENSE = "GPLv2"
 DEPENDS = "openssl curl zlib expat"
 
+PROVIDES_append_virtclass-native = " git-replacement-native"
+
 SRC_URI = "${KERNELORG_MIRROR}/software/scm/git/git-${PV}.tar.bz2 "
 S = "${WORKDIR}/git-${PV}"
 
index 3772d826fe9565e03f61f233709420cf3339fcc3..580f377a619e703a44fda09f1913cfdec35fc3cf 100755 (executable)
@@ -58,7 +58,9 @@ elif [ -z "$BUILDDIR" ] ; then
 fi
 
 needtar="1"
+needgit="1"
 TARVERSION=`tar --version | head -n 1 | cut -d ' ' -f 4`
+GITVERSION=`git --version | cut -d ' ' -f 3`
 float_test() {
      echo | awk 'END { exit ( !( '"$1"')); }'
 }
@@ -67,6 +69,10 @@ float_test() {
 # but earlier versions do not; this needs to work properly for sstate
 float_test "$TARVERSION > 1.23" && needtar="0"
 
+# Need git >= 1.7.5 for git-remote --mirror=xxx syntax
+float_test "$GITVERSION >= 1.7.5" && needgit="0"
+
+
 buildpseudo="1"
 if [ $needpseudo = "1" ]; then
     if [ -e "$BUILDDIR/pseudodone" ]; then
@@ -97,6 +103,10 @@ fi
 if [ -e "$PSEUDOBINDIR/tar" -a "$needtar" = "1" ]; then
     needtar="0"
 fi
+# If git is already built, we don't want to do it again...
+if [ -e "$PSEUDOBINDIR/git" -a "$needgit" = "1" ]; then
+    needgit="0"
+fi
 
 if [ $needpseudo = "0" ]; then
     buildpseudo="0"
@@ -123,6 +133,11 @@ if [ $buildpseudo -gt 0 ]; then
     if [ $needtar = "0" ]; then
         TARTARGET=""
     fi
+    GITTARGET="git-replacement-native"
+    if [ $needgit = "0" ]; then
+        GITTARGET=""
+    fi
+
     # Pass through debug options
     additionalopts=""
     for opt in $@; do
@@ -134,7 +149,7 @@ if [ $buildpseudo -gt 0 ]; then
             fi
         done
     done
-    bitbake pseudo-native $TARTARGET $additionalopts -c populate_sysroot
+    bitbake pseudo-native $TARTARGET $GITTARGET $additionalopts -c populate_sysroot
     ret=$?
     if [ "$ret" != "0" ]; then
         exit 1