commit:     5e05fd7c59d0853e6472bf65d619cedafb4880b7
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 30 18:02:16 2022 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sun Oct 30 18:02:16 2022 +0000
URL:        
https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=5e05fd7c

MissingRemoteIdCheck: fix bad suggestion for downloads.sourceforge.net

For sourceforge, the order of regexes was bad, resulting in it catching
`downloads.sourceforge.net` as project under `sourceforge.net` instead,
which is very wrong. Fix the order, and update the test to check for
this case specially.

On the same note, add support for `sourceforge.io` as a site - cause
looks like it also appears in the wild.

Resolves: https://github.com/pkgcore/pkgcheck/issues/488
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 src/pkgcheck/checks/metadata_xml.py                                 | 6 +++---
 .../MissingRemoteIdCheck/MissingRemoteId/expected.json              | 2 +-
 .../MissingRemoteIdCheck/MissingRemoteId/MissingRemoteId-2.ebuild   | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/pkgcheck/checks/metadata_xml.py 
b/src/pkgcheck/checks/metadata_xml.py
index 56dd2c94..06d62cf3 100644
--- a/src/pkgcheck/checks/metadata_xml.py
+++ b/src/pkgcheck/checks/metadata_xml.py
@@ -601,9 +601,9 @@ class MissingRemoteIdCheck(Check):
         ('pypi', 
r'https://files.pythonhosted.org/packages/source/\S/(?P<value>[^/]+)'),
         ('savannah', r'https://savannah.gnu.org/projects/(?P<value>[^/]+)'),
         ('savannah-nongnu', 
r'https://savannah.nongnu.org/projects/(?P<value>[^/]+)'),
-        ('sourceforge', r'https://(?P<value>[^/]+).sourceforge.net/'),
-        ('sourceforge', r'https://sourceforge.net/projects/(?P<value>[^/]+)'),
-        ('sourceforge', 
r'https://downloads.sourceforge.net/(?:project/)?(?P<value>[^/]+)'),
+        ('sourceforge', 
r'https://downloads.sourceforge.(net|io)/(?:project/)?(?P<value>[^/]+)'),
+        ('sourceforge', 
r'https://sourceforge.(net|io)/projects/(?P<value>[^/]+)'),
+        ('sourceforge', r'https://(?P<value>[^/]+).sourceforge.(net|io)/'),
         ('sourcehut', r'https://sr.ht/(?P<value>[^/]+/[^/]+)'),
     )
 

diff --git 
a/testdata/data/repos/eapis-testing/MissingRemoteIdCheck/MissingRemoteId/expected.json
 
b/testdata/data/repos/eapis-testing/MissingRemoteIdCheck/MissingRemoteId/expected.json
index ab5ae2d4..9d74b4e9 100644
--- 
a/testdata/data/repos/eapis-testing/MissingRemoteIdCheck/MissingRemoteId/expected.json
+++ 
b/testdata/data/repos/eapis-testing/MissingRemoteIdCheck/MissingRemoteId/expected.json
@@ -1,4 +1,4 @@
 {"__class__": "MissingRemoteId", "category": "MissingRemoteIdCheck", 
"package": "MissingRemoteId", "remote_type": "gitlab", "value": 
"pkgcore/pkgcheck/extra/MissingRemoteId", "uri": 
"https://gitlab.com/pkgcore/pkgcheck/extra/MissingRemoteId/-/archive/1/MissingRemoteId-1.tar.bz2"}
 {"__class__": "MissingRemoteId", "category": "MissingRemoteIdCheck", 
"package": "MissingRemoteId", "remote_type": "heptapod", "value": 
"pkgcore/pkgcore", "uri": 
"https://foss.heptapod.net/pkgcore/pkgcore/-/archive/4/MissingRemoteId-4.tar.bz2"}
 {"__class__": "MissingRemoteId", "category": "MissingRemoteIdCheck", 
"package": "MissingRemoteId", "remote_type": "pypi", "value": 
"MissingRemoteId", "uri": 
"https://files.pythonhosted.org/packages/source/M/MissingRemoteId/MissingRemoteId-1.tar.gz"}
-{"__class__": "MissingRemoteId", "category": "MissingRemoteIdCheck", 
"package": "MissingRemoteId", "remote_type": "sourceforge", "value": 
"pkgcheck", "uri": "https://pkgcheck.sourceforge.net/"}
+{"__class__": "MissingRemoteId", "category": "MissingRemoteIdCheck", 
"package": "MissingRemoteId", "remote_type": "sourceforge", "value": 
"pkgcheck", "uri": 
"https://downloads.sourceforge.net/pkgcheck/MissingRemoteId-2.tar.gz"}

diff --git 
a/testdata/repos/eapis-testing/MissingRemoteIdCheck/MissingRemoteId/MissingRemoteId-2.ebuild
 
b/testdata/repos/eapis-testing/MissingRemoteIdCheck/MissingRemoteId/MissingRemoteId-2.ebuild
index ed226b8e..2ee1bda2 100644
--- 
a/testdata/repos/eapis-testing/MissingRemoteIdCheck/MissingRemoteId/MissingRemoteId-2.ebuild
+++ 
b/testdata/repos/eapis-testing/MissingRemoteIdCheck/MissingRemoteId/MissingRemoteId-2.ebuild
@@ -1,7 +1,7 @@
 EAPI=7
 
 DESCRIPTION="Check homepage"
-HOMEPAGE="https://pkgcheck.sourceforge.net/";
-SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+HOMEPAGE="https://pkgcore.github.io/pkgcheck/";
+SRC_URI="mirror://sourceforge/pkgcheck/${P}.tar.gz"
 LICENSE="BSD"
 SLOT="0"

Reply via email to