From: "Arthur Zamarin" <arthurzam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/, tests/checks/
Date: Sun, 5 Mar 2023 17:13:28 +0000 (UTC) [thread overview]
Message-ID: <1678036402.e8d16ecb9765c32694b7a518381aee94ef5d9108.arthurzam@gentoo> (raw)
commit: e8d16ecb9765c32694b7a518381aee94ef5d9108
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 4 09:20:28 2023 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sun Mar 5 17:13:22 2023 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=e8d16ecb
checks: git: add PythonPEP517WithoutRevbump
Warn when DISTUTILS_USE_PEP517 is added or removed from an
ebuild without a new revision.
This is important because PEP517 affects a package's installed
files anyway and it's important to ensure that dependencies
work correctly against it, but also because e.g. config files
or other data files might either now be installed to the wrong
location or not installed at all. Developers must inspect
the image before/after (e.g. using iwdevtools) to avoid
issues.
Fixes: https://github.com/pkgcore/pkgcheck/issues/498
Signed-off-by: Sam James <sam <AT> gentoo.org>
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/git.py | 28 ++++++++++++++++++++++++++++
tests/checks/test_git.py | 19 +++++++++++++++++++
2 files changed, 47 insertions(+)
diff --git a/src/pkgcheck/checks/git.py b/src/pkgcheck/checks/git.py
index 8b272531..22780cbe 100644
--- a/src/pkgcheck/checks/git.py
+++ b/src/pkgcheck/checks/git.py
@@ -171,6 +171,18 @@ class MissingMove(results.PackageResult, results.Error):
return f"renamed package: {self.old} -> {self.new}"
+class PythonPEP517WithoutRevbump(results.PackageResult, results.Warning):
+ """Package has started/stopped using DISTUTILS_USE_PEP517 without revbump.
+
+ The package has started or stopped using DISTUTILS_USE_PEP517 without
+ a new revision. PEP517 affects the files installed by a package
+ and might lead to some files missing.
+
+ """
+
+ desc = "changed DISTUTILS_USE_PEP517 without new revision"
+
+
class SrcUriChecksumChange(results.PackageResult, results.Error):
"""SRC_URI changing checksum without distfile rename."""
@@ -265,9 +277,12 @@ class GitPkgCommitsCheck(GentooRepoCheck, GitCommitsCheck):
MissingMove,
SrcUriChecksumChange,
SuspiciousSrcUriChange,
+ PythonPEP517WithoutRevbump,
]
)
+ python_pep517_regex = re.compile("^DISTUTILS_USE_PEP517=")
+
# package categories that are committed with stable keywords
allowed_direct_stable = frozenset(["acct-user", "acct-group"])
@@ -364,6 +379,19 @@ class GitPkgCommitsCheck(GentooRepoCheck, GitCommitsCheck):
if pkg not in added and old_pkg.rdepend != new_pkg.rdepend:
yield RdependChange(pkg=new_pkg)
+ if "distutils-r1" in new_pkg.inherited:
+
+ def found_pep517_lines(cmp_pkg):
+ return any(
+ self.python_pep517_regex.match(line) for line in cmp_pkg.ebuild.text_fileobj()
+ )
+
+ found_old_pep517_line = found_pep517_lines(old_pkg)
+ found_new_pep517_line = found_pep517_lines(new_pkg)
+
+ if found_old_pep517_line ^ found_new_pep517_line:
+ yield PythonPEP517WithoutRevbump(pkg=new_pkg)
+
old_slot, new_slot = old_pkg.slot, new_pkg.slot
if old_slot != new_slot:
slotmoves = (
diff --git a/tests/checks/test_git.py b/tests/checks/test_git.py
index 57fc28ac..5deaad71 100644
--- a/tests/checks/test_git.py
+++ b/tests/checks/test_git.py
@@ -675,6 +675,25 @@ class TestGitPkgCommitsCheck(ReportTestCase):
r = self.assertReport(self.check, self.source)
assert r == git_mod.SrcUriChecksumChange(distfile[1], pkg=CP("cat/pkg"))
+ def test_python_pep517_change(self):
+ with open(pjoin(self.parent_git_repo.path, "eclass/distutils-r1.eclass"), "w") as f:
+ f.write("# Copyright 1999-2019 Gentoo Authors")
+ self.parent_git_repo.add_all("eclass: add distutils-r1")
+
+ # add pkgs to parent repo
+ self.parent_repo.create_ebuild("newcat/newpkg-1", data="inherit distutils-r1")
+ self.parent_git_repo.add_all("newcat/newpkg: initial import")
+ # pull changes to child repo
+ self.child_git_repo.run(["git", "pull", "origin", "main"])
+ # change an existing ebuild to have DISTUTILS_USE_PEP517 with no revbump
+ with open(pjoin(self.child_git_repo.path, "newcat/newpkg/newpkg-1.ebuild"), "a") as f:
+ f.write("\nDISTUTILS_USE_PEP517=setuptools\n")
+ self.child_git_repo.add_all("newcat/newpkg: use PEP517")
+ self.init_check()
+ r = self.assertReport(self.check, self.source)
+ expected = git_mod.PythonPEP517WithoutRevbump(pkg=CPV("newcat/newpkg-1"))
+ assert r == expected
+
def test_src_uri_change(self):
distfile = [
"DIST",
next reply other threads:[~2023-03-05 17:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-05 17:13 Arthur Zamarin [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-01-16 12:17 [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/, tests/checks/ Arthur Zamarin
2024-03-07 16:06 Arthur Zamarin
2023-07-15 8:52 Arthur Zamarin
2023-03-11 7:14 Arthur Zamarin
2023-03-04 5:59 Arthur Zamarin
2023-01-21 9:46 Arthur Zamarin
2023-01-20 20:47 Arthur Zamarin
2022-11-26 11:47 Arthur Zamarin
2022-11-26 11:47 Arthur Zamarin
2022-10-28 13:34 Arthur Zamarin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1678036402.e8d16ecb9765c32694b7a518381aee94ef5d9108.arthurzam@gentoo \
--to=arthurzam@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox