public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Arthur Zamarin" <arthurzam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/, ...
Date: Wed, 18 Jan 2023 05:19:11 +0000 (UTC)	[thread overview]
Message-ID: <1673814676.9e43d725ce4c2049e53e9df444b47c388bf98573.arthurzam@gentoo> (raw)

commit:     9e43d725ce4c2049e53e9df444b47c388bf98573
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 15 20:31:16 2023 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sun Jan 15 20:31:16 2023 +0000
URL:        https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=9e43d725

ProfilesCheck: check for unknown USE & IUSE_IMPLICIT in make.defaults

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

 src/pkgcheck/checks/profiles.py                                    | 7 +++++++
 .../repos/profiledir/ProfilesCheck/UnknownProfileUse/expected.json | 1 +
 .../repos/profiledir/ProfilesCheck/UnknownProfileUse/fix.patch     | 4 +++-
 testdata/repos/profiledir/profiles/unknown_use/make.defaults       | 2 ++
 4 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/pkgcheck/checks/profiles.py b/src/pkgcheck/checks/profiles.py
index 00d7c069..6d113519 100644
--- a/src/pkgcheck/checks/profiles.py
+++ b/src/pkgcheck/checks/profiles.py
@@ -290,6 +290,13 @@ class ProfilesCheck(Check):
 
     @verify_files(("make.defaults", "make_defaults"))
     def _make_defaults(self, filename: str, node, vals: dict[str, str]):
+        if use_flags := {
+            use.removeprefix("-")
+            for use_group in ("USE", "IUSE_IMPLICIT")
+            for use in vals.get(use_group, "").split()
+        }:
+            if unknown := use_flags - self.available_iuse:
+                yield UnknownProfileUse(pjoin(node.name, filename), sorted(unknown))
         if defined := set(vals.get("USE_EXPAND", "").split()):
             if unknown := defined - self.use_expand_groups:
                 yield UnknownProfileUseExpand(pjoin(node.name, filename), sorted(unknown))

diff --git a/testdata/data/repos/profiledir/ProfilesCheck/UnknownProfileUse/expected.json b/testdata/data/repos/profiledir/ProfilesCheck/UnknownProfileUse/expected.json
index 36f7f55c..b7b1c988 100644
--- a/testdata/data/repos/profiledir/ProfilesCheck/UnknownProfileUse/expected.json
+++ b/testdata/data/repos/profiledir/ProfilesCheck/UnknownProfileUse/expected.json
@@ -1,3 +1,4 @@
+{"__class__": "UnknownProfileUse", "path": "unknown_use/make.defaults", "flags": ["defaults_iuse_implicit", "defaults_use"]}
 {"__class__": "UnknownProfileUse", "path": "unknown_use/unknown_stable_use/use.force", "flags": ["-use_force"]}
 {"__class__": "UnknownProfileUse", "path": "unknown_use/unknown_stable_use/use.stable.force", "flags": ["use_stable_force"]}
 {"__class__": "UnknownProfileUse", "path": "unknown_use/unknown_stable_use_mask/use.mask", "flags": ["-use_mask"]}

diff --git a/testdata/data/repos/profiledir/ProfilesCheck/UnknownProfileUse/fix.patch b/testdata/data/repos/profiledir/ProfilesCheck/UnknownProfileUse/fix.patch
index 1541f627..d4003eb4 100644
--- a/testdata/data/repos/profiledir/ProfilesCheck/UnknownProfileUse/fix.patch
+++ b/testdata/data/repos/profiledir/ProfilesCheck/UnknownProfileUse/fix.patch
@@ -1,9 +1,11 @@
 diff -Naur profiledir/profiles/use.desc fixed/profiles/use.desc
 --- profiledir/profiles/use.desc	2020-11-23 10:54:01.018477444 -0700
 +++ fixed/profiles/use.desc	2020-11-23 11:54:08.071178614 -0700
-@@ -1 +1,5 @@
+@@ -1 +1,7 @@
  used - used global flag
 +use_force - use.force
 +use_mask - use.mask
 +use_stable_force - use.stable.force
 +use_stable_mask - use.stable.mask
++defaults_use - make.defaults USE
++defaults_iuse_implicit - make.defaults IUSE_IMPLICIT

diff --git a/testdata/repos/profiledir/profiles/unknown_use/make.defaults b/testdata/repos/profiledir/profiles/unknown_use/make.defaults
new file mode 100644
index 00000000..4699667b
--- /dev/null
+++ b/testdata/repos/profiledir/profiles/unknown_use/make.defaults
@@ -0,0 +1,2 @@
+USE="defaults_use used"
+IUSE_IMPLICIT="defaults_iuse_implicit used"


             reply	other threads:[~2023-01-18  5:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-18  5:19 Arthur Zamarin [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-11-22 21:35 [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/, Michał Górny
2024-08-01 19:41 Arthur Zamarin
2023-09-23 15:10 Arthur Zamarin
2023-04-24 16:43 Arthur Zamarin
2023-02-03 13:03 Arthur Zamarin
2023-01-30 19:07 Arthur Zamarin
2023-01-18  5:19 Arthur Zamarin
2023-01-14 20:29 Arthur Zamarin
2023-01-02 20:19 Arthur Zamarin
2022-10-30 18:04 Arthur Zamarin
2022-10-13 17:06 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=1673814676.9e43d725ce4c2049e53e9df444b47c388bf98573.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