]> code.ossystems Code Review - openembedded-core.git/commitdiff
bitbake/fetch2: Move ud.localfile setup into urldata_init
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 3 Feb 2011 21:17:26 +0000 (21:17 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 7 Feb 2011 09:06:35 +0000 (09:06 +0000)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
12 files changed:
bitbake/lib/bb/fetch2/bzr.py
bitbake/lib/bb/fetch2/cvs.py
bitbake/lib/bb/fetch2/git.py
bitbake/lib/bb/fetch2/hg.py
bitbake/lib/bb/fetch2/local.py
bitbake/lib/bb/fetch2/osc.py
bitbake/lib/bb/fetch2/perforce.py
bitbake/lib/bb/fetch2/repo.py
bitbake/lib/bb/fetch2/ssh.py
bitbake/lib/bb/fetch2/svk.py
bitbake/lib/bb/fetch2/svn.py
bitbake/lib/bb/fetch2/wget.py

index 80c02f835b3dbe9fa19298c26e4d79d0213a6592..cc003579040923e1bcb83515f26464cfc2196a10 100644 (file)
@@ -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):
index 4915e74e4b2b287b7bbdd1e7df948d2248d03b1c..6a7cdf2a8922cd67edd70dc07046a3451e2500e6 100644 (file)
@@ -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):
index a4a1278b68b125ef4708b3fae9b1ad33b8c1b93a..f38058bbccadc9e1b0ffcf278414affc43441c47 100644 (file)
@@ -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):
index 13e9b8673bf977c9489f01f23ea20794def9b11f..53eeea9a8962960d84bfd04dc1496c4c25947977 100644 (file)
@@ -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):
index 89fbdf6ef1c36fd400eeabef4a9078ccb8254f12..56b20e56d3772c18c786d0003b6dff91474a9e78 100644 (file)
@@ -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):
index 25dcb7bd67450681b7416c0736e99a10893105ad..93deb458e870714a0c0d71227051a43c6dd9ce3d 100644 (file)
@@ -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):
index bda0bb8096e4a147f5f89cf35a5cd17ff0ebf35e..aefc207840db32a2724bd74095882ffe7e2bc69f 100644 (file)
@@ -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):
index c80fe5de844d1e258ae454df3ce4388e4a88d8ee..f742591fdbd5976032d19321b7dd45ccfbfacc79 100644 (file)
@@ -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):
index 711e66896e447ab862bd87c3b7f1a05b7a1ce1b0..246439ef19abf730bf46caae7e0e2eea946ed42c 100644 (file)
@@ -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))
index 3bb4c38c7756d43e6e936d0a1f1e8dcb2206e242..ef1cf4deb1bf5dd6d580fcfecaa429074557bb81 100644 (file)
@@ -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):
index 96d5b1683af58e0d6d2f64518cb6db5bd7f2023b..ded7cd005734194047b1f00c8f21ec42c246f068 100644 (file)
@@ -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):
index 88cb8c7fedf5033c17224e056d6f3f8349038525..a281bdcb4f323d98c14cb14b98853c3000321d7f 100644 (file)
@@ -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):