[Bitbake-dev] [PATCH] fetchers: Add --exclude-vcs option to tar

Khem Raj raj.khem at gmail.com
Sat Sep 25 00:21:34 CEST 2010


This option will exclude the SCM metadata from tar files.
It works with GNU tar only.

Tested with gcc where svn tar which used to be 156M for gcc 4.5
is now 77M

Signed-off-by: Khem Raj <raj.khem at gmail.com>
---
 lib/bb/fetch/bzr.py |    2 +-
 lib/bb/fetch/cvs.py |    2 +-
 lib/bb/fetch/git.py |    2 +-
 lib/bb/fetch/hg.py  |    2 +-
 lib/bb/fetch/svn.py |    2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/bb/fetch/bzr.py b/lib/bb/fetch/bzr.py
index 8b0bd9f..4e97ef5 100644
--- a/lib/bb/fetch/bzr.py
+++ b/lib/bb/fetch/bzr.py
@@ -107,7 +107,7 @@ class Bzr(Fetch):
         os.chdir(ud.pkgdir)
         # tar them up to a defined filename
         try:
-            runfetchcmd("tar -czf %s %s" % (ud.localpath, os.path.basename(ud.pkgdir)), d)
+            runfetchcmd("tar --exclude-vcs -czf %s %s" % (ud.localpath, os.path.basename(ud.pkgdir)), d)
         except:
             t, v, tb = sys.exc_info()
             try:
diff --git a/lib/bb/fetch/cvs.py b/lib/bb/fetch/cvs.py
index 1064b09..8bd3fd6 100644
--- a/lib/bb/fetch/cvs.py
+++ b/lib/bb/fetch/cvs.py
@@ -162,7 +162,7 @@ class Cvs(Fetch):
         # tar them up to a defined filename
         if 'fullpath' in ud.parm:
             os.chdir(pkgdir)
-            myret = os.system("tar -czf %s %s" % (ud.localpath, localdir))
+            myret = os.system("tar --exclude-vcs -czf %s %s" % (ud.localpath, localdir))
         else:
             os.chdir(moddir)
             os.chdir('..')
diff --git a/lib/bb/fetch/git.py b/lib/bb/fetch/git.py
index 1b1bc95..9b35aa2 100644
--- a/lib/bb/fetch/git.py
+++ b/lib/bb/fetch/git.py
@@ -149,7 +149,7 @@ class Git(Fetch):
 
         os.chdir(codir)
         logger.info("Creating tarball of git checkout")
-        runfetchcmd("tar -czf %s %s" % (ud.localpath, os.path.join(".", "*") ), d)
+        runfetchcmd("tar --exclude-vcs -czf %s %s" % (ud.localpath, os.path.join(".", "*") ), d)
 
         os.chdir(ud.clonedir)
         bb.utils.prunedir(codir)
diff --git a/lib/bb/fetch/hg.py b/lib/bb/fetch/hg.py
index ab00d43..47e58d2 100644
--- a/lib/bb/fetch/hg.py
+++ b/lib/bb/fetch/hg.py
@@ -145,7 +145,7 @@ class Hg(Fetch):
 
         os.chdir(ud.pkgdir)
         try:
-            runfetchcmd("tar -czf %s %s" % (ud.localpath, ud.module), d)
+            runfetchcmd("tar --exclude-vcs -czf %s %s" % (ud.localpath, ud.module), d)
         except:
             t, v, tb = sys.exc_info()
             try:
diff --git a/lib/bb/fetch/svn.py b/lib/bb/fetch/svn.py
index 34f8132..46c0be2 100644
--- a/lib/bb/fetch/svn.py
+++ b/lib/bb/fetch/svn.py
@@ -159,7 +159,7 @@ class Svn(Fetch):
         os.chdir(ud.pkgdir)
         # tar them up to a defined filename
         try:
-            runfetchcmd("tar -czf %s %s" % (ud.localpath, ud.module), d)
+            runfetchcmd("tar --exclude-vcs -czf %s %s" % (ud.localpath, ud.module), d)
         except:
             t, v, tb = sys.exc_info()
             try:
-- 
1.7.1




More information about the bitbake-devel mailing list