summaryrefslogtreecommitdiffstats
path: root/lib/bb/fetch2/git.py
diff options
context:
space:
mode:
authorYu Ke <ke.yu@intel.com>2011-01-19 00:58:42 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-02-10 23:36:47 +0000
commit26b9af80971dfe5f0d59c950ff92aff8d59569e0 (patch)
treecf22080cf2a0b6a930e4f7b565d6a4fa410fc1c9 /lib/bb/fetch2/git.py
parentcbbcabe119ac59b1ceedd2491ab77f00d5d17d42 (diff)
downloadbitbake-26b9af80971dfe5f0d59c950ff92aff8d59569e0.tar.gz
git.py: Remove the source tree tarball archives
Since we're now always providing the git source control files it becomes pointless to handle the tarballs of specific git revisions so drop this part of the fetcher. (From Poky rev: affcfe468a0c2993c0c4ace446248f85aee4315f) Signed-off-by: Yu Ke <ke.yu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/fetch2/git.py')
-rw-r--r--lib/bb/fetch2/git.py63
1 files changed, 5 insertions, 58 deletions
diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
index 6e078a1f7..07af02f06 100644
--- a/lib/bb/fetch2/git.py
+++ b/lib/bb/fetch2/git.py
@@ -70,18 +70,7 @@ class Git(Fetch):
if not ud.tag or ud.tag == "master":
ud.tag = self.latest_revision(url, ud, d)
- subdir = ud.parm.get("subpath", "")
- if subdir != "":
- if subdir.endswith("/"):
- subdir = subdir[:-1]
- subdirpath = os.path.join(ud.path, subdir);
- else:
- subdirpath = ud.path;
-
- if 'fullclone' in ud.parm:
- ud.localfile = ud.mirrortarball
- else:
- ud.localfile = data.expand('git_%s%s_%s.tar.gz' % (ud.host, subdirpath.replace('/', '.'), ud.tag), d)
+ ud.localfile = ud.mirrortarball
if 'noclone' in ud.parm:
ud.localfile = None
@@ -94,8 +83,6 @@ class Git(Fetch):
return True
if 'noclone' in ud.parm:
return False
- if os.path.exists(ud.localpath):
- return False
if not self._contains_ref(ud.tag, d):
return True
return False
@@ -120,6 +107,8 @@ class Git(Fetch):
repofile = os.path.join(data.getVar("DL_DIR", d, 1), ud.mirrortarball)
+ ud.repochanged = not os.path.exists(repofile)
+
# If the checkout doesn't exist and the mirror tarball does, extract it
if not os.path.exists(ud.clonedir) and os.path.exists(repofile):
bb.mkdirhier(ud.clonedir)
@@ -144,60 +133,18 @@ class Git(Fetch):
runfetchcmd("%s fetch --tags %s://%s%s%s" % (ud.basecmd, ud.proto, username, ud.host, ud.path), d)
runfetchcmd("%s prune-packed" % ud.basecmd, d)
runfetchcmd("%s pack-redundant --all | xargs -r rm" % ud.basecmd, d)
+ ud.repochanged = True
def build_mirror_data(self, url, ud, d):
# Generate a mirror tarball if needed
- coname = '%s' % (ud.tag)
- codir = os.path.join(ud.clonedir, coname)
repofile = os.path.join(data.getVar("DL_DIR", d, 1), ud.mirrortarball)
os.chdir(ud.clonedir)
mirror_tarballs = data.getVar("BB_GENERATE_MIRROR_TARBALLS", d, True)
- if mirror_tarballs != "0" or 'fullclone' in ud.parm:
+ if (mirror_tarballs != "0" or 'fullclone' in ud.parm) and ud.repochanged:
logger.info("Creating tarball of git repository")
runfetchcmd("tar -czf %s %s" % (repofile, os.path.join(".", ".git", "*") ), d)
- if 'fullclone' in ud.parm:
- return
-
- if os.path.exists(codir):
- bb.utils.prunedir(codir)
-
- subdir = ud.parm.get("subpath", "")
- if subdir != "":
- if subdir.endswith("/"):
- subdirbase = os.path.basename(subdir[:-1])
- else:
- subdirbase = os.path.basename(subdir)
- else:
- subdirbase = ""
-
- if subdir != "":
- readpathspec = ":%s" % (subdir)
- codir = os.path.join(codir, "git")
- coprefix = os.path.join(codir, subdirbase, "")
- else:
- readpathspec = ""
- coprefix = os.path.join(codir, "git", "")
-
- 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 -czf %s %s" % (ud.localpath, os.path.join(".", "*") ), d)
-
- os.chdir(ud.clonedir)
- bb.utils.prunedir(codir)
-
def unpack(self, ud, destdir, d):
""" unpack the downloaded src to destdir"""