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/scripts/
Date: Thu, 11 May 2023 18:08:39 +0000 (UTC)	[thread overview]
Message-ID: <1683828113.a2358d60680611d7cbe07068440031c3c6e68f31.arthurzam@gentoo> (raw)

commit:     a2358d60680611d7cbe07068440031c3c6e68f31
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Thu May 11 18:01:53 2023 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Thu May 11 18:01:53 2023 +0000
URL:        https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=a2358d60

scan: fix unknown checkset during initial config load

The config load is performed in multiple stages:
1. parse `--config` path
2. load bundled config
3. load user & system configs
4. parse cmd args (needed for repo and targets)
5. load repo's config
6. parse full cmd args

The problem is that the checkset is parsed during stage 4, which means
it hasn't loaded the repo's config yet. While a more correct solution
would be to parse only needed args during stage 4, it wasn't simple
since the targets collect everything, including cmd args. So instead
this just patches temporarily to not fail upon unknown checksets.

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

 src/pkgcheck/scripts/pkgcheck_scan.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/pkgcheck/scripts/pkgcheck_scan.py b/src/pkgcheck/scripts/pkgcheck_scan.py
index 9abfe2b5..b83f569f 100644
--- a/src/pkgcheck/scripts/pkgcheck_scan.py
+++ b/src/pkgcheck/scripts/pkgcheck_scan.py
@@ -2,6 +2,7 @@ import argparse
 import os
 import shlex
 from contextlib import ExitStack
+from unittest.mock import patch
 
 from pkgcore import const as pkgcore_const
 from pkgcore.repository import errors as repo_errors
@@ -370,7 +371,8 @@ def _setup_scan(parser, namespace, args):
     # have to be parsed twice, will probably require a custom snakeoil
     # arghparse method.
     # parse command line args to override config defaults
-    namespace, _ = parser._parse_known_args(args, namespace)
+    with patch("pkgcheck.scripts.argparse_actions.ChecksetArgs.__call__", lambda *a, **k: None):
+        namespace, _ = parser._parse_known_args(args, namespace)
 
     # Get the current working directory for repo detection and restriction
     # creation, fallback to the root dir if it's be removed out from under us.


             reply	other threads:[~2023-05-11 18:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-11 18:08 Arthur Zamarin [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-06-29 15:41 [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/scripts/ Arthur Zamarin
2024-12-04 19:20 Michał Górny

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=1683828113.a2358d60680611d7cbe07068440031c3c6e68f31.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