diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-02-03 21:17:26 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-02-07 09:06:35 +0000 |
commit | 972eb5fababb33b5537fcfbbaf8e33ea820f0fee (patch) | |
tree | 2bd453bc66853c72cb284067d6679d6f498cd77b /bitbake/lib | |
parent | 0e5404cedadaea6738ef6468d7eb8a24d23d9bab (diff) | |
download | openembedded-core-972eb5fababb33b5537fcfbbaf8e33ea820f0fee.tar.gz openembedded-core-972eb5fababb33b5537fcfbbaf8e33ea820f0fee.tar.bz2 openembedded-core-972eb5fababb33b5537fcfbbaf8e33ea820f0fee.tar.xz openembedded-core-972eb5fababb33b5537fcfbbaf8e33ea820f0fee.zip |
bitbake/fetch2: Move ud.localfile setup into urldata_init
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/bb/fetch2/bzr.py | 4 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch2/cvs.py | 3 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch2/git.py | 2 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch2/hg.py | 12 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch2/local.py | 5 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch2/osc.py | 3 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch2/perforce.py | 6 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch2/repo.py | 3 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch2/ssh.py | 2 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch2/svk.py | 4 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch2/svn.py | 2 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch2/wget.py | 4 |
12 files changed, 29 insertions, 21 deletions
diff --git a/bitbake/lib/bb/fetch2/bzr.py b/bitbake/lib/bb/fetch2/bzr.py index 80c02f835..cc0035790 100644 --- a/bitbake/lib/bb/fetch2/bzr.py +++ b/bitbake/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/bitbake/lib/bb/fetch2/cvs.py b/bitbake/lib/bb/fetch2/cvs.py index 4915e74e4..6a7cdf2a8 100644 --- a/bitbake/lib/bb/fetch2/cvs.py +++ b/bitbake/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/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py index a4a1278b6..f38058bbc 100644 --- a/bitbake/lib/bb/fetch2/git.py +++ b/bitbake/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/bitbake/lib/bb/fetch2/hg.py b/bitbake/lib/bb/fetch2/hg.py index 13e9b8673..53eeea9a8 100644 --- a/bitbake/lib/bb/fetch2/hg.py +++ b/bitbake/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/bitbake/lib/bb/fetch2/local.py b/bitbake/lib/bb/fetch2/local.py index 89fbdf6ef..56b20e56d 100644 --- a/bitbake/lib/bb/fetch2/local.py +++ b/bitbake/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/bitbake/lib/bb/fetch2/osc.py b/bitbake/lib/bb/fetch2/osc.py index 25dcb7bd6..93deb458e 100644 --- a/bitbake/lib/bb/fetch2/osc.py +++ b/bitbake/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/bitbake/lib/bb/fetch2/perforce.py b/bitbake/lib/bb/fetch2/perforce.py index bda0bb809..aefc20784 100644 --- a/bitbake/lib/bb/fetch2/perforce.py +++ b/bitbake/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/bitbake/lib/bb/fetch2/repo.py b/bitbake/lib/bb/fetch2/repo.py index c80fe5de8..f742591fd 100644 --- a/bitbake/lib/bb/fetch2/repo.py +++ b/bitbake/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/bitbake/lib/bb/fetch2/ssh.py b/bitbake/lib/bb/fetch2/ssh.py index 711e66896..246439ef1 100644 --- a/bitbake/lib/bb/fetch2/ssh.py +++ b/bitbake/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/bitbake/lib/bb/fetch2/svk.py b/bitbake/lib/bb/fetch2/svk.py index 3bb4c38c7..ef1cf4deb 100644 --- a/bitbake/lib/bb/fetch2/svk.py +++ b/bitbake/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/bitbake/lib/bb/fetch2/svn.py b/bitbake/lib/bb/fetch2/svn.py index 96d5b1683..ded7cd005 100644 --- a/bitbake/lib/bb/fetch2/svn.py +++ b/bitbake/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/bitbake/lib/bb/fetch2/wget.py b/bitbake/lib/bb/fetch2/wget.py index 88cb8c7fe..a281bdcb4 100644 --- a/bitbake/lib/bb/fetch2/wget.py +++ b/bitbake/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): |