From e4431daaf17451e4fbf801e04bd4c5ee8d63d487 Mon Sep 17 00:00:00 2001 From: Alfred Wingate Date: Fri, 22 Dec 2023 16:06:11 +0200 Subject: [PATCH] MissingRemoteId: also check EGIT_REPO_URI Signed-off-by: Alfred Wingate --- src/pkgcheck/checks/metadata_xml.py | 12 +++++++++++- .../MissingRemoteIdCheck/MissingRemoteId/fix.patch | 3 ++- .../MissingRemoteId/MissingRemoteId-5.ebuild | 9 +++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 testdata/repos/eapis-testing/MissingRemoteIdCheck/MissingRemoteId/MissingRemoteId-5.ebuild diff --git a/src/pkgcheck/checks/metadata_xml.py b/src/pkgcheck/checks/metadata_xml.py index fb574c0e2..acbdef33e 100644 --- a/src/pkgcheck/checks/metadata_xml.py +++ b/src/pkgcheck/checks/metadata_xml.py @@ -690,7 +690,17 @@ def feed(self, pkgset): chain.from_iterable(f.uri for f in fetchables if isinstance(f, fetchable)) ) urls = {url for url in all_urls if not url.endswith((".patch", ".diff"))} - urls = sorted(urls.union(pkg.homepage), key=len) + urls = urls.union(pkg.homepage) + + if "git-r3" in pkg.inherited and hasattr(pkg, "environment"): + egit_repo_uri = re.compile(r"EGIT_REPO_URI=\"(.*)\"") + for env_line in pkg.environment.data.splitlines(): + result = re.search(egit_repo_uri, env_line) + if result: + urls.add(result.group(1).removesuffix(".git")) + break + + urls = sorted(urls, key=len) for remote_type, regex in self.remotes_map: if remote_type in remotes: diff --git a/testdata/data/repos/eapis-testing/MissingRemoteIdCheck/MissingRemoteId/fix.patch b/testdata/data/repos/eapis-testing/MissingRemoteIdCheck/MissingRemoteId/fix.patch index 035f9ad4b..9bc049e9b 100644 --- a/testdata/data/repos/eapis-testing/MissingRemoteIdCheck/MissingRemoteId/fix.patch +++ b/testdata/data/repos/eapis-testing/MissingRemoteIdCheck/MissingRemoteId/fix.patch @@ -1,6 +1,6 @@ --- eapis-testing/MissingRemoteIdCheck/MissingRemoteId/metadata.xml +++ fixed/MissingRemoteIdCheck/MissingRemoteId/metadata.xml -@@ -3,6 +3,10 @@ +@@ -3,6 +3,11 @@ pkgcore/pkgcheck @@ -8,6 +8,7 @@ + pkgcore/pkgcheck + MissingRemoteId + pkgcheck ++ pkgcore/pkgcheck enable tests diff --git a/testdata/repos/eapis-testing/MissingRemoteIdCheck/MissingRemoteId/MissingRemoteId-5.ebuild b/testdata/repos/eapis-testing/MissingRemoteIdCheck/MissingRemoteId/MissingRemoteId-5.ebuild new file mode 100644 index 000000000..6a91066fd --- /dev/null +++ b/testdata/repos/eapis-testing/MissingRemoteIdCheck/MissingRemoteId/MissingRemoteId-5.ebuild @@ -0,0 +1,9 @@ +EAPI=7 + +inherit git-r3 + +DESCRIPTION="Don't suggest where already value exists" +HOMEPAGE="https://pkgcore.github.io/pkgcheck/" +EGIT_REPO_URI="https://gitlab.com/pkgcore/pkgcheck.git" +LICENSE="BSD" +SLOT="0"