summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py15
-rw-r--r--bitbake/lib/bb/fetch2/local.py13
2 files changed, 19 insertions, 9 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index d6ad3bb99a..9fec705ad6 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -525,6 +525,7 @@ class FetchData(object):
525 self.localpath = None 525 self.localpath = None
526 self.lockfile = None 526 self.lockfile = None
527 self.mirrortarball = None 527 self.mirrortarball = None
528 self.basename = None
528 (self.type, self.host, self.path, self.user, self.pswd, self.parm) = decodeurl(data.expand(url, d)) 529 (self.type, self.host, self.path, self.user, self.pswd, self.parm) = decodeurl(data.expand(url, d))
529 self.date = self.getSRCDate(d) 530 self.date = self.getSRCDate(d)
530 self.url = url 531 self.url = url
@@ -573,11 +574,10 @@ class FetchData(object):
573 elif self.localfile: 574 elif self.localfile:
574 self.localpath = self.method.localpath(self.url, self, d) 575 self.localpath = self.method.localpath(self.url, self, d)
575 576
576 if self.localfile and self.localpath: 577 # Note: These files should always be in DL_DIR whereas localpath may not be.
577 # Note: These files should always be in DL_DIR whereas localpath may not be. 578 basepath = bb.data.expand("${DL_DIR}/%s" % os.path.basename(self.localpath or self.basename), d)
578 basepath = bb.data.expand("${DL_DIR}/%s" % os.path.basename(self.localpath), d) 579 self.donestamp = basepath + '.done'
579 self.donestamp = basepath + '.done' 580 self.lockfile = basepath + '.lock'
580 self.lockfile = basepath + '.lock'
581 581
582 def setup_localpath(self, d): 582 def setup_localpath(self, d):
583 if not self.localpath: 583 if not self.localpath:
@@ -913,9 +913,6 @@ class Fetch(object):
913 m = ud.method 913 m = ud.method
914 localpath = "" 914 localpath = ""
915 915
916 if not ud.localfile:
917 continue
918
919 lf = bb.utils.lockfile(ud.lockfile) 916 lf = bb.utils.lockfile(ud.lockfile)
920 917
921 try: 918 try:
@@ -951,7 +948,7 @@ class Fetch(object):
951 mirrors = mirror_from_string(bb.data.getVar('MIRRORS', self.d, True)) 948 mirrors = mirror_from_string(bb.data.getVar('MIRRORS', self.d, True))
952 localpath = try_mirrors (self.d, ud, mirrors) 949 localpath = try_mirrors (self.d, ud, mirrors)
953 950
954 if not localpath or not os.path.exists(localpath): 951 if not localpath or ((not os.path.exists(localpath)) and localpath.find("*") == -1):
955 raise FetchError("Unable to fetch URL %s from any source." % u, u) 952 raise FetchError("Unable to fetch URL %s from any source." % u, u)
956 953
957 if os.path.exists(ud.donestamp): 954 if os.path.exists(ud.donestamp):
diff --git a/bitbake/lib/bb/fetch2/local.py b/bitbake/lib/bb/fetch2/local.py
index 77a296ec67..ed9a047d8d 100644
--- a/bitbake/lib/bb/fetch2/local.py
+++ b/bitbake/lib/bb/fetch2/local.py
@@ -40,6 +40,7 @@ class Local(FetchMethod):
40 40
41 def urldata_init(self, ud, d): 41 def urldata_init(self, ud, d):
42 # We don't set localfile as for this fetcher the file is already local! 42 # We don't set localfile as for this fetcher the file is already local!
43 ud.basename = os.path.basename(ud.url.split("://")[1].split(";")[0])
43 return 44 return
44 45
45 def localpath(self, url, urldata, d): 46 def localpath(self, url, urldata, d):
@@ -49,6 +50,9 @@ class Local(FetchMethod):
49 path = url.split("://")[1] 50 path = url.split("://")[1]
50 path = path.split(";")[0] 51 path = path.split(";")[0]
51 newpath = path 52 newpath = path
53 dldirfile = os.path.join(data.getVar("DL_DIR", d, True), os.path.basename(path))
54 if os.path.exists(dldirfile):
55 return dldirfile
52 if path[0] != "/": 56 if path[0] != "/":
53 filespath = data.getVar('FILESPATH', d, True) 57 filespath = data.getVar('FILESPATH', d, True)
54 if filespath: 58 if filespath:
@@ -57,8 +61,17 @@ class Local(FetchMethod):
57 filesdir = data.getVar('FILESDIR', d, True) 61 filesdir = data.getVar('FILESDIR', d, True)
58 if filesdir: 62 if filesdir:
59 newpath = os.path.join(filesdir, path) 63 newpath = os.path.join(filesdir, path)
64 if not os.path.exists(newpath) and path.find("*") == -1:
65 return dldirfile
60 return newpath 66 return newpath
61 67
68 def need_update(self, url, ud, d):
69 if url.find("*") == -1:
70 return False
71 if os.path.exists(ud.localpath):
72 return False
73 return True
74
62 def download(self, url, urldata, d): 75 def download(self, url, urldata, d):
63 """Fetch urls (no-op for Local method)""" 76 """Fetch urls (no-op for Local method)"""
64 # no need to fetch local files, we'll deal with them in place. 77 # no need to fetch local files, we'll deal with them in place.