summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorYu Ke <ke.yu@intel.com>2011-01-18 23:35:30 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-01-25 12:25:47 +0000
commitef918a72de97fd2189e1c8487e371d13e18088fd (patch)
treef19cd59514794dc42bbcc0e459e681cecd101770 /bitbake
parente2ac26e7b1a1d058915d489cf3e0985484e1f69e (diff)
downloadpoky-ef918a72de97fd2189e1c8487e371d13e18088fd.tar.gz
git.py: split download to download() and build_mirror_data()
the download is to fetch the source from URL, the build_mirror_data is to create the mirror tar ball. the original go() method mix them together, it is more clean to split them. Signed-off-by: Yu Ke <ke.yu@intel.com>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py4
-rw-r--r--bitbake/lib/bb/fetch2/git.py8
2 files changed, 9 insertions, 3 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 9df91001d5..886d49afa2 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -294,6 +294,8 @@ def download(d, urls = None):
294 # Next try fetching from the original uri, u 294 # Next try fetching from the original uri, u
295 try: 295 try:
296 m.download(u, ud, d) 296 m.download(u, ud, d)
297 if hasattr(m, "build_mirror_data"):
298 m.build_mirror_data(u, ud, d)
297 localpath = ud.localpath 299 localpath = ud.localpath
298 except FetchError: 300 except FetchError:
299 # Remove any incomplete file 301 # Remove any incomplete file
@@ -500,6 +502,8 @@ def try_mirrors(d, uri, mirrors, check = False, force = False):
500 return found 502 return found
501 else: 503 else:
502 ud.method.download(newuri, ud, ld) 504 ud.method.download(newuri, ud, ld)
505 if hasattr(ud.method,"build_mirror_data"):
506 ud.method.build_mirror_data(newuri, ud, ld)
503 return ud.localpath 507 return ud.localpath
504 except (bb.fetch2.MissingParameterError, 508 except (bb.fetch2.MissingParameterError,
505 bb.fetch2.FetchError, 509 bb.fetch2.FetchError,
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index c962acb106..d47191e57f 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -116,9 +116,6 @@ class Git(Fetch):
116 116
117 repofile = os.path.join(data.getVar("DL_DIR", d, 1), ud.mirrortarball) 117 repofile = os.path.join(data.getVar("DL_DIR", d, 1), ud.mirrortarball)
118 118
119 coname = '%s' % (ud.tag)
120 codir = os.path.join(ud.clonedir, coname)
121
122 # If we have no existing clone and no mirror tarball, try and obtain one 119 # If we have no existing clone and no mirror tarball, try and obtain one
123 if not os.path.exists(ud.clonedir) and not os.path.exists(repofile): 120 if not os.path.exists(ud.clonedir) and not os.path.exists(repofile):
124 try: 121 try:
@@ -149,7 +146,12 @@ class Git(Fetch):
149 runfetchcmd("%s prune-packed" % ud.basecmd, d) 146 runfetchcmd("%s prune-packed" % ud.basecmd, d)
150 runfetchcmd("%s pack-redundant --all | xargs -r rm" % ud.basecmd, d) 147 runfetchcmd("%s pack-redundant --all | xargs -r rm" % ud.basecmd, d)
151 148
149 def build_mirror_data(self, url, ud, d):
152 # Generate a mirror tarball if needed 150 # Generate a mirror tarball if needed
151 coname = '%s' % (ud.tag)
152 codir = os.path.join(ud.clonedir, coname)
153 repofile = os.path.join(data.getVar("DL_DIR", d, 1), ud.mirrortarball)
154
153 os.chdir(ud.clonedir) 155 os.chdir(ud.clonedir)
154 mirror_tarballs = data.getVar("BB_GENERATE_MIRROR_TARBALLS", d, True) 156 mirror_tarballs = data.getVar("BB_GENERATE_MIRROR_TARBALLS", d, True)
155 if mirror_tarballs != "0" or 'fullclone' in ud.parm: 157 if mirror_tarballs != "0" or 'fullclone' in ud.parm: