mirror of
https://git.yoctoproject.org/poky
synced 2026-05-31 12:49:46 +00:00
bitbake: fetch2: remove unnecessary expand function calls
The fetch data class already expands the type, host, path, user, pswd and parm variables. The fetcher classes already expand the localfile variable. The getVar function expands the returned string per default. Remove unnecessary expand function calls to simplify the code. (Bitbake rev: 1b1eb037b861fbf20491ac17e519e9eaf232b858) Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
2935d76bb4
commit
3e543e8eaa
@@ -1147,7 +1147,7 @@ def trusted_network(d, url):
|
|||||||
if bb.utils.to_boolean(d.getVar("BB_NO_NETWORK")):
|
if bb.utils.to_boolean(d.getVar("BB_NO_NETWORK")):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
pkgname = d.expand(d.getVar('PN', False))
|
pkgname = d.getVar('PN')
|
||||||
trusted_hosts = None
|
trusted_hosts = None
|
||||||
if pkgname:
|
if pkgname:
|
||||||
trusted_hosts = d.getVarFlag('BB_ALLOWED_NETWORKS', pkgname, False)
|
trusted_hosts = d.getVarFlag('BB_ALLOWED_NETWORKS', pkgname, False)
|
||||||
@@ -1782,7 +1782,7 @@ class Fetch(object):
|
|||||||
self.ud[url] = FetchData(url, self.d)
|
self.ud[url] = FetchData(url, self.d)
|
||||||
|
|
||||||
self.ud[url].setup_localpath(self.d)
|
self.ud[url].setup_localpath(self.d)
|
||||||
return self.d.expand(self.ud[url].localpath)
|
return self.ud[url].localpath
|
||||||
|
|
||||||
def localpaths(self):
|
def localpaths(self):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -66,11 +66,12 @@ class Az(Wget):
|
|||||||
else:
|
else:
|
||||||
azuri = '%s%s%s' % ('https://', ud.host, ud.path)
|
azuri = '%s%s%s' % ('https://', ud.host, ud.path)
|
||||||
|
|
||||||
|
dldir = d.getVar("DL_DIR")
|
||||||
if os.path.exists(ud.localpath):
|
if os.path.exists(ud.localpath):
|
||||||
# file exists, but we didnt complete it.. trying again.
|
# file exists, but we didnt complete it.. trying again.
|
||||||
fetchcmd += d.expand(" -c -P ${DL_DIR} '%s'" % azuri)
|
fetchcmd += " -c -P %s '%s'" % (dldir, azuri)
|
||||||
else:
|
else:
|
||||||
fetchcmd += d.expand(" -P ${DL_DIR} '%s'" % azuri)
|
fetchcmd += " -P %s '%s'" % (dldir, azuri)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self._runwget(ud, d, fetchcmd, False)
|
self._runwget(ud, d, fetchcmd, False)
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class GCP(FetchMethod):
|
|||||||
else:
|
else:
|
||||||
ud.basename = os.path.basename(ud.path)
|
ud.basename = os.path.basename(ud.path)
|
||||||
|
|
||||||
ud.localfile = d.expand(urllib.parse.unquote(ud.basename))
|
ud.localfile = urllib.parse.unquote(ud.basename)
|
||||||
|
|
||||||
def get_gcp_client(self):
|
def get_gcp_client(self):
|
||||||
from google.cloud import storage
|
from google.cloud import storage
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ class Npm(FetchMethod):
|
|||||||
# Using the 'downloadfilename' parameter as local filename
|
# Using the 'downloadfilename' parameter as local filename
|
||||||
# or the npm package name.
|
# or the npm package name.
|
||||||
if "downloadfilename" in ud.parm:
|
if "downloadfilename" in ud.parm:
|
||||||
ud.localfile = npm_localfile(d.expand(ud.parm["downloadfilename"]))
|
ud.localfile = npm_localfile(ud.parm["downloadfilename"])
|
||||||
else:
|
else:
|
||||||
ud.localfile = npm_localfile(ud.package, ud.version)
|
ud.localfile = npm_localfile(ud.package, ud.version)
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ class S3(FetchMethod):
|
|||||||
else:
|
else:
|
||||||
ud.basename = os.path.basename(ud.path)
|
ud.basename = os.path.basename(ud.path)
|
||||||
|
|
||||||
ud.localfile = d.expand(urllib.parse.unquote(ud.basename))
|
ud.localfile = urllib.parse.unquote(ud.basename)
|
||||||
|
|
||||||
ud.basecmd = d.getVar("FETCHCMD_s3") or "/usr/bin/env aws s3"
|
ud.basecmd = d.getVar("FETCHCMD_s3") or "/usr/bin/env aws s3"
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ class SFTP(FetchMethod):
|
|||||||
else:
|
else:
|
||||||
ud.basename = os.path.basename(ud.path)
|
ud.basename = os.path.basename(ud.path)
|
||||||
|
|
||||||
ud.localfile = d.expand(urllib.parse.unquote(ud.basename))
|
ud.localfile = urllib.parse.unquote(ud.basename)
|
||||||
|
|
||||||
def download(self, ud, d):
|
def download(self, ud, d):
|
||||||
"""Fetch urls"""
|
"""Fetch urls"""
|
||||||
|
|||||||
@@ -78,9 +78,9 @@ class Wget(FetchMethod):
|
|||||||
else:
|
else:
|
||||||
ud.basename = os.path.basename(ud.path)
|
ud.basename = os.path.basename(ud.path)
|
||||||
|
|
||||||
ud.localfile = d.expand(urllib.parse.unquote(ud.basename))
|
ud.localfile = urllib.parse.unquote(ud.basename)
|
||||||
if not ud.localfile:
|
if not ud.localfile:
|
||||||
ud.localfile = d.expand(urllib.parse.unquote(ud.host + ud.path).replace("/", "."))
|
ud.localfile = urllib.parse.unquote(ud.host + ud.path).replace("/", ".")
|
||||||
|
|
||||||
self.basecmd = d.getVar("FETCHCMD_wget") or "/usr/bin/env wget -t 2 -T 100"
|
self.basecmd = d.getVar("FETCHCMD_wget") or "/usr/bin/env wget -t 2 -T 100"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user