summaryrefslogtreecommitdiffstats
path: root/lib/bb/fetch2
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2012-05-04 18:26:40 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-05-07 11:01:20 +0100
commit769b92b14a1dfbbf697b8f4bf9a5a828807fd885 (patch)
treeec975bd92f0e1f9ec13d6f9960276581800dc1ea /lib/bb/fetch2
parent5999dc9985ad087c036611bfaa59b090a08781a6 (diff)
downloadbitbake-769b92b14a1dfbbf697b8f4bf9a5a828807fd885.tar.gz
bitbake/fetch2/wget: Remove unneeded function indirection and reindent
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/fetch2')
-rw-r--r--lib/bb/fetch2/wget.py49
1 files changed, 23 insertions, 26 deletions
diff --git a/lib/bb/fetch2/wget.py b/lib/bb/fetch2/wget.py
index 89bf57ba1..9d361150e 100644
--- a/lib/bb/fetch2/wget.py
+++ b/lib/bb/fetch2/wget.py
@@ -53,35 +53,32 @@ class Wget(FetchMethod):
def download(self, uri, ud, d, checkonly = False):
"""Fetch urls"""
- def fetch_uri(uri, ud, d):
- if checkonly:
- fetchcmd = data.getVar("CHECKCOMMAND_wget", d, True)
- elif os.path.exists(ud.localpath):
- # file exists, but we didnt complete it.. trying again..
- fetchcmd = data.getVar("RESUMECOMMAND_wget", d, True)
- else:
- fetchcmd = data.getVar("FETCHCOMMAND_wget", d, True)
+ if checkonly:
+ fetchcmd = data.getVar("CHECKCOMMAND_wget", d, True)
+ elif os.path.exists(ud.localpath):
+ # file exists, but we didnt complete it.. trying again..
+ fetchcmd = data.getVar("RESUMECOMMAND_wget", d, True)
+ else:
+ fetchcmd = data.getVar("FETCHCOMMAND_wget", d, True)
- uri = uri.split(";")[0]
- uri_decoded = list(decodeurl(uri))
- uri_type = uri_decoded[0]
- uri_host = uri_decoded[1]
+ uri = uri.split(";")[0]
+ uri_decoded = list(decodeurl(uri))
+ uri_type = uri_decoded[0]
+ uri_host = uri_decoded[1]
- fetchcmd = fetchcmd.replace("${URI}", uri.split(";")[0])
- fetchcmd = fetchcmd.replace("${FILE}", ud.basename)
- if not checkonly:
- logger.info("fetch " + uri)
- logger.debug(2, "executing " + fetchcmd)
- bb.fetch2.check_network_access(d, fetchcmd)
- runfetchcmd(fetchcmd, d, quiet=checkonly)
+ fetchcmd = fetchcmd.replace("${URI}", uri.split(";")[0])
+ fetchcmd = fetchcmd.replace("${FILE}", ud.basename)
+ if not checkonly:
+ logger.info("fetch " + uri)
+ logger.debug(2, "executing " + fetchcmd)
+ bb.fetch2.check_network_access(d, fetchcmd)
+ runfetchcmd(fetchcmd, d, quiet=checkonly)
- # Sanity check since wget can pretend it succeed when it didn't
- # Also, this used to happen if sourceforge sent us to the mirror page
- if not os.path.exists(ud.localpath) and not checkonly:
- raise FetchError("The fetch command returned success for url %s but %s doesn't exist?!" % (uri, ud.localpath), uri)
-
- fetch_uri(uri, ud, localdata)
-
+ # Sanity check since wget can pretend it succeed when it didn't
+ # Also, this used to happen if sourceforge sent us to the mirror page
+ if not os.path.exists(ud.localpath) and not checkonly:
+ raise FetchError("The fetch command returned success for url %s but %s doesn't exist?!" % (uri, ud.localpath), uri)
+
return True
def checkstatus(self, uri, ud, d):