* Allows generating version information from Git during build.
* Note that tar doesn't need to use --exclude '.git', because
  git checkout-index doesn't clone the repository.

Signed-off-by: Andreas Oberritter <[email protected]>
---
 lib/bb/fetch/git.py |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/lib/bb/fetch/git.py b/lib/bb/fetch/git.py
index 2b252f3..1312671 100644
--- a/lib/bb/fetch/git.py
+++ b/lib/bb/fetch/git.py
@@ -142,14 +142,20 @@ class Git(Fetch):
             readpathspec = ""
             coprefix = os.path.join(codir, "git", "")
 
-        bb.mkdirhier(codir)
-        os.chdir(ud.clonedir)
-        runfetchcmd("%s read-tree %s%s" % (ud.basecmd, ud.tag, readpathspec), 
d)
-        runfetchcmd("%s checkout-index -q -f --prefix=%s -a" % (ud.basecmd, 
coprefix), d)
+        scmdata = ud.parm.get("scmdata", "")
+        if scmdata == "keep":
+            runfetchcmd("%s clone -n %s %s" % (ud.basecmd, ud.clonedir, 
coprefix), d)
+            os.chdir(coprefix)
+            runfetchcmd("%s checkout -q -f %s%s" % (ud.basecmd, ud.tag, 
readpathspec), d)
+        else:
+            bb.mkdirhier(codir)
+            os.chdir(ud.clonedir)
+            runfetchcmd("%s read-tree %s%s" % (ud.basecmd, ud.tag, 
readpathspec), d)
+            runfetchcmd("%s checkout-index -q -f --prefix=%s -a" % 
(ud.basecmd, coprefix), d)
 
         os.chdir(codir)
         logger.info("Creating tarball of git checkout")
-        runfetchcmd("tar --exclude '.git' -czf %s %s" % (ud.localpath, 
os.path.join(".", "*") ), d)
+        runfetchcmd("tar -czf %s %s" % (ud.localpath, os.path.join(".", "*") 
), d)
 
         os.chdir(ud.clonedir)
         bb.utils.prunedir(codir)
-- 
1.7.2.3

_______________________________________________
Bitbake-dev mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/bitbake-dev

Reply via email to