[gentoo-commits] proj/gentoolkit:master commit in: bin/

2024-05-24 Thread Matt Turner
commit: a667d934de4e5980111fb0b4e3ecae19b477131f
Author: Matt Turner  gentoo  org>
AuthorDate: Thu May 23 23:23:23 2024 +
Commit: Matt Turner  gentoo  org>
CommitDate: Sat May 25 03:44:14 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=a667d934

bin/merge-driver-ekeyword: Look for KEYWORDS changes in upstream commit

Previously we only looked for changes to the KEYWORDS= line in our local
commit being rebased. If it contained no changes to KEYWORDS= then the
merge-driver gave up.

However our local patch may conflict with an upstream patch that changed
KEYWORDS.

In that case, we can look for changes to the KEYWORDS= line in the other
patch and try to apply its change to ours.

This happened in gentoo.git commits

2c5cd6c4e004 ("sys-fs/squashfs-tools-ng: Stabilize 1.3.0 amd64, #930693")
7129c2e4e5f3 ("sys-fs/squashfs-tools-ng: run elibtoolize in non-live ebuild")

leading to a rebase mistake in the latter (later fixed by commit
7579afbd4aa1 ("sys-fs/squashfs-tools-ng: stabilize 1.3.0 for amd64")).

With this patch applied, the merge conflicts are automatically resolved
between the two commits regardless of which is "ours" vs "theirs".

Signed-off-by: Matt Turner  gentoo.org>

 bin/merge-driver-ekeyword | 14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/bin/merge-driver-ekeyword b/bin/merge-driver-ekeyword
index efdfbde..6d5f869 100755
--- a/bin/merge-driver-ekeyword
+++ b/bin/merge-driver-ekeyword
@@ -1,6 +1,6 @@
 #!/usr/bin/python3
 #
-# Copyright 2020-2023 Gentoo Authors
+# Copyright 2020-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2 or later
 
 """
@@ -119,12 +119,16 @@ def main(argv: Sequence[str]) -> int:
 B = argv[3]  # %B - filename of the other branch's version
 P = argv[4]  # %P - original path of the file
 
-# Get changes from %O to %B
-changes = keyword_changes(O, B)
-if changes:
-# Apply O -> B changes to A
+# Get changes to KEYWORDS= from %O to %B
+if changes := keyword_changes(O, B):
+# Apply %O -> %B changes to %A
 result = apply_keyword_changes(A, P, changes)
 sys.exit(result)
+# Get changes to KEYWORDS= from %O to %A
+elif changes := keyword_changes(O, A):
+# Apply %O -> %A changes to %B
+result = apply_keyword_changes(B, P, changes)
+sys.exit(result)
 else:
 try:
 os.execlp("git", "git", "merge-file", "-L", "HEAD", "-L", "base", 
"-L", "ours", A, O, B)



[gentoo-commits] proj/gentoolkit:master commit in: bin/

2024-05-24 Thread Matt Turner
commit: 1fd8e83235dcd5cfd9fb2615c77f32da8b89d062
Author: Matt Turner  gentoo  org>
AuthorDate: Wed May  1 15:50:11 2024 +
Commit: Matt Turner  gentoo  org>
CommitDate: Sat May 25 03:44:14 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=1fd8e832

bin/merge-driver-ekeyword: Remove unused imports

Fixes: 1a2c70d ("Run `pyupgrade --py39-plus`")
Signed-off-by: Matt Turner  gentoo.org>

 bin/merge-driver-ekeyword | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/merge-driver-ekeyword b/bin/merge-driver-ekeyword
index ae022f3..ff779c5 100755
--- a/bin/merge-driver-ekeyword
+++ b/bin/merge-driver-ekeyword
@@ -14,7 +14,7 @@ import os
 import sys
 import tempfile
 
-from typing import List, Optional, Tuple
+from typing import Optional
 from collections.abc import Sequence
 
 from gentoolkit.ekeyword import ekeyword



[gentoo-commits] proj/gentoolkit:master commit in: bin/

2024-05-24 Thread Matt Turner
commit: 6b6fa781352b306f7b5aa387fffa53b9bc63f209
Author: Matt Turner  gentoo  org>
AuthorDate: Wed May  1 15:51:45 2024 +
Commit: Matt Turner  gentoo  org>
CommitDate: Sat May 25 03:44:14 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=6b6fa781

bin/merge-driver-ekeyword: Two blank lines after function def

Signed-off-by: Matt Turner  gentoo.org>

 bin/merge-driver-ekeyword | 1 +
 1 file changed, 1 insertion(+)

diff --git a/bin/merge-driver-ekeyword b/bin/merge-driver-ekeyword
index ff779c5..efdfbde 100755
--- a/bin/merge-driver-ekeyword
+++ b/bin/merge-driver-ekeyword
@@ -131,5 +131,6 @@ def main(argv: Sequence[str]) -> int:
 except OSError:
 sys.exit(-1)
 
+
 if __name__ == "__main__":
 main(sys.argv)



[gentoo-commits] proj/gentoolkit:master commit in: /

2024-05-08 Thread Sam James
commit: 054afd492ef2c0d4897d93220b5543b698f8e06d
Author: Sam James  gentoo  org>
AuthorDate: Wed May  8 21:42:57 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Wed May  8 21:42:57 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=054afd49

meson.build: prepare for gentoolkit-0.6.7

Signed-off-by: Sam James  gentoo.org>

 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 1c07ad1..abf171f 100644
--- a/meson.build
+++ b/meson.build
@@ -1,7 +1,7 @@
 project(
 'gentoolkit',
 'c',
-version : '0.6.6',
+version : '0.6.7',
 license : 'GPL-2.0-or-later',
 meson_version : '>=0.64.0'
 )



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eclean/, man/

2024-05-03 Thread Sam James
commit: ada43fcd4306b1dac26606058ef97399beaa360a
Author: Sam James  gentoo  org>
AuthorDate: Fri May  3 06:06:22 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Fri May  3 06:18:10 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=ada43fcd

eclean: dist: make VCS cleaning dependent on --deep

The man page clearly says that without --deep, users can expect eclean-dist
to be conservative in cleaning up, and not consider the VDB, just the repo
state.

Honour that promise by making VCS cleaning dependent on --deep, given it
involves VDB inspection to see what's installed.

Bug: https://bugs.gentoo.org/923369
Signed-off-by: Sam James  gentoo.org>

 man/eclean.1 | 1 +
 pym/gentoolkit/eclean/cli.py | 6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/man/eclean.1 b/man/eclean.1
index 53ba8a7..60cf1ca 100644
--- a/man/eclean.1
+++ b/man/eclean.1
@@ -106,6 +106,7 @@ etc.
 Units are: G, M, K and B.
 .TP
 \fB\-\-skip\-vcs\fPprotect VCS sources for live ebuilds not 
installed
+Only effective with \-\-deep. Without \-\-deep, no VCS cleaning is done.
 .SS "Options for the 'packages' action"
 .TP
 \fB\-i, \-\-ignore\-failure\fP ignore the failure to locate PKGDIR

diff --git a/pym/gentoolkit/eclean/cli.py b/pym/gentoolkit/eclean/cli.py
index 94f87f4..f5c22c2 100644
--- a/pym/gentoolkit/eclean/cli.py
+++ b/pym/gentoolkit/eclean/cli.py
@@ -424,7 +424,7 @@ def parseArgs(options={}):
 options["unique-use"] = True
 elif o in ("--no-clean-invalid"):
 options["no-clean-invalid"] = True
-elif o in ("--skip-vcs"):
+elif o in ("--skip-vcs") or not options["destructive"]:
 options["skip-vcs"] = True
 else:
 return_code = False
@@ -602,11 +602,11 @@ def doAction(action, options, exclude={}, output=None):
 output.einfo("Cleaning " + files_type + "...")
 # do the cleanup, and get size of deleted files
 if options["pretend"]:
-if options["skip-vcs"]:
+if options["skip-vcs"] or not options["destructive"]:
 vcs = {}
 clean_size = cleaner.pretend_clean(clean_me, vcs)
 elif action in ["distfiles"]:
-if options["skip-vcs"]:
+if options["skip-vcs"] or not options["destructive"]:
 vcs = {}
 clean_size = cleaner.clean_dist(clean_me, vcs)
 elif action in ["packages"]:



[gentoo-commits] proj/gentoolkit:master commit in: man/

2024-05-02 Thread Sam James
commit: d6fa2944ed84266acbaef59cb6d3adbd35d372b1
Author: Sam James  gentoo  org>
AuthorDate: Fri May  3 05:46:10 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Fri May  3 05:46:10 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=d6fa2944

man: document eclean-dist's --skip-vcs

Bug: https://bugs.gentoo.org/923369
Signed-off-by: Sam James  gentoo.org>

 man/eclean.1 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/man/eclean.1 b/man/eclean.1
index e47ced9..dc09f62 100644
--- a/man/eclean.1
+++ b/man/eclean.1
@@ -104,6 +104,8 @@ command\-line.
 etc.
 .br
 Units are: G, M, K and B.
+.TP
+\fB\-\-skip\-vcs\fPprotect VCS sources for live ebuilds not 
installed
 .SS "Options for the 'packages' action"
 .TP
 \fB\-i, \-\-ignore\-failure\fP ignore the failure to locate PKGDIR



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/

2024-05-02 Thread Sam James
commit: 2e5933f2972a700cbb8bd15a2464dcdd383918ca
Author: Sam James  gentoo  org>
AuthorDate: Fri May  3 05:53:46 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Fri May  3 05:53:46 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=2e5933f2

package: update example PORTDIR path

Signed-off-by: Sam James  gentoo.org>

 pym/gentoolkit/package.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pym/gentoolkit/package.py b/pym/gentoolkit/package.py
index 2159782..e3dd092 100644
--- a/pym/gentoolkit/package.py
+++ b/pym/gentoolkit/package.py
@@ -1,5 +1,5 @@
 # Copyright(c) 2004, Karl Trygve Kalleberg 
-# Copyright(c) 2004-2010, Gentoo Foundation
+# Copyright(c) 2004-2024, Gentoo Authors
 #
 # Licensed under the GNU General Public License, v2
 
@@ -13,7 +13,7 @@ important parts of Portage's back-end.
 Example usage:
>>> portage = Package('sys-apps/portage-')
>>> portage.ebuild_path()
-   '/usr/portage/sys-apps/portage/portage-.ebuild'
+   '/var/db/repos/gentoo/sys-apps/portage/portage-.ebuild'
>>> portage.is_masked()
True
>>> portage.is_installed()
@@ -318,7 +318,7 @@ class Package(CPV):
 Example usage:
 >>> pkg = Package('sys-apps/portage-')
 >>> pkg.ebuild_path()
-'/usr/portage/sys-apps/portage/portage-.ebuild'
+'/var/db/repos/gentoo/sys-apps/portage/portage-.ebuild'
 >>> pkg.ebuild_path(in_vartree=True)
 '/var/db/pkg/sys-apps/portage-/portage-.ebuild'
 """



[gentoo-commits] proj/gentoolkit:master commit in: man/

2024-05-02 Thread Sam James
commit: 718cae1a831c0923653c4a44d7d8ad9583e2e2a4
Author: Sam James  gentoo  org>
AuthorDate: Fri May  3 05:53:02 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Fri May  3 05:53:02 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=718cae1a

man: update default PKGDIR location to /var/cache/binpkgs

Signed-off-by: Sam James  gentoo.org>

 man/eclean.1 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/man/eclean.1 b/man/eclean.1
index dc09f62..53ba8a7 100644
--- a/man/eclean.1
+++ b/man/eclean.1
@@ -89,7 +89,7 @@ This action should be useful to almost any Gentoo user, we 
all have to big DISTD
 command\-line.
 .TP
 \fBpackages\fR
-Clean files from /usr/portage/packages (or whatever else is your PKGDIR in 
make.conf).
+Clean files from /var/cache/binpkgs (or whatever else is your PKGDIR in 
make.conf).
 This action is in particular useful for people who use the "buildpkg" or 
"buildsyspkg"
 FEATURES flags.
 .br



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eclean/

2024-05-02 Thread Sam James
commit: 7a5a2f540bc4776121d08d331b141d897eac92f6
Author: Sam James  gentoo  org>
AuthorDate: Fri May  3 05:41:46 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Fri May  3 05:41:46 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=7a5a2f54

eclean: dist: fix crash with excluded items

Bug: https://bugs.gentoo.org/915055
Signed-off-by: Sam James  gentoo.org>

 pym/gentoolkit/eclean/cli.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pym/gentoolkit/eclean/cli.py b/pym/gentoolkit/eclean/cli.py
index 52ddf2a..94f87f4 100644
--- a/pym/gentoolkit/eclean/cli.py
+++ b/pym/gentoolkit/eclean/cli.py
@@ -623,6 +623,7 @@ def doAction(action, options, exclude={}, output=None):
 elif not options["quiet"]:
 output.einfo("Your " + action + " directory was already clean.")
 if saved and not options["quiet"]:
+verb = "would be"
 print()
 print(
 pp.emph("   The following ")



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eclean/

2024-05-02 Thread Sam James
commit: 607d7d58638b5f5b085ec861ffb8f751bbe01743
Author: Sam James  gentoo  org>
AuthorDate: Fri May  3 05:25:20 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Fri May  3 05:25:20 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=607d7d58

eclean: dist: fix typo in comment

Signed-off-by: Sam James  gentoo.org>

 pym/gentoolkit/eclean/search.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pym/gentoolkit/eclean/search.py b/pym/gentoolkit/eclean/search.py
index 7f050ee..d38b88e 100644
--- a/pym/gentoolkit/eclean/search.py
+++ b/pym/gentoolkit/eclean/search.py
@@ -641,8 +641,8 @@ def findPackages(
 dead_binpkgs: dict[str, list[str]] = {}
 keep_binpkgs = {}
 
-# FEATURES=pkgdir-index-trusted is now on by default which makes portages 
inavlids
-# inaccessible
+# FEATURES=pkgdir-index-trusted is now on by default which makes Portage's
+# invalids inaccessible
 settings = var_dbapi.settings
 bin_dbapi = portage.binarytree(pkgdir=pkgdir, settings=settings).dbapi
 populate_kwargs = {}



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eclean/

2024-05-02 Thread Sam James
commit: bb6faf478f7e64d75224e55c3b81deb843dc9749
Author: Sam James  gentoo  org>
AuthorDate: Fri May  3 05:40:05 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Fri May  3 05:40:05 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=bb6faf47

eclean: dist: fix printing VCS clean items with --quiet

Bug: https://bugs.gentoo.org/928951
Signed-off-by: Sam James  gentoo.org>

 pym/gentoolkit/eclean/output.py | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/pym/gentoolkit/eclean/output.py b/pym/gentoolkit/eclean/output.py
index 75f7b02..04fb493 100644
--- a/pym/gentoolkit/eclean/output.py
+++ b/pym/gentoolkit/eclean/output.py
@@ -138,8 +138,11 @@ class OutputControl:
 print(self.prettySize(size, True), self.pkg_color(key))
 elif self.options["pretend"] or self.options["interactive"]:
 # file list mode
-for file_ in clean_list:
-print(file_)
+if file_type == "checkout":
+print(clean_list)
+else:
+for file_ in clean_list:
+print(file_)
 if self.options["pretend"]:
 return False
 elif (



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eclean/

2024-05-02 Thread Sam James
commit: a239275df515741aa20289d7fea067b83ab8daf8
Author: Sam James  gentoo  org>
AuthorDate: Fri May  3 05:25:39 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Fri May  3 05:26:17 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=a239275d

eclean: dist: fix copyright headers

Signed-off-by: Sam James  gentoo.org>

 pym/gentoolkit/eclean/clean.py   | 2 +-
 pym/gentoolkit/eclean/exclude.py | 2 +-
 pym/gentoolkit/eclean/output.py  | 2 +-
 pym/gentoolkit/eclean/search.py  | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/pym/gentoolkit/eclean/clean.py b/pym/gentoolkit/eclean/clean.py
index 0347f1d..918d4dc 100644
--- a/pym/gentoolkit/eclean/clean.py
+++ b/pym/gentoolkit/eclean/clean.py
@@ -1,6 +1,6 @@
 #!/usr/bin/python
 
-# Copyright 2003-2010 Gentoo Foundation
+# Copyright 2003-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 

diff --git a/pym/gentoolkit/eclean/exclude.py b/pym/gentoolkit/eclean/exclude.py
index c731ec0..c20574c 100644
--- a/pym/gentoolkit/eclean/exclude.py
+++ b/pym/gentoolkit/eclean/exclude.py
@@ -1,6 +1,6 @@
 #!/usr/bin/python
 
-# Copyright 2003-2010 Gentoo Foundation
+# Copyright 2003-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 

diff --git a/pym/gentoolkit/eclean/output.py b/pym/gentoolkit/eclean/output.py
index ebba499..75f7b02 100644
--- a/pym/gentoolkit/eclean/output.py
+++ b/pym/gentoolkit/eclean/output.py
@@ -1,6 +1,6 @@
 #!/usr/bin/python
 
-# Copyright 2003-2010 Gentoo Foundation
+# Copyright 2003-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 

diff --git a/pym/gentoolkit/eclean/search.py b/pym/gentoolkit/eclean/search.py
index d38b88e..aaa67dc 100644
--- a/pym/gentoolkit/eclean/search.py
+++ b/pym/gentoolkit/eclean/search.py
@@ -1,6 +1,6 @@
 #!/usr/bin/python
 
-# Copyright 2003-2010 Gentoo Foundation
+# Copyright 2003-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eclean/

2024-05-02 Thread Sam James
commit: 7405fdccd73364662089f1001231bf8c24916ca3
Author: Sam James  gentoo  org>
AuthorDate: Fri May  3 05:10:41 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Fri May  3 05:10:41 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=7405fdcc

eclean: dist: fix operating on an empty directory

Zac pointed out that not all return paths had been updated.

Bug: https://bugs.gentoo.org/928138
Fixes: 87912b460c533f8b010617018fdad42246db85f0
Signed-off-by: Sam James  gentoo.org>

 pym/gentoolkit/eclean/search.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pym/gentoolkit/eclean/search.py b/pym/gentoolkit/eclean/search.py
index b696b63..7f050ee 100644
--- a/pym/gentoolkit/eclean/search.py
+++ b/pym/gentoolkit/eclean/search.py
@@ -115,10 +115,11 @@ class DistfilesSearch:
 pkgs = {}
 saved = {}
 deprecated = {}
+vcs = {}
 installed_included = False
 # Check if DISTDIR is empty, return early
 if not os.listdir(_distdir):
-return clean_me, saved, deprecated
+return clean_me, saved, deprecated, vcs
 
 # create a big CPV->SRC_URI dict of packages
 # whose distfiles should be kept



[gentoo-commits] proj/gentoolkit:master commit in: /

2024-04-25 Thread Sam James
commit: f49f246f76db84d6c2d2d0ad2b1d19eb27aa1b2d
Author: Sam James  gentoo  org>
AuthorDate: Thu Apr 25 20:37:33 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Thu Apr 25 20:37:33 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=f49f246f

meson.build: prepare for gentoolkit-0.6.6

Signed-off-by: Sam James  gentoo.org>

 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index b7b07c1..1c07ad1 100644
--- a/meson.build
+++ b/meson.build
@@ -1,7 +1,7 @@
 project(
 'gentoolkit',
 'c',
-version : '0.6.5',
+version : '0.6.6',
 license : 'GPL-2.0-or-later',
 meson_version : '>=0.64.0'
 )



[gentoo-commits] proj/gentoolkit:master commit in: data/eclean/

2024-04-25 Thread Sam James
commit: 13f24e6709d602af467e694a338fb5fd1e011026
Author: Ulrich Müller  gentoo  org>
AuthorDate: Thu Apr 25 08:56:08 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Thu Apr 25 09:04:01 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=13f24e67

distfiles.exclude: whitelist .layout.conf* and .mirror-cache.json

Signed-off-by: Ulrich Müller  gentoo.org>
Signed-off-by: Sam James  gentoo.org>

 data/eclean/distfiles.exclude | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/data/eclean/distfiles.exclude b/data/eclean/distfiles.exclude
index 1c6eaf4..ed087a7 100644
--- a/data/eclean/distfiles.exclude
+++ b/data/eclean/distfiles.exclude
@@ -2,6 +2,8 @@
 # In this file you can list some categories or cat/pkg-name for which you want
 # to protect distfiles from "ecleaning". You can also name some specific files.
 # See `man eclean` for syntax details.
+.layout.conf*
+.mirror-cache.json
 metadata.dtd
 metadata.xsd
 portage-\d\d\d\d\d\d\d\d\.tar\.bz2



[gentoo-commits] proj/gentoolkit:master commit in: data/eclean/

2024-04-25 Thread Sam James
commit: 271b91db8a2ae47732ebbcd1a391445a7d93f4dc
Author: Ulrich Müller  gentoo  org>
AuthorDate: Thu Apr 25 08:56:40 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Thu Apr 25 09:04:02 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=271b91db

distfiles.exclude: whitelist layout.conf

Bug: https://bugs.gentoo.org/877485
Signed-off-by: Ulrich Müller  gentoo.org>
Closes: https://github.com/gentoo/gentoolkit/pull/47
Signed-off-by: Sam James  gentoo.org>

 data/eclean/distfiles.exclude | 1 +
 1 file changed, 1 insertion(+)

diff --git a/data/eclean/distfiles.exclude b/data/eclean/distfiles.exclude
index ed087a7..a2de848 100644
--- a/data/eclean/distfiles.exclude
+++ b/data/eclean/distfiles.exclude
@@ -4,6 +4,7 @@
 # See `man eclean` for syntax details.
 .layout.conf*
 .mirror-cache.json
+layout.conf
 metadata.dtd
 metadata.xsd
 portage-\d\d\d\d\d\d\d\d\.tar\.bz2



[gentoo-commits] proj/gentoolkit:master commit in: /

2024-03-12 Thread Sam James
commit: d00c9f8b80d8f6193810e7cb4b9175c498fc9c82
Author: Greg Kubaryk  gmail  com>
AuthorDate: Tue Mar 12 21:41:48 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Tue Mar 12 21:43:41 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=d00c9f8b

meson: make tests optional

Closes: https://bugs.gentoo.org/926427
Signed-off-by: Greg Kubaryk  gmail.com>
Signed-off-by: Sam James  gentoo.org>
(cherry picked from commit 988e47557368df49035eeba94beca893f7b267c1)

 meson.build   | 6 --
 meson_options.txt | 4 
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/meson.build b/meson.build
index c3e83c5..b7b07c1 100644
--- a/meson.build
+++ b/meson.build
@@ -39,8 +39,10 @@ endif
 subdir('bin')
 subdir('pym')
 
-pytest = find_program('pytest')
-test('pytest', pytest, args : ['-v', meson.current_source_dir() / 'pym'])
+if get_option('tests')
+pytest = find_program('pytest')
+test('pytest', pytest, args : ['-v', meson.current_source_dir() / 'pym'])
+endif
 
 if get_option('code-only')
 subdir_done()

diff --git a/meson_options.txt b/meson_options.txt
index 265d572..9949cbf 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -13,3 +13,7 @@ option('eprefix', type : 'string',
 option('docdir', type : 'string',
 description : 'Documentation directory'
 )
+
+option('tests', type : 'boolean', value: false,
+description : 'Enable tests'
+)



[gentoo-commits] proj/gentoolkit:master commit in: /

2024-03-12 Thread Sam James
commit: 806d0cca43dfbdc124978381305361daf47677cb
Author: Sam James  gentoo  org>
AuthorDate: Tue Mar 12 21:43:17 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Tue Mar 12 21:43:17 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=806d0cca

Revert "meson: make tests optional"

This reverts commit 988e47557368df49035eeba94beca893f7b267c1.

Signed-off-by: Sam James  gentoo.org>

 meson.build   | 6 ++
 meson_options.txt | 4 
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/meson.build b/meson.build
index b7b07c1..c3e83c5 100644
--- a/meson.build
+++ b/meson.build
@@ -39,10 +39,8 @@ endif
 subdir('bin')
 subdir('pym')
 
-if get_option('tests')
-pytest = find_program('pytest')
-test('pytest', pytest, args : ['-v', meson.current_source_dir() / 'pym'])
-endif
+pytest = find_program('pytest')
+test('pytest', pytest, args : ['-v', meson.current_source_dir() / 'pym'])
 
 if get_option('code-only')
 subdir_done()

diff --git a/meson_options.txt b/meson_options.txt
index 9949cbf..265d572 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -13,7 +13,3 @@ option('eprefix', type : 'string',
 option('docdir', type : 'string',
 description : 'Documentation directory'
 )
-
-option('tests', type : 'boolean', value: false,
-description : 'Enable tests'
-)



[gentoo-commits] proj/gentoolkit:master commit in: /

2024-03-12 Thread Sam James
commit: 988e47557368df49035eeba94beca893f7b267c1
Author: Sam James  gentoo  org>
AuthorDate: Tue Mar 12 21:41:48 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Tue Mar 12 21:41:48 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=988e4755

meson: make tests optional

Closes: https://bugs.gentoo.org/926427
Signed-off-by: Greg Kubaryk  gmail.com>
Signed-off-by: Sam James  gentoo.org>

 meson.build   | 6 --
 meson_options.txt | 4 
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/meson.build b/meson.build
index c3e83c5..b7b07c1 100644
--- a/meson.build
+++ b/meson.build
@@ -39,8 +39,10 @@ endif
 subdir('bin')
 subdir('pym')
 
-pytest = find_program('pytest')
-test('pytest', pytest, args : ['-v', meson.current_source_dir() / 'pym'])
+if get_option('tests')
+pytest = find_program('pytest')
+test('pytest', pytest, args : ['-v', meson.current_source_dir() / 'pym'])
+endif
 
 if get_option('code-only')
 subdir_done()

diff --git a/meson_options.txt b/meson_options.txt
index 265d572..9949cbf 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -13,3 +13,7 @@ option('eprefix', type : 'string',
 option('docdir', type : 'string',
 description : 'Documentation directory'
 )
+
+option('tests', type : 'boolean', value: false,
+description : 'Enable tests'
+)



[gentoo-commits] proj/gentoolkit:master commit in: .github/workflows/

2024-03-12 Thread Sam James
commit: 91b74fc8105b7e08a04da4daef9283fc69bf5f85
Author: Sam James  gentoo  org>
AuthorDate: Tue Mar 12 21:42:46 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Tue Mar 12 21:42:56 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=91b74fc8

ci: enable new test option

See 988e47557368df49035eeba94beca893f7b267c1.

Bug: https://bugs.gentoo.org/926427
Signed-off-by: Sam James  gentoo.org>

 .github/workflows/ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 803dfde..871d4aa 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -50,7 +50,7 @@ jobs:
 - name: Test meson install --destdir /tmp/install-root
   run: |
 echo -e "[binaries]\npython = '$(command -v python)'" > /tmp/native.ini
-meson setup --native-file /tmp/native.ini /tmp/build .
+meson setup -Dtests=true --native-file /tmp/native.ini /tmp/build .
 meson install -C /tmp/build --destdir /tmp/install-root
 - name: Run tests for ${{ matrix.python-version }}
   run: |



[gentoo-commits] proj/gentoolkit:master commit in: /, .github/workflows/

2024-03-07 Thread Sam James
commit: 70ea88e3f1e5bdacd8aa6f1eaf30aa0efe2cc114
Author: John Turner  gmail  com>
AuthorDate: Mon Mar  4 00:22:32 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Thu Mar  7 18:49:07 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=70ea88e3

switch test framework to pytest

Pytest is a testing framework that is backwards compatible with
"unittest" tests, but provides new styles of tests that are more
ergonomic.

Pytest tests do not require wrapping the test in a class, just a top
level python function will be automatically picked up. Assertions use
the regular python assert built-in and provide greatly enhanced debug
output. These features reduce friction in writing new unit tests, and being
backwards compatible allows preserving the existing gentoolkit unit
tests.

Changing the meson test command and installing the pytest package in CI are the
only changes required to start using it!

Signed-off-by: John Turner  gmail.com>
Closes: https://github.com/gentoo/gentoolkit/pull/45
Signed-off-by: Sam James  gentoo.org>

 .github/workflows/ci.yml | 2 +-
 meson.build  | 8 ++--
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index bcb2d59..803dfde 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -33,7 +33,7 @@ jobs:
 python -m site
 python -m pip install --upgrade pip
 # setuptools needed for 3.12+ because of 
https://github.com/mesonbuild/meson/issues/7702.
-python -m pip install meson ninja setuptools
+python -m pip install meson ninja setuptools pytest
 - name: Install portage
   run: |
 mkdir portage

diff --git a/meson.build b/meson.build
index c771738..c3e83c5 100644
--- a/meson.build
+++ b/meson.build
@@ -39,12 +39,8 @@ endif
 subdir('bin')
 subdir('pym')
 
-test(
-'python-unittest',
-py,
-args : ['-m', 'unittest', 'discover', meson.current_source_dir() / 'pym'],
-timeout : 0
-)
+pytest = find_program('pytest')
+test('pytest', pytest, args : ['-v', meson.current_source_dir() / 'pym'])
 
 if get_option('code-only')
 subdir_done()



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/

2024-03-07 Thread Sam James
commit: 3a53501625e73483a86f2ee00696047a20682745
Author: John Turner  gmail  com>
AuthorDate: Thu Feb 22 20:50:40 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Thu Mar  7 18:49:06 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=3a535016

dependencies.py: rewrite graph_reverse_depends to pass tests

The graph_reverse_depends method was not able to pass the unit tests
introduced in the previous commits. It has been rewritten to pass them.

This also has adding types to the method, and yields the results as an
iterator rather than collecting them into a list in one shot.

The printer callback parameter has been removed. This callback most
likely existed so that results would be shown to the user as soon as
they were available instead of delaying printing until the method
completed, which could take seconds or minutes depending on the
parameters. By making this method an iterator, the same effect is
acheived by having the caller print every item as its yielded
from the method.

Signed-off-by: John Turner  gmail.com>
Signed-off-by: Sam James  gentoo.org>

 pym/gentoolkit/dependencies.py | 102 +++--
 1 file changed, 36 insertions(+), 66 deletions(-)

diff --git a/pym/gentoolkit/dependencies.py b/pym/gentoolkit/dependencies.py
index c6abff0..be5c71f 100644
--- a/pym/gentoolkit/dependencies.py
+++ b/pym/gentoolkit/dependencies.py
@@ -14,7 +14,7 @@ __all__ = ("Dependencies",)
 import itertools
 from functools import cache
 from enum import Enum
-from typing import List, Dict
+from typing import List, Dict, Iterable, Iterator, Set, Optional, Any, Union
 
 import portage
 from portage.dep import paren_reduce
@@ -22,6 +22,7 @@ from portage.dep import paren_reduce
 from gentoolkit import errors
 from gentoolkit.atom import Atom
 from gentoolkit.query import Query
+from gentoolkit.cpv import CPV
 
 # ===
 # Classes
@@ -52,10 +53,11 @@ class Dependencies(Query):
 
 """
 
-def __init__(self, query, parser=None):
+def __init__(self, query: Any, parser: Any = None) -> None:
 Query.__init__(self, query)
-self.use = []
-self.depatom = ""
+self.use: List[str] = []
+self.depatom: Optional[Atom] = None
+self.depth: Optional[int] = None
 
 # Allow a custom parser function:
 self.parser = parser if parser else self._parser
@@ -185,15 +187,13 @@ class Dependencies(Query):
 
 def graph_reverse_depends(
 self,
-pkgset=None,
-max_depth=-1,
-only_direct=True,
-printer_fn=None,
+pkgset: Iterable[Union[str, CPV]],
+max_depth: Optional[int] = None,
+only_direct: bool = True,
 # The rest of these are only used internally:
-depth=0,
-seen=None,
-result=None,
-):
+depth: int = 0,
+seen: Optional[Set[str]] = None,
+) -> Iterator["Dependencies"]:
 """Graph direct reverse dependencies for self.
 
 Example usage:
@@ -201,10 +201,10 @@ class Dependencies(Query):
 >>> ffmpeg = Dependencies('media-video/ffmpeg-')
 >>> # I only care about installed packages that depend on me:
 ... from gentoolkit.helpers import get_installed_cpvs
->>> # I want to pass in a sorted list. We can pass strings or
-... # Package or Atom types, so I'll use Package to sort:
+>>> # I want to pass in a list. We can pass strings or
+... # Package or Atom types.
 ... from gentoolkit.package import Package
->>> installed = sorted(get_installed_cpvs())
+>>> installed = get_installed_cpvs()
 >>> deptree = ffmpeg.graph_reverse_depends(
 ... only_direct=False,  # Include indirect revdeps
 ... pkgset=installed)   # from installed pkgset
@@ -212,82 +212,52 @@ class Dependencies(Query):
 24
 
 @type pkgset: iterable
-@keyword pkgset: sorted pkg cpv strings or anything sublassing
+@keyword pkgset: pkg cpv strings or anything sublassing
 L{gentoolkit.cpv.CPV} to use for calculate our revdep graph.
-@type max_depth: int
+@type max_depth: optional
 @keyword max_depth: Maximum depth to recurse if only_direct=False.
--1 means no maximum depth;
- 0 is the same as only_direct=True;
+None means no maximum depth;
+0 is the same as only_direct=True;
 >0 means recurse only this many times;
 @type only_direct: bool
 @keyword only_direct: to recurse or not to recurse
-@type printer_fn: callable
-@keyword printer_fn: If None, no effect. If set, it will be applied to
-each L{gentoolkit.atom.Atom} object as it is added to the 
results.
-@rtype: list
+@rtype: 

[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/test/

2024-03-07 Thread Sam James
commit: 34a96faca419b81be2c88655daec4a24056fd926
Author: John Turner  gmail  com>
AuthorDate: Tue Feb 20 00:32:45 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Thu Mar  7 18:49:06 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=34a96fac

dependencies.py: introduce unit testing for graph_reverse_depends

This commit introduces a new file with a basic unit test for the
graph_reverse_depends method on the Dependencies class.

Only 1 test exists right now, but various setup code and the general
pattern of the tests are valuable for creating more advanced tests,
and more tests for the Dependencies class in general.

Pytest is used to run all of the functions in the file that start with
test_, and a monkeypatch object is passed into test cases and allows
us to mock out methods on the Dependencies class, specifically the
"environment" method, which is used to query for packages variables
like DEPEND and RDEPEND. We are able to test against a small fake
denendency graph by patching the method!

Signed-off-by: John Turner  gmail.com>
Signed-off-by: Sam James  gentoo.org>

 pym/gentoolkit/test/test_dependencies.py | 71 
 1 file changed, 71 insertions(+)

diff --git a/pym/gentoolkit/test/test_dependencies.py 
b/pym/gentoolkit/test/test_dependencies.py
new file mode 100644
index 000..48e9507
--- /dev/null
+++ b/pym/gentoolkit/test/test_dependencies.py
@@ -0,0 +1,71 @@
+import portage
+from typing import List, Dict, Optional
+from pytest import MonkeyPatch
+from gentoolkit.dependencies import Dependencies
+
+
+def is_cp_in_cpv(cp: str, cpv: str) -> bool:
+other_cp, _, _ = portage.pkgsplit(cpv)
+return cp == other_cp
+
+
+def environment(
+self: Dependencies,
+env_vars: List[str],
+fake_depends: Dict[str, Optional[Dict[str, str]]],
+fake_pkgs: List[str],
+) -> List[str]:
+metadata = None
+for pkg in fake_pkgs:
+if is_cp_in_cpv(self.cp, pkg):
+if (metadata := fake_depends[pkg]) is not None:
+break
+else:
+return [""]
+results = list()
+for env_var in env_vars:
+try:
+value = metadata[env_var]
+except KeyError:
+value = ""
+results.append(value)
+return results
+
+
+def test_basic_revdeps(monkeypatch: MonkeyPatch) -> None:
+fake_depends = {
+"app-misc/root-1.0": None,
+"app-misc/a-1.0": {"DEPEND": "app-misc/root"},
+"app-misc/b-1.0": {"DEPEND": "app-misc/a"},
+"app-misc/c-1.0": {"DEPEND": "app-misc/b"},
+"app-misc/d-1.0": None,
+}
+fake_pkgs = list(fake_depends.keys())
+
+def e(self, env_vars):
+return environment(self, env_vars, fake_depends, fake_pkgs)
+
+monkeypatch.setattr(Dependencies, "environment", e)
+
+# confirm that monkeypatch is working as expected
+assert Dependencies("app-misc/root").environment(["DEPEND"]) == [""]
+assert Dependencies("app-misc/a").environment(["DEPEND"]) == 
["app-misc/root"]
+assert Dependencies("app-misc/b").environment(["DEPEND"]) == ["app-misc/a"]
+assert Dependencies("app-misc/c").environment(["DEPEND"]) == ["app-misc/b"]
+assert Dependencies("app-misc/d").environment(["DEPEND"]) == [""]
+
+assert sorted(
+pkg.cpv
+for pkg in 
Dependencies("app-misc/root").graph_reverse_depends(pkgset=fake_pkgs)
+) == ["app-misc/a-1.0"]
+
+assert sorted(
+pkg.cpv
+for pkg in Dependencies("app-misc/root").graph_reverse_depends(
+pkgset=fake_pkgs, only_direct=False
+)
+) == [
+"app-misc/a-1.0",
+"app-misc/b-1.0",
+"app-misc/c-1.0",
+]



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/

2024-03-07 Thread Sam James
commit: b2dbcb184063104f750a407e0dbe3a4e0d3bfd9b
Author: John Turner  gmail  com>
AuthorDate: Fri Feb 23 01:38:29 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Thu Mar  7 18:49:06 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=b2dbcb18

equery/depends: print output in module rather than with a callback

The depends module can now iterate over the results of the
graph_reverse_depends function and print the items as they are
yielded.

Before, it passed in a callback printer function, and expected the
Dependencies class to call it correctly.

This setup is nicer because it does not tie together this module and
the Dependencies class, and the old setup most likely existed due to
performance and interactivity concerns which are now fixed by turning
graph_reverse_depends into an iterator.

Signed-off-by: John Turner  gmail.com>
Signed-off-by: Sam James  gentoo.org>

 pym/gentoolkit/equery/depends.py | 29 ++---
 1 file changed, 18 insertions(+), 11 deletions(-)

diff --git a/pym/gentoolkit/equery/depends.py b/pym/gentoolkit/equery/depends.py
index 8ec5f75..f92b7b9 100644
--- a/pym/gentoolkit/equery/depends.py
+++ b/pym/gentoolkit/equery/depends.py
@@ -17,7 +17,6 @@ import gentoolkit.pprinter as pp
 from gentoolkit.dependencies import Dependencies
 from gentoolkit.equery import format_options, mod_usage, CONFIG
 from gentoolkit.helpers import get_cpvs, get_installed_cpvs
-from gentoolkit.cpv import CPV
 from gentoolkit.package import PackageFormatter, Package
 
 # ===
@@ -27,7 +26,7 @@ from gentoolkit.package import PackageFormatter, Package
 QUERY_OPTS = {
 "include_masked": False,
 "only_direct": True,
-"max_depth": -1,
+"max_depth": None,
 "package_format": None,
 }
 
@@ -94,9 +93,9 @@ class DependPrinter:
 if dep_is_displayed and not self.verbose:
 return
 
-depth = getattr(dep, "depth", 0)
+depth = dep.depth
 indent = " " * depth
-mdep = dep.matching_dep
+mdep = dep.depatom
 use_conditional = ""
 
 if QUERY_OPTS["package_format"] != None:
@@ -226,17 +225,25 @@ def main(input_args):
 
 if CONFIG["verbose"]:
 print(" * These packages depend on %s:" % pp.emph(pkg.cpv))
-if pkg.graph_reverse_depends(
-pkgset=sorted(pkggetter(), key=CPV),
-max_depth=QUERY_OPTS["max_depth"],
+
+first_run = False
+
+last_seen = None
+for pkgdep in pkg.graph_reverse_depends(
+pkgset=sorted(pkggetter()),
 only_direct=QUERY_OPTS["only_direct"],
-printer_fn=dep_print,
+max_depth=QUERY_OPTS["max_depth"],
 ):
+if last_seen is None or last_seen != pkgdep:
+seen = False
+else:
+seen = True
+printer(pkgdep, dep_is_displayed=seen)
+last_seen = pkgdep
+if last_seen is not None:
 got_match = True
 
-first_run = False
-
-if not got_match:
+if got_match is None:
 sys.exit(1)
 
 



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/

2024-03-07 Thread Sam James
commit: b9294a02b804f0286f22625d563a1f92a1bb24b3
Author: John Turner  gmail  com>
AuthorDate: Tue Feb 27 20:20:11 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Thu Mar  7 18:49:07 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=b9294a02

depends.py: rename DependPrinter to Printer

The DependPrinter class name and documentation indicated that it was
meant to be part of the gentoolkit.dependencies API, to print
Dependencies objects. This Printer class is used exclusively for
printering equery depends output and is not a public API outside of
the depends.py module

Signed-off-by: John Turner  gmail.com>
Signed-off-by: Sam James  gentoo.org>

 pym/gentoolkit/equery/depends.py | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pym/gentoolkit/equery/depends.py b/pym/gentoolkit/equery/depends.py
index f92b7b9..39e0b25 100644
--- a/pym/gentoolkit/equery/depends.py
+++ b/pym/gentoolkit/equery/depends.py
@@ -35,8 +35,8 @@ QUERY_OPTS = {
 # ===
 
 
-class DependPrinter:
-"""Output L{gentoolkit.dependencies.Dependencies} objects."""
+class Printer:
+"""Output L{gentoolkit.dependencies.Dependencies} objects for equery 
depends."""
 
 def __init__(self, verbose=True):
 self.verbose = verbose
@@ -83,7 +83,7 @@ class DependPrinter:
 )
 
 def format_depend(self, dep, dep_is_displayed):
-"""Format a dependency for printing.
+"""Format a dependency for printing for equery depends.
 
 @type dep: L{gentoolkit.dependencies.Dependencies}
 @param dep: the dependency to display
@@ -209,7 +209,7 @@ def main(input_args):
 # Output
 #
 
-dep_print = DependPrinter(verbose=CONFIG["verbose"])
+printer = Printer(verbose=CONFIG["verbose"])
 
 first_run = True
 got_match = False



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/

2024-03-07 Thread Sam James
commit: 5c8f8d79a8b6179e50b2eb955eb848096727a9ac
Author: John Turner  gmail  com>
AuthorDate: Wed Mar  6 19:43:03 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Thu Mar  7 15:08:04 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=5c8f8d79

dependencies.py: use Enum rather than StrEnum for DependencyKind

StrEnum is only supported in Python versions 3.11 and
newer. Gentoolkit should not require >=3.11, so DependencyKind will
use the regular Enum feature instead.

The difference between StrEnum and Enum is that StrEnum members are
strings and can generally be used in place of strings in APIs
expecting string input. Non-StrEnum members are not strings, but you
can get members values by accessing their value field 
(DependencyKind.DEPEND.value).

Fixes: 78464ec40bad9a0f824b063506f58296cc3ed9f3
Signed-off-by: John Turner  gmail.com>
Closes: https://github.com/gentoo/gentoolkit/pull/46
Signed-off-by: Sam James  gentoo.org>

 pym/gentoolkit/dependencies.py | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pym/gentoolkit/dependencies.py b/pym/gentoolkit/dependencies.py
index f296e27..c6abff0 100644
--- a/pym/gentoolkit/dependencies.py
+++ b/pym/gentoolkit/dependencies.py
@@ -13,7 +13,7 @@ __all__ = ("Dependencies",)
 
 import itertools
 from functools import cache
-from enum import StrEnum
+from enum import Enum
 from typing import List, Dict
 
 import portage
@@ -28,7 +28,7 @@ from gentoolkit.query import Query
 # ===
 
 
-class DependencyKind(StrEnum):
+class DependencyKind(Enum):
 DEPEND = "DEPEND"
 RDEPEND = "RDEPEND"
 BDEPEND = "BDEPEND"
@@ -104,13 +104,13 @@ class Dependencies(Query):
 
 @cache
 def get_raw_depends(self) -> str:
-return self._get_depend([depkind for depkind in DependencyKind], 
raw=True)
+return self._get_depend([depkind.value for depkind in DependencyKind], 
raw=True)
 
 @cache
 def get_depends(self) -> Dict[DependencyKind, List[Atom]]:
 depends = dict()
 for depkind in DependencyKind:
-depend = self._get_depend([depkind])
+depend = self._get_depend([depkind.value])
 depends[depkind] = depend
 return depends
 



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eclean/

2024-02-17 Thread Brian Dolbec
commit: f410ba4ae94c801564f5b0bd3003e429adf2b12e
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sat Feb 17 02:34:39 2024 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Feb 18 02:16:28 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=f410ba4a

eclean/search.py: Fix find_packages docstring for invalid_paths

Signed-off-by: Brian Dolbec  gentoo.org>

 pym/gentoolkit/eclean/search.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/pym/gentoolkit/eclean/search.py b/pym/gentoolkit/eclean/search.py
index 47df3a1..b696b63 100644
--- a/pym/gentoolkit/eclean/search.py
+++ b/pym/gentoolkit/eclean/search.py
@@ -591,7 +591,6 @@ def findPackages(
 ) -> tuple[dict[str, list[str]], dict[str, list[str]]]:
 """Find obsolete binary packages.
 
-@param invalid_paths:
 @param options: dict of options determined at runtime
 @type  options: dict
 @param exclude: exclusion dict (as defined in the exclude.parseExcludeFile 
class)
@@ -610,8 +609,8 @@ def findPackages(
 @param  var_dbapi: defaults to portage.db[portage.root]["vartree"].dbapi
Can be overridden for tests.
 
-@return binary packages to remove. e.g. {'cat/pkg-ver': [filepath]}
-@rtype: dict
+@return binary packages to remove. e.g. {'cat/pkg-ver': [filepath]}, 
invalid_paths
+@rtype: dict, dict
 """
 if exclude is None:
 exclude = {}



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eclean/

2024-02-17 Thread Brian Dolbec
commit: 70cb55fa5fd2af7c7e46c94dc423a96bbedd83a5
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Feb  4 21:00:49 2024 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Feb 18 02:16:03 2024 +
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  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
 



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/test/eclean/

2024-02-17 Thread Brian Dolbec
commit: a1e25deeab64dcb7334381854db23a564d2d2c02
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Feb 18 00:59:22 2024 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Feb 18 02:16:28 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=a1e25dee

Initial tests for _deps_equal()

Signed-off-by: Brian Dolbec  gentoo.org>

 pym/gentoolkit/test/eclean/test_search.py | 157 ++
 1 file changed, 157 insertions(+)

diff --git a/pym/gentoolkit/test/eclean/test_search.py 
b/pym/gentoolkit/test/eclean/test_search.py
index 32d360c..0bbad46 100755
--- a/pym/gentoolkit/test/eclean/test_search.py
+++ b/pym/gentoolkit/test/eclean/test_search.py
@@ -26,8 +26,11 @@ from gentoolkit.test.eclean.distsupport import (
 )
 import gentoolkit.eclean.search as search
 from gentoolkit.eclean.search import DistfilesSearch
+from gentoolkit.eclean.search import _deps_equal
 from gentoolkit.eclean.exclude import parseExcludeFile
 
+from portage.dep import Atom
+
 """Tests for eclean's distfiles search functions."""
 
 
@@ -670,12 +673,166 @@ class TestRemoveProtected(unittest.TestCase):
 )
 
 
+class TestDepsEqual(unittest.TestCase):
+
+def test_deps_equal(self):
+# def _deps_equal(deps_a, eapi_a, deps_b, eapi_b, libc_deps, 
uselist=None, cpv=None):
+all_tests = [
+# 1 equal
+(
+"x11-misc/xdg-user-dirs-gtk-0.11",
+{
+"deps_a": "dev-libs/glib:2 >=x11-libs/gtk+-3.5.1:3 
>=x11-misc/xdg-user-dirs-0.14",
+"eapi_a": "8",
+"deps_b": "dev-libs/glib:2 >=x11-libs/gtk+-3.5.1:3 
>=x11-misc/xdg-user-dirs-0.14",
+"eapi_b": "8",
+"libc_deps": {Atom("sys-libs/glibc:2.2")},
+"uselist": frozenset(
+{
+"elibc_glibc",
+"amd64",
+"abi_x86_64",
+"kernel_linux",
+"userland_GNU",
+}
+),
+},
+True,
+),
+# 2 ebuild different gtk+ dep
+(
+"x11-misc/xdg-user-dirs-gtk-0.11",
+{
+"deps_a": "dev-libs/glib:2 >=x11-libs/gtk+-3.5.1:3 
>=x11-misc/xdg-user-dirs-0.14",
+"eapi_a": "8",
+"deps_b": "dev-libs/glib:2 >=x11-libs/gtk+-3.5.2:3 
>=x11-misc/xdg-user-dirs-0.14",
+"eapi_b": "8",
+"libc_deps": {Atom("sys-libs/glibc:2.2")},
+"uselist": frozenset(
+{
+"elibc_glibc",
+"amd64",
+"abi_x86_64",
+"kernel_linux",
+"userland_GNU",
+}
+),
+},
+False,
+),
+# 3 different eapi, but is not currently tested
+(
+"x11-misc/xdg-user-dirs-gtk-0.11",
+{
+"deps_a": "dev-libs/glib:2 >=x11-libs/gtk+-3.5.1:3 
>=x11-misc/xdg-user-dirs-0.14",
+"eapi_a": "7",
+"deps_b": "dev-libs/glib:2 >=x11-libs/gtk+-3.5.1:3 
>=x11-misc/xdg-user-dirs-0.14",
+"eapi_b": "8",
+"libc_deps": {Atom("sys-libs/glibc:2.2")},
+"uselist": frozenset(
+{
+"elibc_glibc",
+"amd64",
+"abi_x86_64",
+"kernel_linux",
+"userland_GNU",
+}
+),
+},
+True,
+),
+# 4 valid/False
+(
+"x11-misc/xdg-user-dirs-0.18",
+{
+"deps_a": "dev-libs/glib:2 >=x11-libs/gtk+-3.5.1:3 
>=x11-misc/xdg-user-dirs-0.14",
+"eapi_a": "8",
+"deps_b": "gtk? ( x11-misc/xdg-user-dirs-gtk )",
+"eapi_b": "8",
+"libc_deps": {Atom("sys-libs/glibc:2.2")},
+"uselist": frozenset(
+{
+"elibc_glibc",
+"amd64",
+"abi_x86_64",
+"kernel_linux",
+"userland_GNU",
+}
+),
+},
+False,
+),
+# 5 ebuild InvalidDependString
+(
+"x11-misc/xdg-user-dirs-0.18",
+{
+"deps_a": "dev-libs/glib:2 >=x11-libs/gtk+-3.5.1:3 

[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/

2024-02-16 Thread Sam James
commit: 678a1904da6aebc4fa7fd09e8f800e5af9101a61
Author: Sam James  gentoo  org>
AuthorDate: Sat Feb 17 00:01:12 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Sat Feb 17 00:01:40 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=678a1904

gentoolkit: fix flake8 lint error (F401, unused import)

pym/gentoolkit/dependencies.py:24:1: F401 'gentoolkit.helpers.uniqify' imported 
but unused

Fixes: c0300517671076db453204c796637e206bf977e5
Signed-off-by: Sam James  gentoo.org>

 pym/gentoolkit/dependencies.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/pym/gentoolkit/dependencies.py b/pym/gentoolkit/dependencies.py
index 3bbc757..f296e27 100644
--- a/pym/gentoolkit/dependencies.py
+++ b/pym/gentoolkit/dependencies.py
@@ -21,7 +21,6 @@ from portage.dep import paren_reduce
 
 from gentoolkit import errors
 from gentoolkit.atom import Atom
-from gentoolkit.helpers import uniqify
 from gentoolkit.query import Query
 
 # ===



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/enalyze/

2024-02-16 Thread Sam James
commit: f7a80ce2b93f9a65ab7d3383a771d532445c1279
Author: Sam James  gentoo  org>
AuthorDate: Fri Feb 16 23:58:53 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Fri Feb 16 23:58:53 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=f7a80ce2

enalyze: placate black

Signed-off-by: Sam James  gentoo.org>

 pym/gentoolkit/enalyze/rebuild.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/gentoolkit/enalyze/rebuild.py 
b/pym/gentoolkit/enalyze/rebuild.py
index 074e2f5..f4a348a 100644
--- a/pym/gentoolkit/enalyze/rebuild.py
+++ b/pym/gentoolkit/enalyze/rebuild.py
@@ -167,7 +167,7 @@ class Rebuild(ModuleBase):
 "pretend": False,
 "prefix": False,
 "portage": True,
-"slot": False
+"slot": False,
 # "unset": False
 }
 self.module_opts = {



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/

2024-02-16 Thread Sam James
commit: 78464ec40bad9a0f824b063506f58296cc3ed9f3
Author: John Turner  gmail  com>
AuthorDate: Wed Jan 24 23:31:11 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Fri Feb 16 20:12:48 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=78464ec4

dependencies.py: create DependencyKind enum

The DependencyKind enum allows iterating over the different dependency
kinds and represents each dependency kind as a type. This could later
be used in APIs for selecting specific dependency kinds in queries.

Signed-off-by: John Turner  gmail.com>
Signed-off-by: Sam James  gentoo.org>

 pym/gentoolkit/dependencies.py | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/pym/gentoolkit/dependencies.py b/pym/gentoolkit/dependencies.py
index 8dd4867..dd30312 100644
--- a/pym/gentoolkit/dependencies.py
+++ b/pym/gentoolkit/dependencies.py
@@ -11,6 +11,8 @@ __all__ = ("Dependencies",)
 # Imports
 # ===
 
+from enum import StrEnum
+
 import portage
 from portage.dep import paren_reduce
 
@@ -24,6 +26,14 @@ from gentoolkit.query import Query
 # ===
 
 
+class DependencyKind(StrEnum):
+DEPEND = "DEPEND"
+RDEPEND = "RDEPEND"
+BDEPEND = "BDEPEND"
+PDEPEND = "PDEPEND"
+IDEPEND = "IDEPEND"
+
+
 class Dependencies(Query):
 """Access a package's dependencies and reverse dependencies.
 



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/

2024-02-16 Thread Sam James
commit: 6aef2c5968d66e91dc083820db489d85697f3587
Author: John Turner  gmail  com>
AuthorDate: Tue Feb 13 20:45:51 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Fri Feb 16 20:12:49 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=6aef2c59

dependencies.py: replace hand rolled depcache with functools.cache

functools.cache caches the output of functions "automatically" without
requiring any manual management of a cache value. When used on class
methods, the cache is associated with each class instance and only
lives as long as the instance does.

The Dependencies.graph_reverse_depends method used a dict to cache
the output from pkg.get_all_depends. The get_all_depends method involves calling
portage's aux_get and parsing the DEPEND string that is returned by
it. This dict has been removed and replaced with functools.cache.

The graph_reverse_depends method did not cache the output of the
"raw=True" get_all_depends calls. This "raw" output is the literal string value 
for
the pkgdeps *DEPEND variables as returned by aux_get. Searching this for a
category/package sub-string allows quickly ruling out non-matching
pkgdeps, which allows skipping parsing the DEPEND string into a list
of Atoms.

Using functools cache the method that fetches the raw DEPEND string
massively improves performance for graph_reverse_depends when
searching for indirect reverse dependencies. "equery depends --indirect emacs"
runtime is ~2s with the raw value being cached, and ~60s
without. Searching for only direct reverse dependencies does not
utilize the cache and does not see any chance in runtime for me.

Signed-off-by: John Turner  gmail.com>
Closes: https://github.com/gentoo/gentoolkit/pull/44
Signed-off-by: Sam James  gentoo.org>

 pym/gentoolkit/dependencies.py | 13 -
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/pym/gentoolkit/dependencies.py b/pym/gentoolkit/dependencies.py
index 4564d8c..3bbc757 100644
--- a/pym/gentoolkit/dependencies.py
+++ b/pym/gentoolkit/dependencies.py
@@ -12,6 +12,7 @@ __all__ = ("Dependencies",)
 # ===
 
 import itertools
+from functools import cache
 from enum import StrEnum
 from typing import List, Dict
 
@@ -102,9 +103,11 @@ class Dependencies(Query):
 except portage.exception.InvalidPackageName as err:
 raise errors.GentoolkitInvalidCPV(err)
 
+@cache
 def get_raw_depends(self) -> str:
 return self._get_depend([depkind for depkind in DependencyKind], 
raw=True)
 
+@cache
 def get_depends(self) -> Dict[DependencyKind, List[Atom]]:
 depends = dict()
 for depkind in DependencyKind:
@@ -189,7 +192,6 @@ class Dependencies(Query):
 printer_fn=None,
 # The rest of these are only used internally:
 depth=0,
-depcache=None,
 seen=None,
 result=None,
 ):
@@ -233,8 +235,6 @@ class Dependencies(Query):
 )
 raise errors.GentoolkitFatalError(err % (self.__class__.__name__,))
 
-if depcache is None:
-depcache = dict()
 if seen is None:
 seen = set()
 if result is None:
@@ -250,12 +250,8 @@ class Dependencies(Query):
 # us the work of instantiating a whole Atom() for *every*
 # dependency of *every* package in pkgset.
 continue
-try:
-all_depends = depcache[pkgdep]
-except KeyError:
-all_depends = pkgdep.get_all_depends()
-depcache[pkgdep] = all_depends
 
+all_depends = pkgdep.get_all_depends()
 dep_is_displayed = False
 for dep in all_depends:
 # TODO: Add ability to determine if dep is enabled by USE flag.
@@ -284,7 +280,6 @@ class Dependencies(Query):
 only_direct=only_direct,
 printer_fn=printer_fn,
 depth=depth + 1,
-depcache=depcache,
 seen=seen,
 result=result,
 )



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/

2024-02-16 Thread Sam James
commit: c0300517671076db453204c796637e206bf977e5
Author: John Turner  gmail  com>
AuthorDate: Tue Feb 13 19:31:01 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Fri Feb 16 20:12:49 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=c0300517

dependencies.py: unify get_*depend methods

Instead of having separate functions for each DEPEND kind, the unified
method returns a dict with all of the packages *DEPEND values inside
of it. The dict can be indexed with a string or a field of the
DependencyKind enum.

This will be espeically useful for a future change that adds the
ability to filter out specific DEPEND kinds from the query.

The Dependencies class did not search IDEPEND dependencies, the
unified method searches all dependency kinds defined in the
DependencyKind enum, which includes IDEPEND!

Signed-off-by: John Turner  gmail.com>
Signed-off-by: Sam James  gentoo.org>

 pym/gentoolkit/dependencies.py | 32 +++-
 1 file changed, 15 insertions(+), 17 deletions(-)

diff --git a/pym/gentoolkit/dependencies.py b/pym/gentoolkit/dependencies.py
index dd30312..4564d8c 100644
--- a/pym/gentoolkit/dependencies.py
+++ b/pym/gentoolkit/dependencies.py
@@ -11,7 +11,9 @@ __all__ = ("Dependencies",)
 # Imports
 # ===
 
+import itertools
 from enum import StrEnum
+from typing import List, Dict
 
 import portage
 from portage.dep import paren_reduce
@@ -100,22 +102,19 @@ class Dependencies(Query):
 except portage.exception.InvalidPackageName as err:
 raise errors.GentoolkitInvalidCPV(err)
 
-def get_depend(self, **kwargs):
-"""Get the contents of DEPEND and parse it with self.parser."""
-return self._get_depend(("DEPEND",), **kwargs)
+def get_raw_depends(self) -> str:
+return self._get_depend([depkind for depkind in DependencyKind], 
raw=True)
 
-def get_pdepend(self, **kwargs):
-"""Get the contents of PDEPEND and parse it with self.parser."""
-return self._get_depend(("PDEPEND",), **kwargs)
+def get_depends(self) -> Dict[DependencyKind, List[Atom]]:
+depends = dict()
+for depkind in DependencyKind:
+depend = self._get_depend([depkind])
+depends[depkind] = depend
+return depends
 
-def get_rdepend(self, **kwargs):
-"""Get the contents of RDEPEND and parse it with self.parser."""
-return self._get_depend(("RDEPEND",), **kwargs)
-
-def get_all_depends(self, **kwargs):
-"""Get the contents of ?DEPEND and parse it with self.parser."""
-env_vars = ("DEPEND", "PDEPEND", "RDEPEND", "BDEPEND")
-return self._get_depend(env_vars, **kwargs)
+def get_all_depends(self) -> List[Atom]:
+# flatten Dict[DependencyKind, List[Atom]] into a List[Atom]
+return list(itertools.chain.from_iterable(self.get_depends().values()))
 
 def graph_depends(
 self,
@@ -246,8 +245,7 @@ class Dependencies(Query):
 
 pkgdep = None
 for pkgdep in pkgset:
-raw_depends = pkgdep.get_all_depends(raw=True)
-if self.cp not in raw_depends:
+if self.cp not in pkgdep.get_raw_depends():
 # fast path for obviously non-matching packages. This saves
 # us the work of instantiating a whole Atom() for *every*
 # dependency of *every* package in pkgset.
@@ -255,7 +253,7 @@ class Dependencies(Query):
 try:
 all_depends = depcache[pkgdep]
 except KeyError:
-all_depends = uniqify(pkgdep.get_all_depends())
+all_depends = pkgdep.get_all_depends()
 depcache[pkgdep] = all_depends
 
 dep_is_displayed = False



[gentoo-commits] proj/gentoolkit:master commit in: /

2024-02-16 Thread Sam James
commit: dae7ee48695f96ff8fbe4f5b5ba34db3654b327a
Author: Sam James  gentoo  org>
AuthorDate: Fri Feb 16 20:39:33 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Fri Feb 16 20:39:33 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=dae7ee48

tox: fix for meson port

Signed-off-by: Sam James  gentoo.org>

 tox.ini | 15 +++
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/tox.ini b/tox.ini
index 01d9c88..b34c6dc 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,17 +1,16 @@
 [tox]
-envlist = py39,py310,py311,py312,pypy3,flake8
-skip_missing_interpreters = True
+envlist = py{39,310,311,312,313}-test,pypy3-test,flake8
+skipsdist = True
 
 [testenv]
-commands =
-python setup.py test
 sitepackages = True
-
-[testenv:flake8]
 deps =
-flake8
+test: pytest
+allowlist_externals =
+pytest
 commands =
-python -m flake8 pym
+pylint: pylint pym
+test: pytest -vv -ra -l -o console_output_style=count {posargs}
 
 [flake8]
 # We initially start small, but we probably want to expand that list with time.



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eclean/

2024-01-18 Thread Sam James
commit: bd9c485781584e951e703ee191308db23506af9a
Author: Siddhanth Rathod  gmail  com>
AuthorDate: Fri Jan 19 06:59:55 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Fri Jan 19 07:03:39 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=bd9c4857

eclean: handle when git3-src doesn't exist (port to Pathlib)

Followup to c584d83705a2ca08961e4f0b541442fdf9a75947.

Bug: https://bugs.gentoo.org/922455
Signed-off-by: Siddhanth Rathod  gmail.com>
Closes: https://github.com/gentoo/gentoolkit/pull/41
Signed-off-by: Sam James  gentoo.org>

 pym/gentoolkit/eclean/search.py | 50 -
 1 file changed, 25 insertions(+), 25 deletions(-)

diff --git a/pym/gentoolkit/eclean/search.py b/pym/gentoolkit/eclean/search.py
index 3610920..2eebcfd 100644
--- a/pym/gentoolkit/eclean/search.py
+++ b/pym/gentoolkit/eclean/search.py
@@ -5,12 +5,13 @@
 
 
 import os
+import shlex
 import stat
 import sys
-import shlex
 from functools import partial
 from inspect import signature
-from typing import Optional
+from pathlib import Path
+from typing import Optional, Set
 
 import portage
 from portage.dep import Atom, use_reduce
@@ -136,7 +137,7 @@ class DistfilesSearch:
 # gather the files to be cleaned
 self.output("...checking limits for %d ebuild sources" % len(pkgs))
 
-vcs = self.vcs_check(_distdir)
+vcs = self.vcs_check(Path(_distdir))
 checks = self._get_default_checks(size_limit, time_limit, exclude, 
destructive)
 checks.extend(extra_checks)
 clean_me = self._check_limits(_distdir, checks, clean_me)
@@ -335,31 +336,30 @@ class DistfilesSearch:
 deprecated.update(_deprecated)
 return pkgs, deprecated
 
-def vcs_check(self, distdir):
+def vcs_check(self, distdir: Path) -> Set:
 """Checks $DISTDIR/vcs-src for checkouts which are not in the vardb"""
 # For now we only check git
-vcs_src = os.path.join(distdir, "git3-src")
-if not os.path.exists(vcs_src):
-return {}
-
+vcs_src = distdir / "git3-src"
 expected_dirs = set()
-for i in set(self.vardb.cpv_all()):
-if "live" in self.vardb.aux_get(i, ["PROPERTIES"]):
-try:
-# try to get the dir names of the cloned
-# repos from the environment file.
-vcs_dir = {
-i.split("=")[-1].strip('"')
-for i in shlex.split(
-self.vardb._aux_env_search(i, ["EVCS_STORE_DIRS"])[
-"EVCS_STORE_DIRS"
-].strip("()")
-)
-}
-expected_dirs.update(vcs_dir)
-except KeyError:
-pass
-actual_dirs = {os.path.join(vcs_src, i) for i in os.listdir(vcs_src)}
+actual_dirs = set()
+if vcs_src.is_dir():
+for i in set(self.vardb.cpv_all()):
+if "live" in self.vardb.aux_get(i, ["PROPERTIES"]):
+try:
+# try to get the dir names of the cloned
+# repos from the environment file.
+vcs_dir = {
+i.split("=")[-1].strip('"')
+for i in shlex.split(
+self.vardb._aux_env_search(i, 
["EVCS_STORE_DIRS"])[
+"EVCS_STORE_DIRS"
+].strip("()")
+)
+}
+expected_dirs.update(vcs_dir)
+except KeyError:
+pass
+actual_dirs = {str(i) for i in vcs_src.iterdir() if i.is_dir()}
 return actual_dirs.difference(expected_dirs)
 
 def _fetch_restricted(self, pkgs_, cpvs):



[gentoo-commits] proj/gentoolkit:master commit in: /

2024-01-18 Thread Sam James
commit: a7846cf9dc41f03559f64f4ae8b118868197e316
Author: Sam James  gentoo  org>
AuthorDate: Fri Jan 19 06:36:49 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Fri Jan 19 06:36:49 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=a7846cf9

NEWS, meson.build: prepare for gentoolkit-0.6.5

Signed-off-by: Sam James  gentoo.org>

 NEWS| 4 
 meson.build | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 7d8b7d0..f3bd744 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,9 @@
 News (new features/major bug fixes)
 
+gentoolkit-0.6.5
+
+  * eclean: fix eclean-dist with no git3-src dir (bug #922455)
+
 gentoolkit-0.6.4
 
   * Raise portage requirement to >=3.0.57

diff --git a/meson.build b/meson.build
index 109fa82..c771738 100644
--- a/meson.build
+++ b/meson.build
@@ -1,7 +1,7 @@
 project(
 'gentoolkit',
 'c',
-version : '0.6.4',
+version : '0.6.5',
 license : 'GPL-2.0-or-later',
 meson_version : '>=0.64.0'
 )



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eclean/

2024-01-18 Thread Sam James
commit: c584d83705a2ca08961e4f0b541442fdf9a75947
Author: Sam James  gentoo  org>
AuthorDate: Fri Jan 19 06:14:43 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Fri Jan 19 06:15:12 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=c584d837

eclean: fix eclean-dist with no git3-src dir

Bug: https://bugs.gentoo.org/922455
Signed-off-by: Sam James  gentoo.org>

 pym/gentoolkit/eclean/search.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/pym/gentoolkit/eclean/search.py b/pym/gentoolkit/eclean/search.py
index f03c521..3610920 100644
--- a/pym/gentoolkit/eclean/search.py
+++ b/pym/gentoolkit/eclean/search.py
@@ -339,6 +339,9 @@ class DistfilesSearch:
 """Checks $DISTDIR/vcs-src for checkouts which are not in the vardb"""
 # For now we only check git
 vcs_src = os.path.join(distdir, "git3-src")
+if not os.path.exists(vcs_src):
+return {}
+
 expected_dirs = set()
 for i in set(self.vardb.cpv_all()):
 if "live" in self.vardb.aux_get(i, ["PROPERTIES"]):



[gentoo-commits] proj/gentoolkit:master commit in: .github/workflows/

2024-01-18 Thread Sam James
commit: 0f64bf5571e0b9e40c5718a89884a3389760af6c
Author: Sam James  gentoo  org>
AuthorDate: Fri Jan 19 04:55:04 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Fri Jan 19 04:55:04 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=0f64bf55

Revert "ci: add py3.13"

This reverts commit e0dc707cc7a37336c175faf463666e5f531a338f.

Didn't mean to push this.

Signed-off-by: Sam James  gentoo.org>

 .github/workflows/ci.yml | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 40b1de8..bcb2d59 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -12,8 +12,7 @@ jobs:
 - '3.9'
 - '3.10'
 - '3.11'
-- '3.12'
-- '3.13-dev'
+- '3.12-dev'
 - 'pypy-3.9'
 - 'pypy-3.10'
 



[gentoo-commits] proj/gentoolkit:master commit in: .github/workflows/

2024-01-18 Thread Sam James
commit: e0dc707cc7a37336c175faf463666e5f531a338f
Author: Sam James  gentoo  org>
AuthorDate: Fri Jan 19 04:24:22 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Fri Jan 19 04:26:06 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=e0dc707c

ci: add py3.13

Signed-off-by: Sam James  gentoo.org>

 .github/workflows/ci.yml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index bcb2d59..40b1de8 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -12,7 +12,8 @@ jobs:
 - '3.9'
 - '3.10'
 - '3.11'
-- '3.12-dev'
+- '3.12'
+- '3.13-dev'
 - 'pypy-3.9'
 - 'pypy-3.10'
 



[gentoo-commits] proj/gentoolkit:master commit in: /

2024-01-18 Thread Sam James
commit: 13c09d81b4992169664dd77a2943b2962dc70863
Author: Sam James  gentoo  org>
AuthorDate: Fri Jan 19 04:54:39 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Fri Jan 19 04:54:39 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=13c09d81

tox: update impls

Signed-off-by: Sam James  gentoo.org>

 tox.ini | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tox.ini b/tox.ini
index 56b255a..01d9c88 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,5 @@
 [tox]
-envlist = py37,py38,py39,py310,py311,pypy3,flake8
+envlist = py39,py310,py311,py312,pypy3,flake8
 skip_missing_interpreters = True
 
 [testenv]



[gentoo-commits] proj/gentoolkit:master commit in: .github/workflows/

2024-01-18 Thread Sam James
commit: 2ee5764c48adbb2094cafc0130ffb4ffc6a487b1
Author: Sam James  gentoo  org>
AuthorDate: Fri Jan 19 04:24:09 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Fri Jan 19 04:24:09 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=2ee5764c

ci: add pypy3.10

Signed-off-by: Sam James  gentoo.org>

 .github/workflows/ci.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index cfb1eb3..bcb2d59 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -14,6 +14,7 @@ jobs:
 - '3.11'
 - '3.12-dev'
 - 'pypy-3.9'
+- 'pypy-3.10'
 
 env:
   # TODO: get this dynamically



[gentoo-commits] proj/gentoolkit:master commit in: /

2024-01-18 Thread Matt Turner
commit: 61df9f59ab0c13ed6cf8a3d9cd6a77fa1ee0929b
Author: Matt Turner  gentoo  org>
AuthorDate: Thu Jan 18 20:56:09 2024 +
Commit: Matt Turner  gentoo  org>
CommitDate: Thu Jan 18 20:56:09 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=61df9f59

v0.6.4

Signed-off-by: Matt Turner  gentoo.org>

 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 3fbb278..109fa82 100644
--- a/meson.build
+++ b/meson.build
@@ -1,7 +1,7 @@
 project(
 'gentoolkit',
 'c',
-version : '0.6.2',
+version : '0.6.4',
 license : 'GPL-2.0-or-later',
 meson_version : '>=0.64.0'
 )



[gentoo-commits] proj/gentoolkit:master commit in: /

2024-01-18 Thread Matt Turner
commit: 34fe86949036b7b03af3942dd6901904b0f0313e
Author: Matt Turner  gentoo  org>
AuthorDate: Thu Jan 18 20:53:34 2024 +
Commit: Matt Turner  gentoo  org>
CommitDate: Thu Jan 18 20:55:39 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=34fe8694

NEWS: Populate for 0.6.2, 0.6.3, 0.6.4

Signed-off-by: Matt Turner  gentoo.org>

 NEWS | 22 +-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 14325a8..7d8b7d0 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,25 @@
 News (new features/major bug fixes)
 
+gentoolkit-0.6.4
+
+  * Raise portage requirement to >=3.0.57
+  * Strip libc dependencies from eclean-pkg --changed-deps calculations
+
+
+gentoolkit-0.6.3
+
+  * Fix handling invalid binpkgs
+  * Migrate to PEP517 meson-python build
+
+
+gentoolkit-0.6.2
+
+  * Add --clean-invalid option for eclean-pkg
+  * Fix merge-driver-ekeyword compatibility with git >= 2.42
+  * Fix eclean-pkg compatibility with FEATURES=pkgdir-index-trusted
+  * Support the NO_COLOR environment variable
+
+
 gentoolkit-0.6.1
 
   * Fix custom TMPL implementation for depends commit 3e35553df4673
@@ -9,7 +29,7 @@ gentoolkit-0.6.1
 
 gentoolkit-0.6.0
 
-  * merge-driver-ekeyword Fis type annotations
+  * merge-driver-ekeyword Fix type annotations
   * equery changes removal
   * Convert from tab indent to spaces, format cleanup
   * Add github action to check formatting, add unit testing



[gentoo-commits] proj/gentoolkit:master commit in: .github/workflows/

2024-01-12 Thread Matt Turner
commit: a91f692dabd34bc39f332a9af8fe2434b6207f8d
Author: Matt Turner  gentoo  org>
AuthorDate: Thu Jan 11 21:43:27 2024 +
Commit: Matt Turner  gentoo  org>
CommitDate: Thu Jan 11 21:43:52 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=a91f692d

CI: Update portage to 3.0.57

Signed-off-by: Matt Turner  gentoo.org>

 .github/workflows/ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index c78050d..cfb1eb3 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -17,7 +17,7 @@ jobs:
 
 env:
   # TODO: get this dynamically
-  PORTAGE_VERSION: "3.0.45.3"
+  PORTAGE_VERSION: "3.0.57"
 
 steps:
 - uses: actions/checkout@v2



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eclean/

2024-01-12 Thread Matt Turner
commit: a3e56252cdde2f4fb51766c580c0137f28843510
Author: Matt Turner  gentoo  org>
AuthorDate: Thu Jan 11 21:31:12 2024 +
Commit: Matt Turner  gentoo  org>
CommitDate: Fri Jan 12 19:15:28 2024 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=a3e56252

eclean: Strip libc dependencies from --changed-deps calculations

Closes: https://bugs.gentoo.org/921679
Closes: https://github.com/gentoo/gentoolkit/pull/38
Signed-off-by: Matt Turner  gentoo.org>

 pym/gentoolkit/eclean/search.py | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/pym/gentoolkit/eclean/search.py b/pym/gentoolkit/eclean/search.py
index de424c5..f03c521 100644
--- a/pym/gentoolkit/eclean/search.py
+++ b/pym/gentoolkit/eclean/search.py
@@ -15,6 +15,7 @@ from typing import Optional
 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
 
 import gentoolkit.pprinter as pp
 from gentoolkit.eclean.exclude import (
@@ -522,13 +523,15 @@ class DistfilesSearch:
 return clean_me, saved
 
 
-def _deps_equal(deps_a, eapi_a, deps_b, eapi_b, uselist=None):
+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"""
 if deps_a == deps_b:
 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)
 strip_slots(deps_b)
 return deps_a == deps_b
@@ -583,6 +586,8 @@ def findPackages(
 print(pp.error("Error: %s" % str(er)), file=sys.stderr)
 exit(1)
 
+libc_deps = find_libc_deps(var_dbapi, False)
+
 # Create a dictionary of all installed packages
 if destructive and package_names:
 installed = dict.fromkeys(var_dbapi.cp_all())
@@ -653,6 +658,7 @@ def findPackages(
 binpkg_metadata["EAPI"],
 " ".join(ebuild_metadata[key] for key in dep_keys),
 ebuild_metadata["EAPI"],
+libc_deps,
 frozenset(binpkg_metadata["USE"].split()),
 ):
 continue



[gentoo-commits] proj/gentoolkit:master commit in: man/

2023-12-02 Thread Sam James
commit: 4276a6e7e01a78b1e92839475abb78519255136e
Author: Sam James  gentoo  org>
AuthorDate: Sun Dec  3 07:51:13 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Sun Dec  3 07:51:13 2023 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=4276a6e7

man/revdep-rebuild.1: fix 'executables' typo

Reported by kurly, thanks!

Signed-off-by: Sam James  gentoo.org>

 man/revdep-rebuild.1 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/man/revdep-rebuild.1 b/man/revdep-rebuild.1
index bff995c..c7d789f 100644
--- a/man/revdep-rebuild.1
+++ b/man/revdep-rebuild.1
@@ -48,7 +48,7 @@ Turn off the progress meter
 Print less output and disable the progress meter.  (This option is also passed 
to portage.)
 .TP
 .B \-u | \-\-search\-symbols
-Searches for undefined symbols in executibles. This will most likely have 
false positives in the output, so it is recommended to only use this option 
with pretend and manually fix any legitimate issues found. \fBNote:\fR This is 
currently only implemented in revdep-rebuild.sh, it is not implemented in 
revdep-rebuild.py.
+Searches for undefined symbols in executables. This will most likely have 
false positives in the output, so it is recommended to only use this option 
with pretend and manually fix any legitimate issues found. \fBNote:\fR This is 
currently only implemented in revdep-rebuild.sh, it is not implemented in 
revdep-rebuild.py.
 .TP
 .B \-v | \-\-verbose
 More output.  (Prints the revdep\-rebuild search environment.)



[gentoo-commits] proj/gentoolkit:master commit in: /

2023-12-02 Thread Sam James
commit: eeb07714c0a924ac6d96543a05c609af19a18f35
Author: Florian Schmaus  gentoo  org>
AuthorDate: Thu Nov 16 09:26:24 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Sun Dec  3 07:51:53 2023 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=eeb07714

meson: drop find_program('sed') as it isn't used

Signed-off-by: Florian Schmaus  gentoo.org>
Closes: https://github.com/gentoo/gentoolkit/pull/37
Signed-off-by: Sam James  gentoo.org>

 meson.build | 2 --
 1 file changed, 2 deletions(-)

diff --git a/meson.build b/meson.build
index b609876..3fbb278 100644
--- a/meson.build
+++ b/meson.build
@@ -9,8 +9,6 @@ project(
 py_mod = import('python')
 py = py_mod.find_installation(pure : true)
 
-sed = find_program('sed', required : true)
-
 system_wide = get_option('system-wide')
 
 eprefix = get_option('eprefix')



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eclean/

2023-12-02 Thread Sam James
commit: 87912b460c533f8b010617018fdad42246db85f0
Author: Siddhanth Rathod  gmail  com>
AuthorDate: Thu Sep 21 20:20:15 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Sun Dec  3 07:51:44 2023 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=87912b46

Enhancement: eclean-dist handle git checkouts

A new feature for eclean-dist to clean git3-src.
Optionally, cleaning the vcs-src can be skipped with --skip-vcs.

Bug: https://bugs.gentoo.org/622938

Signed-off-by: Siddhanth Rathod  gmail.com>
Closes: https://github.com/gentoo/gentoolkit/pull/33
Signed-off-by: Sam James  gentoo.org>

 pym/gentoolkit/eclean/clean.py  | 35 --
 pym/gentoolkit/eclean/cli.py| 42 -
 pym/gentoolkit/eclean/search.py | 28 ++-
 3 files changed, 89 insertions(+), 16 deletions(-)

diff --git a/pym/gentoolkit/eclean/clean.py b/pym/gentoolkit/eclean/clean.py
index 92449b4..0347f1d 100644
--- a/pym/gentoolkit/eclean/clean.py
+++ b/pym/gentoolkit/eclean/clean.py
@@ -5,6 +5,7 @@
 
 
 import os
+import shutil
 import sys
 
 import gentoolkit.pprinter as pp
@@ -25,7 +26,7 @@ class CleanUp:
 self.controller = controller
 self.quiet = quiet
 
-def clean_dist(self, clean_dict):
+def clean_dist(self, clean_dict, vcs):
 """Calculate size of each entry for display, prompt user if needed,
 delete files if approved and return the total size of files that
 have been deleted.
@@ -41,6 +42,7 @@ class CleanUp:
 for key in sorted(clean_dict):
 clean_size += self._clean_files(clean_dict[key], key, file_type)
 # return total size of deleted or to delete files
+clean_size += self._clean_vcs_src(vcs)
 return clean_size
 
 def clean_pkgs(self, clean_dict, pkgdir):
@@ -74,7 +76,7 @@ class CleanUp:
 # return total size of deleted or to delete files
 return clean_size
 
-def pretend_clean(self, clean_dict):
+def pretend_clean(self, clean_dict, vcs={}):
 """Shortcut function that calculates total space savings
 for the files in clean_dict.
 
@@ -85,6 +87,8 @@ class CleanUp:
 file_type = "file"
 clean_size = 0
 # tally all entries one by one; sorting helps reading
+if vcs:
+clean_size += self._clean_vcs_src(vcs, pretend=True)
 for key in sorted(clean_dict):
 key_size = self._get_size(clean_dict[key])
 self.controller(key_size, key, clean_dict[key], file_type)
@@ -153,3 +157,30 @@ class CleanUp:
 print(pp.error("Could not delete " + file_), 
file=sys.stderr)
 print(pp.error("Error: %s" % str(er)), file=sys.stderr)
 return clean_size
+
+def _clean_vcs_src(self, deprecated_vcs, pretend=False):
+clean_size = 0
+for checkout in deprecated_vcs:
+csize = 0
+for path, dirs, files in os.walk(checkout):
+for f in files:
+fp = os.path.join(path, f)
+try:
+statinfo = os.stat(fp)
+except OSError as er:
+print(
+pp.error("Could not get stat info for:" + fp),
+file=sys.stderr,
+)
+print(pp.error("Error: %s" % str(er)), file=sys.stderr)
+clean_size += statinfo.st_size
+csize += statinfo.st_size
+
+try:
+self.controller(csize, checkout, checkout, "checkout")
+if not pretend:
+shutil.rmtree(checkout)
+except OSError as er:
+print(pp.error("Could not delete " + checkout), 
file=sys.stderr)
+print(pp.error("Error: %s" % str(er)), file=sys.stderr)
+return clean_size

diff --git a/pym/gentoolkit/eclean/cli.py b/pym/gentoolkit/eclean/cli.py
index e3dd540..52ddf2a 100644
--- a/pym/gentoolkit/eclean/cli.py
+++ b/pym/gentoolkit/eclean/cli.py
@@ -13,25 +13,25 @@ __version__ = "@VERSION@"
 __productname__ = "eclean"
 __description__ = "A cleaning tool for Gentoo distfiles and binaries."
 
+import getopt
 import os
-import sys
 import re
+import sys
 import time
-import getopt
 
 import portage
-from portage.output import white, yellow, turquoise, green, red
+from portage.output import green, red, turquoise, white, yellow
 
 import gentoolkit.pprinter as pp
+from gentoolkit.eclean.clean import CleanUp
+from gentoolkit.eclean.exclude import ParseExcludeFileException, 
parseExcludeFile
+from gentoolkit.eclean.output import OutputControl
 from gentoolkit.eclean.search import (
 DistfilesSearch,
 findPackages,
-port_settings,
 pkgdir,
+port_settings,
 )
-from gentoolkit.eclean.exclude import parseExcludeFile, 
ParseExcludeFileException
-from 

[gentoo-commits] proj/gentoolkit:master commit in: .github/workflows/, /, pym/gentoolkit/test/, data/, ...

2023-10-11 Thread Sam James
commit: 78c8fbe8a35cd2926f37f21235c5d8b587efae46
Author: Zac Medico  gentoo  org>
AuthorDate: Mon Oct  9 04:57:02 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Thu Oct 12 05:04:06 2023 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=78c8fbe8

Migrate to PEP517 meson-python build

Bug: https://bugs.gentoo.org/909888
Signed-off-by: Zac Medico  gentoo.org>
Closes: https://github.com/gentoo/gentoolkit/pull/36
Signed-off-by: Sam James  gentoo.org>

 .github/workflows/ci.yml  |  17 ++-
 MANIFEST.in   |  13 ---
 bin/ebump |   2 +-
 bin/euse  |   2 +-
 bin/meson.build   |  55 ++
 bin/revdep-rebuild.sh |   2 +-
 data/meson.build  |  20 
 man/meson.build   |  23 
 meson.build   |  68 
 meson_options.txt |  15 +++
 pym/gentoolkit/eclean/cli.py  |   2 +-
 pym/gentoolkit/eclean/meson.build |  18 +++
 pym/gentoolkit/ekeyword/ekeyword.py   |   2 +-
 pym/gentoolkit/ekeyword/meson.build   |  26 +
 pym/gentoolkit/ekeyword/tests/meson.build |  12 ++
 pym/gentoolkit/enalyze/__init__.py|   4 +-
 pym/gentoolkit/enalyze/meson.build|  17 +++
 pym/gentoolkit/equery/__init__.py |   4 +-
 pym/gentoolkit/equery/meson.build |  26 +
 pym/gentoolkit/eshowkw/__init__.py|   2 +-
 pym/gentoolkit/eshowkw/meson.build|  16 +++
 pym/gentoolkit/imlate/imlate.py   |   2 +-
 pym/gentoolkit/imlate/meson.build |  14 +++
 pym/gentoolkit/meson.build|  35 ++
 pym/gentoolkit/revdep_rebuild/__init__.py |   2 +-
 pym/gentoolkit/revdep_rebuild/meson.build |  21 
 pym/gentoolkit/test/eclean/meson.build|  20 
 pym/gentoolkit/test/equery/meson.build|   7 ++
 pym/gentoolkit/test/meson.build   |  16 +++
 pym/meson.build   |   1 +
 pyproject.toml|  17 +++
 setup.py  | 176 --
 32 files changed, 454 insertions(+), 203 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 36a636a..c78050d 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -25,6 +25,14 @@ jobs:
   uses: actions/setup-python@v2
   with:
 python-version: ${{ matrix.python-version }}
+- name: Install dependencies
+  run: |
+set -xe
+python -VV
+python -m site
+python -m pip install --upgrade pip
+# setuptools needed for 3.12+ because of 
https://github.com/mesonbuild/meson/issues/7702.
+python -m pip install meson ninja setuptools
 - name: Install portage
   run: |
 mkdir portage
@@ -38,8 +46,13 @@ jobs:
 sudo wget "https://www.gentoo.org/dtd/metadata.dtd; -O 
/var/cache/distfiles/metadata.dtd
 sudo wget 
"https://gitweb.gentoo.org/proj/portage.git/plain/cnf/repos.conf; -O 
/etc/portage/repos.conf
 sudo ln -s 
/var/db/repos/gentoo/profiles/default/linux/amd64/17.1/systemd 
/etc/portage/make.profile
-- name: Run tests
+- name: Test meson install --destdir /tmp/install-root
+  run: |
+echo -e "[binaries]\npython = '$(command -v python)'" > /tmp/native.ini
+meson setup --native-file /tmp/native.ini /tmp/build .
+meson install -C /tmp/build --destdir /tmp/install-root
+- name: Run tests for ${{ matrix.python-version }}
   run: |
 export PYTHONPATH="${PWD}/portage/lib"${PYTHONPATH:+:}${PYTHONPATH}
 export PATH="${PWD}/portage/bin":${PATH}
-python setup.py test
+meson test -C /tmp/build --verbose

diff --git a/MANIFEST.in b/MANIFEST.in
deleted file mode 100644
index 8f26bea..000
--- a/MANIFEST.in
+++ /dev/null
@@ -1,13 +0,0 @@
-include AUTHORS
-include ChangeLog
-include COPYING
-include CREDITS
-include DEVELOPING
-include NEWS
-include README
-include TODO
-include setup.py
-recursive-include data *
-recursive-include bin *
-recursive-include man *
-recursive-include pym *.py *.txt

diff --git a/bin/ebump b/bin/ebump
index 25e9a7c..dc045e7 100755
--- a/bin/ebump
+++ b/bin/ebump
@@ -12,7 +12,7 @@ __description__="Ebuild version bumping tool"
 # a given ebuild and auxiliary files in the Portage tree. It is only
 # useful for Gentoo developers with CVS commit access.
 
-VERSION="git"
+VERSION="@VERSION@"
 
 die() {
echo $1 >&2

diff --git a/bin/euse b/bin/euse
index daffd66..f15a36c 100755
--- a/bin/euse
+++ b/bin/euse
@@ -8,7 +8,7 @@ set -f
 # Licensed under the GPL v2
 
 PROGRAM_NAME=euse
-VERSION="git"
+VERSION="@VERSION@"
 
 EPREFIX=${EPREFIX:-$(portageq envvar EPREFIX)}
 ETC="${EPREFIX}/etc"

diff --git a/bin/meson.build b/bin/meson.build
new file mode 100644
index 000..eb99870

[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eclean/

2023-10-07 Thread Sam James
commit: c846c08c046588a98f2b40a45ac74b84cda21a89
Author: Siddhanth Rathod  gmail  com>
AuthorDate: Thu Oct  5 13:29:32 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Sun Oct  8 03:27:35 2023 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=c846c08c

eclean: pkg: fix pkgindex handling

Last implemention was importing binhost module incorrectly:
calling Modules() from portage.module which sets binhost var to the 
BinhostHandler class
which would always fail as it needs name and namepath, leading to always call 
emaint
via a subprocess call.

Signed-off-by: Siddhanth Rathod  gmail.com>
Signed-off-by: Sam James  gentoo.org>

 pym/gentoolkit/eclean/clean.py| 17 +---
 pym/gentoolkit/eclean/pkgindex.py | 86 ---
 2 files changed, 11 insertions(+), 92 deletions(-)

diff --git a/pym/gentoolkit/eclean/clean.py b/pym/gentoolkit/eclean/clean.py
index 87d7aac..92449b4 100644
--- a/pym/gentoolkit/eclean/clean.py
+++ b/pym/gentoolkit/eclean/clean.py
@@ -8,7 +8,9 @@ import os
 import sys
 
 import gentoolkit.pprinter as pp
-from gentoolkit.eclean.pkgindex import PkgIndex
+import portage
+from portage.emaint.main import TaskHandler
+from portage.emaint.modules.binhost import binhost
 
 
 class CleanUp:
@@ -61,11 +63,14 @@ class CleanUp:
 
 #  run 'emaint --fix' here
 if clean_size:
-index_control = PkgIndex(self.controller)
-# emaint is not yet importable so call it
-# print a blank line here for separation
-print()
-clean_size += index_control.clean_pkgs_index(self.quiet)
+file = os.path.join(portage.settings["PKGDIR"], "Packages")
+size1 = os.stat(file).st_size
+TaskHandler(show_progress_bar=self.quiet).run_tasks(
+[binhost.BinhostHandler], "fix"
+)
+size = size1 - os.stat(file).st_size
+self.controller(size, "Packages Index", file, "Index")
+clean_size += size
 # return total size of deleted or to delete files
 return clean_size
 

diff --git a/pym/gentoolkit/eclean/pkgindex.py 
b/pym/gentoolkit/eclean/pkgindex.py
deleted file mode 100644
index 7d6fade..000
--- a/pym/gentoolkit/eclean/pkgindex.py
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/usr/bin/python
-
-# Copyright 2003-2010 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-import subprocess
-import os
-import sys
-
-import gentoolkit.pprinter as pp
-from gentoolkit.eprefix import EPREFIX
-
-import portage
-from portage.module import (
-InvalidModuleName,
-Modules,
-)
-from portage.emaint.main import TaskHandler
-
-
-class PkgIndex:
-"""Handle the cleaning of the binpkg Package
-Index file
-
-@type output: class
-@param output: optional output class for printing
-"""
-
-def __init__(self, controller=None):
-self.controller = controller
-# backup command line call
-self.emaint_cmd = "%s/usr/sbin/emaint --fix binhost" % EPREFIX
-
-def _get_emaint_binhost(self):
-"""Obtain a reference to the binhost module class
-
-@sets: self.binhost to BinhostHandler class
-@rtype: boolean
-"""
-try:
-self.emaint_control = Modules()
-self.binhost = self.emaint_control._get_class("binhost")
-except InvalidModuleName as er:
-print(pp.error("Error importing emaint binhost module"), 
file=sys.stderr)
-print(pp.error("Original error: " + er), file=sys.stderr)
-except:
-return False
-return True
-
-def clean_pkgs_index(self, quiet):
-"""This will clean the binpkgs packages index file
-
-@param quiet: boolean
-@return: the difference in file size
-"""
-file_ = os.path.join(portage.settings["PKGDIR"], "Packages")
-statinfo = os.stat(file_)
-size1 = statinfo.st_size
-show_progress = not quiet
-if self._get_emaint_binhost():
-self.taskmaster = TaskHandler(show_progress_bar=show_progress)
-tasks = [self.binhost]
-self.taskmaster.run_tasks(tasks)
-else:
-self.call_emaint()
-statinfo = os.stat(file_)
-clean_size = size1 - statinfo.st_size
-self.controller(clean_size, "Packages Index", file_, "Index")
-return clean_size
-
-def call_emaint(self):
-"""Run the stand alone emaint script from
-a subprocess call.
-
-@rtype: integer
-@return: the difference in file size
-"""
-try:
-retcode = subprocess.call(self.emaint_cmd, shell=True)
-if retcode < 0:
-print(
-pp.error("Child was terminated by signal" + str(-retcode)),
-file=sys.stderr,
-)
-except OSError as e:
-print(pp.error("Execution 

[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eclean/

2023-10-07 Thread Sam James
commit: a12d24f99d03c3c4975d84d63083449cd8487ef9
Author: Siddhanth Rathod  gmail  com>
AuthorDate: Thu Oct  5 13:34:59 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Sun Oct  8 03:27:53 2023 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=a12d24f9

eclean: pkg: suppress invalid binary error

[sam: Note that this needs https://github.com/gentoo/portage/pull/1123 on
the Portage side.]

Bug: https://bugs.gentoo.org/900224
Signed-off-by: Siddhanth Rathod  gmail.com>
Closes: https://github.com/gentoo/gentoolkit/pull/35
Signed-off-by: Sam James  gentoo.org>

 pym/gentoolkit/eclean/search.py | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/pym/gentoolkit/eclean/search.py b/pym/gentoolkit/eclean/search.py
index ce8fe37..77f16af 100644
--- a/pym/gentoolkit/eclean/search.py
+++ b/pym/gentoolkit/eclean/search.py
@@ -572,8 +572,11 @@ def findPackages(
 # inaccessible
 settings = var_dbapi.settings
 bin_dbapi = portage.binarytree(pkgdir=pkgdir, settings=settings).dbapi
+populate_kwargs = {}
+if "invalid_errors" in signature(bin_dbapi.bintree.populate).parameters:
+populate_kwargs["invalid_errors"] = False
 if "force_reindex" in signature(bin_dbapi.bintree.populate).parameters:
-bin_dbapi.bintree.populate(force_reindex=True)
+bin_dbapi.bintree.populate(force_reindex=True, **populate_kwargs)
 for cpv in bin_dbapi.cpv_all():
 cp = portage.cpv_getkey(cpv)
 



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eclean/

2023-09-29 Thread Sam James
commit: e49cc3493ab77678a740bf8a27cf22e77e061409
Author: Siddhanth Rathod  gmail  com>
AuthorDate: Thu Sep 28 18:54:44 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Fri Sep 29 07:20:18 2023 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=e49cc349

eclean-pkg: fix compatibility with FEATURES=pkgdir-index-trusted

Portage recently enabled FEATURES=pkgdir-index-trusted by default which breaks
the eclean-invalids feature.

Force reindexing after cleaning up to fix this.

See-also: 
https://github.com/gentoo/portage/commit/3bc7bfef51d88fd716e882d3931f2873e3493e01
Bug: https://bugs.gentoo.org/889300
Bug: https://bugs.gentoo.org/900224
Signed-off-by: Siddhanth Rathod  gmail.com>
Closes: https://github.com/gentoo/gentoolkit/pull/34
Signed-off-by: Sam James  gentoo.org>

 pym/gentoolkit/eclean/search.py | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/pym/gentoolkit/eclean/search.py b/pym/gentoolkit/eclean/search.py
index a2ac0ce..ce8fe37 100644
--- a/pym/gentoolkit/eclean/search.py
+++ b/pym/gentoolkit/eclean/search.py
@@ -8,6 +8,7 @@ import os
 import stat
 import sys
 from functools import partial
+from inspect import signature
 from typing import Optional
 
 import portage
@@ -16,13 +17,12 @@ from portage.dep._slot_operator import strip_slots
 
 import gentoolkit.pprinter as pp
 from gentoolkit.eclean.exclude import (
-exclDictMatchCP,
 exclDictExpand,
 exclDictExpandPkgname,
+exclDictMatchCP,
 exclMatchFilename,
 )
 
-
 # Misc. shortcuts to some portage stuff:
 port_settings = portage.settings
 pkgdir = port_settings["PKGDIR"]
@@ -568,7 +568,12 @@ def findPackages(
 dead_binpkgs: dict[str, list[str]] = {}
 keep_binpkgs = {}
 
-bin_dbapi = portage.binarytree(pkgdir=pkgdir, 
settings=var_dbapi.settings).dbapi
+# FEATURES=pkgdir-index-trusted is now on by default which makes portages 
inavlids
+# inaccessible
+settings = var_dbapi.settings
+bin_dbapi = portage.binarytree(pkgdir=pkgdir, settings=settings).dbapi
+if "force_reindex" in signature(bin_dbapi.bintree.populate).parameters:
+bin_dbapi.bintree.populate(force_reindex=True)
 for cpv in bin_dbapi.cpv_all():
 cp = portage.cpv_getkey(cpv)
 



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/

2023-09-19 Thread Sam James
commit: 5146d35eb97e2c1a8f7691e59c755ed14e858dd4
Author: Siddhanth Rathod  gmail  com>
AuthorDate: Tue Sep 19 18:31:49 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Tue Sep 19 19:13:02 2023 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=5146d35e

equery meta: map the remote-id to the respective url

Bug: https://bugs.gentoo.org/877519
Signed-off-by: Siddhanth Rathod  gmail.com>
Closes: https://github.com/gentoo/gentoolkit/pull/32
Signed-off-by: Sam James  gentoo.org>

 pym/gentoolkit/equery/meta.py | 51 ++-
 1 file changed, 41 insertions(+), 10 deletions(-)

diff --git a/pym/gentoolkit/equery/meta.py b/pym/gentoolkit/equery/meta.py
index 02b6f67..de5631b 100644
--- a/pym/gentoolkit/equery/meta.py
+++ b/pym/gentoolkit/equery/meta.py
@@ -10,19 +10,19 @@ __docformat__ = "epytext"
 # Imports
 # ===
 
-import re
 import os
+import re
 import sys
 import warnings
-from getopt import gnu_getopt, GetoptError
+from getopt import GetoptError, gnu_getopt
 
 import gentoolkit.pprinter as pp
 from gentoolkit import errors
+from gentoolkit.equery import CONFIG, format_options, mod_usage
+from gentoolkit.helpers import print_file, print_sequence
 from gentoolkit.keyword import Keyword
-from gentoolkit.equery import format_options, mod_usage, CONFIG
-from gentoolkit.helpers import print_sequence, print_file
-from gentoolkit.textwrap_ import TextWrapper
 from gentoolkit.query import Query
+from gentoolkit.textwrap_ import TextWrapper
 
 # ===
 # Globals
@@ -189,11 +189,42 @@ def format_upstream(upstream):
 
 def _format_upstream_ids(ids):
 result = []
-for id_ in ids:
-site = id_[0]
-proj_id = id_[1]
-idstr = f"{site} ID: {proj_id}"
-result.append(idstr)
+remote_ids = {
+"github": "https://github.com/remote-id;,
+"gentoo": "https://gitweb.gentoo.org/remote-id.git/;,
+"bitbucket": "https://bitbucket.org/remote-id;,
+"codeberg": "https://codeberg.org/remote-id;,
+"cpan": "https://metacpan.org/dist/remote-id;,
+"cpan-module": "https://metacpan.org/pod/remote-id;,
+"cpe": "remote-id",
+"cran": "https://cran.r-project.org/web/packages/remote-id/;,
+"ctan": "https://ctan.org/pkg/remote-id;,
+"freedesktop-gitlab": 
"https://gitlab.freedesktop.org/remote-id.git/;,
+"gitlab": "https://gitlab.com/remote-id;,
+"gnome-gitlab": "https://gitlab.gnome.org/remote-id.git/;,
+"google-code": "https://code.google.com/archive/p/remote-id/;,
+"hackage": "https://hackage.haskell.org/package/remote-id;,
+"heptapod": "https://foss.heptapod.net/remote-id;,
+"kde-invent": "https://invent.kde.org/remote-id;,
+"launchpad": "https://launchpad.net/remote-id;,
+"osdn": "https://osdn.net/projects/remote-id/;,
+"pear": "https://pear.php.net/package/remote-id;,
+"pecl": "https://pecl.php.net/package/remote-id;,
+"pypi": "https://pypi.org/project/remote-id/;,
+"rubygems": "https://rubygems.org/gems/remote-id/;,
+"savannah": "https://savannah.gnu.org/projects/remote-id;,
+"savannah-nongnu": 
"https://savannah.nongnu.org/projects/remote-id;,
+"sourceforge": "https://sourceforge.net/projects/remote-id/;,
+"sourcehut": "https://sr.ht/remote-id/;,
+"vim": 
"https://www.vim.org/scripts/script.php?script_id=remote-id;,
+}
+for id in ids:
+proj_id = id[1]
+try:
+site = remote_ids[proj_id].replace("remote-id", id[0])
+except KeyError:
+site = id[0]
+result.append(f"{site} ({proj_id})")
 return result
 
 result = []



[gentoo-commits] proj/gentoolkit:master commit in: bin/

2023-08-29 Thread Mike Gilbert
commit: 67983750f9014d5b1821b9cd2522b34f04ce1795
Author: Mike Gilbert  gentoo  org>
AuthorDate: Tue Aug 29 15:25:55 2023 +
Commit: Mike Gilbert  gentoo  org>
CommitDate: Tue Aug 29 15:41:11 2023 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=67983750

bin/merge-driver-ekeyword: replace os.system with os.execlp

Signed-off-by: Mike Gilbert  gentoo.org>

 bin/merge-driver-ekeyword | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/bin/merge-driver-ekeyword b/bin/merge-driver-ekeyword
index 0235a98..ae022f3 100755
--- a/bin/merge-driver-ekeyword
+++ b/bin/merge-driver-ekeyword
@@ -126,11 +126,10 @@ def main(argv: Sequence[str]) -> int:
 result = apply_keyword_changes(A, P, changes)
 sys.exit(result)
 else:
-result = os.system(f"git merge-file -L HEAD -L base -L ours {A} {O} 
{B}")
-result = os.waitstatus_to_exitcode(result)
-if result < 0 or result >= 128:
+try:
+os.execlp("git", "git", "merge-file", "-L", "HEAD", "-L", "base", 
"-L", "ours", A, O, B)
+except OSError:
 sys.exit(-1)
-sys.exit(result)
 
 if __name__ == "__main__":
 main(sys.argv)



[gentoo-commits] proj/gentoolkit:master commit in: bin/

2023-08-28 Thread Sam James
commit: fb45df369b4be7061fc14f5eb361c4d6c97e3f02
Author: Sam James  gentoo  org>
AuthorDate: Tue Aug 29 01:21:04 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Tue Aug 29 01:21:17 2023 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=fb45df36

bin/merge-driver-ekeyword: mangle exit code correctly

Fixes: 263e3d64adac1ee2968233e151d1ee590532f42d
Signed-off-by: Sam James  gentoo.org>

 bin/merge-driver-ekeyword | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/bin/merge-driver-ekeyword b/bin/merge-driver-ekeyword
index e59e10c..0235a98 100755
--- a/bin/merge-driver-ekeyword
+++ b/bin/merge-driver-ekeyword
@@ -1,6 +1,6 @@
-#!/usr/bin/python
+#!/usr/bin/python3
 #
-# Copyright 2020 Gentoo Authors
+# Copyright 2020-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2 or later
 
 """
@@ -127,8 +127,10 @@ def main(argv: Sequence[str]) -> int:
 sys.exit(result)
 else:
 result = os.system(f"git merge-file -L HEAD -L base -L ours {A} {O} 
{B}")
+result = os.waitstatus_to_exitcode(result)
+if result < 0 or result >= 128:
+sys.exit(-1)
 sys.exit(result)
 
-
 if __name__ == "__main__":
 main(sys.argv)



[gentoo-commits] proj/gentoolkit:master commit in: bin/

2023-08-28 Thread Sam James
commit: 263e3d64adac1ee2968233e151d1ee590532f42d
Author: Sam James  gentoo  org>
AuthorDate: Tue Aug 29 00:50:11 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Tue Aug 29 00:51:32 2023 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=263e3d64

bin/merge-driver-ekeyword: fix compatibility with >=git-2.42.0

Commit 2b7b788fb31a74bcbff4e4c6efc6f3db6c3a49b7 upstream makes more use
of the result from a merge driver.

Correctly surface the result from `git merge-file` so that we don't wrongly
throw away information but also don't make git think the driver crashed (-1
is for exceptional cases, not "failed to merge").

Signed-off-by: Sam James  gentoo.org>

 bin/merge-driver-ekeyword | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/merge-driver-ekeyword b/bin/merge-driver-ekeyword
index f75056c..e59e10c 100755
--- a/bin/merge-driver-ekeyword
+++ b/bin/merge-driver-ekeyword
@@ -127,7 +127,7 @@ def main(argv: Sequence[str]) -> int:
 sys.exit(result)
 else:
 result = os.system(f"git merge-file -L HEAD -L base -L ours {A} {O} 
{B}")
-sys.exit(0 if result == 0 else -1)
+sys.exit(result)
 
 
 if __name__ == "__main__":



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eclean/

2023-08-24 Thread Sam James
commit: 9ea9cfe27f3debe4f97f3b04da6681fc3ae11b88
Author: Siddhanth Rathod  gmail  com>
AuthorDate: Thu Aug 24 15:41:35 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Thu Aug 24 19:52:20 2023 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=9ea9cfe2

eclean: Make cleaning invalid default

Bug: https://bugs.gentoo.org/900224
Signed-off-by: Siddhanth Rathod  gmail.com>
Closes: https://github.com/gentoo/gentoolkit/pull/31
Signed-off-by: Sam James  gentoo.org>

 pym/gentoolkit/eclean/cli.py | 15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/pym/gentoolkit/eclean/cli.py b/pym/gentoolkit/eclean/cli.py
index 75c5c63..b180641 100644
--- a/pym/gentoolkit/eclean/cli.py
+++ b/pym/gentoolkit/eclean/cli.py
@@ -262,7 +262,8 @@ def printUsage(_error=None, help=None, 
unresolved_invalids=None):
 file=out,
 )
 print(
-yellow(" -N, --clean-invalid") + "  - cleanup invalid 
binpkgs",
+yellow(" --no-clean-invalid")
++ "   - Skip cleaning invalid binpkgs",
 file=out,
 )
 print(
@@ -417,8 +418,8 @@ def parseArgs(options={}):
 options["ignore-failure"] = True
 elif o in ("-u", "--unique-use"):
 options["unique-use"] = True
-elif o in ("-N", "--skip-invalid"):
-options["clean-invalid"] = False
+elif o in ("--no-clean-invalid"):
+options["no-clean-invalid"] = True
 else:
 return_code = False
 # sanity check of --deep only options:
@@ -457,12 +458,12 @@ def parseArgs(options={}):
 ]
 getopt_options["short"]["distfiles"] = "fs:"
 getopt_options["long"]["distfiles"] = ["fetch-restricted", "size-limit="]
-getopt_options["short"]["packages"] = "iNu"
+getopt_options["short"]["packages"] = "iu"
 getopt_options["long"]["packages"] = [
 "ignore-failure",
 "changed-deps",
-"clean-invalid",
 "unique-use",
+"no-clean-invalid",
 ]
 # set default options, except 'nocolor', which is set in main()
 options["interactive"] = False
@@ -478,7 +479,7 @@ def parseArgs(options={}):
 options["verbose"] = False
 options["changed-deps"] = False
 options["ignore-failure"] = False
-options["clean-invalid"] = False
+options["no-clean-invalid"] = False
 options["unique-use"] = False
 # if called by a well-named symlink, set the action accordingly:
 action = None
@@ -625,7 +626,7 @@ def doAction(action, options, exclude={}, output=None):
 output.set_colors("deprecated")
 output.list_pkgs(deprecated)
 if action in ["packages"]:
-if invalids and options["clean-invalid"]:
+if invalids and not options["no-clean-invalid"]:
 if type(invalids) == list:
 printUsage(_error="invalid_paths", 
unresolved_invalids=invalids)
 sys.exit(1)



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eclean/

2023-08-22 Thread Sam James
commit: 62ae253a36d77ac238f1dbc47e4757b92456b174
Author: Sam James  gentoo  org>
AuthorDate: Tue Aug 22 20:54:01 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Tue Aug 22 20:54:01 2023 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=62ae253a

eclean-pkg: placate black

Signed-off-by: Sam James  gentoo.org>

 pym/gentoolkit/eclean/cli.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/pym/gentoolkit/eclean/cli.py b/pym/gentoolkit/eclean/cli.py
index adc4210..75c5c63 100644
--- a/pym/gentoolkit/eclean/cli.py
+++ b/pym/gentoolkit/eclean/cli.py
@@ -262,8 +262,7 @@ def printUsage(_error=None, help=None, 
unresolved_invalids=None):
 file=out,
 )
 print(
-yellow(" -N, --clean-invalid")
-+ "  - cleanup invalid binpkgs",
+yellow(" -N, --clean-invalid") + "  - cleanup invalid 
binpkgs",
 file=out,
 )
 print(



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/ekeyword/, pym/gentoolkit/revdep_rebuild/

2023-08-22 Thread Sam James
commit: 0e7237628b982f18e48164ab91f0134c7f7d0e86
Author: Sam James  gentoo  org>
AuthorDate: Tue Aug 22 20:53:45 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Tue Aug 22 20:53:45 2023 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=0e723762

Drop useless imports (fix flake8)

Signed-off-by: Sam James  gentoo.org>

 pym/gentoolkit/ekeyword/ekeyword.py | 1 -
 pym/gentoolkit/revdep_rebuild/assign.py | 1 -
 2 files changed, 2 deletions(-)

diff --git a/pym/gentoolkit/ekeyword/ekeyword.py 
b/pym/gentoolkit/ekeyword/ekeyword.py
index 0eaca78..01946e9 100755
--- a/pym/gentoolkit/ekeyword/ekeyword.py
+++ b/pym/gentoolkit/ekeyword/ekeyword.py
@@ -39,7 +39,6 @@ Examples:
 import argparse
 import collections
 import difflib
-import io
 import os
 import re
 import subprocess

diff --git a/pym/gentoolkit/revdep_rebuild/assign.py 
b/pym/gentoolkit/revdep_rebuild/assign.py
index 328db54..8f1a266 100644
--- a/pym/gentoolkit/revdep_rebuild/assign.py
+++ b/pym/gentoolkit/revdep_rebuild/assign.py
@@ -6,7 +6,6 @@ Functions used for determining the package the broken lib 
belongs to.
 
 import errno
 import os
-import io
 import re
 import time
 



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eclean/

2023-08-22 Thread Sam James
commit: d40b5009c1f73730ad4d68169b1302393cdce8cf
Author: Sam James  gentoo  org>
AuthorDate: Tue Aug 22 20:52:35 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Tue Aug 22 20:52:35 2023 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=d40b5009

eclean-pkg: fix --help alignment, mention shortopt for clean-invalid

Bug: https://bugs.gentoo.org/900224
Signed-off-by: Sam James  gentoo.org>

 pym/gentoolkit/eclean/cli.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pym/gentoolkit/eclean/cli.py b/pym/gentoolkit/eclean/cli.py
index 7591959..adc4210 100644
--- a/pym/gentoolkit/eclean/cli.py
+++ b/pym/gentoolkit/eclean/cli.py
@@ -262,8 +262,8 @@ def printUsage(_error=None, help=None, 
unresolved_invalids=None):
 file=out,
 )
 print(
-yellow(" --clean-invalid")
-+ "   - cleanup invalid binpkgs",
+yellow(" -N, --clean-invalid")
++ "  - cleanup invalid binpkgs",
 file=out,
 )
 print(



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eclean/

2023-08-22 Thread Sam James
commit: 6b17633d0d74cb8fa0eeb46c8ee4f4f05d0e38b2
Author: Sam James  gentoo  org>
AuthorDate: Tue Aug 22 20:43:25 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Tue Aug 22 20:49:55 2023 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=6b17633d

eclean-pkg: add --clean-invalid to help, fix parsing

* Rename --clean-invalids -> --clean-invalid
* Add --clean-invalid to help
* Make it default-off for now to match the option name (rather than
  the help saying --no-clean-invalids).

  (I could go either way on what the actual default should be, but this is more
  conservative for now.)
* Fix typo in option name.
* Make it a package specific arg, not a global one.

Bug: https://bugs.gentoo.org/900224
Fixes: 204b1abca2c0cbbdad188c7fd4b84452c2f630a0
Fixes: a16d0d4fbfb4614832c4b682b41284a9050af29f
Signed-off-by: Sam James  gentoo.org>

 pym/gentoolkit/eclean/cli.py | 19 ---
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/pym/gentoolkit/eclean/cli.py b/pym/gentoolkit/eclean/cli.py
index c8381a0..aa8b20f 100644
--- a/pym/gentoolkit/eclean/cli.py
+++ b/pym/gentoolkit/eclean/cli.py
@@ -261,6 +261,11 @@ def printUsage(_error=None, help=None, 
unresolved_invalids=None):
 + "   - delete packages for which ebuild dependencies 
have changed",
 file=out,
 )
+print(
+yellow(" --clean-invalid")
++ "   - cleanup invalid binpkgs",
+file=out,
+)
 print(
 yellow(" -i, --ignore-failure")
 + " - ignore failure to locate PKGDIR",
@@ -413,8 +418,8 @@ def parseArgs(options={}):
 options["ignore-failure"] = True
 elif o in ("-u", "--unique-use"):
 options["unique-use"] = True
-elif o in ("-N", "--skip-invalids"):
-options["clean-invalids"] = False
+elif o in ("-N", "--skip-invalid"):
+options["clean-invalid"] = False
 else:
 return_code = False
 # sanity check of --deep only options:
@@ -435,7 +440,7 @@ def parseArgs(options={}):
 
 # here are the different allowed command line options (getopt args)
 getopt_options = {"short": {}, "long": {}}
-getopt_options["short"]["global"] = "CdDipqe:t:nhVvN"
+getopt_options["short"]["global"] = "CdDipqe:t:nhVv"
 getopt_options["long"]["global"] = [
 "nocolor",
 "deep",
@@ -450,14 +455,14 @@ def parseArgs(options={}):
 "help",
 "version",
 "verbose",
-"clean-inavlids",
 ]
 getopt_options["short"]["distfiles"] = "fs:"
 getopt_options["long"]["distfiles"] = ["fetch-restricted", "size-limit="]
-getopt_options["short"]["packages"] = "i"
+getopt_options["short"]["packages"] = "iN"
 getopt_options["long"]["packages"] = [
 "ignore-failure",
 "changed-deps",
+"clean-invalid",
 "unique-use",
 ]
 # set default options, except 'nocolor', which is set in main()
@@ -474,8 +479,8 @@ def parseArgs(options={}):
 options["verbose"] = False
 options["changed-deps"] = False
 options["ignore-failure"] = False
+options["clean-invalid"] = False
 options["unique-use"] = False
-options["clean-invalids"] = True
 # if called by a well-named symlink, set the action accordingly:
 action = None
 # temp print line to ensure it is the svn/branch code running, etc..
@@ -621,7 +626,7 @@ def doAction(action, options, exclude={}, output=None):
 output.set_colors("deprecated")
 output.list_pkgs(deprecated)
 if action in ["packages"]:
-if invalids and options["clean-invalids"]:
+if invalids and options["clean-invalid"]:
 if type(invalids) == list:
 printUsage(_error="invalid_paths", 
unresolved_invalids=invalids)
 sys.exit(1)



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eclean/

2023-08-22 Thread Sam James
commit: 2aae0531f51064651240a5957bf724f30f5c0cd1
Author: Sam James  gentoo  org>
AuthorDate: Tue Aug 22 20:49:41 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Tue Aug 22 20:50:14 2023 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=2aae0531

eclean-pkg: fix --unique-use shortopt

Signed-off-by: Sam James  gentoo.org>

 pym/gentoolkit/eclean/cli.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/gentoolkit/eclean/cli.py b/pym/gentoolkit/eclean/cli.py
index aa8b20f..7591959 100644
--- a/pym/gentoolkit/eclean/cli.py
+++ b/pym/gentoolkit/eclean/cli.py
@@ -458,7 +458,7 @@ def parseArgs(options={}):
 ]
 getopt_options["short"]["distfiles"] = "fs:"
 getopt_options["long"]["distfiles"] = ["fetch-restricted", "size-limit="]
-getopt_options["short"]["packages"] = "iN"
+getopt_options["short"]["packages"] = "iNu"
 getopt_options["long"]["packages"] = [
 "ignore-failure",
 "changed-deps",



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eclean/

2023-08-22 Thread Sam James
commit: 204b1abca2c0cbbdad188c7fd4b84452c2f630a0
Author: Siddhanth Rathod  gmail  com>
AuthorDate: Tue Aug 22 13:55:48 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Tue Aug 22 20:34:30 2023 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=204b1abc

eclean-pkg: Limit invalid search to 'packages' action

Bug: https://bugs.gentoo.org/900224
Fixes: a16d0d4fbfb4614832c4b682b41284a9050af29f
Signed-off-by: Siddhanth Rathod  gmail.com>
Closes: https://github.com/gentoo/gentoolkit/pull/30
Signed-off-by: Sam James  gentoo.org>

 pym/gentoolkit/eclean/cli.py | 46 +++-
 1 file changed, 24 insertions(+), 22 deletions(-)

diff --git a/pym/gentoolkit/eclean/cli.py b/pym/gentoolkit/eclean/cli.py
index 40fc4f9..c8381a0 100644
--- a/pym/gentoolkit/eclean/cli.py
+++ b/pym/gentoolkit/eclean/cli.py
@@ -435,7 +435,7 @@ def parseArgs(options={}):
 
 # here are the different allowed command line options (getopt args)
 getopt_options = {"short": {}, "long": {}}
-getopt_options["short"]["global"] = "CdDipqe:t:nhVv"
+getopt_options["short"]["global"] = "CdDipqe:t:nhVvN"
 getopt_options["long"]["global"] = [
 "nocolor",
 "deep",
@@ -450,6 +450,7 @@ def parseArgs(options={}):
 "help",
 "version",
 "verbose",
+"clean-inavlids",
 ]
 getopt_options["short"]["distfiles"] = "fs:"
 getopt_options["long"]["distfiles"] = ["fetch-restricted", "size-limit="]
@@ -619,28 +620,29 @@ def doAction(action, options, exclude={}, output=None):
 )
 output.set_colors("deprecated")
 output.list_pkgs(deprecated)
-if invalids and options["clean-invalids"]:
-if type(invalids) == list:
-printUsage(_error="invalid_paths", unresolved_invalids=invalids)
-sys.exit(1)
-verb = "were"
-if options["pretend"]:
-verb = "would be"
-if not options["quiet"]:
-print()
-print(
-(
-pp.emph("   The following ")
-+ red("invalid")
-+ pp.emph(" binpkgs were found")
+if action in ["packages"]:
+if invalids and options["clean-invalids"]:
+if type(invalids) == list:
+printUsage(_error="invalid_paths", 
unresolved_invalids=invalids)
+sys.exit(1)
+verb = "were"
+if options["pretend"]:
+verb = "would be"
+if not options["quiet"]:
+print()
+print(
+(
+pp.emph("   The following ")
++ red("invalid")
++ pp.emph(" binpkgs were found")
+)
 )
-)
-output.set_colors("invalid")
-output.list_pkgs(invalids)
-clean_size = cleaner.clean_pkgs(invalids, pkgdir)
-output.total("invalid", clean_size, len(invalids), verb, action)
-else:
-cleaner.clean_pkgs(invalids, pkgdir)
+output.set_colors("invalid")
+output.list_pkgs(invalids)
+clean_size = cleaner.clean_pkgs(invalids, pkgdir)
+output.total("invalid", clean_size, len(invalids), verb, 
action)
+else:
+cleaner.clean_pkgs(invalids, pkgdir)
 
 
 def main():



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eclean/

2023-08-20 Thread Sam James
commit: d93602634628ee5f0063b14efa52f98b141d2cc9
Author: Siddhanth Rathod  gmail  com>
AuthorDate: Thu Apr  6 15:17:28 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Mon Aug 21 05:16:18 2023 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=d9360263

eclean: Add type hints

Signed-off-by: Siddhanth Rathod  gmail.com>
Signed-off-by: Sam James  gentoo.org>

 pym/gentoolkit/eclean/search.py | 17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/pym/gentoolkit/eclean/search.py b/pym/gentoolkit/eclean/search.py
index 3288208..eb26ac8 100644
--- a/pym/gentoolkit/eclean/search.py
+++ b/pym/gentoolkit/eclean/search.py
@@ -8,6 +8,7 @@ import os
 import stat
 import sys
 from functools import partial
+from typing import Optional
 
 import portage
 from portage.dep import Atom, use_reduce
@@ -508,15 +509,15 @@ def _deps_equal(deps_a, eapi_a, deps_b, eapi_b, 
uselist=None):
 
 
 def findPackages(
-options,
-exclude=None,
-destructive=False,
-time_limit=0,
-package_names=False,
-pkgdir=None,
+options: dict[str, bool],
+exclude: Optional[dict] = None,
+destructive: bool = False,
+time_limit: Optional[int] = 0,
+package_names: Optional[bool] = False,
+pkgdir: str = None,
 port_dbapi=portage.db[portage.root]["porttree"].dbapi,
 var_dbapi=portage.db[portage.root]["vartree"].dbapi,
-):
+) -> dict[str, list[str]]:
 """Find obsolete binary packages.
 
 @param options: dict of options determined at runtime
@@ -563,7 +564,7 @@ def findPackages(
 
 # Dictionary of binary packages to clean. Organized as cpv->[pkgs] in order
 # to support FEATURES=binpkg-multi-instance.
-dead_binpkgs = {}
+dead_binpkgs: dict[str, list[str]] = {}
 keep_binpkgs = {}
 
 bin_dbapi = portage.binarytree(pkgdir=pkgdir, 
settings=var_dbapi.settings).dbapi



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eclean/

2023-08-20 Thread Sam James
commit: a16d0d4fbfb4614832c4b682b41284a9050af29f
Author: Siddhanth Rathod  gmail  com>
AuthorDate: Thu Mar 23 12:14:36 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Mon Aug 21 05:16:18 2023 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=a16d0d4f

eclean-pkg: deal with invalid binpkgs

Changes required in portage -> https://github.com/gentoo/portage/pull/1016

Bug: https://bugs.gentoo.org/900224
Signed-off-by: Siddhanth Rathod  gmail.com>
Signed-off-by: Sam James  gentoo.org>

 pym/gentoolkit/eclean/cli.py| 47 +
 pym/gentoolkit/eclean/output.py | 14 
 pym/gentoolkit/eclean/search.py |  9 ++--
 3 files changed, 64 insertions(+), 6 deletions(-)

diff --git a/pym/gentoolkit/eclean/cli.py b/pym/gentoolkit/eclean/cli.py
index fa94a55..40fc4f9 100644
--- a/pym/gentoolkit/eclean/cli.py
+++ b/pym/gentoolkit/eclean/cli.py
@@ -13,7 +13,6 @@ __version__ = "git"
 __productname__ = "eclean"
 __description__ = "A cleaning tool for Gentoo distfiles and binaries."
 
-
 import os
 import sys
 import re
@@ -21,7 +20,7 @@ import time
 import getopt
 
 import portage
-from portage.output import white, yellow, turquoise, green
+from portage.output import white, yellow, turquoise, green, red
 
 import gentoolkit.pprinter as pp
 from gentoolkit.eclean.search import (
@@ -47,7 +46,7 @@ def printVersion():
 print("Distributed under the terms of the GNU General Public License v2")
 
 
-def printUsage(_error=None, help=None):
+def printUsage(_error=None, help=None, unresolved_invalids=None):
 """Print help message. May also print partial help to stderr if an
 error from {'options','actions'} is specified."""
 
@@ -63,10 +62,25 @@ def printUsage(_error=None, help=None):
 "merged-distfiles-options",
 "time",
 "size",
+"invalid_paths",
 ):
 _error = None
 if not _error and not help:
 help = "all"
+if _error == "invalid_paths":
+print(
+pp.error(
+"eclean was not able to remove invalid binpkgs due to missing 
features in the currently installed portage"
+),
+file=out,
+)
+print(
+pp.error("Please remove the following binpkgs manually:"),
+file=out,
+)
+for invalid in unresolved_invalids:
+print(pp.error(invalid), file=out)
+return
 if _error == "time":
 print(pp.error("Wrong time specification"), file=out)
 print(
@@ -399,6 +413,8 @@ def parseArgs(options={}):
 options["ignore-failure"] = True
 elif o in ("-u", "--unique-use"):
 options["unique-use"] = True
+elif o in ("-N", "--skip-invalids"):
+options["clean-invalids"] = False
 else:
 return_code = False
 # sanity check of --deep only options:
@@ -458,6 +474,7 @@ def parseArgs(options={}):
 options["changed-deps"] = False
 options["ignore-failure"] = False
 options["unique-use"] = False
+options["clean-invalids"] = True
 # if called by a well-named symlink, set the action accordingly:
 action = None
 # temp print line to ensure it is the svn/branch code running, etc..
@@ -527,7 +544,7 @@ def doAction(action, options, exclude={}, output=None):
 if not options["quiet"]:
 output.einfo("Building file list for " + action + " cleaning...")
 if action == "packages":
-clean_me = findPackages(
+clean_me, invalids = findPackages(
 options,
 exclude=exclude,
 destructive=options["destructive"],
@@ -602,6 +619,28 @@ def doAction(action, options, exclude={}, output=None):
 )
 output.set_colors("deprecated")
 output.list_pkgs(deprecated)
+if invalids and options["clean-invalids"]:
+if type(invalids) == list:
+printUsage(_error="invalid_paths", unresolved_invalids=invalids)
+sys.exit(1)
+verb = "were"
+if options["pretend"]:
+verb = "would be"
+if not options["quiet"]:
+print()
+print(
+(
+pp.emph("   The following ")
++ red("invalid")
++ pp.emph(" binpkgs were found")
+)
+)
+output.set_colors("invalid")
+output.list_pkgs(invalids)
+clean_size = cleaner.clean_pkgs(invalids, pkgdir)
+output.total("invalid", clean_size, len(invalids), verb, action)
+else:
+cleaner.clean_pkgs(invalids, pkgdir)
 
 
 def main():

diff --git a/pym/gentoolkit/eclean/output.py b/pym/gentoolkit/eclean/output.py
index 62777b7..ebba499 100644
--- a/pym/gentoolkit/eclean/output.py
+++ b/pym/gentoolkit/eclean/output.py
@@ -39,6 +39,9 @@ class OutputControl:
 self.pkg_color = cpv  # green
 

[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/, pym/gentoolkit/eshowkw/, pym/gentoolkit/imlate/, ...

2023-08-06 Thread Sam James
commit: 1a2c70dd32ab335b38fa6da8a625ff47a3467dfa
Author: Sam James  gentoo  org>
AuthorDate: Mon Aug  7 00:29:39 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Mon Aug  7 00:32:33 2023 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=1a2c70dd

Run `pyupgrade --py39-plus`

Signed-off-by: Sam James  gentoo.org>

 .github/workflows/ci.yml   |  4 
 bin/epkginfo   |  2 +-
 bin/eshowkw|  1 -
 bin/merge-driver-ekeyword  | 11 +-
 pym/gentoolkit/atom.py |  8 +++
 pym/gentoolkit/base.py | 26 +++---
 pym/gentoolkit/cpv.py  | 10 -
 pym/gentoolkit/dependencies.py |  4 ++--
 pym/gentoolkit/eclean/clean.py |  8 +++
 pym/gentoolkit/eclean/cli.py   | 24 
 pym/gentoolkit/eclean/exclude.py   |  3 +--
 pym/gentoolkit/eclean/search.py|  4 ++--
 pym/gentoolkit/ekeyword/ekeyword.py| 16 +++---
 pym/gentoolkit/enalyze/__init__.py |  2 +-
 pym/gentoolkit/enalyze/analyze.py  |  6 ++---
 pym/gentoolkit/enalyze/output.py   |  2 +-
 pym/gentoolkit/enalyze/rebuild.py  | 14 +---
 pym/gentoolkit/equery/__init__.py  | 30 -
 pym/gentoolkit/equery/depgraph.py  |  2 +-
 pym/gentoolkit/equery/has.py   |  2 +-
 pym/gentoolkit/equery/keywords.py  |  1 -
 pym/gentoolkit/equery/list_.py |  2 +-
 pym/gentoolkit/equery/meta.py  | 24 ++--
 pym/gentoolkit/equery/size.py  |  2 +-
 pym/gentoolkit/equery/uses.py  | 18 +++
 pym/gentoolkit/errors.py   |  2 +-
 pym/gentoolkit/eshowkw/__init__.py | 11 --
 pym/gentoolkit/eshowkw/display_pretty.py   |  3 +--
 pym/gentoolkit/eshowkw/keywords_content.py | 15 ++---
 pym/gentoolkit/eshowkw/keywords_header.py  |  1 -
 pym/gentoolkit/flag.py |  2 +-
 pym/gentoolkit/formatters.py   |  2 +-
 pym/gentoolkit/helpers.py  |  6 ++---
 pym/gentoolkit/imlate/imlate.py| 20 -
 pym/gentoolkit/keyword.py  |  4 ++--
 pym/gentoolkit/module_base.py  |  2 +-
 pym/gentoolkit/package.py  | 12 +-
 pym/gentoolkit/pprinter.py |  2 +-
 pym/gentoolkit/profile.py  |  6 ++---
 pym/gentoolkit/query.py| 10 -
 pym/gentoolkit/revdep_rebuild/analyse.py   |  3 +--
 pym/gentoolkit/revdep_rebuild/assign.py| 23 
 pym/gentoolkit/revdep_rebuild/cache.py | 14 +---
 pym/gentoolkit/revdep_rebuild/collect.py   | 35 --
 pym/gentoolkit/revdep_rebuild/rebuild.py   |  1 -
 pym/gentoolkit/revdep_rebuild/runner.py|  2 --
 pym/gentoolkit/sets.py |  2 +-
 pym/gentoolkit/test/eclean/creator.py  |  2 +-
 pym/gentoolkit/test/eclean/distsupport.py  |  2 +-
 pym/gentoolkit/test/eclean/test_search.py  | 10 +
 pym/gentoolkit/test/test_atom.py   | 12 +-
 pym/gentoolkit/versionmatch.py | 10 -
 setup.py   |  4 ++--
 53 files changed, 200 insertions(+), 244 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 509f82e..36a636a 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -9,14 +9,10 @@ jobs:
 strategy:
   matrix:
 python-version:
-- '3.7'
-- '3.8'
 - '3.9'
 - '3.10'
 - '3.11'
 - '3.12-dev'
-- 'pypy-3.7'
-- 'pypy-3.8'
 - 'pypy-3.9'
 
 env:

diff --git a/bin/epkginfo b/bin/epkginfo
index 4cb483e..29c4c4d 100755
--- a/bin/epkginfo
+++ b/bin/epkginfo
@@ -28,7 +28,7 @@ def print_epkginfo_help():
 
 equery.initialize_configuration()
 args = sys.argv[1:]
-if not args or set(('-h', '--help')).intersection(args):
+if not args or {'-h', '--help'}.intersection(args):
 print_epkginfo_help()
 else:
 try:

diff --git a/bin/eshowkw b/bin/eshowkw
index 0ef4dda..d32ba6c 100755
--- a/bin/eshowkw
+++ b/bin/eshowkw
@@ -1,5 +1,4 @@
 #!/usr/bin/python
-#  vim:fileencoding=utf-8
 # Copyright 2010 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/merge-driver-ekeyword b/bin/merge-driver-ekeyword
index 73e0430..f75056c 100755
--- a/bin/merge-driver-ekeyword
+++ b/bin/merge-driver-ekeyword
@@ -14,15 +14,16 @@ import os
 import sys
 import tempfile
 
-from typing import List, Optional, Sequence, Tuple
+from typing import List, Optional, Tuple
+from collections.abc import Sequence
 
 from gentoolkit.ekeyword import ekeyword
 
 
-KeywordChanges = List[Tuple[Optional[List[str]], Optional[List[str

[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/

2023-08-04 Thread Sam James
commit: 9fbd05c05f86bb9c67d229ea64fe72c5ea08cf62
Author: Sam James  gentoo  org>
AuthorDate: Sat Aug  5 05:38:40 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Sat Aug  5 05:38:45 2023 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=9fbd05c0

equery: reformat with black

Fixes: 637bfbfb27d2104a81d80e5c67a7878d2e874966
Signed-off-by: Sam James  gentoo.org>

 pym/gentoolkit/equery/list_.py | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/pym/gentoolkit/equery/list_.py b/pym/gentoolkit/equery/list_.py
index 9b38c3e..237e7fe 100644
--- a/pym/gentoolkit/equery/list_.py
+++ b/pym/gentoolkit/equery/list_.py
@@ -233,10 +233,16 @@ def main(input_args):
 )
 
 if QUERY_OPTS["in_porttree"] and not QUERY_OPTS["in_overlay"]:
-if not ("P" in pkgstr.location or (QUERY_OPTS['in_installed'] 
and 'I' in pkgstr.location)):
+if not (
+"P" in pkgstr.location
+or (QUERY_OPTS["in_installed"] and "I" in pkgstr.location)
+):
 continue
 if QUERY_OPTS["in_overlay"] and not QUERY_OPTS["in_porttree"]:
-if not ("O" in pkgstr.location or (QUERY_OPTS['in_installed'] 
and 'I' in pkgstr.location)):
+if not (
+"O" in pkgstr.location
+or (QUERY_OPTS["in_installed"] and "I" in pkgstr.location)
+):
 continue
 pp.uprint(pkgstr)
 



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/

2023-07-18 Thread Sam James
commit: 637bfbfb27d2104a81d80e5c67a7878d2e874966
Author: Rafał Mużyło  o2  pl>
AuthorDate: Tue Jul 18 22:28:44 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Tue Jul 18 22:28:44 2023 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=637bfbfb

equery: list: correctly handle installed packages no longer in tree

Closes: https://bugs.gentoo.org/369581
Signed-off-by: Sam James  gentoo.org>

 pym/gentoolkit/equery/list_.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pym/gentoolkit/equery/list_.py b/pym/gentoolkit/equery/list_.py
index 1e03d91..9b38c3e 100644
--- a/pym/gentoolkit/equery/list_.py
+++ b/pym/gentoolkit/equery/list_.py
@@ -233,10 +233,10 @@ def main(input_args):
 )
 
 if QUERY_OPTS["in_porttree"] and not QUERY_OPTS["in_overlay"]:
-if not "P" in pkgstr.location:
+if not ("P" in pkgstr.location or (QUERY_OPTS['in_installed'] 
and 'I' in pkgstr.location)):
 continue
 if QUERY_OPTS["in_overlay"] and not QUERY_OPTS["in_porttree"]:
-if not "O" in pkgstr.location:
+if not ("O" in pkgstr.location or (QUERY_OPTS['in_installed'] 
and 'I' in pkgstr.location)):
 continue
 pp.uprint(pkgstr)
 



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/

2023-07-18 Thread Sam James
commit: 9eeff3399b23df1e4eed6f782e77c28b30347c9a
Author: Sam James  gentoo  org>
AuthorDate: Tue Jul 18 22:26:33 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Tue Jul 18 22:26:50 2023 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=9eeff339

equery: depgraph: Fix --linear shortopt (-l)

Closes: https://bugs.gentoo.org/709816
Signed-off-by: Sam James  gentoo.org>

 pym/gentoolkit/equery/depgraph.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/gentoolkit/equery/depgraph.py 
b/pym/gentoolkit/equery/depgraph.py
index 9003a47..d9e3901 100644
--- a/pym/gentoolkit/equery/depgraph.py
+++ b/pym/gentoolkit/equery/depgraph.py
@@ -197,7 +197,7 @@ def main(input_args):
 """Parse input and run the program"""
 
 short_opts = "hAMUl"
-long_opts = ("help", "no-atom", "no-useflags", "no-mask", "depth=")
+long_opts = ("help", "no-atom", "no-useflags", "no-mask", "depth=", 
"linear")
 
 try:
 module_opts, queries = gnu_getopt(input_args, short_opts, long_opts)



[gentoo-commits] proj/gentoolkit:master commit in: man/

2023-06-16 Thread Sam James
commit: 3c8109dc84b3f3d9262d842c50d2dca18dc4e5ac
Author: Alexis  gmail  com>
AuthorDate: Thu Jun 15 02:34:49 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Sat Jun 17 02:49:06 2023 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=3c8109dc

equery.1: Add description of 'keywords' module, fix typo.

Signed-off-by: Alexis  gmail.com>
Closes: https://github.com/gentoo/gentoolkit/pull/29
Signed-off-by: Sam James  gentoo.org>

 man/equery.1 | 78 ++--
 1 file changed, 76 insertions(+), 2 deletions(-)

diff --git a/man/equery.1 b/man/equery.1
index 9cb046f..aed2094 100644
--- a/man/equery.1
+++ b/man/equery.1
@@ -1,4 +1,4 @@
-.TH "EQUERY" "1" "August 2009" "GENTOOLKIT" ""
+.TH "EQUERY" "1" "June 2023" "GENTOOLKIT" ""
 .SH "NAME"
 equery \- Gentoo Package Query Tool
 
@@ -307,7 +307,7 @@ Customize the output format of the matched packages using 
the template string \f
 equery hasuse \-pI perl
 .EE
 .br
-View all Gentoo packages that have the "perl" USE flag, exluding installed 
packages.
+View all Gentoo packages that have the "perl" USE flag, excluding installed 
packages.
 .EX
 .HP
 USE="perl"; for PKG in $(equery \-q hasuse $USE); do echo $PKG: $(equery \-q 
uses $PKG |grep $USE); done
@@ -315,6 +315,80 @@ USE="perl"; for PKG in $(equery \-q hasuse $USE); do echo 
$PKG: $(equery \-q use
 .br
 This Bash one\-liner uses \fBhasuse\fP to find a list of packages that have a 
certain USE flag, and \fBuses\fP to check whether the flag is enabled or 
disabled. Modify \fBUSE="perl"\fP to change the query.
 
+.SS
+.BI "keywords (y) [OPTIONS] " "PKG"
+Display keywords for specified \fIPKG\fP or for \fIPKG\fP that is in pwd.
+
+.I R "LOCAL OPTIONS" ":"
+.HP
+.B \-h, \-\-help
+.br
+Show this help message and exit.
+.HP
+.B \-v, \-\-version
+.br
+Show package version and exit.
+.HP
+.B \-a, \-\-arch \fIARCH\fP
+.br
+Display only specified arch(s). (default: []).
+.HP
+.B \-A, \-\-align [{top,bottom}]
+.br
+Specify alignment for descriptions. (default: bottom)
+.HP
+.B \-T, \-\-top-position [{archlist,versionlist}]
+.br
+Specify which fields we want to have in top listing. (default: archlist)
+.HP
+.B \-B, \-\-bold
+.br
+Print out each other column in bold for easier visual separation. (default: 
False)
+.HP
+.B \-C, \-\-color
+.br
+Force colored output. (default: False)
+.HP
+.B \-O, \-\-overlays
+.br
+Search also overlays. (default: False)
+.HP
+.B \-P, \-\-prefix
+.br
+Display prefix keywords in output. (default: False)
+.HP
+.B \-S, \-\-ignore-slot
+.br
+Treat slots as irrelevant during detection of redundant packages. (default: 
False)
+.P
+.I R "OUTPUT" ":"
+
+.EX
+Keywords for sys-apps/coreutils:
+  |   |   u   |  
+  | a   a p s l r   a |   n   |  
+  | m   r h   p p   i o i s l m m | e u s | r
+  | d a m p p c a x a o s 3 p 6 i | a s l | e
+  | 6 r 6 p p 6 r 8 6 n c 9 h 8 p | p e o | p
+  | 4 m 4 a c 4 c 6 4 g v 0 a k s | i d t | o
+--+---+---+---
+  8.32-r1 | + + + + + + + + ~ o ~ ~ ~ ~ ~ | 7 # 0 | gentoo
+   9.1-r2 | + + + + + + + + ~ ~ ~ ~ ~ ~ ~ | 7 o   | gentoo
+   9.2-r2 | ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ | 8 #   | gentoo
+   9.3| ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ | 8 #   | gentoo
+   9.3-r1 | + ~ ~ + + ~ + ~ ~ ~ ~ ~ ~ ~ ~ | 8 #   | gentoo
+[I]9.3-r2 | + ~ ~ + + ~ + ~ ~ ~ ~ ~ ~ ~ ~ | 8 o   | gentoo
+  | o o o o o o o o o o o o o o o | 8 o   | gentoo
+.EE
+.P
+.I R "EXAMPLES" ":"
+.EX
+.HP
+equery keywords coreutils
+.EE
+.br
+Show the keywording status of the sys-apps/coreutils package on 
Gentoo-supported architectures.
+
 .SS
 .BI "list (l) [OPTIONS] " "PKG"
 List installed versions of \fIPKG\fP or all packages matching the query 
pattern.



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/enalyze/

2023-06-04 Thread Mike Gilbert
commit: 6e285a2416d5616cc672b5cf15a468e6e4c9de75
Author: Diego Viola  gmail  com>
AuthorDate: Tue Mar 21 19:44:16 2023 +
Commit: Mike Gilbert  gentoo  org>
CommitDate: Sun Jun  4 19:01:12 2023 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=6e285a24

enalyze/analyze.py: fix typos

Signed-off-by: Diego Viola  gmail.com>
Closes: https://github.com/gentoo/gentoolkit/pull/27
Signed-off-by: Mike Gilbert  gentoo.org>

 pym/gentoolkit/enalyze/analyze.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pym/gentoolkit/enalyze/analyze.py 
b/pym/gentoolkit/enalyze/analyze.py
index 3a09145..553ba5e 100644
--- a/pym/gentoolkit/enalyze/analyze.py
+++ b/pym/gentoolkit/enalyze/analyze.py
@@ -158,7 +158,7 @@ def gather_keywords_info(
 
 
 class Analyse(ModuleBase):
-"""Installed db analysis tool to query the installed databse
+"""Installed db analysis tool to query the installed database
 and produce/output stats for USE flags or keywords/mask.
 The 'rebuild' action output is in the form suitable for file type output
 to create a new package.use, package.keywords, package.unmask
@@ -201,7 +201,7 @@ class Analyse(ModuleBase):
 "--width": ("width", "int", 80),
 }
 self.formatted_options = [
-("  -h, --help", "Outputs this useage message"),
+("  -h, --help", "Outputs this usage message"),
 (
 "  -u, --unset",
 "Additionally include any unset USE flags and the packages",
@@ -265,7 +265,7 @@ class Analyse(ModuleBase):
 self.warning = (
 "   CAUTION",
 "This is beta software and some features/options are incomplete,",
-"some features may change in future releases includig its name.",
+"some features may change in future releases including its name.",
 "Feedback will be appreciated, http://bugs.gentoo.org;,
 )
 



[gentoo-commits] proj/gentoolkit:master commit in: /

2023-03-23 Thread Sam James
commit: 08af5752b8f433ed921ac13128c6f810df1f3fe3
Author: Sam James  gentoo  org>
AuthorDate: Fri Mar 24 02:50:40 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Fri Mar 24 02:50:40 2023 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=08af5752

.editorconfig: add (import from portage)

Signed-off-by: Sam James  gentoo.org>

 .editorconfig | 21 +
 1 file changed, 21 insertions(+)

diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 000..68c8e6c
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,21 @@
+# Copyright 2017-2020 Gentoo Authors
+
+root = true
+
+[*]
+charset = utf-8
+end_of_line = lf
+indent_style = tab
+indent_size = 4
+tab_width = 4
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+[*.{py,yaml,yml}]
+indent_style = space
+
+[pylintrc]
+indent_style = space
+
+[*.py]
+profile = black



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eclean/, pym/gentoolkit/ekeyword/, pym/gentoolkit/, man/, ...

2023-03-21 Thread Sam James
commit: 1b82c21ec8897da285728f9e99e135fbd7406462
Author: Ulrich Müller  gentoo  org>
AuthorDate: Tue Mar 21 17:05:59 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Wed Mar 22 03:36:35 2023 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=1b82c21e

Support the NO_COLOR environment variable

Bug: https://bugs.gentoo.org/902551
Signed-off-by: Ulrich Müller  gentoo.org>
Closes: https://github.com/gentoo/gentoolkit/pull/26
Signed-off-by: Sam James  gentoo.org>

 bin/revdep-rebuild.sh   | 18 ++
 man/revdep-rebuild.1|  2 +-
 pym/gentoolkit/base.py  |  8 ++--
 pym/gentoolkit/eclean/cli.py|  8 +---
 pym/gentoolkit/ekeyword/ekeyword.py |  7 +--
 pym/gentoolkit/equery/__init__.py   |  4 ++--
 6 files changed, 29 insertions(+), 18 deletions(-)

diff --git a/bin/revdep-rebuild.sh b/bin/revdep-rebuild.sh
index 7ee3647..09b0d1c 100755
--- a/bin/revdep-rebuild.sh
+++ b/bin/revdep-rebuild.sh
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 2003-2023 Gentoo Authors
 
 # revdep-rebuild: Reverse dependency rebuilder.
 # Original Author: Stanislav Brabec
@@ -80,6 +80,7 @@ declare SEARCH_DIRS_MASK # List of dirs not to search
 declare OLDPROG# Previous pass through the progress meter
 declare EXACT_PKG  # Versionated atom to emerge
 declare HEAD_TEXT  # Feedback string about the search
+declare NO_COLOR   # Set to nonempty not to output term colors
 declare NOCOLOR# Set to "true" not to output term colors
 declare OK_TEXT# Feedback about a search which found no errors
 declare RC_NOCOLOR # Hack to insure we respect NOCOLOR
@@ -169,7 +170,7 @@ print_usage() {
 cat << EOF
 ${APP_NAME}: (${VERSION})
 
-Copyright (C) 2003-2010 Gentoo Foundation, Inc.
+Copyright (C) 2003-2023 Gentoo Authors
 This is free software; see the source for copying conditions.
 
 Usage: $APP_NAME [OPTIONS] [--] [EMERGE_OPTIONS]
@@ -320,7 +321,8 @@ normalize_emerge_opts() {
 setup_color() {
# This should still work if NOCOLOR is set by the -C flag or in the 
user's
# environment.
-   [[ $NOCOLOR = yes || $NOCOLOR = true ]] && export RC_NOCOLOR=yes # 
HACK! (grr)
+   [[ -n $NO_COLOR || $NOCOLOR = yes || $NOCOLOR = true ]] &&
+   export RC_NOCOLOR=yes # HACK! (grr)
# TODO: Change location according to Bug 373219
# Remove /etc/init.d/functions.sh once everything is migrated
if [ -e /lib/gentoo/functions.sh ]; then
@@ -367,9 +369,9 @@ warn_deprecated_opt() {
 # Get whole-word commandline options preceded by two dashes.
 get_longopts() {
case $1 in
-  --nocolor) export NOCOLOR="yes";;
+  --nocolor) export NO_COLOR=1 
NOCOLOR="yes";;
  --no-color) warn_deprecated_opt 
"$1" "--nocolor"
- export NOCOLOR="yes";;
+ export NO_COLOR=1 
NOCOLOR="yes";;
 --debug) set -xv;;
 --exact) unset PACKAGE_NAMES;;
  --help) print_usage
@@ -424,7 +426,7 @@ get_shortopts() {
while getopts ":CdehikL:loPpquvX" OPT; do
case "$OPT" in
C) # TODO: Match syntax with the rest of gentoolkit
-  export NOCOLOR="yes";;
+  export NO_COLOR=1 NOCOLOR="yes";;
d) set -xv;;
e) unset PACKAGE_NAMES;;
h) print_usage
@@ -1092,8 +1094,8 @@ portage_settings() {
unset SEARCH_DIRS_MASK
unset LD_LIBRARY_MASK
 
-   eval $(portageq envvar -v PORTAGE_ROOT PORTAGE_NICENESS 
EMERGE_DEFAULT_OPTS NOCOLOR SEARCH_DIRS SEARCH_DIRS_MASK LD_LIBRARY_MASK 
REVDEP_REBUILD_DEFAULT_OPTS)
-   export NOCOLOR
+   eval $(portageq envvar -v PORTAGE_ROOT PORTAGE_NICENESS 
EMERGE_DEFAULT_OPTS NO_COLOR NOCOLOR SEARCH_DIRS SEARCH_DIRS_MASK 
LD_LIBRARY_MASK REVDEP_REBUILD_DEFAULT_OPTS)
+   export NO_COLOR NOCOLOR
 
# Convert quoted paths to array.
eval "EMERGE_DEFAULT_OPTS=(${EMERGE_DEFAULT_OPTS})"

diff --git a/man/revdep-rebuild.1 b/man/revdep-rebuild.1
index fad5f47..bff995c 100644
--- a/man/revdep-rebuild.1
+++ b/man/revdep-rebuild.1
@@ -82,7 +82,7 @@ REVDEP_REBUILD_DEFAULT_OPTS \- List of default emerge options 
for revdep-rebuild
 
 The REVDEP_REBUILD_DEFAULT_OPTS variable can be used to override 
EMERGE_DEFAULT_OPTS for revdep\-rebuild. This variable replaces the values of 
EMERGE_DEFAULT_OPTS and can still be overridden by command line options. Please 
note that this variable is only for options to pass to emerge and not 

[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/, pym/gentoolkit/ekeyword/, pym/gentoolkit/, ...

2023-03-19 Thread Sam James
commit: 5318fb2032cf24beafdda843af83c0a56d6c9dfe
Author: Sam James  gentoo  org>
AuthorDate: Mon Mar 20 04:40:25 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Mon Mar 20 04:40:25 2023 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=5318fb20

*/*: Reformat with newer Black

Signed-off-by: Sam James  gentoo.org>

 pym/gentoolkit/dependencies.py   | 1 -
 pym/gentoolkit/ekeyword/ekeyword.py  | 1 -
 pym/gentoolkit/equery/uses.py| 1 -
 pym/gentoolkit/eshowkw/__init__.py   | 1 -
 pym/gentoolkit/revdep_rebuild/collect.py | 1 -
 pym/gentoolkit/textwrap_.py  | 1 -
 6 files changed, 6 deletions(-)

diff --git a/pym/gentoolkit/dependencies.py b/pym/gentoolkit/dependencies.py
index f94b82e..cff2080 100644
--- a/pym/gentoolkit/dependencies.py
+++ b/pym/gentoolkit/dependencies.py
@@ -268,7 +268,6 @@ class Dependencies(Query):
 and pkgdep.cpv not in seen
 and (depth < max_depth or max_depth == -1)
 ):
-
 seen.add(pkgdep.cpv)
 result.append(
 pkgdep.graph_reverse_depends(

diff --git a/pym/gentoolkit/ekeyword/ekeyword.py 
b/pym/gentoolkit/ekeyword/ekeyword.py
index 4d017d4..d031c2f 100755
--- a/pym/gentoolkit/ekeyword/ekeyword.py
+++ b/pym/gentoolkit/ekeyword/ekeyword.py
@@ -138,7 +138,6 @@ def diff_keywords(old_keywords, new_keywords, 
style="color-inline"):
 output = ""
 
 for tag, i0, i1, j0, j1 in s.get_opcodes():
-
 if tag == "equal":
 output += s.a[i0:i1]
 

diff --git a/pym/gentoolkit/equery/uses.py b/pym/gentoolkit/equery/uses.py
index 89f011c..eeea356 100644
--- a/pym/gentoolkit/equery/uses.py
+++ b/pym/gentoolkit/equery/uses.py
@@ -337,7 +337,6 @@ def main(input_args):
 
 global_usedesc = get_global_useflags()
 for pkg in matches:
-
 output = get_output_descriptions(pkg, global_usedesc)
 if output:
 if CONFIG["verbose"]:

diff --git a/pym/gentoolkit/eshowkw/__init__.py 
b/pym/gentoolkit/eshowkw/__init__.py
index ee58e8c..4bef14e 100644
--- a/pym/gentoolkit/eshowkw/__init__.py
+++ b/pym/gentoolkit/eshowkw/__init__.py
@@ -25,7 +25,6 @@ topper = "versionlist"
 
 
 def process_display(package, keywords, dbapi):
-
 portdata = keywords_content(
 package, keywords.keywords, dbapi, ignore_slots, order, bold, topper
 )

diff --git a/pym/gentoolkit/revdep_rebuild/collect.py 
b/pym/gentoolkit/revdep_rebuild/collect.py
index 0e5d274..897a12c 100644
--- a/pym/gentoolkit/revdep_rebuild/collect.py
+++ b/pym/gentoolkit/revdep_rebuild/collect.py
@@ -134,7 +134,6 @@ def collect_libraries_from_dir(dirs, mask, logger):
 or listing.endswith(".a")
 or ".so." in listing
 ):
-
 if os.path.islink(listing):
 found_symlinks.add(listing)
 else:

diff --git a/pym/gentoolkit/textwrap_.py b/pym/gentoolkit/textwrap_.py
index fd28c6a..dbacfec 100644
--- a/pym/gentoolkit/textwrap_.py
+++ b/pym/gentoolkit/textwrap_.py
@@ -47,7 +47,6 @@ class TextWrapper(textwrap.TextWrapper):
 ansi_re = re.compile(r"\x1b\[[0-9;]*m")
 
 while chunks:
-
 # Start the list of chunks that will make up the current line.
 # cur_len is just the length of all the chunks in cur_line.
 cur_line = []



[gentoo-commits] proj/gentoolkit:master commit in: /

2023-03-19 Thread Sam James
commit: 3bb68da27b4c47e86dbfd5f0ae6386a2a53f89f9
Author: Sam James  gentoo  org>
AuthorDate: Mon Mar 20 04:41:16 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Mon Mar 20 04:41:16 2023 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=3bb68da2

.gitignorerevs: update for Black reformatting

See 5318fb2032cf24beafdda843af83c0a56d6c9dfe.

Signed-off-by: Sam James  gentoo.org>

 .gitignorerevs | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.gitignorerevs b/.gitignorerevs
index d9d4b22..a061025 100644
--- a/.gitignorerevs
+++ b/.gitignorerevs
@@ -2,3 +2,5 @@
 bbcd72b5fe85fe9bbca1913f8aa22077d94e75d0
 # Reformat with black 22.1.0
 76c188b5189375b3b3b7c92f31491990e29a1669
+# */*: Reformat with newer Black
+5318fb2032cf24beafdda843af83c0a56d6c9dfe



[gentoo-commits] proj/gentoolkit:master commit in: .github/workflows/

2023-03-19 Thread Sam James
commit: a5f1b8e775fe1d7d3ea55be6bf4813e54126f890
Author: Sam James  gentoo  org>
AuthorDate: Mon Mar 20 03:52:59 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Mon Mar 20 03:52:59 2023 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=a5f1b8e7

CI: add Python 3.12 alphas

Per https://github.com/actions/setup-python/issues/150, we can just do
3.12-dev and such.

Signed-off-by: Sam James  gentoo.org>

 .github/workflows/ci.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 90444dc..509f82e 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -14,6 +14,7 @@ jobs:
 - '3.9'
 - '3.10'
 - '3.11'
+- '3.12-dev'
 - 'pypy-3.7'
 - 'pypy-3.8'
 - 'pypy-3.9'



[gentoo-commits] proj/gentoolkit:master commit in: .github/workflows/

2023-03-19 Thread Sam James
commit: d0998f38174bffe40dfab925fc4ca23eff1ae5af
Author: Sam James  gentoo  org>
AuthorDate: Mon Mar 20 03:51:52 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Mon Mar 20 03:51:52 2023 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=d0998f38

CI: fix Python 3.11 workflow/job

Use the latest Python 3.11 release.

Signed-off-by: Sam James  gentoo.org>

 .github/workflows/ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 83e6ef3..422daa7 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -13,7 +13,7 @@ jobs:
 - '3.8'
 - '3.9'
 - '3.10'
-- '3.11.0-alpha - 3.11.0'
+- '3.11'
 - 'pypy-3.7'
 - 'pypy-3.8'
 - 'pypy-3.9'



[gentoo-commits] proj/gentoolkit:master commit in: .github/workflows/

2023-03-19 Thread Sam James
commit: 690bd313006a5a84b260fde2e6c7be788dd97bd0
Author: Sam James  gentoo  org>
AuthorDate: Mon Mar 20 03:52:21 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Mon Mar 20 03:52:41 2023 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=690bd313

CI: update Portage version

Signed-off-by: Sam James  gentoo.org>

 .github/workflows/ci.yml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 422daa7..90444dc 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -19,7 +19,8 @@ jobs:
 - 'pypy-3.9'
 
 env:
-  PORTAGE_VERSION: "3.0.30"
+  # TODO: get this dynamically
+  PORTAGE_VERSION: "3.0.45.3"
 
 steps:
 - uses: actions/checkout@v2



[gentoo-commits] proj/gentoolkit:master commit in: man/, pym/gentoolkit/eshowkw/

2023-01-06 Thread Sam James
commit: c215d99eb488df355bcd77f2da90474720636d6c
Author: Greg Kubaryk  vt  edu>
AuthorDate: Sat Jan  7 06:46:59 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Sat Jan  7 06:56:59 2023 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=c215d99e

eshowkw: Fix spelling error

Signed-off-by: Greg Kubaryk  vt.edu>
Signed-off-by: Sam James  gentoo.org>

 man/eshowkw.1  | 2 +-
 pym/gentoolkit/eshowkw/__init__.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/man/eshowkw.1 b/man/eshowkw.1
index 88b7917..20fc6e7 100644
--- a/man/eshowkw.1
+++ b/man/eshowkw.1
@@ -41,7 +41,7 @@ Search overlays (default: False)
 Display prefix keywords in output. (default: False)
 .TP
 .B \-S | \-\-ignore\-slot
-Treat slots as irelevant during detection of redundant packages. (default: 
False)
+Treat slots as irrelevant during detection of redundant packages. (default: 
False)
 .SH "BUGS"
 .LP
 Report bugs to .

diff --git a/pym/gentoolkit/eshowkw/__init__.py 
b/pym/gentoolkit/eshowkw/__init__.py
index ba6c076..ee58e8c 100644
--- a/pym/gentoolkit/eshowkw/__init__.py
+++ b/pym/gentoolkit/eshowkw/__init__.py
@@ -121,7 +121,7 @@ def process_args(argv):
 "--ignore-slot",
 action="store_true",
 default=False,
-help="Treat slots as irelevant during detection of redundant 
packages.",
+help="Treat slots as irrelevant during detection of redundant 
packages.",
 )
 
 return parser.parse_args(args=argv)



[gentoo-commits] proj/gentoolkit:master commit in: man/

2022-12-14 Thread Sam James
commit: c6dee3ef49e122a99dd299eae4749b7188751287
Author: Vitaly Zdanevich  ya  ru>
AuthorDate: Sun Aug 21 11:45:04 2022 +
Commit: Sam James  gentoo  org>
CommitDate: Wed Dec 14 09:43:23 2022 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=c6dee3ef

man: fix path of distfiles

Signed-off-by: Vitaly Zdanevich  ya.ru>
Closes: https://github.com/gentoo/gentoolkit/pull/23
Signed-off-by: Sam James  gentoo.org>

 man/eclean.1 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/man/eclean.1 b/man/eclean.1
index a407ce7..e47ced9 100644
--- a/man/eclean.1
+++ b/man/eclean.1
@@ -82,7 +82,7 @@ Units are: y (years), m (months), w (weeks), d (days) and h 
(hours).
 .SS "Actions"
 .TP
 \fBdistfiles\fR
-Clean files from /usr/portage/distfiles (or whatever else is your DISTDIR in 
make.conf).
+Clean files from /var/cache/distfiles (or whatever else is your DISTDIR in 
make.conf).
 This action should be useful to almost any Gentoo user, we all have to big 
DISTDIRs sometime...
 .br
 \fBeclean\-dist\fP is a shortcut to call eclean with the "distfiles" action, 
for simplified



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/

2022-12-14 Thread Sam James
commit: d2b36d9abfaed58360bdc0f92d214beb25a94518
Author: Krzesimir Nowak  microsoft  com>
AuthorDate: Thu Dec  8 15:25:39 2022 +
Commit: Sam James  gentoo  org>
CommitDate: Wed Dec 14 09:24:04 2022 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=d2b36d9a

profile: Default to main repo name

In Flatcar we have a different repo marked as a default one
(portage-stable), so "equery keywords" was crashing because it was
trying to use gentoo repo anyways.

Signed-off-by: Krzesimir Nowak  microsoft.com>
Closes: https://github.com/gentoo/gentoolkit/pull/24
Signed-off-by: Sam James  gentoo.org>

 pym/gentoolkit/profile.py | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/pym/gentoolkit/profile.py b/pym/gentoolkit/profile.py
index f6943be..7469138 100644
--- a/pym/gentoolkit/profile.py
+++ b/pym/gentoolkit/profile.py
@@ -21,21 +21,26 @@ def warning(msg):
 print("warning: %s" % msg, file=sys.stderr)
 
 
-def load_profile_data(portdir=None, repo="gentoo"):
+def load_profile_data(portdir=None, repo=""):
 """Load the list of known arches from the tree
 
 Args:
   portdir: The repository to load all data from (and ignore |repo|)
-  repo: Look up this repository by name to locate profile data
+  repo: Look up this repository by name to locate profile data (if empty, 
uses main repo name)
 
 Returns:
   A dict mapping the keyword to its preferred state:
   {'x86': ('stable', 'arch'), 'mips': ('dev', '~arch'), ...}
 """
 if portdir is None:
-portdir = (
-
portage.db[portage.root]["vartree"].settings.repositories[repo].location
-)
+repos = portage.db[portage.root]["vartree"].settings.repositories
+if repo == "":
+main_repo = repos.mainRepo()
+if main_repo is None:
+repo = "gentoo"
+else:
+repo = main_repo.name
+portdir = repos[repo].location
 
 arch_status = {}
 



[gentoo-commits] proj/gentoolkit:master commit in: bin/

2022-12-03 Thread Michał Górny
commit: 62d22ed69cecd3ae416b3b899062244865659d5b
Author: Michał Górny  gentoo  org>
AuthorDate: Sat Dec  3 13:54:06 2022 +
Commit: Michał Górny  gentoo  org>
CommitDate: Sat Dec  3 13:54:06 2022 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=62d22ed6

ebump: Use `git rev-parse --is-inside-work-tree`

Signed-off-by: Michał Górny  gentoo.org>

 bin/ebump | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/ebump b/bin/ebump
index 06264c4..25e9a7c 100755
--- a/bin/ebump
+++ b/bin/ebump
@@ -277,7 +277,7 @@ get_vcs() {
return 0
else
if command -v git >/dev/null; then
-   if [ -n "$(git rev-parse --git-dir 2>/dev/null)" ]; then
+   if [ "$(git rev-parse --is-inside-work-tree)" = true ]; 
then
echo "git"
return 0
fi



[gentoo-commits] proj/gentoolkit:master commit in: bin/

2022-12-03 Thread Michał Górny
commit: 932473493220d48457aeb547018d040138c1e161
Author: Michał Górny  gentoo  org>
AuthorDate: Sat Dec  3 13:45:14 2022 +
Commit: Michał Górny  gentoo  org>
CommitDate: Sat Dec  3 13:45:14 2022 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=93247349

ebump: Replace which(1) with `command -v`

Signed-off-by: Michał Górny  gentoo.org>

 bin/ebump | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/ebump b/bin/ebump
index 7f6e3ce..06264c4 100755
--- a/bin/ebump
+++ b/bin/ebump
@@ -276,7 +276,7 @@ get_vcs() {
echo "svn"
return 0
else
-   if [ -x "$(which git)" ]; then
+   if command -v git >/dev/null; then
if [ -n "$(git rev-parse --git-dir 2>/dev/null)" ]; then
echo "git"
return 0



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/

2022-07-28 Thread Brian Dolbec
commit: 91721fcdb85ff67f7607dad60e82f11c1bf701fd
Author: Brian Dolbec  gentoo  org>
AuthorDate: Tue Jul 12 01:37:37 2022 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Tue Jul 12 01:37:37 2022 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=91721fcd

equery meta: Put maintainer description on the same line

Bug: https://bugs.gentoo.org/576224

Signed-off-by: Brian Dolbec  gentoo.org>

 pym/gentoolkit/equery/meta.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/gentoolkit/equery/meta.py b/pym/gentoolkit/equery/meta.py
index 124f59b..22e9ad8 100644
--- a/pym/gentoolkit/equery/meta.py
+++ b/pym/gentoolkit/equery/meta.py
@@ -167,7 +167,7 @@ def format_maintainers(maints):
 if CONFIG["verbose"]:
 maintstr += " (%s)" % (maint.name,) if maint.name else ""
 maintstr += " - %s" % (maint.restrict,) if maint.restrict else ""
-maintstr += "\n%s" % (maint.description,) if maint.description 
else ""
+maintstr += " - %s" % (maint.description,) if maint.description 
else ""
 result.append(maintstr)
 
 return result



[gentoo-commits] proj/gentoolkit:master commit in: bin/

2022-07-28 Thread Brian Dolbec
commit: 4a56a7feff4fe8ed427cddff6e6b2719f0fe58c3
Author: Brian Dolbec  gentoo  org>
AuthorDate: Tue Jul 12 00:58:23 2022 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Tue Jul 12 00:58:23 2022 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=4a56a7fe

revdep-rebuild.sh: Create its cache dir if it doesn't exist

Bug: https://bugs.gentoo.org/382009

Signed-off-by: Brian Dolbec  gentoo.org>

 bin/revdep-rebuild.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/bin/revdep-rebuild.sh b/bin/revdep-rebuild.sh
index 5fecf97..7ee3647 100755
--- a/bin/revdep-rebuild.sh
+++ b/bin/revdep-rebuild.sh
@@ -570,7 +570,8 @@ verify_tmpdir() {
elif [[ -d $1 ]]; then
cd "$1"
else
-   die 1 "Unable to find a satisfactory location for temporary 
files ($1)"
+   mkdir -p "$1"
+   cd "$1"
fi
[[ $VERBOSE ]] && einfo "Temporary cache files are located in $PWD"
setup_rm



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/

2022-07-28 Thread Brian Dolbec
commit: 9a402fba0d63240685a2326926060c3c8c523101
Author: Brian Dolbec  gentoo  org>
AuthorDate: Thu Jul 28 15:22:55 2022 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Thu Jul 28 15:22:55 2022 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=9a402fba

equery: Set nocolor for piping to after options are parsed

Fixes commit 84ffe42e5 which set nocolor before options were parsed.

Bug: https://bugs.gentoo.org/861116

Signed-off-by: Brian Dolbec  gentoo.org>

 pym/gentoolkit/equery/__init__.py | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/pym/gentoolkit/equery/__init__.py 
b/pym/gentoolkit/equery/__init__.py
index 56b2caa..ae760c1 100644
--- a/pym/gentoolkit/equery/__init__.py
+++ b/pym/gentoolkit/equery/__init__.py
@@ -228,8 +228,6 @@ def initialize_configuration():
 # set extra wide, should disable wrapping unless
 # there is some extra long text
 CONFIG["termWidth"] = 600
-# turn off color
-pp.output.nocolor()
 
 CONFIG["debug"] = bool(os.getenv("DEBUG", False))
 
@@ -338,6 +336,10 @@ def main(argv):
 else:
 CONFIG["verbose"] = True
 
+if CONFIG["piping"]:
+# turn off color
+pp.output.nocolor()
+
 try:
 module_name, module_args = split_arguments(args)
 except IndexError:



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eclean/

2022-07-11 Thread Brian Dolbec
commit: bf3eb16e451fd1bdee8ef03a0d22e0040e033f19
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jul 11 06:41:33 2022 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Mon Jul 11 06:53:33 2022 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=bf3eb16e

eclean/pkgindex.py: Fix typo in function call

  File "/usr/lib/python3.10/site-packages/gentoolkit/eclean/pkgindex.py", line
60, in clean_pkgs_index
if self.get_emaint_binhost():
AttributeError: 'PkgIndex' object has no attribute 'get_emaint_binhost'. Did
you mean: '_get_emaint_binhost'?

Also fix too many parameters in line 68 for the self.controller() call

Bug: https://bugs.gentoo.org/857555

Signed-off-by: Brian Dolbec  gentoo.org>

 pym/gentoolkit/eclean/pkgindex.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pym/gentoolkit/eclean/pkgindex.py 
b/pym/gentoolkit/eclean/pkgindex.py
index d0878a1..7d6fade 100644
--- a/pym/gentoolkit/eclean/pkgindex.py
+++ b/pym/gentoolkit/eclean/pkgindex.py
@@ -57,7 +57,7 @@ class PkgIndex:
 statinfo = os.stat(file_)
 size1 = statinfo.st_size
 show_progress = not quiet
-if self.get_emaint_binhost():
+if self._get_emaint_binhost():
 self.taskmaster = TaskHandler(show_progress_bar=show_progress)
 tasks = [self.binhost]
 self.taskmaster.run_tasks(tasks)
@@ -65,7 +65,7 @@ class PkgIndex:
 self.call_emaint()
 statinfo = os.stat(file_)
 clean_size = size1 - statinfo.st_size
-self.controller("\n", clean_size, "Packages Index", file_, "Index")
+self.controller(clean_size, "Packages Index", file_, "Index")
 return clean_size
 
 def call_emaint(self):



[gentoo-commits] proj/gentoolkit:master commit in: /

2022-07-10 Thread Brian Dolbec
commit: 9ab5d996f33c219ced4c9ca53d66fb2e6e45a691
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jul 10 20:41:36 2022 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jul 10 20:48:48 2022 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=9ab5d996

Revert "setup.py: migrate to setuptools"

This reverts commit bbbde97b5e625a49a1a66e307931548cb33f260b.
setuptools only installs data files to the python pkg directory

Signed-off-by: Brian Dolbec  gentoo.org>

 setup.py | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/setup.py b/setup.py
index 36995de..23e9b36 100755
--- a/setup.py
+++ b/setup.py
@@ -3,8 +3,8 @@
 import re
 import sys
 import subprocess
-
-from setuptools import setup, Command
+from distutils import core
+from distutils.cmd import Command
 from glob import glob
 
 import os
@@ -67,7 +67,7 @@ manpages = [
 ]
 
 
-class set_version(Command):
+class set_version(core.Command):
 """Set python __version__ and bash VERSION to our __version__."""
 
 description = "hardcode scripts' version using VERSION from environment"
@@ -130,7 +130,7 @@ test_data = {
 ]
 }
 
-setup(
+core.setup(
 name="gentoolkit",
 version=__version__,
 description="Set of tools that work with and enhance portage.",



[gentoo-commits] proj/gentoolkit:master commit in: /

2022-07-10 Thread Brian Dolbec
commit: 3946fd19f21ade60c4212c4738292ea5d2e4098b
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jul 10 18:58:50 2022 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jul 10 18:58:50 2022 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=3946fd19

NEWS: update for point release

Signed-off-by: Brian Dolbec  gentoo.org>

 NEWS | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/NEWS b/NEWS
index 7976818..14325a8 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,12 @@
 News (new features/major bug fixes)
 
+gentoolkit-0.6.1
+
+  * Fix custom TMPL implementation for depends commit 3e35553df4673
+  * fix unused variable detection
+  * migrate setup.py to setuptools
+
+
 gentoolkit-0.6.0
 
   * merge-driver-ekeyword Fis type annotations



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/

2022-07-10 Thread Brian Dolbec
commit: 68159035c6479e313c33dd31d19d42d3178f1235
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jul 10 18:25:18 2022 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jul 10 18:25:18 2022 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=68159035

equery check.py: Fix flake 8 qa for unused variable

flake8 did not correctly detect the way the variable is used.
Add an assert to eliminate the false detection.

Signed-off-by: Brian Dolbec  gentoo.org>

 pym/gentoolkit/equery/check.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pym/gentoolkit/equery/check.py b/pym/gentoolkit/equery/check.py
index 7e580b1..2ef881c 100644
--- a/pym/gentoolkit/equery/check.py
+++ b/pym/gentoolkit/equery/check.py
@@ -144,6 +144,7 @@ class VerifyContents:
 obj_errs.append(err % locals())
 return obj_errs
 except Exception as ex:
+assert ex  # to silence unused variable ex
 err = "Problem checking %(cfile)s: %(ex)s"
 obj_errs.append(err % locals())
 return obj_errs



[gentoo-commits] proj/gentoolkit:master commit in: /

2022-07-10 Thread Brian Dolbec
commit: bbbde97b5e625a49a1a66e307931548cb33f260b
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jul 10 18:33:11 2022 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jul 10 18:33:11 2022 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=bbbde97b

setup.py: migrate to setuptools

Signed-off-by: Brian Dolbec  gentoo.org>

 setup.py | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/setup.py b/setup.py
index 23e9b36..36995de 100755
--- a/setup.py
+++ b/setup.py
@@ -3,8 +3,8 @@
 import re
 import sys
 import subprocess
-from distutils import core
-from distutils.cmd import Command
+
+from setuptools import setup, Command
 from glob import glob
 
 import os
@@ -67,7 +67,7 @@ manpages = [
 ]
 
 
-class set_version(core.Command):
+class set_version(Command):
 """Set python __version__ and bash VERSION to our __version__."""
 
 description = "hardcode scripts' version using VERSION from environment"
@@ -130,7 +130,7 @@ test_data = {
 ]
 }
 
-core.setup(
+setup(
 name="gentoolkit",
 version=__version__,
 description="Set of tools that work with and enhance portage.",



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/

2022-07-10 Thread Brian Dolbec
commit: d755f0f7c8e6b21f926837d46440768d58281b04
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jul 10 17:58:42 2022 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jul 10 17:58:42 2022 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=d755f0f7

depends.py: Fix 3e35553df46 missing Package import

Remove unused FORMAT_TMPL_VARS import

Signed-off-by: Brian Dolbec  gentoo.org>

 pym/gentoolkit/equery/depends.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/gentoolkit/equery/depends.py b/pym/gentoolkit/equery/depends.py
index fe56148..8ec5f75 100644
--- a/pym/gentoolkit/equery/depends.py
+++ b/pym/gentoolkit/equery/depends.py
@@ -18,7 +18,7 @@ from gentoolkit.dependencies import Dependencies
 from gentoolkit.equery import format_options, mod_usage, CONFIG
 from gentoolkit.helpers import get_cpvs, get_installed_cpvs
 from gentoolkit.cpv import CPV
-from gentoolkit.package import PackageFormatter, FORMAT_TMPL_VARS
+from gentoolkit.package import PackageFormatter, Package
 
 # ===
 # Globals



[gentoo-commits] proj/gentoolkit:master commit in: /

2022-07-10 Thread Brian Dolbec
commit: ca7731ef8d12d23d5164de801dd2bfba2d3767e9
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jul 10 17:18:11 2022 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jul 10 17:18:11 2022 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=ca7731ef

v0.6.0

Signed-off-by: Brian Dolbec  gentoo.org>

 NEWS | 32 
 1 file changed, 32 insertions(+)

diff --git a/NEWS b/NEWS
index b542cf1..7976818 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,37 @@
 News (new features/major bug fixes)
 
+gentoolkit-0.6.0
+
+  * merge-driver-ekeyword Fis type annotations
+  * equery changes removal
+  * Convert from tab indent to spaces, format cleanup
+  * Add github action to check formatting, add unit testing
+  * Add flake testing to github action
+  * ChangeLog cleanups
+  * imlate: Remove 'experimental' code
+  * Remove remnants of herds support
+  * man page updates/fixes
+  * euse: migrate egrep -> grep -E
+  * Add python 3.10, 3.11 testing to tox.ini
+  * implement --unique-use option for eclean-pkg
+  * eshowkw: Fix bug 503366 row alignment issue
+  * revdep-rebuild: set up a child logger with propagate = False
+  * Add -f/--forced-masked to equery uses
+  * metadata.py: Don't fail on unmatched package
+  * equery: update linguas->l10n option
+  * equery: Add -F TMPL option to depends module
+  * revdep-rebuild.sh: use awk command instead of gawk
+  * ekeyword: remove .ebuild file suffix requirement (bug 762331)
+  * eclean: Complete migration to imported emaint code
+  * eclean: add early return for empty DISTDIR
+  * enalyze: Fix missing newline at end of saved rebuild files
+  * equery: Turn off color when piping is set
+  * equery meta: Fix missing description when not in metadata.xml
+  * equery meta: Migrate to portage's MetadataXML class
+  * equery check: Fix exception handling for Insufficient permissions
+  * equery depends: Fix a traceback due to UnboundLocalError:
+
+
 gentoolkit-0.5.1
 
   * Added support for Python 3.9



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/

2022-07-10 Thread Brian Dolbec
commit: c1c66b84d3e14b887b7b460111664e62238172fb
Author: Alexander Miller  gmx  de>
AuthorDate: Sun Jul 10 15:55:25 2022 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jul 10 15:55:25 2022 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=c1c66b84

equery check: Fix exception handling for Insufficient permissions

A quick look into the source reveals that there is actually code to handle the 
case,
but it expects the wrong exception type.
This patch fixes that and also avoids a crash for other errors.

Bug: https://bugs.gentoo.org/494134
Signed-off-by: Brian Dolbec  gentoo.org>

 pym/gentoolkit/equery/check.py | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/pym/gentoolkit/equery/check.py b/pym/gentoolkit/equery/check.py
index 7a7c3db..7e580b1 100644
--- a/pym/gentoolkit/equery/check.py
+++ b/pym/gentoolkit/equery/check.py
@@ -16,6 +16,7 @@ from functools import partial
 from getopt import gnu_getopt, GetoptError
 
 import portage.checksum as checksum
+from portage.exception import PermissionDenied
 
 import gentoolkit.pprinter as pp
 from gentoolkit import errors
@@ -138,10 +139,14 @@ class VerifyContents:
 md5sum = files[cfile][2]
 try:
 cur_checksum = checksum.perform_md5(real_cfile, calc_prelink=1)
-except IOError:
+except PermissionDenied:
 err = "Insufficient permissions to read %(cfile)s"
 obj_errs.append(err % locals())
 return obj_errs
+except Exception as ex:
+err = "Problem checking %(cfile)s: %(ex)s"
+obj_errs.append(err % locals())
+return obj_errs
 if cur_checksum != md5sum:
 err = "%(cfile)s has incorrect MD5sum"
 obj_errs.append(err % locals())



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/

2022-07-10 Thread Brian Dolbec
commit: 9b9711bf1bd0bdc24e4be6fc226758738d7a
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jul 10 16:16:40 2022 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jul 10 16:16:40 2022 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=9b9711bf

equery depends: Fix a traceback due to UnboundLocalError:

  File "/home/brian/Dev/git/gentoolkit/pym/gentoolkit/equery/depends.py"
  , line 106, in format_depend
self.print_fn(indent, str(dep.cpv), use_conditional, formatted_dep)
UnboundLocalError: local variable 'formatted_dep' referenced before
assignment

The statement appears to be added as preliminary debug info.
Removed it.

Signed-off-by: Brian Dolbec  gentoo.org>

 pym/gentoolkit/equery/depends.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/pym/gentoolkit/equery/depends.py b/pym/gentoolkit/equery/depends.py
index f65e846..fe56148 100644
--- a/pym/gentoolkit/equery/depends.py
+++ b/pym/gentoolkit/equery/depends.py
@@ -103,7 +103,6 @@ class DependPrinter:
 pkg = Package(str(dep.cpv))
 self.print_formated(pkg)
 else:
-self.print_fn(indent, str(dep.cpv), use_conditional, formatted_dep)
 if mdep.use_conditional:
 use_conditional = " & ".join(
 pp.useflag(u) for u in mdep.use_conditional.split()



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/

2022-07-10 Thread Brian Dolbec
commit: eb9a4d026ef453e392faff35925537bee74c9d80
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jul 10 07:45:34 2022 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jul 10 07:49:28 2022 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=eb9a4d02

equery meta: Migrate to portage's MetadataXML class

Portage's metadata handling code was originally ported from gentoolkit.
Finally get around to migrating, eliminating duplicate code.

Bug: https://bugs.gentoo.org/573030
Signed-off-by: Brian Dolbec  gentoo.org>

 pym/gentoolkit/metadata.py | 256 -
 pym/gentoolkit/package.py  |  10 +-
 2 files changed, 7 insertions(+), 259 deletions(-)

diff --git a/pym/gentoolkit/metadata.py b/pym/gentoolkit/metadata.py
deleted file mode 100644
index 479456a..000
--- a/pym/gentoolkit/metadata.py
+++ /dev/null
@@ -1,256 +0,0 @@
-# Copyright(c) 2009, Gentoo Foundation
-#
-# Licensed under the GNU General Public License, v2
-
-"""Provides an easy-to-use python interface to Gentoo's metadata.xml file.
-
-Example usage:
->>> pkg_md = 
MetaData('/var/db/repos/gentoo/app-accessibility/espeak-ng/metadata.xml')
->>> pkg_md
-
->>> for maint in pkg_md.maintainers():
-... print('{0} ({1})'.format(maint.email, maint.name))
-...
-willi...@gentoo.org (William Hubbs)
->>> for flag in pkg_md.use():
-... print(flag.name, '->', flag.description)
-...
-async -> Enables asynchronous commands
-klatt -> Enables Klatt formant synthesis and implementation
-l10n_ru -> Builds extended Russian Dictionary file
-l10n_zh -> Builds extended Chinese (Mandarin and Cantonese) Dictionary 
files
-man -> Builds and installs manpage with app-text/ronn
-mbrola -> Adds support for mbrola voices
->>> upstream = pkg_md.upstream()
->>> upstream
-[<_Upstream {'node': ,
- 'maintainers': [<_Maintainer 'mscl...@gmail.com'>],
- 'changelogs': ['https://github.com/espeak-ng/espeak-ng/releases.atom'],
- 'docs': [], 'bugtrackers': [],
- 'remoteids': [('espeak-ng/espeak-ng', 'github')]}>]
->>> upstream[0].maintainers[0].name
-'Reece H. Dunn'
-"""
-
-__all__ = ("MetaData",)
-__docformat__ = "epytext"
-
-# ===
-# Imports
-# ===
-
-import re
-import xml.etree.cElementTree as etree
-
-# ===
-# Classes
-# ===
-
-
-class _Maintainer:
-"""An object for representing one maintainer.
-
-@type email: str or None
-@ivar email: Maintainer's email address. Used for both Gentoo and upstream.
-@type name: str or None
-@ivar name: Maintainer's name. Used for both Gentoo and upstream.
-@type description: str or None
-@ivar description: Description of what a maintainer does. Gentoo only.
-@type restrict: str or None
-@ivar restrict: e.g. =portage-2.2 means only maintains versions
-of Portage greater than 2.2. Should be DEPEND string with < and >
-converted to  and  respectively.
-@type status: str or None
-@ivar status: If set, either 'active' or 'inactive'. Upstream only.
-"""
-
-def __init__(self, node):
-self.email = None
-self.name = None
-self.description = None
-self.restrict = node.get("restrict")
-self.status = node.get("status")
-for attr in node.iter():
-setattr(self, attr.tag, attr.text)
-
-def __repr__(self):
-return "<%s %r>" % (self.__class__.__name__, self.email)
-
-
-class _Useflag:
-"""An object for representing one USE flag.
-
-@todo: Is there any way to have a keyword option to leave in
- and  for later processing?
-@type name: str or None
-@ivar name: USE flag
-@type restrict: str or None
-@ivar restrict: e.g. =portage-2.2 means flag is only avaiable in
-versions greater than 2.2
-@type description: str
-@ivar description: description of the USE flag
-"""
-
-def __init__(self, node):
-self.name = node.get("name")
-self.restrict = node.get("restrict")
-_desc = ""
-if node.text:
-_desc = node.text
-for child in node.iter():
-# prevent duplicate text
-if child.text and child.text not in _desc:
-_desc += child.text
-if child.tail and not child.tail in _desc:
-_desc += child.tail
-# This takes care of tabs and newlines left from the file
-self.description = re.sub(r"\s+", " ", _desc)
-
-def __repr__(self):
-return "<%s %r>" % (self.__class__.__name__, self.name)
-
-
-class _Upstream:
-"""An object for representing one package's upstream.
-
-@type maintainers: list
-@ivar maintainers: L{_Maintainer} objects for each upstream maintainer
-@type changelogs: list
-@ivar changelogs: URLs to upstream's ChangeLog file in str format
-@type docs: list
-@ivar docs: Sequence of tuples containing 

[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/

2022-07-10 Thread Brian Dolbec
commit: 6fcf53bcf3579e4439623315875a4303af9af41f
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jul 10 07:47:28 2022 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jul 10 07:53:23 2022 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=6fcf53bc

package.py: code cleanup via black

Signed-off-by: Brian Dolbec  gentoo.org>

 pym/gentoolkit/package.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/pym/gentoolkit/package.py b/pym/gentoolkit/package.py
index 51bb329..612fbd3 100644
--- a/pym/gentoolkit/package.py
+++ b/pym/gentoolkit/package.py
@@ -448,7 +448,9 @@ class Package(CPV):
 @rtype: list
 """
 
-return portage.db[portage.root]["porttree"].dbapi.aux_get(self.cpv, 
["DESCRIPTION"])
+return portage.db[portage.root]["porttree"].dbapi.aux_get(
+self.cpv, ["DESCRIPTION"]
+)
 
 
 class PackageFormatter:



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/, pym/gentoolkit/

2022-07-09 Thread Brian Dolbec
commit: cc0b45fde4d333bd62da9988bc35418cd383c9ee
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jul 10 03:41:54 2022 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jul 10 03:44:38 2022 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=cc0b45fd

equery meta: Fix missing description when not in metadata.xml

Add description property to Package class.
If no description in metadata.xml, get the description from the ebuild.

Bug: https://bugs.gentoo.org/447538

Signed-off-by: Brian Dolbec  gentoo.org>

 pym/gentoolkit/equery/meta.py | 2 ++
 pym/gentoolkit/package.py | 9 +
 2 files changed, 11 insertions(+)

diff --git a/pym/gentoolkit/equery/meta.py b/pym/gentoolkit/equery/meta.py
index 2e8dc36..124f59b 100644
--- a/pym/gentoolkit/equery/meta.py
+++ b/pym/gentoolkit/equery/meta.py
@@ -331,6 +331,8 @@ def call_format_functions(best_match, matches):
 
 if QUERY_OPTS["description"]:
 desc = best_match.metadata.descriptions()
+if not desc:
+desc = best_match.description
 print_sequence(format_list(desc))
 
 if QUERY_OPTS["useflags"]:

diff --git a/pym/gentoolkit/package.py b/pym/gentoolkit/package.py
index 92bc3a3..1110bf5 100644
--- a/pym/gentoolkit/package.py
+++ b/pym/gentoolkit/package.py
@@ -437,6 +437,15 @@ class Package(CPV):
 )
 return self.cpv not in unmasked
 
+@property
+def description(self):
+"""Returns the DESCRIPTION from the ebuild
+
+@rtype: list
+"""
+
+return portage.db[portage.root]["porttree"].dbapi.aux_get(self.cpv, 
["DESCRIPTION"])
+
 
 class PackageFormatter:
 """When applied to a L{gentoolkit.package.Package} object, determine the



[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eshowkw/, pym/gentoolkit/revdep_rebuild/

2022-07-09 Thread Brian Dolbec
commit: 8c9b533343801fcab49a150c1e49dddf7bdaf4f3
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jul 10 01:21:14 2022 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jul 10 01:21:14 2022 +
URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=8c9b5333

Fix typo "informations" revdep-rebuild & eshowkw

original Author: buchner.johannes  gmx.at
Bug: https://bugs.gentoo.org/648444

Signed-off-by: Brian Dolbec  gentoo.org>

 pym/gentoolkit/eshowkw/keywords_content.py | 2 +-
 pym/gentoolkit/revdep_rebuild/analyse.py   | 2 +-
 pym/gentoolkit/revdep_rebuild/settings.py  | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/pym/gentoolkit/eshowkw/keywords_content.py 
b/pym/gentoolkit/eshowkw/keywords_content.py
index 4f9e3e1..d70be72 100644
--- a/pym/gentoolkit/eshowkw/keywords_content.py
+++ b/pym/gentoolkit/eshowkw/keywords_content.py
@@ -106,7 +106,7 @@ class keywords_content:
 return [self.__separateVersion(x, repo, revlength) for x, repo in 
packages]
 
 def __getRevision(self, cpv):
-"""Get revision informations for each package for nice further 
alignment"""
+"""Get revision information for each package for nice further 
alignment"""
 rev = port.catpkgsplit(cpv)[3]
 return rev if rev != "r0" else ""
 

diff --git a/pym/gentoolkit/revdep_rebuild/analyse.py 
b/pym/gentoolkit/revdep_rebuild/analyse.py
index c9c4a77..b176943 100644
--- a/pym/gentoolkit/revdep_rebuild/analyse.py
+++ b/pym/gentoolkit/revdep_rebuild/analyse.py
@@ -384,7 +384,7 @@ def analyse(
 ftime = current_milli_time()
 logger.debug("\ttime to complete task: %d milliseconds" % (ftime - 
stime))
 stime = current_milli_time()
-logger.info(green(" * ") + bold("Collecting dynamic linking 
informations"))
+logger.info(green(" * ") + bold("Collecting dynamic linking 
information"))
 
 libraries, la_libraries, libraries_links = collect_libraries_from_dir(
 lib_dirs, all_masks, logger

diff --git a/pym/gentoolkit/revdep_rebuild/settings.py 
b/pym/gentoolkit/revdep_rebuild/settings.py
index 5551855..2a880fd 100644
--- a/pym/gentoolkit/revdep_rebuild/settings.py
+++ b/pym/gentoolkit/revdep_rebuild/settings.py
@@ -64,7 +64,7 @@ def parse_options():
 "-V",
 "--version",
 action="version",
-help="Show version informations",
+help="Show version information",
 version="%(prog)s " + VERSION,
 )
 
@@ -116,7 +116,7 @@ def parse_options():
 help="Be more verbose (also passed to emerge command)",
 )
 parser.add_argument(
-"-d", "--debug", action="store_true", help="Print debug informations"
+"-d", "--debug", action="store_true", help="Print debug information"
 )
 
 parser.add_argument("portage_options", nargs="*")



  1   2   3   4   >