summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>2025-02-07 13:46:54 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-02-11 21:18:39 +0000
commit3e543e8eaa18cecd9e360eecd3925b18e7a9058e (patch)
treeeb145aea3fba915b26a850fef7d9c0410d4ab957
parent2935d76bb468e576ab6219fa352968f2835f4ab8 (diff)
downloadpoky-3e543e8eaa18cecd9e360eecd3925b18e7a9058e.tar.gz
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>
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py4
-rw-r--r--bitbake/lib/bb/fetch2/az.py5
-rw-r--r--bitbake/lib/bb/fetch2/gcp.py2
-rw-r--r--bitbake/lib/bb/fetch2/npm.py2
-rw-r--r--bitbake/lib/bb/fetch2/s3.py2
-rw-r--r--bitbake/lib/bb/fetch2/sftp.py2
-rw-r--r--bitbake/lib/bb/fetch2/wget.py4
7 files changed, 11 insertions, 10 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 2a60e94ed0..628cae023a 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -1147,7 +1147,7 @@ def trusted_network(d, url):
1147 if bb.utils.to_boolean(d.getVar("BB_NO_NETWORK")): 1147 if bb.utils.to_boolean(d.getVar("BB_NO_NETWORK")):
1148 return True 1148 return True
1149 1149
1150 pkgname = d.expand(d.getVar('PN', False)) 1150 pkgname = d.getVar('PN')
1151 trusted_hosts = None 1151 trusted_hosts = None
1152 if pkgname: 1152 if pkgname:
1153 trusted_hosts = d.getVarFlag('BB_ALLOWED_NETWORKS', pkgname, False) 1153 trusted_hosts = d.getVarFlag('BB_ALLOWED_NETWORKS', pkgname, False)
@@ -1782,7 +1782,7 @@ class Fetch(object):
1782 self.ud[url] = FetchData(url, self.d) 1782 self.ud[url] = FetchData(url, self.d)
1783 1783
1784 self.ud[url].setup_localpath(self.d) 1784 self.ud[url].setup_localpath(self.d)
1785 return self.d.expand(self.ud[url].localpath) 1785 return self.ud[url].localpath
1786 1786
1787 def localpaths(self): 1787 def localpaths(self):
1788 """ 1788 """
diff --git a/bitbake/lib/bb/fetch2/az.py b/bitbake/lib/bb/fetch2/az.py
index 3ccc594c22..346124a8bf 100644
--- a/bitbake/lib/bb/fetch2/az.py
+++ b/bitbake/lib/bb/fetch2/az.py
@@ -66,11 +66,12 @@ class Az(Wget):
66 else: 66 else:
67 azuri = '%s%s%s' % ('https://', ud.host, ud.path) 67 azuri = '%s%s%s' % ('https://', ud.host, ud.path)
68 68
69 dldir = d.getVar("DL_DIR")
69 if os.path.exists(ud.localpath): 70 if os.path.exists(ud.localpath):
70 # file exists, but we didnt complete it.. trying again. 71 # file exists, but we didnt complete it.. trying again.
71 fetchcmd += d.expand(" -c -P ${DL_DIR} '%s'" % azuri) 72 fetchcmd += " -c -P %s '%s'" % (dldir, azuri)
72 else: 73 else:
73 fetchcmd += d.expand(" -P ${DL_DIR} '%s'" % azuri) 74 fetchcmd += " -P %s '%s'" % (dldir, azuri)
74 75
75 try: 76 try:
76 self._runwget(ud, d, fetchcmd, False) 77 self._runwget(ud, d, fetchcmd, False)
diff --git a/bitbake/lib/bb/fetch2/gcp.py b/bitbake/lib/bb/fetch2/gcp.py
index 2ee9ed2194..268267b7ac 100644
--- a/bitbake/lib/bb/fetch2/gcp.py
+++ b/bitbake/lib/bb/fetch2/gcp.py
@@ -46,7 +46,7 @@ class GCP(FetchMethod):
46 else: 46 else:
47 ud.basename = os.path.basename(ud.path) 47 ud.basename = os.path.basename(ud.path)
48 48
49 ud.localfile = d.expand(urllib.parse.unquote(ud.basename)) 49 ud.localfile = urllib.parse.unquote(ud.basename)
50 50
51 def get_gcp_client(self): 51 def get_gcp_client(self):
52 from google.cloud import storage 52 from google.cloud import storage
diff --git a/bitbake/lib/bb/fetch2/npm.py b/bitbake/lib/bb/fetch2/npm.py
index ac76d64cdb..c09f050448 100644
--- a/bitbake/lib/bb/fetch2/npm.py
+++ b/bitbake/lib/bb/fetch2/npm.py
@@ -166,7 +166,7 @@ class Npm(FetchMethod):
166 # Using the 'downloadfilename' parameter as local filename 166 # Using the 'downloadfilename' parameter as local filename
167 # or the npm package name. 167 # or the npm package name.
168 if "downloadfilename" in ud.parm: 168 if "downloadfilename" in ud.parm:
169 ud.localfile = npm_localfile(d.expand(ud.parm["downloadfilename"])) 169 ud.localfile = npm_localfile(ud.parm["downloadfilename"])
170 else: 170 else:
171 ud.localfile = npm_localfile(ud.package, ud.version) 171 ud.localfile = npm_localfile(ud.package, ud.version)
172 172
diff --git a/bitbake/lib/bb/fetch2/s3.py b/bitbake/lib/bb/fetch2/s3.py
index 6b8ffd5359..fa5292dfd7 100644
--- a/bitbake/lib/bb/fetch2/s3.py
+++ b/bitbake/lib/bb/fetch2/s3.py
@@ -77,7 +77,7 @@ class S3(FetchMethod):
77 else: 77 else:
78 ud.basename = os.path.basename(ud.path) 78 ud.basename = os.path.basename(ud.path)
79 79
80 ud.localfile = d.expand(urllib.parse.unquote(ud.basename)) 80 ud.localfile = urllib.parse.unquote(ud.basename)
81 81
82 ud.basecmd = d.getVar("FETCHCMD_s3") or "/usr/bin/env aws s3" 82 ud.basecmd = d.getVar("FETCHCMD_s3") or "/usr/bin/env aws s3"
83 83
diff --git a/bitbake/lib/bb/fetch2/sftp.py b/bitbake/lib/bb/fetch2/sftp.py
index 7884cce949..45b6afb4ad 100644
--- a/bitbake/lib/bb/fetch2/sftp.py
+++ b/bitbake/lib/bb/fetch2/sftp.py
@@ -77,7 +77,7 @@ class SFTP(FetchMethod):
77 else: 77 else:
78 ud.basename = os.path.basename(ud.path) 78 ud.basename = os.path.basename(ud.path)
79 79
80 ud.localfile = d.expand(urllib.parse.unquote(ud.basename)) 80 ud.localfile = urllib.parse.unquote(ud.basename)
81 81
82 def download(self, ud, d): 82 def download(self, ud, d):
83 """Fetch urls""" 83 """Fetch urls"""
diff --git a/bitbake/lib/bb/fetch2/wget.py b/bitbake/lib/bb/fetch2/wget.py
index 198426065b..7066d5e2ca 100644
--- a/bitbake/lib/bb/fetch2/wget.py
+++ b/bitbake/lib/bb/fetch2/wget.py
@@ -78,9 +78,9 @@ class Wget(FetchMethod):
78 else: 78 else:
79 ud.basename = os.path.basename(ud.path) 79 ud.basename = os.path.basename(ud.path)
80 80
81 ud.localfile = d.expand(urllib.parse.unquote(ud.basename)) 81 ud.localfile = urllib.parse.unquote(ud.basename)
82 if not ud.localfile: 82 if not ud.localfile:
83 ud.localfile = d.expand(urllib.parse.unquote(ud.host + ud.path).replace("/", ".")) 83 ud.localfile = urllib.parse.unquote(ud.host + ud.path).replace("/", ".")
84 84
85 self.basecmd = d.getVar("FETCHCMD_wget") or "/usr/bin/env wget -t 2 -T 100" 85 self.basecmd = d.getVar("FETCHCMD_wget") or "/usr/bin/env wget -t 2 -T 100"
86 86