summaryrefslogtreecommitdiffstats
path: root/bitbake
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
parent7bbde5b149751c2b38964b786b76a25f62199397 (diff)
downloadpoky-bd34e7d6dffbdcd3cfb0bc21daf73e9090e5110f.tar.gz
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')
-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 7d377a15d9..0eb2dad5dc 100644
--- a/bitbake/lib/bb/fetch/bzr.py
+++ b/bitbake/lib/bb/fetch/bzr.py
@@ -100,9 +100,16 @@ class Bzr(Fetch):
100 runfetchcmd(bzrcmd, d) 100 runfetchcmd(bzrcmd, d)
101 101
102 os.chdir(ud.pkgdir) 102 os.chdir(ud.pkgdir)
103
104 scmdata = ud.parm.get("scmdata", "")
105 if scmdata == "keep":
106 tar_flags = ""
107 else:
108 tar_flags = "--exclude '.bzr' --exclude '.bzrtags'"
109
103 # tar them up to a defined filename 110 # tar them up to a defined filename
104 try: 111 try:
105 runfetchcmd("tar --exclude '.bzr' --exclude '.bzrtags' -czf %s %s" % (ud.localpath, os.path.basename(ud.pkgdir)), d) 112 runfetchcmd("tar %s -czf %s %s" % (tar_flags, ud.localpath, os.path.basename(ud.pkgdir)), d)
106 except: 113 except:
107 t, v, tb = sys.exc_info() 114 t, v, tb = sys.exc_info()
108 try: 115 try:
diff --git a/bitbake/lib/bb/fetch/cvs.py b/bitbake/lib/bb/fetch/cvs.py
index bd919e234e..0edb794b04 100644
--- a/bitbake/lib/bb/fetch/cvs.py
+++ b/bitbake/lib/bb/fetch/cvs.py
@@ -149,14 +149,20 @@ class Cvs(Fetch):
149 pass 149 pass
150 raise FetchError(ud.module) 150 raise FetchError(ud.module)
151 151
152 scmdata = ud.parm.get("scmdata", "")
153 if scmdata == "keep":
154 tar_flags = ""
155 else:
156 tar_flags = "--exclude 'CVS'"
157
152 # tar them up to a defined filename 158 # tar them up to a defined filename
153 if 'fullpath' in ud.parm: 159 if 'fullpath' in ud.parm:
154 os.chdir(pkgdir) 160 os.chdir(pkgdir)
155 myret = os.system("tar --exclude 'CVS' -czf %s %s" % (ud.localpath, localdir)) 161 myret = os.system("tar %s -czf %s %s" % (tar_flags, ud.localpath, localdir))
156 else: 162 else:
157 os.chdir(moddir) 163 os.chdir(moddir)
158 os.chdir('..') 164 os.chdir('..')
159 myret = os.system("tar -czf %s %s" % (ud.localpath, os.path.basename(moddir))) 165 myret = os.system("tar %s -czf %s %s" % (tar_flags, ud.localpath, os.path.basename(moddir)))
160 166
161 if myret != 0: 167 if myret != 0:
162 try: 168 try:
diff --git a/bitbake/lib/bb/fetch/git.py b/bitbake/lib/bb/fetch/git.py
index a2fbd78cbf..de415ec309 100644
--- a/bitbake/lib/bb/fetch/git.py
+++ b/bitbake/lib/bb/fetch/git.py
@@ -180,14 +180,20 @@ class Git(Fetch):
180 readpathspec = "" 180 readpathspec = ""
181 coprefix = os.path.join(codir, "git", "") 181 coprefix = os.path.join(codir, "git", "")
182 182
183 bb.mkdirhier(codir) 183 scmdata = ud.parm.get("scmdata", "")
184 os.chdir(ud.clonedir) 184 if scmdata == "keep":
185 runfetchcmd("%s read-tree %s%s" % (ud.basecmd, ud.tag, readpathspec), d) 185 runfetchcmd("%s clone -n %s %s" % (ud.basecmd, ud.clonedir, coprefix), d)
186 runfetchcmd("%s checkout-index -q -f --prefix=%s -a" % (ud.basecmd, coprefix), d) 186 os.chdir(coprefix)
187 runfetchcmd("%s checkout -q -f %s%s" % (ud.basecmd, ud.tag, readpathspec), d)
188 else:
189 bb.mkdirhier(codir)
190 os.chdir(ud.clonedir)
191 runfetchcmd("%s read-tree %s%s" % (ud.basecmd, ud.tag, readpathspec), d)
192 runfetchcmd("%s checkout-index -q -f --prefix=%s -a" % (ud.basecmd, coprefix), d)
187 193
188 os.chdir(codir) 194 os.chdir(codir)
189 logger.info("Creating tarball of git checkout") 195 logger.info("Creating tarball of git checkout")
190 runfetchcmd("tar --exclude '.git' -czf %s %s" % (ud.localpath, os.path.join(".", "*") ), d) 196 runfetchcmd("tar -czf %s %s" % (ud.localpath, os.path.join(".", "*") ), d)
191 197
192 os.chdir(ud.clonedir) 198 os.chdir(ud.clonedir)
193 bb.utils.prunedir(codir) 199 bb.utils.prunedir(codir)
diff --git a/bitbake/lib/bb/fetch/hg.py b/bitbake/lib/bb/fetch/hg.py
index 6bc261ae68..3c649a6ad0 100644
--- a/bitbake/lib/bb/fetch/hg.py
+++ b/bitbake/lib/bb/fetch/hg.py
@@ -143,9 +143,15 @@ class Hg(Fetch):
143 logger.debug(1, "Running %s", updatecmd) 143 logger.debug(1, "Running %s", updatecmd)
144 runfetchcmd(updatecmd, d) 144 runfetchcmd(updatecmd, d)
145 145
146 scmdata = ud.parm.get("scmdata", "")
147 if scmdata == "keep":
148 tar_flags = ""
149 else:
150 tar_flags = "--exclude '.hg' --exclude '.hgrags'"
151
146 os.chdir(ud.pkgdir) 152 os.chdir(ud.pkgdir)
147 try: 153 try:
148 runfetchcmd("tar --exclude '.hg' --exclude '.hgrags' -czf %s %s" % (ud.localpath, ud.module), d) 154 runfetchcmd("tar %s -czf %s %s" % (tar_flags, ud.localpath, ud.module), d)
149 except: 155 except:
150 t, v, tb = sys.exc_info() 156 t, v, tb = sys.exc_info()
151 try: 157 try:
diff --git a/bitbake/lib/bb/fetch/repo.py b/bitbake/lib/bb/fetch/repo.py
index e5132a14fe..03642e7a0d 100644
--- a/bitbake/lib/bb/fetch/repo.py
+++ b/bitbake/lib/bb/fetch/repo.py
@@ -79,8 +79,14 @@ class Repo(Fetch):
79 runfetchcmd("repo sync", d) 79 runfetchcmd("repo sync", d)
80 os.chdir(codir) 80 os.chdir(codir)
81 81
82 scmdata = ud.parm.get("scmdata", "")
83 if scmdata == "keep":
84 tar_flags = ""
85 else:
86 tar_flags = "--exclude '.repo' --exclude '.git'"
87
82 # Create a cache 88 # Create a cache
83 runfetchcmd("tar --exclude=.repo --exclude=.git -czf %s %s" % (ud.localpath, os.path.join(".", "*") ), d) 89 runfetchcmd("tar %s -czf %s %s" % (tar_flags, ud.localpath, os.path.join(".", "*") ), d)
84 90
85 def supports_srcrev(self): 91 def supports_srcrev(self):
86 return False 92 return False
diff --git a/bitbake/lib/bb/fetch/svn.py b/bitbake/lib/bb/fetch/svn.py
index dc35c9d121..8f053abf74 100644
--- a/bitbake/lib/bb/fetch/svn.py
+++ b/bitbake/lib/bb/fetch/svn.py
@@ -151,10 +151,16 @@ class Svn(Fetch):
151 logger.debug(1, "Running %s", svnfetchcmd) 151 logger.debug(1, "Running %s", svnfetchcmd)
152 runfetchcmd(svnfetchcmd, d) 152 runfetchcmd(svnfetchcmd, d)
153 153
154 scmdata = ud.parm.get("scmdata", "")
155 if scmdata == "keep":
156 tar_flags = ""
157 else:
158 tar_flags = "--exclude '.svn'"
159
154 os.chdir(ud.pkgdir) 160 os.chdir(ud.pkgdir)
155 # tar them up to a defined filename 161 # tar them up to a defined filename
156 try: 162 try:
157 runfetchcmd("tar --exclude '.svn' -czf %s %s" % (ud.localpath, ud.module), d) 163 runfetchcmd("tar %s -czf %s %s" % (tar_flags, ud.localpath, ud.module), d)
158 except: 164 except:
159 t, v, tb = sys.exc_info() 165 t, v, tb = sys.exc_info()
160 try: 166 try: