]> code.ossystems Code Review - openembedded-core.git/commitdiff
fetchers: Add parameter scmdata=keep to include .git/ and others in generated tarballs.
authorAndreas Oberritter <obi@opendreambox.org>
Wed, 8 Dec 2010 13:38:23 +0000 (13:38 +0000)
committerRichard Purdie <rpurdie@linux.intel.com>
Tue, 4 Jan 2011 14:46:51 +0000 (14:46 +0000)
* Allows generating version information from SCMs during build.
* Note that tar doesn't need to use --exclude '.git', because
  git checkout-index doesn't clone the repository.

(Bitbake rev: 05cbc1d1a01c667c77688f36fbc5b61c5f452a3a)

Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
bitbake/lib/bb/fetch/bzr.py
bitbake/lib/bb/fetch/cvs.py
bitbake/lib/bb/fetch/git.py
bitbake/lib/bb/fetch/hg.py
bitbake/lib/bb/fetch/repo.py
bitbake/lib/bb/fetch/svn.py

index 7d377a15d9bf45bdb76f5d24a8cba6e7d9a720d7..0eb2dad5dcfdf3270f9d769b05edf47bad388aa2 100644 (file)
@@ -100,9 +100,16 @@ class Bzr(Fetch):
             runfetchcmd(bzrcmd, d)
 
         os.chdir(ud.pkgdir)
+
+        scmdata = ud.parm.get("scmdata", "")
+        if scmdata == "keep":
+            tar_flags = ""
+        else:
+            tar_flags = "--exclude '.bzr' --exclude '.bzrtags'"
+
         # tar them up to a defined filename
         try:
-            runfetchcmd("tar --exclude '.bzr' --exclude '.bzrtags' -czf %s %s" % (ud.localpath, os.path.basename(ud.pkgdir)), d)
+            runfetchcmd("tar %s -czf %s %s" % (tar_flags, ud.localpath, os.path.basename(ud.pkgdir)), d)
         except:
             t, v, tb = sys.exc_info()
             try:
index bd919e234efa25936ba11e911b50c699037d49e5..0edb794b044787f3f1e19a3522392f2c41b46237 100644 (file)
@@ -149,14 +149,20 @@ class Cvs(Fetch):
                 pass
             raise FetchError(ud.module)
 
+        scmdata = ud.parm.get("scmdata", "")
+        if scmdata == "keep":
+            tar_flags = ""
+        else:
+            tar_flags = "--exclude 'CVS'"
+
         # tar them up to a defined filename
         if 'fullpath' in ud.parm:
             os.chdir(pkgdir)
-            myret = os.system("tar --exclude 'CVS' -czf %s %s" % (ud.localpath, localdir))
+            myret = os.system("tar %s -czf %s %s" % (tar_flags, ud.localpath, localdir))
         else:
             os.chdir(moddir)
             os.chdir('..')
-            myret = os.system("tar -czf %s %s" % (ud.localpath, os.path.basename(moddir)))
+            myret = os.system("tar %s -czf %s %s" % (tar_flags, ud.localpath, os.path.basename(moddir)))
 
         if myret != 0:
             try:
index a2fbd78cbf36f7841e35aa36c1ab268877f8f8cb..de415ec309a9077de0e52b728010290b2d96641a 100644 (file)
@@ -180,14 +180,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)
index 6bc261ae681c1acc7be7d939fd5b555b0a93a2bc..3c649a6ad0c9d0f35dd8648d3e6840bf12525679 100644 (file)
@@ -143,9 +143,15 @@ class Hg(Fetch):
         logger.debug(1, "Running %s", updatecmd)
         runfetchcmd(updatecmd, d)
 
+        scmdata = ud.parm.get("scmdata", "")
+        if scmdata == "keep":
+            tar_flags = ""
+        else:
+            tar_flags = "--exclude '.hg' --exclude '.hgrags'"
+
         os.chdir(ud.pkgdir)
         try:
-            runfetchcmd("tar --exclude '.hg' --exclude '.hgrags' -czf %s %s" % (ud.localpath, ud.module), d)
+            runfetchcmd("tar %s -czf %s %s" % (tar_flags, ud.localpath, ud.module), d)
         except:
             t, v, tb = sys.exc_info()
             try:
index e5132a14fed7255a5821d912c7e44659401ba542..03642e7a0d2a13e37ab4de6015f9b172cf414434 100644 (file)
@@ -79,8 +79,14 @@ class Repo(Fetch):
         runfetchcmd("repo sync", d)
         os.chdir(codir)
 
+        scmdata = ud.parm.get("scmdata", "")
+        if scmdata == "keep":
+            tar_flags = ""
+        else:
+            tar_flags = "--exclude '.repo' --exclude '.git'"
+
         # Create a cache
-        runfetchcmd("tar --exclude=.repo --exclude=.git -czf %s %s" % (ud.localpath, os.path.join(".", "*") ), d)
+        runfetchcmd("tar %s -czf %s %s" % (tar_flags, ud.localpath, os.path.join(".", "*") ), d)
 
     def supports_srcrev(self):
         return False
index dc35c9d121259b9180ddd5dbdca1df7d1a44a275..8f053abf74b7e101227b46b9b8760a77a955e2d5 100644 (file)
@@ -151,10 +151,16 @@ class Svn(Fetch):
             logger.debug(1, "Running %s", svnfetchcmd)
             runfetchcmd(svnfetchcmd, d)
 
+        scmdata = ud.parm.get("scmdata", "")
+        if scmdata == "keep":
+            tar_flags = ""
+        else:
+            tar_flags = "--exclude '.svn'"
+
         os.chdir(ud.pkgdir)
         # tar them up to a defined filename
         try:
-            runfetchcmd("tar --exclude '.svn' -czf %s %s" % (ud.localpath, ud.module), d)
+            runfetchcmd("tar %s -czf %s %s" % (tar_flags, ud.localpath, ud.module), d)
         except:
             t, v, tb = sys.exc_info()
             try: