summaryrefslogtreecommitdiff
path: root/bitbake/lib/bb/fetch
diff options
context:
space:
mode:
authorAndreas Oberritter <obi@opendreambox.org>2010-12-08 13:38:23 +0000
committerRichard Purdie <rpurdie@linux.intel.com>2011-01-04 14:46:51 +0000
commitbd34e7d6dffbdcd3cfb0bc21daf73e9090e5110f (patch)
tree4eb6fdd4501facd55b4921f7b09f35bac638b79f /bitbake/lib/bb/fetch
parent7bbde5b149751c2b38964b786b76a25f62199397 (diff)
downloadopenembedded-core-bd34e7d6dffbdcd3cfb0bc21daf73e9090e5110f.tar.gz
openembedded-core-bd34e7d6dffbdcd3cfb0bc21daf73e9090e5110f.tar.bz2
openembedded-core-bd34e7d6dffbdcd3cfb0bc21daf73e9090e5110f.tar.xz
openembedded-core-bd34e7d6dffbdcd3cfb0bc21daf73e9090e5110f.zip
fetchers: Add parameter scmdata=keep to include .git/ and others in generated tarballs.
* 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>
Diffstat (limited to 'bitbake/lib/bb/fetch')
-rw-r--r--bitbake/lib/bb/fetch/bzr.py9
-rw-r--r--bitbake/lib/bb/fetch/cvs.py10
-rw-r--r--bitbake/lib/bb/fetch/git.py16
-rw-r--r--bitbake/lib/bb/fetch/hg.py8
-rw-r--r--bitbake/lib/bb/fetch/repo.py8
-rw-r--r--bitbake/lib/bb/fetch/svn.py8
6 files changed, 48 insertions, 11 deletions
diff --git a/bitbake/lib/bb/fetch/bzr.py b/bitbake/lib/bb/fetch/bzr.py
index 7d377a15d..0eb2dad5d 100644
--- a/bitbake/lib/bb/fetch/bzr.py
+++ b/bitbake/lib/bb/fetch/bzr.py
@@ -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:
diff --git a/bitbake/lib/bb/fetch/cvs.py b/bitbake/lib/bb/fetch/cvs.py
index bd919e234..0edb794b0 100644
--- a/bitbake/lib/bb/fetch/cvs.py
+++ b/bitbake/lib/bb/fetch/cvs.py
@@ -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:
diff --git a/bitbake/lib/bb/fetch/git.py b/bitbake/lib/bb/fetch/git.py
index a2fbd78cb..de415ec30 100644
--- a/bitbake/lib/bb/fetch/git.py
+++ b/bitbake/lib/bb/fetch/git.py
@@ -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)
diff --git a/bitbake/lib/bb/fetch/hg.py b/bitbake/lib/bb/fetch/hg.py
index 6bc261ae6..3c649a6ad 100644
--- a/bitbake/lib/bb/fetch/hg.py
+++ b/bitbake/lib/bb/fetch/hg.py
@@ -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:
diff --git a/bitbake/lib/bb/fetch/repo.py b/bitbake/lib/bb/fetch/repo.py
index e5132a14f..03642e7a0 100644
--- a/bitbake/lib/bb/fetch/repo.py
+++ b/bitbake/lib/bb/fetch/repo.py
@@ -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
diff --git a/bitbake/lib/bb/fetch/svn.py b/bitbake/lib/bb/fetch/svn.py
index dc35c9d12..8f053abf7 100644
--- a/bitbake/lib/bb/fetch/svn.py
+++ b/bitbake/lib/bb/fetch/svn.py
@@ -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: