Skip to contentSkip to conversation

fetch2/wget: do not hardcode tarball compressors in version check

PATCH In review Alexander Kanavin 3 participants 7 messages Dec 6, 2021 – Dec 7, 2021 2 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fetch2/wget: do not hardcode tarball compressors in version check

---
 bitbake/lib/bb/fetch2/wget.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
bitbake/lib/bb/fetch2/wget.py +1 -1
index fd9b304961..3021ef359e 100644
@@ -583,7 +583,7 @@ class Wget(FetchMethod):
 
         # src.rpm extension was added only for rpm package. Can be removed if the rpm
         # packaged will always be considered as having to be manually upgraded
-        psuffix_regex = r"(tar\.gz|tgz|tar\.bz2|zip|xz|tar\.lz|rpm|bz2|orig\.tar\.gz|tar\.xz|src\.tar\.gz|src\.tgz|svnr\d+\.tar\.bz2|stable\.tar\.gz|src\.rpm)"
+        psuffix_regex = r"(tar\.\w+|tgz|zip|xz|rpm|bz2|orig\.tar\.\w+|src\.tar\.\w+|src\.tgz|svnr\d+\.tar\.\w+|stable\.tar\.\w+|src\.rpm)"
 
         # match name, version and archive type of a package
         package_regex_comp = re.compile(r"(?P<name>%s?\.?v?)(?P<pver>%s)(?P<arch>%s)?[\.-](?P<type>%s$)"
Signature · 1 line
2.20.1
#1 lore raw
Quoted 10 lines · Alexander Kanavin
---
  bitbake/lib/bb/fetch2/wget.py | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
bitbake/lib/bb/fetch2/wget.py +0 -0
index fd9b304961..3021ef359e 100644

bitbake/lib/bb/fetch2/wget.py class Wget(FetchMethod): · line 586

Quoted 5 lines
bitbake/lib/bb/fetch2/wget.py +1 -1
@@ -583,7 +583,7 @@ class Wget(FetchMethod):
 
          # src.rpm extension was added only for rpm package. Can be removed if the rpm
          # packaged will always be considered as having to be manually upgraded
-        psuffix_regex = r"(tar\.gz|tgz|tar\.bz2|zip|xz|tar\.lz|rpm|bz2|orig\.tar\.gz|tar\.xz|src\.tar\.gz|src\.tgz|svnr\d+\.tar\.bz2|stable\.tar\.gz|src\.rpm)"
+        psuffix_regex = r"(tar\.\w+|tgz|zip|xz|rpm|bz2|orig\.tar\.\w+|src\.tar\.\w+|src\.tgz|svnr\d+\.tar\.\w+|stable\.tar\.\w+|src\.rpm)"

I've seen tar.gz.md5, tar.gz.sig, tar.siz or even tar.sum files on a bunch of server - unfortunately those would now be considered as well. Not sure if that causes any negative effect on the actual version parsing...

Quoted 14 lines
bitbake/lib/bb/fetch2/wget.py +0 -1
          # match name, version and archive type of a package
          package_regex_comp = re.compile(r"(?P<name>%s?\.?v?)(?P<pver>%s)(?P<arch>%s)?[\.-](?P<type>%s$)"
 
 
 
-=-=-=-=-=-=-=-=-=-=-=-

Links: You receive all messages sent to this group.
View/Reply Online (#13133): https://lists.openembedded.org/g/bitbake-devel/message/13133
Mute This Topic: https://lists.openembedded.org/mt/87544042/3647476
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw

I'd hope that those always come in tandem with the actual tarballs, if that proves to be not the case, we can tweak things further.

Alex

Quoted 47 lines · Konrad Weihmann

Review

Quoted 6 lines · Alexander Kanavin
---
  bitbake/lib/bb/fetch2/wget.py | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/bitbake/lib/bb/fetch2/wget.py

bitbake/lib/bb/fetch2/wget.py class Wget(FetchMethod): · line 584

Quoted 6 lines

index fd9b304961..3021ef359e 100644

bitbake/lib/bb/fetch2/wget.py +0 -0
@@ -583,7 +583,7 @@ class Wget(FetchMethod):
 
          # src.rpm extension was added only for rpm package. Can be

removed if the rpm

bitbake/lib/bb/fetch2/wget.py class Wget(FetchMethod): · line 585

Quoted 1 line
bitbake/lib/bb/fetch2/wget.py +0 -0
          # packaged will always be considered as having to be manually

upgraded

bitbake/lib/bb/fetch2/wget.py class Wget(FetchMethod): · line 586

Quoted 1 line
bitbake/lib/bb/fetch2/wget.py +0 -1
-        psuffix_regex =

r"(tar\.gz|tgz|tar\.bz2|zip|xz|tar\.lz|rpm|bz2|orig\.tar\.gz|tar\.xz|src\.tar\.gz|src\.tgz|svnr\d+\.tar\.bz2|stable\.tar\.gz|src\.rpm)"

bitbake/lib/bb/fetch2/wget.py class Wget(FetchMethod): · line 586

Quoted 1 line
bitbake/lib/bb/fetch2/wget.py +1 -0
+        psuffix_regex =

r"(tar\.\w+|tgz|zip|xz|rpm|bz2|orig\.tar\.\w+|src\.tar\.\w+|src\.tgz|svnr\d+\.tar\.\w+|stable\.tar\.\w+|src\.rpm)"

I've seen tar.gz.md5, tar.gz.sig, tar.siz or even tar.sum files on a bunch of server - unfortunately those would now be considered as well. Not sure if that causes any negative effect on the actual version parsing...

bitbake/lib/bb/fetch2/wget.py class Wget(FetchMethod): · line 588

Quoted 3 lines
bitbake/lib/bb/fetch2/wget.py +0 -0
          # match name, version and archive type of a package
          package_regex_comp =

re.compile(r"(?P<name>%s?\.?v?)(?P<pver>%s)(?P<arch>%s)?[\.-](?P<type>%s$)"

Quoted 6 lines
bitbake/lib/bb/fetch2/wget.py +0 -1
-=-=-=-=-=-=-=-=-=-=-=-

Links: You receive all messages sent to this group. View/Reply Online (#13133):

https://lists.openembedded.org/g/bitbake-devel/message/13133

Quoted 3 lines

Mute This Topic: https://lists.openembedded.org/mt/87544042/3647476
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [

[email protected]]

Quoted 2 lines

-=-=-=-=-=-=-=-=-=-=-=-

#3 lore raw
In reply to Alexander Kanavin
Quoted 10 lines · Alexander Kanavin
---
 bitbake/lib/bb/fetch2/wget.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
bitbake/lib/bb/fetch2/wget.py +0 -0
index fd9b304961..3021ef359e 100644

bitbake/lib/bb/fetch2/wget.py class Wget(FetchMethod): · line 589

Quoted 8 lines
bitbake/lib/bb/fetch2/wget.py +1 -1
@@ -583,7 +583,7 @@ class Wget(FetchMethod):
 
         # src.rpm extension was added only for rpm package. Can be removed if the rpm
         # packaged will always be considered as having to be manually upgraded
-        psuffix_regex = r"(tar\.gz|tgz|tar\.bz2|zip|xz|tar\.lz|rpm|bz2|orig\.tar\.gz|tar\.xz|src\.tar\.gz|src\.tgz|svnr\d+\.tar\.bz2|stable\.tar\.gz|src\.rpm)"
+        psuffix_regex = r"(tar\.\w+|tgz|zip|xz|rpm|bz2|orig\.tar\.\w+|src\.tar\.\w+|src\.tgz|svnr\d+\.tar\.\w+|stable\.tar\.\w+|src\.rpm)"
 
         # match name, version and archive type of a package
         package_regex_comp = re.compile(r"(?P<name>%s?\.?v?)(?P<pver>%s)(?P<arch>%s)?[\.-](?P<type>%s$)"

Looks good, is there something we should be adding to lib/bb/tests/fetch.py so that we don't forget this lesson?

Cheers,

Richard

#4 lore raw
Quoted 8 lines · Richard Purdie
Quoted 2 lines
         # match name, version and archive type of a package
         package_regex_comp =

re.compile(r"(?P<name>%s?\.?v?)(?P<pver>%s)(?P<arch>%s)?[\.-](?P<type>%s$)"

Looks good, is there something we should be adding to lib/bb/tests/fetch.py so
that we don't forget this lesson?

I don't think so, 'test that various tar.something suffixes are ok' is already covered, and it's not possible to make a test for 'any tar.suffix is okay'.

Alex

A message that is not in the archive (sent off-list or not yet received): 3600232f440e8a1a1caed9a57f0105a02f38e6df.camel@linuxfoundation.org

#6 lore raw
Quoted 7 lines · Richard Purdie

The issue was a .orig.tar.XXX so perhaps we're missing a test for that though?

I appreciate we can't cover everything, my worry is that if we change this code
again, we may lose this corner case...

The issue was that orig.tar.gz was covered by the regex (as it was explicitly listed), but orig.tar.bz2 was not. The test already checks various .tar.XXX suffixes, so I don't think there's much value in also adding .orig.tar.XXX and stable.tar.XXX and src.tar.XXX checks. They've all been changed to use \w (i.e. alphanumeric suffix).

Alex

A message that is not in the archive (sent off-list or not yet received): [email protected]

#8 lore raw
Quoted 12 lines · Alexander Kanavin via lists.openembedded.org

I appreciate we can't cover everything, my worry is that if we change this code

Quoted 2 lines

again, we may lose this corner case...

The issue was that orig.tar.gz was covered by the regex (as it was explicitly listed), but orig.tar.bz2 was not. The test already checks various .tar.XXX suffixes, so I don't think there's much value in also adding .orig.tar.XXX and stable.tar.XXX and src.tar.XXX checks. They've all been changed to use \w (i.e. alphanumeric suffix).

Let me look again actually, maybe I misunderstood what the test does.

Alex