diff mbox series

[wrynose,2.18,2/3] fetch/wget: in upstream version checks, match versioned directories exactly

Message ID 91d8f8c29107728c8974a7b66d5b78af46b362bc.1778197991.git.yoann.congal@smile.fr
State New
Headers show
Series [wrynose,2.18,1/3] doc: Fix description of git shallow mirror tarball creation | expand

Commit Message

Yoann Congal May 8, 2026, 7:13 a.m. UTC
From: Alexander Kanavin <alex@linutronix.de>

This change is in code that iterates over a html page, picking
out links to versioned subdirectories to check further for new versions.

Without the ^ and $ guards, there would be sub-string matches. This results in
querying the server multiple times for the same directory (for example,
perl check where the page contains multiple references to 5.0/something-unrelated)
or querying the server for directory that doesn't exist (nasm check, where
existence of 3.02rcX directories would result in querying the server for non-existing 3.02).

I have confirmed that the overall oe-core version check returns same results as before, with
less network churn and nasm version check working properly again.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 4af5f6a65a63bd92021d5eaa9d9ecc14f7397823)
Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
---
 lib/bb/fetch2/wget.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/lib/bb/fetch2/wget.py b/lib/bb/fetch2/wget.py
index ca4959ab5..6ac4306c0 100644
--- a/lib/bb/fetch2/wget.py
+++ b/lib/bb/fetch2/wget.py
@@ -539,7 +539,7 @@  class Wget(FetchMethod):
         version_dir = ['', '', '']
         version = ['', '', '']
 
-        dirver_regex = re.compile(r"(?P<pfx>\D*)(?P<ver>(\d+[\.\-_])*(\d+))")
+        dirver_regex = re.compile(r"^(?P<pfx>\D*)(?P<ver>(\d+[\.\-_])*(\d+))$")
         s = dirver_regex.search(dirver)
         if s:
             version_dir[1] = s.group('ver')