summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Perrot <thomas.perrot@bootlin.com>2024-02-09 17:04:50 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-02-10 14:13:51 +0000
commit987ab2a446aab235d6e86e97c05f25fb800d7acc (patch)
treeef608bf644940f3dcc48c05d875512fdfd5f2675
parent0f50f21151f302d4b4db115866a907628bcd4e3c (diff)
downloadpoky-987ab2a446aab235d6e86e97c05f25fb800d7acc.tar.gz
bitbake: wget.py: always use the custom user agent
Add the "--user-agent" paramater in the wget base command to perform all wget commands with this parameter, because a few HTTP servers block requests with the default wget user agent. For example, "hg.openjdk.org" never send a response to requests have been sent with wget: wget https://hg.openjdk.org/jdk8u/jdk8u/archive/jdk8u272-ga.tar.bz2 https://hg.openjdk.org/jdk8u/jdk8u/archive/jdk8u272-ga.tar.bz2 Resolving hg.openjdk.org (hg.openjdk.org)... 23.54.129.73 Connecting to hg.openjdk.org (hg.openjdk.org)|23.54.129.73|:443... connected. HTTP request sent, awaiting response... (Bitbake rev: d6fa261a9603677f0b3abbd309c1ca6073b63f4c) Signed-off-by: Thomas Perrot <thomas.perrot@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/fetch2/wget.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/bitbake/lib/bb/fetch2/wget.py b/bitbake/lib/bb/fetch2/wget.py
index dc025800e6..bb38dd4358 100644
--- a/bitbake/lib/bb/fetch2/wget.py
+++ b/bitbake/lib/bb/fetch2/wget.py
@@ -87,7 +87,8 @@ class Wget(FetchMethod):
87 if not ud.localfile: 87 if not ud.localfile:
88 ud.localfile = d.expand(urllib.parse.unquote(ud.host + ud.path).replace("/", ".")) 88 ud.localfile = d.expand(urllib.parse.unquote(ud.host + ud.path).replace("/", "."))
89 89
90 self.basecmd = d.getVar("FETCHCMD_wget") or "/usr/bin/env wget -t 2 -T 30 --passive-ftp" 90 self.basecmd = d.getVar("FETCHCMD_wget") \
91 or "/usr/bin/env wget -t 2 -T 30 --passive-ftp --user-agent='%s'" % (self.user_agent)
91 92
92 if not self.check_certs(d): 93 if not self.check_certs(d):
93 self.basecmd += " --no-check-certificate" 94 self.basecmd += " --no-check-certificate"
@@ -454,7 +455,7 @@ class Wget(FetchMethod):
454 f = tempfile.NamedTemporaryFile() 455 f = tempfile.NamedTemporaryFile()
455 with tempfile.TemporaryDirectory(prefix="wget-index-") as workdir, tempfile.NamedTemporaryFile(dir=workdir, prefix="wget-listing-") as f: 456 with tempfile.TemporaryDirectory(prefix="wget-index-") as workdir, tempfile.NamedTemporaryFile(dir=workdir, prefix="wget-listing-") as f:
456 fetchcmd = self.basecmd 457 fetchcmd = self.basecmd
457 fetchcmd += " -O " + f.name + " --user-agent='" + self.user_agent + "' '" + uri + "'" 458 fetchcmd += " -O " + f.name + " '" + uri + "'"
458 try: 459 try:
459 self._runwget(ud, d, fetchcmd, True, workdir=workdir) 460 self._runwget(ud, d, fetchcmd, True, workdir=workdir)
460 fetchresult = f.read() 461 fetchresult = f.read()
@@ -492,7 +493,7 @@ class Wget(FetchMethod):
492 valid = 1 493 valid = 1
493 elif self._vercmp(version, newver) < 0: 494 elif self._vercmp(version, newver) < 0:
494 version = newver 495 version = newver
495 496
496 pupver = re.sub('_', '.', version[1]) 497 pupver = re.sub('_', '.', version[1])
497 498
498 bb.debug(3, "*** %s -> UpstreamVersion = %s (CurrentVersion = %s)" % 499 bb.debug(3, "*** %s -> UpstreamVersion = %s (CurrentVersion = %s)" %