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 | poky-972eb5fababb33b5537fcfbbaf8e33ea820f0fee.tar.gz |
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 80c02f835b..cc00357904 100644 --- a/bitbake/lib/bb/fetch2/bzr.py +++ b/bitbake/lib/bb/fetch2/bzr.py | |||
@@ -42,12 +42,12 @@ class Bzr(Fetch): | |||
42 | relpath = self._strip_leading_slashes(ud.path) | 42 | relpath = self._strip_leading_slashes(ud.path) |
43 | ud.pkgdir = os.path.join(data.expand('${BZRDIR}', d), ud.host, relpath) | 43 | ud.pkgdir = os.path.join(data.expand('${BZRDIR}', d), ud.host, relpath) |
44 | 44 | ||
45 | def localpath (self, url, ud, d): | ||
46 | if not ud.revision: | 45 | if not ud.revision: |
47 | ud.revision = self.latest_revision(url, ud, d) | 46 | ud.revision = self.latest_revision(ud.url, ud, d) |
48 | 47 | ||
49 | ud.localfile = data.expand('bzr_%s_%s_%s.tar.gz' % (ud.host, ud.path.replace('/', '.'), ud.revision), d) | 48 | ud.localfile = data.expand('bzr_%s_%s_%s.tar.gz' % (ud.host, ud.path.replace('/', '.'), ud.revision), d) |
50 | 49 | ||
50 | def localpath (self, url, ud, d): | ||
51 | return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile) | 51 | return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile) |
52 | 52 | ||
53 | def _buildbzrcommand(self, ud, d, command): | 53 | def _buildbzrcommand(self, ud, d, command): |
diff --git a/bitbake/lib/bb/fetch2/cvs.py b/bitbake/lib/bb/fetch2/cvs.py index 4915e74e4b..6a7cdf2a89 100644 --- a/bitbake/lib/bb/fetch2/cvs.py +++ b/bitbake/lib/bb/fetch2/cvs.py | |||
@@ -42,7 +42,7 @@ class Cvs(Fetch): | |||
42 | """ | 42 | """ |
43 | return ud.type in ['cvs'] | 43 | return ud.type in ['cvs'] |
44 | 44 | ||
45 | def localpath(self, url, ud, d): | 45 | def urldata_init(self, ud, d): |
46 | if not "module" in ud.parm: | 46 | if not "module" in ud.parm: |
47 | raise MissingParameterError("cvs method needs a 'module' parameter") | 47 | raise MissingParameterError("cvs method needs a 'module' parameter") |
48 | ud.module = ud.parm["module"] | 48 | ud.module = ud.parm["module"] |
@@ -65,6 +65,7 @@ class Cvs(Fetch): | |||
65 | 65 | ||
66 | ud.localfile = data.expand('%s_%s_%s_%s%s%s.tar.gz' % (ud.module.replace('/', '.'), ud.host, ud.tag, ud.date, norecurse, fullpath), d) | 66 | ud.localfile = data.expand('%s_%s_%s_%s%s%s.tar.gz' % (ud.module.replace('/', '.'), ud.host, ud.tag, ud.date, norecurse, fullpath), d) |
67 | 67 | ||
68 | def localpath(self, url, ud, d): | ||
68 | return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile) | 69 | return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile) |
69 | 70 | ||
70 | def forcefetch(self, url, ud, d): | 71 | def forcefetch(self, url, ud, d): |
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py index a4a1278b68..f38058bbcc 100644 --- a/bitbake/lib/bb/fetch2/git.py +++ b/bitbake/lib/bb/fetch2/git.py | |||
@@ -71,13 +71,13 @@ class Git(Fetch): | |||
71 | 71 | ||
72 | ud.basecmd = data.getVar("FETCHCMD_git", d, True) or "git" | 72 | ud.basecmd = data.getVar("FETCHCMD_git", d, True) or "git" |
73 | 73 | ||
74 | def localpath(self, url, ud, d): | ||
75 | for name in ud.names: | 74 | for name in ud.names: |
76 | if not ud.revisions[name] or ud.revisions[name] == "master": | 75 | if not ud.revisions[name] or ud.revisions[name] == "master": |
77 | ud.revisions[name] = self.latest_revision(url, ud, d, name) | 76 | ud.revisions[name] = self.latest_revision(url, ud, d, name) |
78 | 77 | ||
79 | ud.localfile = ud.mirrortarball | 78 | ud.localfile = ud.mirrortarball |
80 | 79 | ||
80 | def localpath(self, url, ud, d): | ||
81 | return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile) | 81 | return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile) |
82 | 82 | ||
83 | def forcefetch(self, url, ud, d): | 83 | def forcefetch(self, url, ud, d): |
diff --git a/bitbake/lib/bb/fetch2/hg.py b/bitbake/lib/bb/fetch2/hg.py index 13e9b8673b..53eeea9a89 100644 --- a/bitbake/lib/bb/fetch2/hg.py +++ b/bitbake/lib/bb/fetch2/hg.py | |||
@@ -57,18 +57,18 @@ class Hg(Fetch): | |||
57 | ud.pkgdir = os.path.join(data.expand('${HGDIR}', d), ud.host, relpath) | 57 | ud.pkgdir = os.path.join(data.expand('${HGDIR}', d), ud.host, relpath) |
58 | ud.moddir = os.path.join(ud.pkgdir, ud.module) | 58 | ud.moddir = os.path.join(ud.pkgdir, ud.module) |
59 | 59 | ||
60 | def forcefetch(self, url, ud, d): | ||
61 | revTag = ud.parm.get('rev', 'tip') | ||
62 | return revTag == "tip" | ||
63 | |||
64 | def localpath(self, url, ud, d): | ||
65 | if 'rev' in ud.parm: | 60 | if 'rev' in ud.parm: |
66 | ud.revision = ud.parm['rev'] | 61 | ud.revision = ud.parm['rev'] |
67 | elif not ud.revision: | 62 | elif not ud.revision: |
68 | ud.revision = self.latest_revision(url, ud, d) | 63 | ud.revision = self.latest_revision(ud.url, ud, d) |
69 | 64 | ||
70 | ud.localfile = data.expand('%s_%s_%s_%s.tar.gz' % (ud.module.replace('/', '.'), ud.host, ud.path.replace('/', '.'), ud.revision), d) | 65 | ud.localfile = data.expand('%s_%s_%s_%s.tar.gz' % (ud.module.replace('/', '.'), ud.host, ud.path.replace('/', '.'), ud.revision), d) |
71 | 66 | ||
67 | def forcefetch(self, url, ud, d): | ||
68 | revTag = ud.parm.get('rev', 'tip') | ||
69 | return revTag == "tip" | ||
70 | |||
71 | def localpath(self, url, ud, d): | ||
72 | return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile) | 72 | return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile) |
73 | 73 | ||
74 | def _buildhgcommand(self, ud, d, command): | 74 | def _buildhgcommand(self, ud, d, command): |
diff --git a/bitbake/lib/bb/fetch2/local.py b/bitbake/lib/bb/fetch2/local.py index 89fbdf6ef1..56b20e56d3 100644 --- a/bitbake/lib/bb/fetch2/local.py +++ b/bitbake/lib/bb/fetch2/local.py | |||
@@ -38,6 +38,10 @@ class Local(Fetch): | |||
38 | """ | 38 | """ |
39 | return urldata.type in ['file'] | 39 | return urldata.type in ['file'] |
40 | 40 | ||
41 | def urldata_init(self, ud, d): | ||
42 | # We don't set localfile as for this fetcher the file is already local! | ||
43 | return | ||
44 | |||
41 | def localpath(self, url, urldata, d): | 45 | def localpath(self, url, urldata, d): |
42 | """ | 46 | """ |
43 | Return the local filename of a given url assuming a successful fetch. | 47 | Return the local filename of a given url assuming a successful fetch. |
@@ -53,7 +57,6 @@ class Local(Fetch): | |||
53 | filesdir = data.getVar('FILESDIR', d, 1) | 57 | filesdir = data.getVar('FILESDIR', d, 1) |
54 | if filesdir: | 58 | if filesdir: |
55 | newpath = os.path.join(filesdir, path) | 59 | newpath = os.path.join(filesdir, path) |
56 | # We don't set localfile as for this fetcher the file is already local! | ||
57 | return newpath | 60 | return newpath |
58 | 61 | ||
59 | def download(self, url, urldata, d): | 62 | def download(self, url, urldata, d): |
diff --git a/bitbake/lib/bb/fetch2/osc.py b/bitbake/lib/bb/fetch2/osc.py index 25dcb7bd67..93deb458e8 100644 --- a/bitbake/lib/bb/fetch2/osc.py +++ b/bitbake/lib/bb/fetch2/osc.py | |||
@@ -26,7 +26,7 @@ class Osc(Fetch): | |||
26 | """ | 26 | """ |
27 | return ud.type in ['osc'] | 27 | return ud.type in ['osc'] |
28 | 28 | ||
29 | def localpath(self, url, ud, d): | 29 | def urldata_init(self, ud, d): |
30 | if not "module" in ud.parm: | 30 | if not "module" in ud.parm: |
31 | raise MissingParameterError("osc method needs a 'module' parameter.") | 31 | raise MissingParameterError("osc method needs a 'module' parameter.") |
32 | 32 | ||
@@ -49,6 +49,7 @@ class Osc(Fetch): | |||
49 | 49 | ||
50 | ud.localfile = data.expand('%s_%s_%s.tar.gz' % (ud.module.replace('/', '.'), ud.path.replace('/', '.'), ud.revision), d) | 50 | ud.localfile = data.expand('%s_%s_%s.tar.gz' % (ud.module.replace('/', '.'), ud.path.replace('/', '.'), ud.revision), d) |
51 | 51 | ||
52 | def localpath(self, url, ud, d): | ||
52 | return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile) | 53 | return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile) |
53 | 54 | ||
54 | def _buildosccommand(self, ud, d, command): | 55 | def _buildosccommand(self, ud, d, command): |
diff --git a/bitbake/lib/bb/fetch2/perforce.py b/bitbake/lib/bb/fetch2/perforce.py index bda0bb8096..aefc207840 100644 --- a/bitbake/lib/bb/fetch2/perforce.py +++ b/bitbake/lib/bb/fetch2/perforce.py | |||
@@ -98,9 +98,8 @@ class Perforce(Fetch): | |||
98 | return cset.split(' ')[1] | 98 | return cset.split(' ')[1] |
99 | getcset = staticmethod(getcset) | 99 | getcset = staticmethod(getcset) |
100 | 100 | ||
101 | def localpath(self, url, ud, d): | 101 | def urldata_init(self, ud, d): |
102 | 102 | (host, path, user, pswd, parm) = Perforce.doparse(ud.url, d) | |
103 | (host, path, user, pswd, parm) = Perforce.doparse(url, d) | ||
104 | 103 | ||
105 | # If a label is specified, we use that as our filename | 104 | # If a label is specified, we use that as our filename |
106 | 105 | ||
@@ -119,6 +118,7 @@ class Perforce(Fetch): | |||
119 | 118 | ||
120 | ud.localfile = data.expand('%s+%s+%s.tar.gz' % (host, base.replace('/', '.'), cset), d) | 119 | ud.localfile = data.expand('%s+%s+%s.tar.gz' % (host, base.replace('/', '.'), cset), d) |
121 | 120 | ||
121 | def localpath(self, url, ud, d): | ||
122 | return os.path.join(data.getVar("DL_DIR", d, 1), ud.localfile) | 122 | return os.path.join(data.getVar("DL_DIR", d, 1), ud.localfile) |
123 | 123 | ||
124 | def download(self, loc, ud, d): | 124 | def download(self, loc, ud, d): |
diff --git a/bitbake/lib/bb/fetch2/repo.py b/bitbake/lib/bb/fetch2/repo.py index c80fe5de84..f742591fdb 100644 --- a/bitbake/lib/bb/fetch2/repo.py +++ b/bitbake/lib/bb/fetch2/repo.py | |||
@@ -37,7 +37,7 @@ class Repo(Fetch): | |||
37 | """ | 37 | """ |
38 | return ud.type in ["repo"] | 38 | return ud.type in ["repo"] |
39 | 39 | ||
40 | def localpath(self, url, ud, d): | 40 | def urldata_init(self, ud, d): |
41 | """ | 41 | """ |
42 | We don"t care about the git rev of the manifests repository, but | 42 | We don"t care about the git rev of the manifests repository, but |
43 | we do care about the manifest to use. The default is "default". | 43 | we do care about the manifest to use. The default is "default". |
@@ -53,6 +53,7 @@ class Repo(Fetch): | |||
53 | 53 | ||
54 | ud.localfile = data.expand("repo_%s%s_%s_%s.tar.gz" % (ud.host, ud.path.replace("/", "."), ud.manifest, ud.branch), d) | 54 | ud.localfile = data.expand("repo_%s%s_%s_%s.tar.gz" % (ud.host, ud.path.replace("/", "."), ud.manifest, ud.branch), d) |
55 | 55 | ||
56 | def localpath(self, url, ud, d): | ||
56 | return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile) | 57 | return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile) |
57 | 58 | ||
58 | def download(self, loc, ud, d): | 59 | def download(self, loc, ud, d): |
diff --git a/bitbake/lib/bb/fetch2/ssh.py b/bitbake/lib/bb/fetch2/ssh.py index 711e66896e..246439ef19 100644 --- a/bitbake/lib/bb/fetch2/ssh.py +++ b/bitbake/lib/bb/fetch2/ssh.py | |||
@@ -68,7 +68,7 @@ class SSH(Fetch): | |||
68 | return __pattern__.match(url) != None | 68 | return __pattern__.match(url) != None |
69 | 69 | ||
70 | def localpath(self, url, urldata, d): | 70 | def localpath(self, url, urldata, d): |
71 | m = __pattern__.match(url) | 71 | m = __pattern__.match(urldata.url) |
72 | path = m.group('path') | 72 | path = m.group('path') |
73 | host = m.group('host') | 73 | host = m.group('host') |
74 | lpath = os.path.join(data.getVar('DL_DIR', d, True), host, os.path.basename(path)) | 74 | 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 3bb4c38c77..ef1cf4deb1 100644 --- a/bitbake/lib/bb/fetch2/svk.py +++ b/bitbake/lib/bb/fetch2/svk.py | |||
@@ -42,7 +42,8 @@ class Svk(Fetch): | |||
42 | """ | 42 | """ |
43 | return ud.type in ['svk'] | 43 | return ud.type in ['svk'] |
44 | 44 | ||
45 | def localpath(self, url, ud, d): | 45 | def urldata_init(self, ud, d): |
46 | |||
46 | if not "module" in ud.parm: | 47 | if not "module" in ud.parm: |
47 | raise MissingParameterError("svk method needs a 'module' parameter") | 48 | raise MissingParameterError("svk method needs a 'module' parameter") |
48 | else: | 49 | else: |
@@ -52,6 +53,7 @@ class Svk(Fetch): | |||
52 | 53 | ||
53 | ud.localfile = data.expand('%s_%s_%s_%s_%s.tar.gz' % (ud.module.replace('/', '.'), ud.host, ud.path.replace('/', '.'), ud.revision, ud.date), d) | 54 | ud.localfile = data.expand('%s_%s_%s_%s_%s.tar.gz' % (ud.module.replace('/', '.'), ud.host, ud.path.replace('/', '.'), ud.revision, ud.date), d) |
54 | 55 | ||
56 | def localpath(self, url, ud, d): | ||
55 | return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile) | 57 | return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile) |
56 | 58 | ||
57 | def forcefetch(self, url, ud, d): | 59 | def forcefetch(self, url, ud, d): |
diff --git a/bitbake/lib/bb/fetch2/svn.py b/bitbake/lib/bb/fetch2/svn.py index 96d5b1683a..ded7cd0057 100644 --- a/bitbake/lib/bb/fetch2/svn.py +++ b/bitbake/lib/bb/fetch2/svn.py | |||
@@ -56,7 +56,6 @@ class Svn(Fetch): | |||
56 | ud.pkgdir = os.path.join(data.expand('${SVNDIR}', d), ud.host, relpath) | 56 | ud.pkgdir = os.path.join(data.expand('${SVNDIR}', d), ud.host, relpath) |
57 | ud.moddir = os.path.join(ud.pkgdir, ud.module) | 57 | ud.moddir = os.path.join(ud.pkgdir, ud.module) |
58 | 58 | ||
59 | def localpath(self, url, ud, d): | ||
60 | if 'rev' in ud.parm: | 59 | if 'rev' in ud.parm: |
61 | ud.date = "" | 60 | ud.date = "" |
62 | ud.revision = ud.parm['rev'] | 61 | ud.revision = ud.parm['rev'] |
@@ -79,6 +78,7 @@ class Svn(Fetch): | |||
79 | 78 | ||
80 | ud.localfile = data.expand('%s_%s_%s_%s_%s.tar.gz' % (ud.module.replace('/', '.'), ud.host, ud.path.replace('/', '.'), ud.revision, ud.date), d) | 79 | ud.localfile = data.expand('%s_%s_%s_%s_%s.tar.gz' % (ud.module.replace('/', '.'), ud.host, ud.path.replace('/', '.'), ud.revision, ud.date), d) |
81 | 80 | ||
81 | def localpath(self, url, ud, d): | ||
82 | return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile) | 82 | return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile) |
83 | 83 | ||
84 | def _buildsvncommand(self, ud, d, command): | 84 | def _buildsvncommand(self, ud, d, command): |
diff --git a/bitbake/lib/bb/fetch2/wget.py b/bitbake/lib/bb/fetch2/wget.py index 88cb8c7fed..a281bdcb4f 100644 --- a/bitbake/lib/bb/fetch2/wget.py +++ b/bitbake/lib/bb/fetch2/wget.py | |||
@@ -40,12 +40,12 @@ class Wget(Fetch): | |||
40 | """ | 40 | """ |
41 | return ud.type in ['http', 'https', 'ftp'] | 41 | return ud.type in ['http', 'https', 'ftp'] |
42 | 42 | ||
43 | def localpath(self, url, ud, d): | 43 | def urldata_init(self, ud, d): |
44 | 44 | ||
45 | url = encodeurl([ud.type, ud.host, ud.path, ud.user, ud.pswd, {}]) | ||
46 | ud.basename = os.path.basename(ud.path) | 45 | ud.basename = os.path.basename(ud.path) |
47 | ud.localfile = data.expand(urllib.unquote(ud.basename), d) | 46 | ud.localfile = data.expand(urllib.unquote(ud.basename), d) |
48 | 47 | ||
48 | def localpath(self, url, ud, d): | ||
49 | return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile) | 49 | return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile) |
50 | 50 | ||
51 | def download(self, uri, ud, d, checkonly = False): | 51 | def download(self, uri, ud, d, checkonly = False): |