summaryrefslogtreecommitdiff
path: root/bitbake/lib/bb/fetch/wget.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/fetch/wget.py')
-rw-r--r--bitbake/lib/bb/fetch/wget.py35
1 files changed, 8 insertions, 27 deletions
diff --git a/bitbake/lib/bb/fetch/wget.py b/bitbake/lib/bb/fetch/wget.py
index ae1c6ad13..dcc58c75e 100644
--- a/bitbake/lib/bb/fetch/wget.py
+++ b/bitbake/lib/bb/fetch/wget.py
@@ -30,6 +30,8 @@ import bb
from bb import data
from bb.fetch import Fetch
from bb.fetch import FetchError
+from bb.fetch import encodeurl, decodeurl
+from bb.fetch import runfetchcmd
class Wget(Fetch):
"""Class to fetch urls via 'wget'"""
@@ -37,11 +39,11 @@ class Wget(Fetch):
"""
Check to see if a given url can be fetched with wget.
"""
- return ud.type in ['http','https','ftp']
+ return ud.type in ['http', 'https', 'ftp']
def localpath(self, url, ud, d):
- url = bb.encodeurl([ud.type, ud.host, ud.path, ud.user, ud.pswd, {}])
+ url = encodeurl([ud.type, ud.host, ud.path, ud.user, ud.pswd, {}])
ud.basename = os.path.basename(ud.path)
ud.localfile = data.expand(os.path.basename(url), d)
@@ -60,37 +62,16 @@ class Wget(Fetch):
fetchcmd = data.getVar("FETCHCOMMAND", d, 1)
uri = uri.split(";")[0]
- uri_decoded = list(bb.decodeurl(uri))
+ uri_decoded = list(decodeurl(uri))
uri_type = uri_decoded[0]
uri_host = uri_decoded[1]
- bb.msg.note(1, bb.msg.domain.Fetcher, "fetch " + uri)
fetchcmd = fetchcmd.replace("${URI}", uri.split(";")[0])
fetchcmd = fetchcmd.replace("${FILE}", ud.basename)
- httpproxy = None
- ftpproxy = None
- if uri_type == 'http':
- httpproxy = data.getVar("HTTP_PROXY", d, True)
- httpproxy_ignore = (data.getVar("HTTP_PROXY_IGNORE", d, True) or "").split()
- for p in httpproxy_ignore:
- if uri_host.endswith(p):
- httpproxy = None
- break
- if uri_type == 'ftp':
- ftpproxy = data.getVar("FTP_PROXY", d, True)
- ftpproxy_ignore = (data.getVar("HTTP_PROXY_IGNORE", d, True) or "").split()
- for p in ftpproxy_ignore:
- if uri_host.endswith(p):
- ftpproxy = None
- break
- if httpproxy:
- fetchcmd = "http_proxy=" + httpproxy + " " + fetchcmd
- if ftpproxy:
- fetchcmd = "ftp_proxy=" + ftpproxy + " " + fetchcmd
+
+ bb.msg.note(1, bb.msg.domain.Fetcher, "fetch " + uri)
bb.msg.debug(2, bb.msg.domain.Fetcher, "executing " + fetchcmd)
- ret = os.system(fetchcmd)
- if ret != 0:
- return False
+ runfetchcmd(fetchcmd, d)
# 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