Message ID | 20250326122523.293551-1-ross.burton@arm.com |
---|---|
State | Accepted, archived |
Commit | 2d5f135e997d13fabda0ad266fd5c928ee33f487 |
Headers | show |
Series | [v3,1/7] fetch2/wget: consider downloadfilename when checking for upstream | expand |
On Wed Mar 26, 2025 at 1:25 PM CET, Ross Burton via lists.openembedded.org wrote: > latest_versionstring() currently looks at just the end of the URI when > guessing what the filename to look for is, but this doesn't work if the > URL filename is not simple. > > For example, miniupnpd has a SRC_URI of: > > http://miniupnp.tuxfamily.org/files/download.php?file=${BP}.tar.gz;downloadfilename=${BP}.tar.gz > > The filename component of this is "download.php", which causes the > heuristics in latest_versionstring() to exit early. > > Instead, if the downloadfilename is set then use that, as it's often the > actual filename that we're after. > > Signed-off-by: Ross Burton <ross.burton@arm.com> > --- Hi Ross, I've been trying to apply this series on my branch, but I get some error on the autobuilder: FAIL: test_wget_latest_versionstring (bb.tests.fetch.FetchLatestVersionTest.test_wget_latest_versionstring) (pn='miniupnpd') ---------------------------------------------------------------------- Traceback (most recent call last): File "/srv/pokybuild/yocto-worker/oe-selftest-fedora/build/bitbake/lib/bb/tests/fetch.py", line 1578, in test_wget_latest_versionstring self.assertTrue(verstring, msg="Could not find upstream version for %s" % data.pn) ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AssertionError: '' is not true : Could not find upstream version for miniupnpd https://autobuilder.yoctoproject.org/valkyrie/#/builders/48/builds/1193
diff --git a/bitbake/lib/bb/fetch2/wget.py b/bitbake/lib/bb/fetch2/wget.py index 6cb728ab43c..df3e649312f 100644 --- a/bitbake/lib/bb/fetch2/wget.py +++ b/bitbake/lib/bb/fetch2/wget.py @@ -650,13 +650,17 @@ class Wget(FetchMethod): sanity check to ensure same name and type. """ - package = ud.path.split("/")[-1] + if 'downloadfilename' in ud.parm: + package = ud.parm['downloadfilename'] + else: + package = ud.path.split("/")[-1] current_version = ['', d.getVar('PV'), ''] """possible to have no version in pkg name, such as spectrum-fw""" if not re.search(r"\d+", package): current_version[1] = re.sub('_', '.', current_version[1]) current_version[1] = re.sub('-', '.', current_version[1]) + bb.debug(3, "latest_versionstring: no version found in %s" % package) return (current_version[1], '') package_regex = self._init_regexes(package, ud, d)
latest_versionstring() currently looks at just the end of the URI when guessing what the filename to look for is, but this doesn't work if the URL filename is not simple. For example, miniupnpd has a SRC_URI of: http://miniupnp.tuxfamily.org/files/download.php?file=${BP}.tar.gz;downloadfilename=${BP}.tar.gz The filename component of this is "download.php", which causes the heuristics in latest_versionstring() to exit early. Instead, if the downloadfilename is set then use that, as it's often the actual filename that we're after. Signed-off-by: Ross Burton <ross.burton@arm.com> --- bitbake/lib/bb/fetch2/wget.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)