]> code.ossystems Code Review - openembedded-core.git/commitdiff
bitbake/fetch2: Define a sane localpath function and remove code duplication
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 3 Feb 2011 21:20:39 +0000 (21:20 +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>
bitbake/lib/bb/fetch2/__init__.py
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/osc.py
bitbake/lib/bb/fetch2/perforce.py
bitbake/lib/bb/fetch2/repo.py
bitbake/lib/bb/fetch2/svk.py
bitbake/lib/bb/fetch2/svn.py
bitbake/lib/bb/fetch2/wget.py

index c8076019742a474146d35950accef31fd1deadc1..e8eaebe9dc52edceeb3ad6bee456fa013d19cd42 100644 (file)
@@ -621,7 +621,8 @@ class Fetch(object):
         Can also setup variables in urldata for use in go (saving code duplication
         and duplicate code execution)
         """
-        return url
+        return os.path.join(data.getVar("DL_DIR", d, True), urldata.localfile)
+
     def _strip_leading_slashes(self, relpath):
         """
         Remove leading slash as os.path.join can't cope
index cc003579040923e1bcb83515f26464cfc2196a10..1e25207b19aa21334601fe93dac619f61dc7dbcc 100644 (file)
@@ -47,9 +47,6 @@ class Bzr(Fetch):
 
         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):
         """
         Build up an bzr commandline based on ud
index 6a7cdf2a8922cd67edd70dc07046a3451e2500e6..907812d717821ab119b42bef474aaab779d25f2d 100644 (file)
@@ -65,9 +65,6 @@ 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):
         if (ud.date == "now"):
             return True
index f38058bbccadc9e1b0ffcf278414affc43441c47..392491ed87a77cd3a4a0482154071054ddfec537 100644 (file)
@@ -77,9 +77,6 @@ class Git(Fetch):
 
         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):
         for name in ud.names:
             if not self._contains_ref(ud.revisions[name], d):
index 53eeea9a8962960d84bfd04dc1496c4c25947977..6929d971f5b8cb19d2276d231b4d936bd1b70f47 100644 (file)
@@ -68,9 +68,6 @@ class Hg(Fetch):
         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):
         """
         Build up an hg commandline based on ud
index 93deb458e870714a0c0d71227051a43c6dd9ce3d..14bde82fd788ec8317ceab1e84852574f54916a5 100644 (file)
@@ -49,9 +49,6 @@ 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):
         """
         Build up an ocs commandline based on ud
index aefc207840db32a2724bd74095882ffe7e2bc69f..5c128b3fdedb724122d3e5e5e377254ec6884cc8 100644 (file)
@@ -118,9 +118,6 @@ 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):
         """
         Fetch urls
index f742591fdbd5976032d19321b7dd45ccfbfacc79..9d890a5e944b9e79e6031a1c565ff544d68ac31b 100644 (file)
@@ -53,9 +53,6 @@ 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):
         """Fetch url"""
 
index ef1cf4deb1bf5dd6d580fcfecaa429074557bb81..95206f52fbcd62f2fc2d8f9c2f1b4d44d56bc3be 100644 (file)
@@ -53,9 +53,6 @@ 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):
         return ud.date == "now"
 
index ded7cd005734194047b1f00c8f21ec42c246f068..5ff064ebf3d3caf6c820cb6f08f2ab7b7d625184 100644 (file)
@@ -78,9 +78,6 @@ 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):
         """
         Build up an svn commandline based on ud
index a281bdcb4f323d98c14cb14b98853c3000321d7f..8d623721a92f2a36f590a0e8acea86d6c82da7c0 100644 (file)
@@ -45,9 +45,6 @@ class Wget(Fetch):
         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):
         """Fetch urls"""