aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bb
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2005-05-17 19:20:55 +0000
committerHolger Hans Peter Freyther <zecke@selfish.org>2005-05-17 19:20:55 +0000
commit8417420700a69b521827e6ebf2e4d25aad6309cd (patch)
treefeb5bf391203ac8bbed51e048c36bd2f5fdb0cf4 /lib/bb
parentaf0493301ecf23bde89342a27ead6ab02e4d1f59 (diff)
downloadbitbake-8417420700a69b521827e6ebf2e4d25aad6309cd.tar.gz
lib/bb/fetch.py:
* Remove default params from the fetcher methods to avoid problems with scoping. The meaning of 'd' is quite overloaded and we try to undo it one by one. This change is a bit more invasive than I had hoped for but it is needed. -- Holger Hans Peter Freyther <freyther@handhelds.org>
Diffstat (limited to 'lib/bb')
-rw-r--r--lib/bb/fetch.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/lib/bb/fetch.py b/lib/bb/fetch.py
index a29ee2a04..8b981efa9 100644
--- a/lib/bb/fetch.py
+++ b/lib/bb/fetch.py
@@ -41,7 +41,7 @@ class MissingParameterError(Exception):
#decodeurl("cvs://anoncvs:anonymous@cvs.handhelds.org/cvs;module=familiar/dist/ipkg;tag=V0-99-81")
#('cvs', 'cvs.handhelds.org', '/cvs', 'anoncvs', 'anonymous', {'tag': 'V0-99-81', 'module': 'familiar/dist/ipkg'})
-def uri_replace(uri, uri_find, uri_replace, d = bb.data.init()):
+def uri_replace(uri, uri_find, uri_replace, d):
# bb.note("uri_replace: operating on %s" % uri)
if not uri or not uri_find or not uri_replace:
bb.debug(1, "uri_replace: passed an undefined value, not replacing")
@@ -73,7 +73,7 @@ def uri_replace(uri, uri_find, uri_replace, d = bb.data.init()):
methods = []
-def init(urls = [], d = bb.data.init()):
+def init(urls = [], d = None):
for m in methods:
m.urls = []
@@ -83,7 +83,7 @@ def init(urls = [], d = bb.data.init()):
if m.supports(u, d):
m.urls.append(u)
-def go(d = bb.data.init()):
+def go(d):
"""Fetch all urls"""
for m in methods:
if m.urls:
@@ -97,7 +97,7 @@ def localpaths(d):
local.append(m.localpath(u, d))
return local
-def localpath(url, d = bb.data.init()):
+def localpath(url, d):
for m in methods:
if m.supports(url, d):
return m.localpath(url, d)
@@ -119,7 +119,7 @@ class Fetch(object):
return 0
supports = staticmethod(supports)
- def localpath(url, d = bb.data.init()):
+ def localpath(url, d):
"""Return the local filename of a given url assuming a successful fetch.
"""
return url
@@ -162,10 +162,11 @@ class Wget(Fetch):
# if user overrides local path, use it.
return parm["localpath"]
url = bb.encodeurl([type, host, path, user, pswd, {}])
+
return os.path.join(bb.data.getVar("DL_DIR", d), os.path.basename(url))
localpath = staticmethod(localpath)
- def go(self, d = bb.data.init(), urls = []):
+ def go(self, d, urls = []):
"""Fetch urls"""
def fetch_uri(uri, basename, dl, md5, d):
if os.path.exists(dl):
@@ -220,7 +221,7 @@ class Wget(Fetch):
premirrors = [ i.split() for i in (bb.data.getVar('PREMIRRORS', localdata, 1) or "").split('\n') if i ]
for (find, replace) in premirrors:
- newuri = uri_replace(uri, find, replace)
+ newuri = uri_replace(uri, find, replace, d)
if newuri != uri:
if fetch_uri(newuri, basename, dl, md5, localdata):
completed = 1
@@ -235,7 +236,7 @@ class Wget(Fetch):
# try mirrors
mirrors = [ i.split() for i in (bb.data.getVar('MIRRORS', localdata, 1) or "").split('\n') if i ]
for (find, replace) in mirrors:
- newuri = uri_replace(uri, find, replace)
+ newuri = uri_replace(uri, find, replace, d)
if newuri != uri:
if fetch_uri(newuri, basename, dl, md5, localdata):
completed = 1
@@ -284,7 +285,7 @@ class Cvs(Fetch):
return os.path.join(bb.data.getVar("DL_DIR", d, 1),bb.data.expand('%s_%s_%s_%s.tar.gz' % ( module.replace('/', '.'), host, tag, date), d))
localpath = staticmethod(localpath)
- def go(self, d = bb.data.init(), urls = []):
+ def go(self, d, urls = []):
"""Fetch urls"""
if not urls:
urls = self.urls
@@ -505,7 +506,7 @@ class Svn(Fetch):
return os.path.join(bb.data.getVar("DL_DIR", d, 1),bb.data.expand('%s_%s_%s_%s.tar.gz' % ( module.replace('/', '.'), host, revision, date), d))
localpath = staticmethod(localpath)
- def go(self, d = bb.data.init(), urls = []):
+ def go(self, d, urls = []):
"""Fetch urls"""
if not urls:
urls = self.urls