summaryrefslogtreecommitdiffstats
path: root/lib/bb/fetch2
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-02-03 21:17:26 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-02-10 23:36:56 +0000
commitfdab13939be23227d49db7bd5b9c01cd10737a47 (patch)
tree7fa3a4f4bedef68ef49b5a8bd90c135fd30b658a /lib/bb/fetch2
parent2fc8ecca9b9ff373a48e3726daa3267d6def434f (diff)
downloadbitbake-fdab13939be23227d49db7bd5b9c01cd10737a47.tar.gz
bitbake/fetch2: Move ud.localfile setup into urldata_init
(From Poky rev: 972eb5fababb33b5537fcfbbaf8e33ea820f0fee) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/fetch2')
-rw-r--r--lib/bb/fetch2/bzr.py4
-rw-r--r--lib/bb/fetch2/cvs.py3
-rw-r--r--lib/bb/fetch2/git.py2
-rw-r--r--lib/bb/fetch2/hg.py12
-rw-r--r--lib/bb/fetch2/local.py5
-rw-r--r--lib/bb/fetch2/osc.py3
-rw-r--r--lib/bb/fetch2/perforce.py6
-rw-r--r--lib/bb/fetch2/repo.py3
-rw-r--r--lib/bb/fetch2/ssh.py2
-rw-r--r--lib/bb/fetch2/svk.py4
-rw-r--r--lib/bb/fetch2/svn.py2
-rw-r--r--lib/bb/fetch2/wget.py4
12 files changed, 29 insertions, 21 deletions
diff --git a/lib/bb/fetch2/bzr.py b/lib/bb/fetch2/bzr.py
index 80c02f835..cc0035790 100644
--- a/lib/bb/fetch2/bzr.py
+++ b/lib/bb/fetch2/bzr.py
@@ -42,12 +42,12 @@ class Bzr(Fetch):
relpath = self._strip_leading_slashes(ud.path)
ud.pkgdir = os.path.join(data.expand('${BZRDIR}', d), ud.host, relpath)
- def localpath (self, url, ud, d):
if not ud.revision:
- ud.revision = self.latest_revision(url, ud, d)
+ ud.revision = self.latest_revision(ud.url, ud, d)
ud.localfile = data.expand('bzr_%s_%s_%s.tar.gz' % (ud.host, ud.path.replace('/', '.'), ud.revision), d)
+ def localpath (self, url, ud, d):
return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile)
def _buildbzrcommand(self, ud, d, command):
diff --git a/lib/bb/fetch2/cvs.py b/lib/bb/fetch2/cvs.py
index 4915e74e4..6a7cdf2a8 100644
--- a/lib/bb/fetch2/cvs.py
+++ b/lib/bb/fetch2/cvs.py
@@ -42,7 +42,7 @@ class Cvs(Fetch):
"""
return ud.type in ['cvs']
- def localpath(self, url, ud, d):
+ def urldata_init(self, ud, d):
if not "module" in ud.parm:
raise MissingParameterError("cvs method needs a 'module' parameter")
ud.module = ud.parm["module"]
@@ -65,6 +65,7 @@ class Cvs(Fetch):
ud.localfile = data.expand('%s_%s_%s_%s%s%s.tar.gz' % (ud.module.replace('/', '.'), ud.host, ud.tag, ud.date, norecurse, fullpath), d)
+ def localpath(self, url, ud, d):
return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile)
def forcefetch(self, url, ud, d):
diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
index a4a1278b6..f38058bbc 100644
--- a/lib/bb/fetch2/git.py
+++ b/lib/bb/fetch2/git.py
@@ -71,13 +71,13 @@ class Git(Fetch):
ud.basecmd = data.getVar("FETCHCMD_git", d, True) or "git"
- def localpath(self, url, ud, d):
for name in ud.names:
if not ud.revisions[name] or ud.revisions[name] == "master":
ud.revisions[name] = self.latest_revision(url, ud, d, name)
ud.localfile = ud.mirrortarball
+ def localpath(self, url, ud, d):
return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile)
def forcefetch(self, url, ud, d):
diff --git a/lib/bb/fetch2/hg.py b/lib/bb/fetch2/hg.py
index 13e9b8673..53eeea9a8 100644
--- a/lib/bb/fetch2/hg.py
+++ b/lib/bb/fetch2/hg.py
@@ -57,18 +57,18 @@ class Hg(Fetch):
ud.pkgdir = os.path.join(data.expand('${HGDIR}', d), ud.host, relpath)
ud.moddir = os.path.join(ud.pkgdir, ud.module)
- def forcefetch(self, url, ud, d):
- revTag = ud.parm.get('rev', 'tip')
- return revTag == "tip"
-
- def localpath(self, url, ud, d):
if 'rev' in ud.parm:
ud.revision = ud.parm['rev']
elif not ud.revision:
- ud.revision = self.latest_revision(url, ud, d)
+ ud.revision = self.latest_revision(ud.url, ud, d)
ud.localfile = data.expand('%s_%s_%s_%s.tar.gz' % (ud.module.replace('/', '.'), ud.host, ud.path.replace('/', '.'), ud.revision), d)
+ def forcefetch(self, url, ud, d):
+ revTag = ud.parm.get('rev', 'tip')
+ return revTag == "tip"
+
+ def localpath(self, url, ud, d):
return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile)
def _buildhgcommand(self, ud, d, command):
diff --git a/lib/bb/fetch2/local.py b/lib/bb/fetch2/local.py
index 89fbdf6ef..56b20e56d 100644
--- a/lib/bb/fetch2/local.py
+++ b/lib/bb/fetch2/local.py
@@ -38,6 +38,10 @@ class Local(Fetch):
"""
return urldata.type in ['file']
+ def urldata_init(self, ud, d):
+ # We don't set localfile as for this fetcher the file is already local!
+ return
+
def localpath(self, url, urldata, d):
"""
Return the local filename of a given url assuming a successful fetch.
@@ -53,7 +57,6 @@ class Local(Fetch):
filesdir = data.getVar('FILESDIR', d, 1)
if filesdir:
newpath = os.path.join(filesdir, path)
- # We don't set localfile as for this fetcher the file is already local!
return newpath
def download(self, url, urldata, d):
diff --git a/lib/bb/fetch2/osc.py b/lib/bb/fetch2/osc.py
index 25dcb7bd6..93deb458e 100644
--- a/lib/bb/fetch2/osc.py
+++ b/lib/bb/fetch2/osc.py
@@ -26,7 +26,7 @@ class Osc(Fetch):
"""
return ud.type in ['osc']
- def localpath(self, url, ud, d):
+ def urldata_init(self, ud, d):
if not "module" in ud.parm:
raise MissingParameterError("osc method needs a 'module' parameter.")
@@ -49,6 +49,7 @@ class Osc(Fetch):
ud.localfile = data.expand('%s_%s_%s.tar.gz' % (ud.module.replace('/', '.'), ud.path.replace('/', '.'), ud.revision), d)
+ def localpath(self, url, ud, d):
return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile)
def _buildosccommand(self, ud, d, command):
diff --git a/lib/bb/fetch2/perforce.py b/lib/bb/fetch2/perforce.py
index bda0bb809..aefc20784 100644
--- a/lib/bb/fetch2/perforce.py
+++ b/lib/bb/fetch2/perforce.py
@@ -98,9 +98,8 @@ class Perforce(Fetch):
return cset.split(' ')[1]
getcset = staticmethod(getcset)
- def localpath(self, url, ud, d):
-
- (host, path, user, pswd, parm) = Perforce.doparse(url, d)
+ def urldata_init(self, ud, d):
+ (host, path, user, pswd, parm) = Perforce.doparse(ud.url, d)
# If a label is specified, we use that as our filename
@@ -119,6 +118,7 @@ class Perforce(Fetch):
ud.localfile = data.expand('%s+%s+%s.tar.gz' % (host, base.replace('/', '.'), cset), d)
+ def localpath(self, url, ud, d):
return os.path.join(data.getVar("DL_DIR", d, 1), ud.localfile)
def download(self, loc, ud, d):
diff --git a/lib/bb/fetch2/repo.py b/lib/bb/fetch2/repo.py
index c80fe5de8..f742591fd 100644
--- a/lib/bb/fetch2/repo.py
+++ b/lib/bb/fetch2/repo.py
@@ -37,7 +37,7 @@ class Repo(Fetch):
"""
return ud.type in ["repo"]
- def localpath(self, url, ud, d):
+ def urldata_init(self, ud, d):
"""
We don"t care about the git rev of the manifests repository, but
we do care about the manifest to use. The default is "default".
@@ -53,6 +53,7 @@ class Repo(Fetch):
ud.localfile = data.expand("repo_%s%s_%s_%s.tar.gz" % (ud.host, ud.path.replace("/", "."), ud.manifest, ud.branch), d)
+ def localpath(self, url, ud, d):
return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile)
def download(self, loc, ud, d):
diff --git a/lib/bb/fetch2/ssh.py b/lib/bb/fetch2/ssh.py
index 711e66896..246439ef1 100644
--- a/lib/bb/fetch2/ssh.py
+++ b/lib/bb/fetch2/ssh.py
@@ -68,7 +68,7 @@ class SSH(Fetch):
return __pattern__.match(url) != None
def localpath(self, url, urldata, d):
- m = __pattern__.match(url)
+ m = __pattern__.match(urldata.url)
path = m.group('path')
host = m.group('host')
lpath = os.path.join(data.getVar('DL_DIR', d, True), host, os.path.basename(path))
diff --git a/lib/bb/fetch2/svk.py b/lib/bb/fetch2/svk.py
index 3bb4c38c7..ef1cf4deb 100644
--- a/lib/bb/fetch2/svk.py
+++ b/lib/bb/fetch2/svk.py
@@ -42,7 +42,8 @@ class Svk(Fetch):
"""
return ud.type in ['svk']
- def localpath(self, url, ud, d):
+ def urldata_init(self, ud, d):
+
if not "module" in ud.parm:
raise MissingParameterError("svk method needs a 'module' parameter")
else:
@@ -52,6 +53,7 @@ class Svk(Fetch):
ud.localfile = data.expand('%s_%s_%s_%s_%s.tar.gz' % (ud.module.replace('/', '.'), ud.host, ud.path.replace('/', '.'), ud.revision, ud.date), d)
+ def localpath(self, url, ud, d):
return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile)
def forcefetch(self, url, ud, d):
diff --git a/lib/bb/fetch2/svn.py b/lib/bb/fetch2/svn.py
index 96d5b1683..ded7cd005 100644
--- a/lib/bb/fetch2/svn.py
+++ b/lib/bb/fetch2/svn.py
@@ -56,7 +56,6 @@ class Svn(Fetch):
ud.pkgdir = os.path.join(data.expand('${SVNDIR}', d), ud.host, relpath)
ud.moddir = os.path.join(ud.pkgdir, ud.module)
- def localpath(self, url, ud, d):
if 'rev' in ud.parm:
ud.date = ""
ud.revision = ud.parm['rev']
@@ -79,6 +78,7 @@ class Svn(Fetch):
ud.localfile = data.expand('%s_%s_%s_%s_%s.tar.gz' % (ud.module.replace('/', '.'), ud.host, ud.path.replace('/', '.'), ud.revision, ud.date), d)
+ def localpath(self, url, ud, d):
return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile)
def _buildsvncommand(self, ud, d, command):
diff --git a/lib/bb/fetch2/wget.py b/lib/bb/fetch2/wget.py
index 88cb8c7fe..a281bdcb4 100644
--- a/lib/bb/fetch2/wget.py
+++ b/lib/bb/fetch2/wget.py
@@ -40,12 +40,12 @@ class Wget(Fetch):
"""
return ud.type in ['http', 'https', 'ftp']
- def localpath(self, url, ud, d):
+ def urldata_init(self, ud, d):
- url = encodeurl([ud.type, ud.host, ud.path, ud.user, ud.pswd, {}])
ud.basename = os.path.basename(ud.path)
ud.localfile = data.expand(urllib.unquote(ud.basename), d)
+ def localpath(self, url, ud, d):
return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile)
def download(self, uri, ud, d, checkonly = False):