From: "Brian Dolbec" <dolsen@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eclean/
Date: Sun, 18 Feb 2024 02:19:41 +0000 (UTC) [thread overview]
Message-ID: <1708222563.70cb55fa5fd2af7c7e46c94dc423a96bbedd83a5.dolsen@gentoo> (raw)
commit: 70cb55fa5fd2af7c7e46c94dc423a96bbedd83a5
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Feb 4 21:00:49 2024 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Feb 18 02:16:03 2024 +0000
URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=70cb55fa
eclean: Handle InvalidDepstring info in _deps_equal
Add try/except pair to _deps_equal() to output relavent details
causing the exception in order to aid the user to fix the issue.
Mark binpkg dep failures as a non match for possible deletion.
Make the ebuild dep failure a warning only, return True to save
the binpkg.
Add parameter docstring info
Bug: https://bugs.gentoo.org/923439
Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>
pym/gentoolkit/eclean/search.py | 54 ++++++++++++++++++++++++++++++++++++-----
1 file changed, 48 insertions(+), 6 deletions(-)
diff --git a/pym/gentoolkit/eclean/search.py b/pym/gentoolkit/eclean/search.py
index 2eebcfd..47df3a1 100644
--- a/pym/gentoolkit/eclean/search.py
+++ b/pym/gentoolkit/eclean/search.py
@@ -17,6 +17,7 @@ import portage
from portage.dep import Atom, use_reduce
from portage.dep._slot_operator import strip_slots
from portage.dep.libc import find_libc_deps, strip_libc_deps
+from portage.exception import InvalidDependString
import gentoolkit.pprinter as pp
from gentoolkit.eclean.exclude import (
@@ -526,13 +527,51 @@ class DistfilesSearch:
return clean_me, saved
-def _deps_equal(deps_a, eapi_a, deps_b, eapi_b, libc_deps, uselist=None):
- """Compare two dependency lists given a set of USE flags"""
+def _deps_equal(deps_a, eapi_a, deps_b, eapi_b, libc_deps, uselist=None, cpv=None):
+ """Compare two dependency lists given a set of USE flags
+
+ @param deps_a: binpkg DEPEND string (for InvalidDependString errors)
+ @rtype: string
+ @param eapi_a: EAPI
+ @rtype: string
+ @param deps_b: ebuild DEPEND string (for InvalidDependString errors)
+ @rtype: string
+ @param eapi_b: EAPI
+ @rtype: string
+ @param libc_deps: List of libc packages (or atoms if realized is passed).
+ @rtype: list
+ @param uselist: use flag list
+ @rtype: frozenset
+ @param cpv: Cat/Pkg-version
+ @rtype: string
+ """
if deps_a == deps_b:
return True
+ try:
+ deps_a = use_reduce(deps_a, uselist=uselist, eapi=eapi_a, token_class=Atom)
+ except InvalidDependString: # the binpkg depend string is bad
+ print(
+ pp.warn(
+ "Warning: Invalid binpkg DEPEND string found for: %s, %s"
+ " | tagging for removal" % (cpv, deps_a)
+ ),
+ file=sys.stderr,
+ )
+ return False
+ try:
+ deps_b = use_reduce(deps_b, uselist=uselist, eapi=eapi_b, token_class=Atom)
+ except InvalidDependString as er: # the ebuild depend string is bad
+ print(
+ pp.warn("Warning: Invalid ebuild DEPEND String found for: %s" % cpv),
+ file=sys.stderr,
+ )
+ print(
+ pp.warn("Warning: DEPEND string for ebuild: %s" % deps_b),
+ file=sys.stderr,
+ )
+ print(er, file=sys.stderr)
+ return True
- deps_a = use_reduce(deps_a, uselist=uselist, eapi=eapi_a, token_class=Atom)
- deps_b = use_reduce(deps_b, uselist=uselist, eapi=eapi_b, token_class=Atom)
strip_libc_deps(deps_a, libc_deps)
strip_libc_deps(deps_b, libc_deps)
strip_slots(deps_a)
@@ -656,13 +695,16 @@ def findPackages(
binpkg_metadata = dict(zip(keys, bin_dbapi.aux_get(cpv, keys)))
ebuild_metadata = dict(zip(keys, port_dbapi.aux_get(cpv, keys)))
+ deps_binpkg = " ".join(binpkg_metadata[key] for key in dep_keys)
+ deps_ebuild = " ".join(ebuild_metadata[key] for key in dep_keys)
if _deps_equal(
- " ".join(binpkg_metadata[key] for key in dep_keys),
+ deps_binpkg,
binpkg_metadata["EAPI"],
- " ".join(ebuild_metadata[key] for key in dep_keys),
+ deps_ebuild,
ebuild_metadata["EAPI"],
libc_deps,
frozenset(binpkg_metadata["USE"].split()),
+ cpv,
):
continue
next reply other threads:[~2024-02-18 2:19 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-18 2:19 Brian Dolbec [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-05-03 5:42 [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eclean/ Sam James
2024-05-03 5:40 Sam James
2024-05-03 5:40 Sam James
2024-05-03 5:40 Sam James
2024-05-03 5:11 Sam James
2024-02-18 2:19 Brian Dolbec
2024-01-19 7:03 Sam James
2024-01-19 6:15 Sam James
2024-01-12 19:16 Matt Turner
2023-12-03 7:51 Sam James
2023-10-08 3:28 Sam James
2023-10-08 3:28 Sam James
2023-09-29 7:20 Sam James
2023-08-24 19:52 Sam James
2023-08-22 20:54 Sam James
2023-08-22 20:52 Sam James
2023-08-22 20:50 Sam James
2023-08-22 20:50 Sam James
2023-08-22 20:35 Sam James
2023-08-21 5:16 Sam James
2023-08-21 5:16 Sam James
2022-07-11 7:17 Brian Dolbec
2022-07-09 22:45 Brian Dolbec
2022-07-09 21:46 Brian Dolbec
2022-06-01 10:25 Yixun Lan
2022-05-28 15:28 Yixun Lan
2022-02-09 10:48 Sam James
2020-06-09 17:29 Zac Medico
2020-03-12 16:51 Matt Turner
2020-03-12 16:51 Matt Turner
2020-01-03 4:31 Matt Turner
2019-12-05 16:51 Matt Turner
2019-12-05 16:51 Matt Turner
2019-09-13 23:34 Zac Medico
2017-12-12 5:51 Zac Medico
2016-07-03 6:29 Zac Medico
2016-07-01 6:19 Zac Medico
2016-06-24 21:40 Zac Medico
2016-06-24 21:36 Zac Medico
2016-06-23 20:01 Paul Varner
2015-10-19 21:33 Paul Varner
2015-10-15 21:39 Paul Varner
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=1708222563.70cb55fa5fd2af7c7e46c94dc423a96bbedd83a5.dolsen@gentoo \
--to=dolsen@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