summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r--bitbake/lib/bb/fetch/__init__.py24
-rw-r--r--bitbake/lib/bb/fetch/cvs.py2
-rw-r--r--bitbake/lib/bb/fetch/local.py8
-rw-r--r--bitbake/lib/bb/fetch/wget.py16
4 files changed, 44 insertions, 6 deletions
diff --git a/bitbake/lib/bb/fetch/__init__.py b/bitbake/lib/bb/fetch/__init__.py
index 41eebb29b5..c697f4744f 100644
--- a/bitbake/lib/bb/fetch/__init__.py
+++ b/bitbake/lib/bb/fetch/__init__.py
@@ -162,6 +162,22 @@ def go(d):
162 Fetch.write_md5sum(u, ud, d) 162 Fetch.write_md5sum(u, ud, d)
163 bb.utils.unlockfile(lf) 163 bb.utils.unlockfile(lf)
164 164
165
166def checkstatus(d):
167 """
168 Check all urls exist upstream
169 init must have previously been called
170 """
171 urldata = init([], d, True)
172
173 for u in urldata:
174 ud = urldata[u]
175 m = ud.method
176 bb.msg.note(1, bb.msg.domain.Fetcher, "Testing URL %s" % u)
177 ret = m.checkstatus(u, ud, d)
178 if not ret:
179 bb.msg.fatal(bb.msg.domain.Fetcher, "URL %s doesn't work" % u)
180
165def localpaths(d): 181def localpaths(d):
166 """ 182 """
167 Return a list of the local filenames, assuming successful fetch 183 Return a list of the local filenames, assuming successful fetch
@@ -364,6 +380,14 @@ class Fetch(object):
364 """ 380 """
365 raise NoMethodError("Missing implementation for url") 381 raise NoMethodError("Missing implementation for url")
366 382
383 def checkstatus(self, url, urldata, d):
384 """
385 Check the status of a URL
386 Assumes localpath was called first
387 """
388 bb.msg.note(1, bb.msg.domain.Fetcher, "URL %s could not be checked for status since no method exists." % url)
389 return True
390
367 def getSRCDate(urldata, d): 391 def getSRCDate(urldata, d):
368 """ 392 """
369 Return the SRC Date for the component 393 Return the SRC Date for the component
diff --git a/bitbake/lib/bb/fetch/cvs.py b/bitbake/lib/bb/fetch/cvs.py
index 01acc3f785..c4ccf4303f 100644
--- a/bitbake/lib/bb/fetch/cvs.py
+++ b/bitbake/lib/bb/fetch/cvs.py
@@ -118,7 +118,7 @@ class Cvs(Fetch):
118 if 'norecurse' in ud.parm: 118 if 'norecurse' in ud.parm:
119 options.append("-l") 119 options.append("-l")
120 if ud.date: 120 if ud.date:
121 options.append("-D %s" % ud.date) 121 options.append("-D \"%s UTC\"" % ud.date)
122 if ud.tag: 122 if ud.tag:
123 options.append("-r %s" % ud.tag) 123 options.append("-r %s" % ud.tag)
124 124
diff --git a/bitbake/lib/bb/fetch/local.py b/bitbake/lib/bb/fetch/local.py
index 5e480a208e..a39cdce22f 100644
--- a/bitbake/lib/bb/fetch/local.py
+++ b/bitbake/lib/bb/fetch/local.py
@@ -59,3 +59,11 @@ class Local(Fetch):
59 """Fetch urls (no-op for Local method)""" 59 """Fetch urls (no-op for Local method)"""
60 # no need to fetch local files, we'll deal with them in place. 60 # no need to fetch local files, we'll deal with them in place.
61 return 1 61 return 1
62
63 def checkstatus(self, url, urldata, d):
64 """
65 Check the status of the url
66 """
67 if os.path.exists(urldata.localpath):
68 return True
69 return False
diff --git a/bitbake/lib/bb/fetch/wget.py b/bitbake/lib/bb/fetch/wget.py
index f8ade45da7..a5979dead8 100644
--- a/bitbake/lib/bb/fetch/wget.py
+++ b/bitbake/lib/bb/fetch/wget.py
@@ -48,11 +48,13 @@ class Wget(Fetch):
48 48
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 go(self, uri, ud, d): 51 def go(self, uri, ud, d, checkonly = False):
52 """Fetch urls""" 52 """Fetch urls"""
53 53
54 def fetch_uri(uri, ud, d): 54 def fetch_uri(uri, ud, d):
55 if os.path.exists(ud.localpath): 55 if checkonly:
56 fetchcmd = data.getVar("FETCHCOMMAND", d, 1) + " " + data.getVar("FETCHOPTION_checkonly", d, 1)
57 elif os.path.exists(ud.localpath):
56 # file exists, but we didnt complete it.. trying again.. 58 # file exists, but we didnt complete it.. trying again..
57 fetchcmd = data.getVar("RESUMECOMMAND", d, 1) 59 fetchcmd = data.getVar("RESUMECOMMAND", d, 1)
58 else: 60 else:
@@ -83,10 +85,10 @@ class Wget(Fetch):
83 newuri = uri_replace(uri, find, replace, d) 85 newuri = uri_replace(uri, find, replace, d)
84 if newuri != uri: 86 if newuri != uri:
85 if fetch_uri(newuri, ud, localdata): 87 if fetch_uri(newuri, ud, localdata):
86 return 88 return True
87 89
88 if fetch_uri(uri, ud, localdata): 90 if fetch_uri(uri, ud, localdata):
89 return 91 return True
90 92
91 # try mirrors 93 # try mirrors
92 mirrors = [ i.split() for i in (data.getVar('MIRRORS', localdata, 1) or "").split('\n') if i ] 94 mirrors = [ i.split() for i in (data.getVar('MIRRORS', localdata, 1) or "").split('\n') if i ]
@@ -94,6 +96,10 @@ class Wget(Fetch):
94 newuri = uri_replace(uri, find, replace, d) 96 newuri = uri_replace(uri, find, replace, d)
95 if newuri != uri: 97 if newuri != uri:
96 if fetch_uri(newuri, ud, localdata): 98 if fetch_uri(newuri, ud, localdata):
97 return 99 return True
98 100
99 raise FetchError(uri) 101 raise FetchError(uri)
102
103
104 def checkstatus(self, uri, ud, d):
105 return self.go(uri, ud, d, True)