From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 8A8FE15802F for ; Sun, 5 Mar 2023 17:13:32 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id BBEABE07D4; Sun, 5 Mar 2023 17:13:31 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 8668CE07D4 for ; Sun, 5 Mar 2023 17:13:31 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 6F6D633BE33 for ; Sun, 5 Mar 2023 17:13:30 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id EC49D88E for ; Sun, 5 Mar 2023 17:13:28 +0000 (UTC) From: "Arthur Zamarin" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Arthur Zamarin" Message-ID: <1678036402.e8d16ecb9765c32694b7a518381aee94ef5d9108.arthurzam@gentoo> Subject: [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/, tests/checks/ X-VCS-Repository: proj/pkgcore/pkgcheck X-VCS-Files: src/pkgcheck/checks/git.py tests/checks/test_git.py X-VCS-Directories: tests/checks/ src/pkgcheck/checks/ X-VCS-Committer: arthurzam X-VCS-Committer-Name: Arthur Zamarin X-VCS-Revision: e8d16ecb9765c32694b7a518381aee94ef5d9108 X-VCS-Branch: master Date: Sun, 5 Mar 2023 17:13:28 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 3a10ff52-61e6-4985-8f8f-08d57f24ab84 X-Archives-Hash: cfca0fa10b21810c898d3a82123e536c commit: e8d16ecb9765c32694b7a518381aee94ef5d9108 Author: Sam James gentoo org> AuthorDate: Sat Mar 4 09:20:28 2023 +0000 Commit: Arthur Zamarin gentoo 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 gentoo.org> Signed-off-by: Arthur Zamarin 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",