[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eclean/, man/
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: pym/gentoolkit/
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: pym/gentoolkit/eclean/
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/
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/
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/
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/
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: pym/gentoolkit/
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/
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/
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/
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/
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/
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/
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/
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/
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/
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/
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/
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/
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: pym/gentoolkit/eclean/
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: pym/gentoolkit/eclean/
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: pym/gentoolkit/eclean/
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: pym/gentoolkit/eclean/
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: pym/gentoolkit/eclean/
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/
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/
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/
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: pym/gentoolkit/eclean/
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/
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/
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/
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/
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/
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/
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/
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/
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/, ...
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/
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/
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/
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: pym/gentoolkit/enalyze/
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: pym/gentoolkit/eclean/, pym/gentoolkit/ekeyword/, pym/gentoolkit/, man/, ...
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/, ...
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: pym/gentoolkit/
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: pym/gentoolkit/equery/
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: pym/gentoolkit/equery/
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/
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: pym/gentoolkit/equery/
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: pym/gentoolkit/equery/
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: pym/gentoolkit/equery/
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/
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/
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/
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/
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/
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="*")
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/
commit: 84ffe42e52d06fd90a21c93d60dbec7c64b621cf Author: Brian Dolbec gentoo org> AuthorDate: Sun Jul 10 01:06:50 2022 + Commit: Brian Dolbec gentoo org> CommitDate: Sun Jul 10 01:06:50 2022 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=84ffe42e equery: Turn off color when piping is set Bug: https://bugs.gentoo.org/506394 Signed-off-by: Brian Dolbec gentoo.org> pym/gentoolkit/equery/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pym/gentoolkit/equery/__init__.py b/pym/gentoolkit/equery/__init__.py index cecb5be..56b2caa 100644 --- a/pym/gentoolkit/equery/__init__.py +++ b/pym/gentoolkit/equery/__init__.py @@ -228,6 +228,8 @@ 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))
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/enalyze/
commit: 0db35305e9ff05ef792ae18b9721772f4bdd3efb Author: Brian Dolbec gentoo org> AuthorDate: Sat Jul 9 23:44:44 2022 + Commit: Brian Dolbec gentoo org> CommitDate: Sat Jul 9 23:44:44 2022 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=0db35305 enalyze: Fix missing newline at end of saved rebuild files Bug: https://bugs.gentoo.org/626308 Signed-off-by: Brian Dolbec gentoo.org> pym/gentoolkit/enalyze/rebuild.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pym/gentoolkit/enalyze/rebuild.py b/pym/gentoolkit/enalyze/rebuild.py index f341680..e3396f3 100644 --- a/pym/gentoolkit/enalyze/rebuild.py +++ b/pym/gentoolkit/enalyze/rebuild.py @@ -401,6 +401,7 @@ class Rebuild(ModuleBase): encoding=_encodings["content"], ) as output: output.write("\n".join(data)) +output.write("\n") print(" - Done")
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eclean/
commit: 125142667c338eddb3777433e513fbe58e7bfd45 Author: Brian Dolbec gentoo org> AuthorDate: Sat Jul 9 22:35:33 2022 + Commit: Brian Dolbec gentoo org> CommitDate: Sat Jul 9 22:42:48 2022 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=12514266 eclean: add early return for empty DISTDIR Gentoo-bug-url: https://bugs.gentoo.org/703282 Signed-off-by: Brian Dolbec gentoo.org> pym/gentoolkit/eclean/search.py | 4 1 file changed, 4 insertions(+) diff --git a/pym/gentoolkit/eclean/search.py b/pym/gentoolkit/eclean/search.py index 365970c..60ced02 100644 --- a/pym/gentoolkit/eclean/search.py +++ b/pym/gentoolkit/eclean/search.py @@ -111,6 +111,10 @@ class DistfilesSearch: saved = {} deprecated = {} installed_included = False +# Check if DISTDIR is empty, return early +if not os.listdir(_distdir): +return clean_me, saved, deprecated + # create a big CPV->SRC_URI dict of packages # whose distfiles should be kept if (not destructive) or fetch_restricted:
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eclean/
commit: 680dd160e1e5a41f008bd1a47afa2da2eb25714f Author: Brian Dolbec gentoo org> AuthorDate: Sat Jul 9 21:41:39 2022 + Commit: Brian Dolbec gentoo org> CommitDate: Sat Jul 9 21:45:04 2022 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=680dd160 eclean: Complete migration to imported emaint code eclean-pkg now uses imported emaint binhost code to run, Properly handle --quiet option for progressbar suppression from emaint. Keeps the standalone emaint binhost subprocess call as backup. Closes: https://bugs.gentoo.org/688550 Signed-off-by: Brian Dolbec gentoo.org> pym/gentoolkit/eclean/clean.py| 5 ++-- pym/gentoolkit/eclean/cli.py | 2 +- pym/gentoolkit/eclean/pkgindex.py | 56 ++- 3 files changed, 30 insertions(+), 33 deletions(-) diff --git a/pym/gentoolkit/eclean/clean.py b/pym/gentoolkit/eclean/clean.py index a6358a4..37a042a 100644 --- a/pym/gentoolkit/eclean/clean.py +++ b/pym/gentoolkit/eclean/clean.py @@ -19,8 +19,9 @@ class CleanUp: or bypassing/ignoring """ -def __init__(self, controller): +def __init__(self, controller, quiet): self.controller = controller +self.quiet = quiet def clean_dist(self, clean_dict): """Calculate size of each entry for display, prompt user if needed, @@ -64,7 +65,7 @@ class CleanUp: # emaint is not yet importable so call it # print a blank line here for separation print() -clean_size += index_control.call_emaint() +clean_size += index_control.clean_pkgs_index(self.quiet) # return total size of deleted or to delete files return clean_size diff --git a/pym/gentoolkit/eclean/cli.py b/pym/gentoolkit/eclean/cli.py index e3bc21a..23c7f3b 100644 --- a/pym/gentoolkit/eclean/cli.py +++ b/pym/gentoolkit/eclean/cli.py @@ -555,7 +555,7 @@ def doAction(action, options, exclude={}, output=None): ) # initialize our cleaner -cleaner = CleanUp(output.progress_controller) +cleaner = CleanUp(output.progress_controller, options["quiet"]) # actually clean files if something was found if clean_me: diff --git a/pym/gentoolkit/eclean/pkgindex.py b/pym/gentoolkit/eclean/pkgindex.py index 617b437..d0878a1 100644 --- a/pym/gentoolkit/eclean/pkgindex.py +++ b/pym/gentoolkit/eclean/pkgindex.py @@ -11,6 +11,11 @@ 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: @@ -32,37 +37,36 @@ class PkgIndex: @sets: self.binhost to BinhostHandler class @rtype: boolean """ -# About noqa below: I don't understand how this code can run at all. -# TODO: verify soundness try: -self.emaint_control = Modules() # noqa +self.emaint_control = Modules() self.binhost = self.emaint_control._get_class("binhost") -except InvalidModuleName as er: # noqa +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 _load_modules(self): -"""Import the emaint modules and report the success/fail of them""" -try: -from emaint.module import Modules # noqa -from emaint.main import TaskHandler # noqa -except ImportError: -return False -return True +def clean_pkgs_index(self, quiet): +"""This will clean the binpkgs packages index file -def clean_pkgs_index( -self, -): -"""This will clean the binpkgs packages index file""" -go = self._load_modules() -if go: -if self.get_emaint_binhost(): -self.taskmaster = TaskHandler(show_progress_bar=True) # noqa -tasks = [self.binhost] -self.taskmaster.run_tasks(tasks) +@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("\n", clean_size, "Packages Index", file_, "Index") +return clean_size def call_emaint(self): """Run the stand alone emaint script from @@
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/ekeyword/
commit: 04e8fd5252c9bc1efad66fdb8cb40d376550d580 Author: Zac Medico gentoo org> AuthorDate: Tue Dec 29 02:00:42 2020 + Commit: Brian Dolbec gentoo org> CommitDate: Sat Jul 9 19:46:35 2022 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=04e8fd52 ekeyword: remove .ebuild file suffix requirement (bug 762331) We'd like to use ekeyword in a git merge driver implementation, but the files that the driver will pass to ekeyword do not necessarily have a .ebuild suffix. Therefore, it would be handy to be able to distinguish ebuild arguments some other way. If the ignorable_arg(arg) function returns False and os.path.isfile(arg) returns True, then simply assume that the argument is an ebuild. Bug: https://bugs.gentoo.org/762331 Signed-off-by: Zac Medico gentoo.org> Closes: https://github.com/gentoo/gentoolkit/pull/13 Signed-off-by: Brian Dolbec gentoo.org> pym/gentoolkit/ekeyword/ekeyword.py | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pym/gentoolkit/ekeyword/ekeyword.py b/pym/gentoolkit/ekeyword/ekeyword.py index 7d3a1ef..4d017d4 100755 --- a/pym/gentoolkit/ekeyword/ekeyword.py +++ b/pym/gentoolkit/ekeyword/ekeyword.py @@ -253,7 +253,7 @@ def process_content( else: # Chop the full path and the .ebuild suffix. -disp_name = os.path.basename(ebuild)[:-7] +disp_name, _, _ = os.path.basename(ebuild).partition(".ebuild") def logit(msg): print("%s: %s" % (disp_name, msg)) @@ -430,7 +430,9 @@ def args_to_work(args, arch_status=None, _repo=None, quiet=0): last_todo_arches = [] for arg in args: -if arg.endswith(".ebuild"): +if ignorable_arg(arg, quiet=quiet): +pass +elif os.path.isfile(arg): if not todo_arches: todo_arches = last_todo_arches work.append([arg, todo_arches]) @@ -440,7 +442,7 @@ def args_to_work(args, arch_status=None, _repo=None, quiet=0): op = arg_to_op(arg) if not arch_status or op.arch in arch_status: todo_arches.append(op) -elif not ignorable_arg(arg, quiet=quiet): +else: raise ValueError("unknown arch/argument: %s" % arg) if todo_arches:
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/
commit: 3851c6ea2fe93ee1d190adc13f3cfaef0901c982 Author: Sam James gentoo org> AuthorDate: Sat Jul 9 05:17:34 2022 + Commit: Sam James gentoo org> CommitDate: Sat Jul 9 05:17:34 2022 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=3851c6ea equery: run black Signed-off-by: Sam James gentoo.org> pym/gentoolkit/equery/depends.py | 47 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/pym/gentoolkit/equery/depends.py b/pym/gentoolkit/equery/depends.py index 93f0ec1..f65e846 100644 --- a/pym/gentoolkit/equery/depends.py +++ b/pym/gentoolkit/equery/depends.py @@ -19,6 +19,7 @@ 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 + # === # Globals # === @@ -69,18 +70,18 @@ class DependPrinter: if pkg is None: return -if CONFIG['verbose']: -print (PackageFormatter( -pkg, -do_format=True, -custom_format=QUERY_OPTS["package_format"] -)) +if CONFIG["verbose"]: +print( +PackageFormatter( +pkg, do_format=True, custom_format=QUERY_OPTS["package_format"] +) +) else: -print (PackageFormatter( -pkg, -do_format=False, -custom_format=QUERY_OPTS["package_format"] -)) +print( +PackageFormatter( +pkg, do_format=False, custom_format=QUERY_OPTS["package_format"] +) +) def format_depend(self, dep, dep_is_displayed): """Format a dependency for printing. @@ -107,24 +108,23 @@ class DependPrinter: use_conditional = " & ".join( pp.useflag(u) for u in mdep.use_conditional.split() ) -if mdep.operator == '=*': -formatted_dep = '=%s*' % str(mdep.cpv) +if mdep.operator == "=*": +formatted_dep = "=%s*" % str(mdep.cpv) else: formatted_dep = mdep.operator + str(mdep.cpv) if mdep.slot: -formatted_dep += pp.emph(':') + pp.slot(mdep.slot) +formatted_dep += pp.emph(":") + pp.slot(mdep.slot) if mdep.sub_slot: -formatted_dep += pp.slot('/') + pp.slot(mdep.sub_slot) +formatted_dep += pp.slot("/") + pp.slot(mdep.sub_slot) if mdep.use: -useflags = pp.useflag(','.join(mdep.use.tokens)) -formatted_dep += (pp.emph('[') + useflags + pp.emph(']')) +useflags = pp.useflag(",".join(mdep.use.tokens)) +formatted_dep += pp.emph("[") + useflags + pp.emph("]") if dep_is_displayed: indent = indent + " " * len(str(dep.cpv)) -self.print_fn(indent, '', use_conditional, formatted_dep) +self.print_fn(indent, "", use_conditional, formatted_dep) else: -self.print_fn(indent, \ -str(dep.cpv), use_conditional, formatted_dep) +self.print_fn(indent, str(dep.cpv), use_conditional, formatted_dep) # = @@ -174,7 +174,7 @@ def parse_module_options(module_opts): QUERY_OPTS["include_masked"] = True elif opt in ("-D", "--indirect"): QUERY_OPTS["only_direct"] = False -elif opt in ('-F', '--format'): +elif opt in ("-F", "--format"): QUERY_OPTS["package_format"] = posarg elif opt in ("--depth"): if posarg.isdigit(): @@ -190,9 +190,8 @@ def parse_module_options(module_opts): def main(input_args): """Parse input and run the program""" -short_opts = "hadDF:" # -d, --direct was old option for default action -long_opts = ('help', 'all-packages', 'direct', 'indirect', \ -'format', 'depth=') +short_opts = "hadDF:" # -d, --direct was old option for default action +long_opts = ("help", "all-packages", "direct", "indirect", "format", "depth=") try: module_opts, queries = gnu_getopt(input_args, short_opts, long_opts)
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/, man/
commit: 6a9be2d05751558d7d34e900dfc06a721278b447 Author: Martin Matous matous dev> AuthorDate: Sat Jul 9 03:05:58 2022 + Commit: Brian Dolbec gentoo org> CommitDate: Sat Jul 9 03:10:24 2022 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=6a9be2d0 equery: update linguas->l10n option Signed-off-by: Martin Matous matous.dev> Signed-off-by: Brian Dolbec gentoo.org> man/equery.1 | 4 ++-- pym/gentoolkit/equery/uses.py | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/man/equery.1 b/man/equery.1 index 83aba0d..ee7ad7b 100644 --- a/man/equery.1 +++ b/man/equery.1 @@ -547,9 +547,9 @@ Display all package versions. Without this option, \fBequery\fP will choose the .br Show the forced and masked USE flags .HP -.B \-i, \-\-ignore\-linguas +.B \-i, \-\-ignore\-l10n .br -Do not show the linguas USE flags +Do not show the l10n USE flags .P .I R "EXAMPLES" ":" .EX diff --git a/pym/gentoolkit/equery/uses.py b/pym/gentoolkit/equery/uses.py index 7af7f43..89f011c 100644 --- a/pym/gentoolkit/equery/uses.py +++ b/pym/gentoolkit/equery/uses.py @@ -215,8 +215,7 @@ def get_output_descriptions(pkg, global_usedesc): if QUERY_OPTS["ignore_l10n"]: for a in usevar[:]: -# TODO: Remove linguas after transition to l10n is complete -if a.startswith("l10n_") or a.startswith("linguas_"): +if a.startswith("l10n_"): usevar.remove(a) if pkg.is_installed():
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/, pym/gentoolkit/
commit: c33468ba1d8ddd5a69516e8a39796db8de08ff63 Author: Oskari Pirhonen gmail com> AuthorDate: Wed Jun 8 05:51:35 2022 + Commit: Brian Dolbec gentoo org> CommitDate: Sat Jul 9 02:40:24 2022 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=c33468ba Add -f/--forced-masked to equery uses Option to include forced and masked USE flags in `equery uses` output. - Marked with F / M in verbose/normal output - Marked with (+flag) / (-flag) in non-verbose/piped output Signed-off-by: Oskari Pirhonen gmail.com> Signed-off-by: Brian Dolbec gentoo.org> pym/gentoolkit/equery/uses.py | 62 ++- pym/gentoolkit/flag.py| 36 +++-- 2 files changed, 77 insertions(+), 21 deletions(-) diff --git a/pym/gentoolkit/equery/uses.py b/pym/gentoolkit/equery/uses.py index 7c90b90..7af7f43 100644 --- a/pym/gentoolkit/equery/uses.py +++ b/pym/gentoolkit/equery/uses.py @@ -31,7 +31,11 @@ from gentoolkit.flag import get_flags, reduce_flags # Globals # === -QUERY_OPTS = {"all_versions": False, "ignore_l10n": False} +QUERY_OPTS = { +"all_versions": False, +"forced_masked": False, +"ignore_l10n": False, +} # = # Functions @@ -56,6 +60,7 @@ def print_help(with_description=True): ( (" -h, --help", "display this help message"), (" -a, --all", "include all package versions"), +(" -f, --forced-masked", "include forced/masked USE flags"), (" -i, --ignore-l10n", "don't show l10n USE flags"), ) ) @@ -67,8 +72,14 @@ def display_useflags(output): @type output: list @param output: [(inuse, inused, flag, desc, restrict), ...] -inuse (int) = 0 or 1; if 1, flag is set in make.conf -inused (int) = 0 or 1; if 1, package is installed with flag enabled +inuse (int) = 0, 1, 2, 3; +if 1, flag is set in make.conf; +if 2, flag is masked; +if 3, flag is forced +inused (int) = 0, 1, 2, 3; +if 1, package is installed with flag enabled; +if 2, flag is masked; +if 3, flag is forced flag (str) = the name of the USE flag desc (str) = the flag's description restrict (str) = corresponds to the text of restrict in metadata @@ -80,7 +91,8 @@ def display_useflags(output): twrap.width = CONFIG["termWidth"] twrap.subsequent_indent = " " * (maxflag_len + 8) -markers = ("-", "+") +markers = ("-", "+", "M", "F") +# Colors for masked/forced = unset/set (mod 2) color = (partial(pp.useflag, enabled=False), partial(pp.useflag, enabled=True)) for in_makeconf, in_installed, flag, desc, restrict in output: if CONFIG["verbose"]: @@ -92,7 +104,7 @@ def display_useflags(output): else: flag_name += " %s %s" % (markers[in_makeconf], markers[in_installed]) -flag_name += " " + color[in_makeconf](flag.ljust(maxflag_len)) +flag_name += " " + color[in_makeconf % 2](flag.ljust(maxflag_len)) flag_name += " : " # Strip initial whitespace at the start of the description @@ -119,7 +131,11 @@ def display_useflags(output): twrap.initial_indent = flag_name print(twrap.fill("")) else: -pp.uprint(markers[in_makeconf] + flag) +# Match emerge -v output for forced/masked flags +if in_makeconf > 1: +pp.uprint("(" + markers[in_makeconf % 2] + flag + ")") +else: +pp.uprint(markers[in_makeconf] + flag) def get_global_useflags(): @@ -184,7 +200,16 @@ def get_output_descriptions(pkg, global_usedesc): else: local_usedesc = pkg.metadata.use() -iuse, final_use = get_flags(pkg.cpv, final_setting=True) +useforced = [] +usemasked = [] +if QUERY_OPTS["forced_masked"]: +iuse, final_use, useforced, usemasked = get_flags( +pkg.cpv, final_setting=True, include_forced_masked=True +) +else: +iuse, final_use = get_flags( +pkg.cpv, final_setting=True, include_forced_masked=False +) usevar = reduce_flags(iuse) usevar.sort() @@ -202,8 +227,8 @@ def get_output_descriptions(pkg, global_usedesc): # store (inuse, inused, flag, desc, restrict) output = [] for flag in usevar: -inuse = False -inused = False +inuse = 0 +inused = 0 local_use = None for use in local_usedesc: @@ -226,9 +251,18 @@ def get_output_descriptions(pkg, global_usedesc): restrict = "" if flag in final_use: -inuse = True +inuse = 1 +if flag in useforced: +inuse = 3 +elif flag in usemasked: +
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/revdep_rebuild/
commit: 635e0b9f8b96217070eb48a6888ac5e1c46f8822 Author: Mike Gilbert gentoo org> AuthorDate: Sat Jul 9 01:26:19 2022 + Commit: Mike Gilbert gentoo org> CommitDate: Sat Jul 9 01:26:19 2022 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=635e0b9f revdep-rebuild: set up a child logger with propagate = False This prevents log messages from being emitted more than once, especially by the root level loggger. Bug: https://bugs.gentoo.org/838406 Signed-off-by: Mike Gilbert gentoo.org> pym/gentoolkit/revdep_rebuild/rebuild.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pym/gentoolkit/revdep_rebuild/rebuild.py b/pym/gentoolkit/revdep_rebuild/rebuild.py index 75e209d..16d07b8 100644 --- a/pym/gentoolkit/revdep_rebuild/rebuild.py +++ b/pym/gentoolkit/revdep_rebuild/rebuild.py @@ -44,7 +44,8 @@ __productname__ = "revdep-ng" def init_logger(settings): """Creates and iitializes our logger according to the settings""" -logger = logging.getLogger() +logger = logging.getLogger(__name__) +logger.propagate = False log_handler = logging.StreamHandler(sys.stdout) log_fmt = logging.Formatter("%(msg)s") log_handler.setFormatter(log_fmt)
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eshowkw/
commit: 707b0340d69da92d6e3c72892c190a1e3fd0c2e1 Author: Mike Gilbert gentoo org> AuthorDate: Sat Jul 9 01:35:41 2022 + Commit: Mike Gilbert gentoo org> CommitDate: Sat Jul 9 01:35:41 2022 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=707b0340 eshowkw: make black happy Signed-off-by: Mike Gilbert gentoo.org> pym/gentoolkit/eshowkw/display_pretty.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pym/gentoolkit/eshowkw/display_pretty.py b/pym/gentoolkit/eshowkw/display_pretty.py index 82fd446..9a769f9 100644 --- a/pym/gentoolkit/eshowkw/display_pretty.py +++ b/pym/gentoolkit/eshowkw/display_pretty.py @@ -125,6 +125,6 @@ class string_rotator: if x.find("+ -") != -1: x = x.replace(" ", "-") # strip all chars and remove empty lines -if not strip or len(x.strip(" |-")) > 0 or '-' in x: +if not strip or len(x.strip(" |-")) > 0 or "-" in x: tmp.append(x) return tmp
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eshowkw/
commit: 84fc1ec271328e064da8b2537112b724e5a4c3b5 Author: Brian Dolbec gentoo org> AuthorDate: Wed Jun 8 20:06:01 2022 + Commit: Brian Dolbec gentoo org> CommitDate: Wed Jun 8 20:06:01 2022 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=84fc1ec2 eshowkw: Fix missing dash for -r? ebuilds in versionlist output Turns out the real issue causing the row alignment issue was this. The code inadvertently dropped the dash display which in turn caused the row alignment issue. Reverts: 4695379c1921865d7763669580ac909ea94db90d Gentoo-bug-url: https://bugs.gentoo.org/503366 Signed-off-by: Brian Dolbec gentoo.org> pym/gentoolkit/eshowkw/__init__.py | 2 +- pym/gentoolkit/eshowkw/display_pretty.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pym/gentoolkit/eshowkw/__init__.py b/pym/gentoolkit/eshowkw/__init__.py index c33c47a..ba6c076 100644 --- a/pym/gentoolkit/eshowkw/__init__.py +++ b/pym/gentoolkit/eshowkw/__init__.py @@ -49,7 +49,7 @@ def process_display(package, keywords, dbapi): content.extend(sep) content.extend(keywords.extra) header_length = keywords.length -content_length = portdata.version_length - 1 +content_length = portdata.version_length display(content, header, header_length, content_length, portdata.cp, topper) diff --git a/pym/gentoolkit/eshowkw/display_pretty.py b/pym/gentoolkit/eshowkw/display_pretty.py index 0629d7e..82fd446 100644 --- a/pym/gentoolkit/eshowkw/display_pretty.py +++ b/pym/gentoolkit/eshowkw/display_pretty.py @@ -125,6 +125,6 @@ class string_rotator: if x.find("+ -") != -1: x = x.replace(" ", "-") # strip all chars and remove empty lines -if not strip or len(x.strip(" |-")) > 0: +if not strip or len(x.strip(" |-")) > 0 or '-' in x: tmp.append(x) return tmp
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eshowkw/
commit: 4695379c1921865d7763669580ac909ea94db90d Author: Brian Dolbec gentoo org> AuthorDate: Wed Jun 8 01:16:13 2022 + Commit: Brian Dolbec gentoo org> CommitDate: Wed Jun 8 01:16:13 2022 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=4695379c eshowkw: Correctly fix row alignment issue bug 503366 Reverts: 42cf522c06080d Changes the content_length correctly for versionlist output Signed-off-by: Brian Dolbec gentoo.org> pym/gentoolkit/eshowkw/__init__.py | 2 +- pym/gentoolkit/eshowkw/display_pretty.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/pym/gentoolkit/eshowkw/__init__.py b/pym/gentoolkit/eshowkw/__init__.py index ba6c076..c33c47a 100644 --- a/pym/gentoolkit/eshowkw/__init__.py +++ b/pym/gentoolkit/eshowkw/__init__.py @@ -49,7 +49,7 @@ def process_display(package, keywords, dbapi): content.extend(sep) content.extend(keywords.extra) header_length = keywords.length -content_length = portdata.version_length +content_length = portdata.version_length - 1 display(content, header, header_length, content_length, portdata.cp, topper) diff --git a/pym/gentoolkit/eshowkw/display_pretty.py b/pym/gentoolkit/eshowkw/display_pretty.py index 47d18d1..0629d7e 100644 --- a/pym/gentoolkit/eshowkw/display_pretty.py +++ b/pym/gentoolkit/eshowkw/display_pretty.py @@ -29,8 +29,7 @@ def display( # data corner_image = ["".ljust(plain_width) for x in range(rotated_height)] if toplist != "archlist": -# DON'T add the first list item which is: "---", it will throw the row alignment off -corner_image.extend(plain_list[1:]) +corner_image.extend(plain_list) data_printout = [ "%s%s" % (x, y) for x, y in zip_longest(corner_image, rotated_list, fillvalue=corner_image[0])
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eshowkw/
commit: 42cf522c06080d3b92d7c87d3e00d93d3a7e1a7f Author: Brian Dolbec gentoo org> AuthorDate: Tue Jun 7 23:55:35 2022 + Commit: Brian Dolbec gentoo org> CommitDate: Wed Jun 8 00:09:54 2022 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=42cf522c eshowkw: Fix bug 503366 row alignment issue The first element in the plain_list was a "--" string. This was causing the corner image to throw off the row alignment between the two columns. This fix corrects the alignment, but removes the "--" above the keywords to complete the header seperator line. Gentoo-bug-url: https://bugs.gentoo.org/503366 Signed-off-by: Brian Dolbec gentoo.org> pym/gentoolkit/eshowkw/display_pretty.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pym/gentoolkit/eshowkw/display_pretty.py b/pym/gentoolkit/eshowkw/display_pretty.py index d58036a..47d18d1 100644 --- a/pym/gentoolkit/eshowkw/display_pretty.py +++ b/pym/gentoolkit/eshowkw/display_pretty.py @@ -1,4 +1,4 @@ -# vim:fileencoding=utf-8 +# vim:fileencoding=utf-8 # Copyright 2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 @@ -29,7 +29,8 @@ def display( # data corner_image = ["".ljust(plain_width) for x in range(rotated_height)] if toplist != "archlist": -corner_image.extend(plain_list) +# DON'T add the first list item which is: "---", it will throw the row alignment off +corner_image.extend(plain_list[1:]) data_printout = [ "%s%s" % (x, y) for x, y in zip_longest(corner_image, rotated_list, fillvalue=corner_image[0])
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eclean/
commit: b3251b763901ec5a5d7690fd8ec2885629104ee2 Author: Yixun Lan gentoo org> AuthorDate: Wed Jun 1 10:23:49 2022 + Commit: Yixun Lan gentoo org> CommitDate: Wed Jun 1 10:24:41 2022 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=b3251b76 fix missing short option "-u" for --unique-use Signed-off-by: Yixun Lan 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 c129d5e..e3bc21a 100644 --- a/pym/gentoolkit/eclean/cli.py +++ b/pym/gentoolkit/eclean/cli.py @@ -397,7 +397,7 @@ def parseArgs(options={}): options["changed-deps"] = True elif o in ("-i", "--ignore-failure"): options["ignore-failure"] = True -elif o in ("--unique-use"): +elif o in ("-u", "--unique-use"): options["unique-use"] = True else: return_code = False
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eclean/
commit: 2fffbd450df2443bbd671f7ec760051ce3c930e9 Author: Yixun Lan gentoo org> AuthorDate: Wed May 25 08:08:09 2022 + Commit: Yixun Lan gentoo org> CommitDate: Sat May 28 15:24:32 2022 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=2fffbd45 implement --unique-use option for eclean-pkg this will help to clean duplicated binpkg which has exact same USEs flags enabled, and it will choose the more recent version according to BUILD_TIME by default Closes: https://bugs.gentoo.org/727576 Closes: https://github.com/gentoo/gentoolkit/pull/20 Signed-off-by: Yixun Lan gentoo.org> pym/gentoolkit/eclean/cli.py| 14 +- pym/gentoolkit/eclean/search.py | 26 ++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/pym/gentoolkit/eclean/cli.py b/pym/gentoolkit/eclean/cli.py index 2ad2ae9..c129d5e 100644 --- a/pym/gentoolkit/eclean/cli.py +++ b/pym/gentoolkit/eclean/cli.py @@ -252,6 +252,11 @@ def printUsage(_error=None, help=None): + " - ignore failure to locate PKGDIR", file=out, ) +print( +yellow(" -u, --unique-use") ++ " - keep unique packages which have no duplicated USE", +file=out, +) print(file=out) if _error in ("distfiles-options", "merged-distfiles-options") or help in ( "all", @@ -392,6 +397,8 @@ def parseArgs(options={}): options["changed-deps"] = True elif o in ("-i", "--ignore-failure"): options["ignore-failure"] = True +elif o in ("--unique-use"): +options["unique-use"] = True else: return_code = False # sanity check of --deep only options: @@ -431,7 +438,11 @@ def parseArgs(options={}): getopt_options["short"]["distfiles"] = "fs:" getopt_options["long"]["distfiles"] = ["fetch-restricted", "size-limit="] getopt_options["short"]["packages"] = "i" -getopt_options["long"]["packages"] = ["ignore-failure", "changed-deps"] +getopt_options["long"]["packages"] = [ +"ignore-failure", +"changed-deps", +"unique-use", +] # set default options, except 'nocolor', which is set in main() options["interactive"] = False options["pretend"] = False @@ -446,6 +457,7 @@ def parseArgs(options={}): options["verbose"] = False options["changed-deps"] = False options["ignore-failure"] = False +options["unique-use"] = False # 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.. diff --git a/pym/gentoolkit/eclean/search.py b/pym/gentoolkit/eclean/search.py index cb695c0..365970c 100644 --- a/pym/gentoolkit/eclean/search.py +++ b/pym/gentoolkit/eclean/search.py @@ -560,6 +560,7 @@ def findPackages( # Dictionary of binary packages to clean. Organized as cpv->[pkgs] in order # to support FEATURES=binpkg-multi-instance. dead_binpkgs = {} +keep_binpkgs = {} bin_dbapi = portage.binarytree(pkgdir=pkgdir, settings=var_dbapi.settings).dbapi for cpv in bin_dbapi.cpv_all(): @@ -575,6 +576,28 @@ def findPackages( if mtime >= time_limit: continue +# Exclude if binpkg has exact same USEs +if not destructive and options["unique-use"]: +keys = ("CPV", "EAPI", "USE") +binpkg_metadata = dict(zip(keys, bin_dbapi.aux_get(cpv, keys))) +cpv_key = "_".join(binpkg_metadata[key] for key in keys) +if cpv_key in keep_binpkgs: +old_cpv = keep_binpkgs[cpv_key] +# compare BUILD_TIME, keep the new one +old_time = int(bin_dbapi.aux_get(old_cpv, ["BUILD_TIME"])[0]) +new_time = int(bin_dbapi.aux_get(cpv, ["BUILD_TIME"])[0]) +drop_cpv = old_cpv if new_time >= old_time else cpv + +binpkg_path = bin_dbapi.bintree.getname(drop_cpv) +dead_binpkgs.setdefault(drop_cpv, []).append(binpkg_path) + +if new_time >= old_time: +keep_binpkgs[cpv_key] = cpv +else: +continue +else: +keep_binpkgs[cpv_key] = cpv + # Exclude if binpkg exists in the porttree and not --deep if not destructive and port_dbapi.cpv_exists(cpv): if not options["changed-deps"]: @@ -605,6 +628,9 @@ def findPackages( if buildtime == bin_dbapi.aux_get(cpv, ["BUILD_TIME"])[0]: continue +if not destructive and options["unique-use"]: +del keep_binpkgs[cpv_key] + binpkg_path = bin_dbapi.bintree.getname(cpv) dead_binpkgs.setdefault(cpv, []).append(binpkg_path)
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/, man/, pym/gentoolkit/imlate/, pym/gentoolkit/equery/
commit: ac589ba6708f62d41ac6684c5602a45e2c625766 Author: Matt Turner gentoo org> AuthorDate: Wed Mar 16 18:33:57 2022 + Commit: Matt Turner gentoo org> CommitDate: Wed Mar 16 19:02:13 2022 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=ac589ba6 Remove remnants of herds support Signed-off-by: Matt Turner gentoo.org> man/epkginfo.1 | 24 - man/equery.1| 10 ++-- man/imlate.1| 3 -- pym/gentoolkit/equery/meta.py | 35 -- pym/gentoolkit/imlate/imlate.py | 45 - pym/gentoolkit/metadata.py | 105 ++-- 6 files changed, 38 insertions(+), 184 deletions(-) diff --git a/man/epkginfo.1 b/man/epkginfo.1 index 4000ab4..6c88de9 100644 --- a/man/epkginfo.1 +++ b/man/epkginfo.1 @@ -12,22 +12,16 @@ examples, see \fBman equery\fP. .SH "EXAMPLES" .nf - * app\-portage/gentoolkit [portage] -Location:/usr/portage/app\-portage/gentoolkit -Herd:tools\-portage (tools\-port...@gentoo.org) -Maintainer: None specified + * app-portage/gentoolkit [gentoo] +Maintainer: tools-port...@gentoo.org (Gentoo Portage tools team) Upstream:None specified -Keywords:0.2.4.5: alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 - s390 sh sparc x86 \-x86\-fbsd -Keywords:0.3.0_rc5: ~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips -~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc\-fbsd -~x86\-fbsd -Keywords:0.3.0_rc6: ~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips -~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc\-fbsd -~x86\-fbsd -Keywords:0.3.0_rc7: ~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips -~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc\-fbsd -~x86\-fbsd +Homepage:https://wiki.gentoo.org/wiki/Project:Portage-Tools +Location:/var/db/repos/gentoo/app-portage/gentoolkit +Keywords:0.5.0-r3:0: +Keywords:0.5.1-r1:0: amd64 arm arm64 hppa ppc ppc64 sparc x86 ~alpha ~amd64-linux ~ia64 ~m68k ~mips ~ppc-macos ~riscv ~s390 + ~sparc-solaris ~sparc64-solaris ~x64-cygwin ~x64-macos ~x64-solaris ~x86-linux ~x86-solaris +Keywords::0: +License: GPL-2 .fi .SH "AUTHORS" diff --git a/man/equery.1 b/man/equery.1 index f7a5deb..9cbe408 100644 --- a/man/equery.1 +++ b/man/equery.1 @@ -465,10 +465,6 @@ https://devmanual.gentoo.org/ebuild-writing/misc-files/metadata/index.html .br Show an extended package description. .HP -.B \-H, \-\-herd -.br -Show the herd(s) for the package. When not piping and not passing \fB\-\-quiet\fP as a global option, also show the herd's email address. (shown by default) -.HP .B \-k, \-\-keywords .br Show keywords for all matching versions. \fBkeywords\fP does not list all keywords for all versions. Instead, it filters the list to make it easier to spot versions that need bumping or are okay to remove from the tree. It filters by slot. For example: @@ -501,7 +497,7 @@ Dump the plain XML file to the screen. equery meta gnucash .EE .br -Show general information about maintainership, including herd, maintainer and upstream. +Show general information about maintainership, including maintainer and upstream. .EX .HP equery meta \-\-description app\-misc/screen @@ -510,10 +506,10 @@ equery meta \-\-description app\-misc/screen See if the package maintainer has provided an extended description. .EX .HP -equery \-N meta \-H gnome |grep \-o \-\-color=never '[^( ]*@gentoo.org' +equery \-N meta \-H gnome-base/gnome |grep \-o \-\-color=never '[^( ]*@gentoo.org' .EE .br -Extract the herd's email address to let them know they're doing a great job. Remember, bug reports should go to bugs.gentoo.org. The above example will extract one or more emails if available, or return nothing if the herd is \fBno\-herd\fP. +Extract the maintainers's email address to let them know they're doing a great job. Remember, bug reports should go to bugs.gentoo.org. The above example will extract one or more emails if available. .SS .BI "size (s) [OPTIONS] " "PKG" diff --git a/man/imlate.1 b/man/imlate.1 index 7d8cbe8..8e2430b 100644 --- a/man/imlate.1 +++ b/man/imlate.1 @@ -36,9 +36,6 @@ just show keyword candidates (e.g. \-s and \-k is the default result) [default: .B \-M MAINTAINER, \-\-maintainer=MAINTAINER Show only packages from the specified maintainer .TP -.B \-H HERD, \-\-herd=HERD -Show only packages from the specified herd -.TP .B \-C CATEGORIES, \-\-category=CATEGORIES, \-\-categories=CATEGORIES just check in the specified category/categories (comma separated) [default: none] .SH "AUTHORS" diff --git a/pym/gentoolkit/equery/meta.py b/pym/gentoolkit/equery/meta.py index 7747893..4cf4bc6 100644 --- a/pym/gentoolkit/equery/meta.py +++ b/pym/gentoolkit/equery/meta.py @@ -30,7 +30,6 @@ from gentoolkit.query import
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/imlate/
commit: fa1b6d8bab551576d0d493176c8dbac2cf81db48 Author: Matt Turner gentoo org> AuthorDate: Wed Mar 16 18:22:58 2022 + Commit: Matt Turner gentoo org> CommitDate: Wed Mar 16 18:22:58 2022 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=fa1b6d8b imlate: Remove 'experimental' code Signed-off-by: Matt Turner gentoo.org> pym/gentoolkit/imlate/imlate.py | 5 - 1 file changed, 5 deletions(-) diff --git a/pym/gentoolkit/imlate/imlate.py b/pym/gentoolkit/imlate/imlate.py index 87b8ef1..b553849 100755 --- a/pym/gentoolkit/imlate/imlate.py +++ b/pym/gentoolkit/imlate/imlate.py @@ -521,10 +521,6 @@ def main(): default=None, ) -# # EXPERIMENTAL -# parser.add_option( "-e", "--experimental", dest = "experimental", action = "store_true", default = False, -# help = "enables experimental functions/features (have a look for # EXPERIMENTAL comments in the source) [default: %default]" ) - parser.add_option( "-C", "--category", @@ -577,7 +573,6 @@ def main(): conf["STABLE"] = options.stable conf["KEYWORD"] = options.keyword -# conf["EXPERIMENTAL"] = options.experimental conf["CATEGORIES"] = options.categories conf["MAINTAINER"] = options.maintainer
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eclean/
commit: 76c188b5189375b3b3b7c92f31491990e29a1669 Author: Sam James gentoo org> AuthorDate: Wed Feb 9 10:47:54 2022 + Commit: Sam James gentoo org> CommitDate: Wed Feb 9 10:48:13 2022 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=76c188b5 */*: reformat with latest Black 22.1.0 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 bb6deeb..2ad2ae9 100644 --- a/pym/gentoolkit/eclean/cli.py +++ b/pym/gentoolkit/eclean/cli.py @@ -309,7 +309,7 @@ def parseSize(size): @raise ParseArgsException: in case of failure """ -units = {"G": (1024 ** 3), "M": (1024 ** 2), "K": 1024, "B": 1} +units = {"G": (1024**3), "M": (1024**2), "K": 1024, "B": 1} try: match = re.match(r"^(?P\d+)(?P[GMKBgmkb])?$", size) size = int(match.group("value"))
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/
commit: 813c8e3a4853bedc50d7d4176282c5f0bacde31e Author: Wolfgang E. Sanyer gmail com> AuthorDate: Tue Sep 21 20:50:35 2021 + Commit: Matt Turner gentoo org> CommitDate: Tue Sep 21 21:00:18 2021 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=813c8e3a Fix flake F401 'imported but unused' error Closes: https://github.com/gentoo/gentoolkit/pull/17 Signed-off-by: Wolfgang E. Sanyer gmail.com> Signed-off-by: Matt Turner gentoo.org> pym/gentoolkit/helpers.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/pym/gentoolkit/helpers.py b/pym/gentoolkit/helpers.py index 15d959d..72c5d13 100644 --- a/pym/gentoolkit/helpers.py +++ b/pym/gentoolkit/helpers.py @@ -32,9 +32,6 @@ from portage import _encodings, _unicode_encode from gentoolkit import pprinter as pp from gentoolkit import errors -from gentoolkit.atom import Atom -from gentoolkit.cpv import CPV -from gentoolkit.versionmatch import VersionMatch # This has to be imported below to stop circular import. # from gentoolkit.package import Package
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/, man/
commit: 55170b5be88df6d5d8f6e07ecb39fc1a86d3426a Author: Matt Turner gentoo org> AuthorDate: Fri Jul 16 21:21:44 2021 + Commit: Matt Turner gentoo org> CommitDate: Fri Jul 16 21:21:44 2021 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=55170b5b equery: Remove leftovers from 'changes' removal Closes: https://bugs.gentoo.org/796986 Fixes: bcb8158 ("equery: Remove 'changes' subcommand") Signed-off-by: Matt Turner gentoo.org> man/equery.1 | 48 --- pym/gentoolkit/equery/__init__.py | 1 - 2 files changed, 49 deletions(-) diff --git a/man/equery.1 b/man/equery.1 index 3b85bee..f7a5deb 100644 --- a/man/equery.1 +++ b/man/equery.1 @@ -87,54 +87,6 @@ Tell .B emerge to reinstall or update any package that installed a file matching a regular expression. -.SS -.BI "changes (c) [OPTIONS] " "PKG" -Display the Gentoo ChangeLog entry for the latest installable version of \fIPKG\fP. - -.I R "LOCAL OPTIONS" ":" -.HP -.B \-l, \-\-latest -.br -Display only the latest ChangeLog entry. It's not uncommon for changes to be prepended to the ChangeLog without a version header if the changes did not require a version bump. Use this option to display such entries. -.HP -.B \-f, \-\-full -.br -Display the full ChangeLog. -.br -\fBHint\fP: Try piping (|) the output to a pager, like 'less'. -.HP -.BI "\-\-limit=" "NUM" -.br -Limit the \fINUM\fP of entries displayed. Use this option in conjunction with \fB\-\-full\fP. \fB\-\-limit=3\fP would display the three latest entries. -.HP -.BI "\-\-from=" "VER" -.br -Set which \fIVER\fP to display from. Using this option by itself is equivalent to passing \fBchanges\fP a ranged package atom, e.g., '>=foo/bar\-1.5'. It can be used in conjunction with \fB\-\-to\fP to request a more complex range of entries. -.HP -.BI "\-\-to=" "VER" -.br -Set which \fIVER\fP to display to. (See \fB\-\-from\fP) -.P -.I R "EXAMPLES" ":" -.EX -.HP -equery changes portage -.EE -.br -Display the Gentoo ChangeLog entry for the latest installable version of Portage. -.EX -.HP -equery changes '=sys\-apps/portage\-2.1.6*' -.EE -.br -Use Portage's atom syntax. (See \fBman 5 ebuild\fP) -.EX -.HP -equery changes portage \-\-from=2.2_rc1 \-\-to=2.2 -.EE -.br -Display any ChangeLog entry within a range of versions. - .SS .BI "check (k) [OPTIONS] " "PKG" Check timestamps and MD5 sums for files owned by \fIPKG\fP, where \fIPKG\fP is an installed package. diff --git a/pym/gentoolkit/equery/__init__.py b/pym/gentoolkit/equery/__init__.py index 677f534..e5b3deb 100644 --- a/pym/gentoolkit/equery/__init__.py +++ b/pym/gentoolkit/equery/__init__.py @@ -82,7 +82,6 @@ def print_help(with_description=True): print(pp.command("modules") + " (" + pp.command("short name") + ")") print(format_options(( (" (b)elongs", "list what package FILES belong to"), - (" (c)hanges", "list changelog entries for ATOM"), (" chec(k)", "verify checksums and timestamps for PKG"), (" (d)epends", "list all packages directly depending on ATOM"), (" dep(g)raph", "display a tree of all dependencies for PKG"),
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/ekeyword/
commit: 237ae83ec64cf06271609abe79acddf94033f447 Author: Petr Vaněk excello cz> AuthorDate: Fri Nov 6 13:39:52 2020 + Commit: Sam James gentoo org> CommitDate: Fri Jun 18 14:02:46 2021 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=237ae83e ekeyword: fix typo Signed-off-by: Petr Vaněk excello.cz> Closes: https://github.com/gentoo/gentoolkit/pull/12 Signed-off-by: Sam James gentoo.org> pym/gentoolkit/ekeyword/ekeyword.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pym/gentoolkit/ekeyword/ekeyword.py b/pym/gentoolkit/ekeyword/ekeyword.py index 4e57c09..da0fd58 100755 --- a/pym/gentoolkit/ekeyword/ekeyword.py +++ b/pym/gentoolkit/ekeyword/ekeyword.py @@ -429,7 +429,7 @@ def get_parser(): help='Be quiet while processing things (only show errors)') parser.add_argument('--format', default='auto', dest='style', choices=('auto', 'color-inline', 'inline', 'short-multi', 'long-multi'), - help='Selet output format for showing differences') + help='Select output format for showing differences') parser.add_argument('-V', '--version', action='version', version=__version__, help='Show version information') return parser
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/test/
commit: da5a8798054f23fc16f8c59644e4ac03c4d4980d Author: Matt Turner gentoo org> AuthorDate: Sun Jan 3 00:52:59 2021 + Commit: Matt Turner gentoo org> CommitDate: Sun Jan 3 00:52:59 2021 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=da5a8798 gentoolkit: Remove gentoolkit.test.cmp Signed-off-by: Matt Turner gentoo.org> pym/gentoolkit/test/__init__.py | 23 --- pym/gentoolkit/test/test_atom.py | 15 --- pym/gentoolkit/test/test_cpv.py | 15 --- 3 files changed, 53 deletions(-) diff --git a/pym/gentoolkit/test/__init__.py b/pym/gentoolkit/test/__init__.py index 9e41686..e69de29 100644 --- a/pym/gentoolkit/test/__init__.py +++ b/pym/gentoolkit/test/__init__.py @@ -1,23 +0,0 @@ -#!/usr/bin/python -# Copyright 2009 Gentoo Foundation -# -# Distributed under the terms of the GNU General Public License v2 - -__all__ = ['cmp'] - -# py3k doesn't have cmp emulate it in order to keep testing cmp -# in python-2.x -#XXX: not sure if this is the best place for this -try: - cmp = cmp -except NameError: - def cmp(a, b): - if a == b: - return 0 - elif a < b: - return -1 - elif a > b: - return 1 - # just to be safe, __lt__/ __gt__ above should have thrown - # something like this already - raise TypeError("Comparison between unorderable types") diff --git a/pym/gentoolkit/test/test_atom.py b/pym/gentoolkit/test/test_atom.py index 664bf40..6df52a9 100644 --- a/pym/gentoolkit/test/test_atom.py +++ b/pym/gentoolkit/test/test_atom.py @@ -7,7 +7,6 @@ import unittest from gentoolkit.atom import Atom from gentoolkit.cpv import CPV -from gentoolkit.test import cmp """Atom test suite (verbatim) from pkgcore.""" @@ -17,26 +16,12 @@ class TestGentoolkitAtom(unittest.TestCase): # logic bugs hidden behind short circuiting comparisons for metadata # is why we test the comparison *both* ways. self.assertEqual(o1, o2) - c = cmp(o1, o2) - self.assertEqual(c, 0, - msg="checking cmp for %r, %r, aren't equal: got %i" % (o1, o2, c)) self.assertEqual(o2, o1) - c = cmp(o2, o1) - self.assertEqual(c, 0, - msg="checking cmp for %r, %r,aren't equal: got %i" % (o2, o1, c)) def assertNotEqual2(self, o1, o2): # is why we test the comparison *both* ways. self.assertNotEqual(o1, o2) - c = cmp(o1, o2) - self.assertNotEqual(c, 0, - msg="checking cmp for %r, %r, not supposed to be equal, got %i" - % (o1, o2, c)) self.assertNotEqual(o2, o1) - c = cmp(o2, o1) - self.assertNotEqual(c, 0, - msg="checking cmp for %r, %r, not supposed to be equal, got %i" - % (o2, o1, c)) def test_comparison(self): self.assertEqual2(Atom('cat/pkg'), Atom('cat/pkg')) diff --git a/pym/gentoolkit/test/test_cpv.py b/pym/gentoolkit/test/test_cpv.py index 3817e9f..92ffba5 100644 --- a/pym/gentoolkit/test/test_cpv.py +++ b/pym/gentoolkit/test/test_cpv.py @@ -7,7 +7,6 @@ import unittest from gentoolkit.cpv import CPV, compare_strs -from gentoolkit.test import cmp class TestGentoolkitCPV(unittest.TestCase): @@ -15,26 +14,12 @@ class TestGentoolkitCPV(unittest.TestCase): # logic bugs hidden behind short circuiting comparisons for metadata # is why we test the comparison *both* ways. self.assertEqual(o1, o2) - c = cmp(o1, o2) - self.assertEqual(c, 0, - msg="checking cmp for %r, %r, aren't equal: got %i" % (o1, o2, c)) self.assertEqual(o2, o1) - c = cmp(o2, o1) - self.assertEqual(c, 0, - msg="checking cmp for %r, %r,aren't equal: got %i" % (o2, o1, c)) def assertNotEqual2(self, o1, o2): # is why we test the comparison *both* ways. self.assertNotEqual(o1, o2) - c = cmp(o1, o2) - self.assertNotEqual(c, 0, - msg="checking cmp for %r, %r, not supposed to be equal, got %i" - % (o1, o2, c)) self.assertNotEqual(o2, o1) - c = cmp(o2, o1) - self.assertNotEqual(c, 0, - msg="checking cmp for %r, %r, not supposed to be equal, got %i" - % (o2, o1, c)) def test_comparison(self): self.assertEqual2(CPV('pkg'), CPV('pkg'))
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/test/, pym/gentoolkit/test/equery/, pym/gentoolkit/equery/, ...
commit: bcb81589c94c416aa460100092f1c2c76c013a93 Author: Matt Turner gentoo org> AuthorDate: Mon Jan 4 18:38:04 2021 + Commit: Matt Turner gentoo org> CommitDate: Mon Jan 4 18:43:48 2021 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=bcb81589 equery: Remove 'changes' subcommand ChangeLogs have been gone from gentoo.git since the beginning, and Council agreed in 2016 to allow Infra to decide whether to distribute them through rsync, which they have decided not to do [1]. [1] https://projects.gentoo.org/council/meeting-logs/20160410-summary.txt Signed-off-by: Matt Turner gentoo.org> pym/gentoolkit/equery/__init__.py | 1 - pym/gentoolkit/equery/changes.py| 184 pym/gentoolkit/helpers.py | 173 -- pym/gentoolkit/test/equery/test_init.py | 1 - pym/gentoolkit/test/test_helpers.py | 47 5 files changed, 406 deletions(-) diff --git a/pym/gentoolkit/equery/__init__.py b/pym/gentoolkit/equery/__init__.py index 4640086..677f534 100644 --- a/pym/gentoolkit/equery/__init__.py +++ b/pym/gentoolkit/equery/__init__.py @@ -42,7 +42,6 @@ __authors__ = ( NAME_MAP = { 'b': 'belongs', - 'c': 'changes', 'k': 'check', 'd': 'depends', 'g': 'depgraph', diff --git a/pym/gentoolkit/equery/changes.py b/pym/gentoolkit/equery/changes.py deleted file mode 100644 index f234ecb..000 --- a/pym/gentoolkit/equery/changes.py +++ /dev/null @@ -1,184 +0,0 @@ -# Copyright(c) 2009, Gentoo Foundation -# -# Licensed under the GNU General Public License, v2 or higher - -"""Displays the ChangeLog entry for the latest installable version of an atom""" - -__docformat__ = 'epytext' - -# === -# Imports -# === - -import sys -import os -from getopt import gnu_getopt, GetoptError - -import gentoolkit.pprinter as pp -from gentoolkit.atom import Atom -from gentoolkit.equery import format_options, mod_usage -from gentoolkit.helpers import ChangeLog -from gentoolkit.query import Query - -# === -# Globals -# === - -QUERY_OPTS = { - 'only_latest': False, - 'show_full_log': False, - 'limit': None, - 'from': None, - 'to': None -} - -# = -# Functions -# = - -def print_help(with_description=True): - """Print description, usage and a detailed help message. - - @type with_description: bool - @param with_description: if true, print module's __doc__ string - """ - - if with_description: - print(__doc__.strip()) - print() - print(mod_usage(mod_name="changes")) - print() - print(pp.emph("examples")) - print (" c portage# show latest visible " - "version's entry") - print(" c portage --full --limit=3 # show 3 latest entries") - print(" c '=sys-apps/portage-2.1.6*' # use atom syntax") - print(" c portage --from=2.2_rc60 --to=2.2_rc70 # use version ranges") - print() - print(pp.command("options")) - print(format_options(( - (" -h, --help", "display this help message"), - (" -l, --latest", "display only the latest ChangeLog entry"), - (" -f, --full", "display the full ChangeLog"), - (" --limit=NUM", - "limit the number of entries displayed (with --full)"), - (" --from=VER", "set which version to display from"), - (" --to=VER", "set which version to display to"), - ))) - - -def parse_module_options(module_opts): - """Parse module options and update QUERY_OPTS""" - - opts = (x[0] for x in module_opts) - posargs = (x[1] for x in module_opts) - for opt, posarg in zip(opts, posargs): - if opt in ('-h', '--help'): - print_help() - sys.exit(0) - elif opt in ('-f', '--full'): - QUERY_OPTS['show_full_log'] = True - elif opt in ('-l', '--latest'): - QUERY_OPTS['only_latest'] = True - elif opt in ('--limit',): - set_limit(posarg) - elif opt in ('--from',): - QUERY_OPTS['from'] = posarg - elif opt in ('--to',): - QUERY_OPTS['to'] = posarg - - -def print_entries(entries): - """Print entries and strip trailing whitespace from the last entry.""" - - len_entries = len(entries) - for i, entry in enumerate(entries, start=1): - if i < len_entries: - pp.uprint(entry) - else: - pp.uprint(entry.strip()) - - -def set_limit(posarg): - """Set a limit in QUERY_OPTS on how many ChangeLog entries to display. - - Die if posarg is not an integer. - """ - -
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/ekeyword/
commit: 2f572237ebbf2be2b56803394a40d5c4938cbdb7 Author: Matt Turner gentoo org> AuthorDate: Mon Dec 28 18:00:28 2020 + Commit: Matt Turner gentoo org> CommitDate: Mon Dec 28 18:00:55 2020 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=2f572237 ekeyword: Use mock from unittest Since we only support Python 3.6+. Signed-off-by: Matt Turner gentoo.org> pym/gentoolkit/ekeyword/test_ekeyword.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pym/gentoolkit/ekeyword/test_ekeyword.py b/pym/gentoolkit/ekeyword/test_ekeyword.py index 12a0b54..0763783 100755 --- a/pym/gentoolkit/ekeyword/test_ekeyword.py +++ b/pym/gentoolkit/ekeyword/test_ekeyword.py @@ -10,7 +10,7 @@ import subprocess import tempfile import unittest -import mock +from unittest import mock from gentoolkit.ekeyword import ekeyword
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/ekeyword/
commit: 5e421373f2cc82ad2a000925e01bb5421d280b76 Author: Matt Turner gentoo org> AuthorDate: Mon Dec 21 02:09:06 2020 + Commit: Matt Turner gentoo org> CommitDate: Mon Dec 21 03:24:54 2020 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=5e421373 ekeyword: Rename unit test so that it runs unittests should be named test_*.py so that they are discoverable. Signed-off-by: Matt Turner gentoo.org> pym/gentoolkit/ekeyword/pytest.ini | 2 +- pym/gentoolkit/ekeyword/{ekeyword_unittest.py => test_ekeyword.py} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pym/gentoolkit/ekeyword/pytest.ini b/pym/gentoolkit/ekeyword/pytest.ini index 622c9d8..7e21bec 100644 --- a/pym/gentoolkit/ekeyword/pytest.ini +++ b/pym/gentoolkit/ekeyword/pytest.ini @@ -1,3 +1,3 @@ [pytest] addopts = --cov -python_files = *_unittest.py +python_files = test_*.py diff --git a/pym/gentoolkit/ekeyword/ekeyword_unittest.py b/pym/gentoolkit/ekeyword/test_ekeyword.py similarity index 99% rename from pym/gentoolkit/ekeyword/ekeyword_unittest.py rename to pym/gentoolkit/ekeyword/test_ekeyword.py index ef2e256..3d23585 100755 --- a/pym/gentoolkit/ekeyword/ekeyword_unittest.py +++ b/pym/gentoolkit/ekeyword/test_ekeyword.py @@ -12,7 +12,7 @@ import unittest import mock -import ekeyword +from gentoolkit.ekeyword import ekeyword TESTDIR = os.path.join(os.path.dirname(__file__), 'tests')
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/test/eclean/
commit: e0bce6f37f4bbee9eb3d77931396ee5aaeafdeea Author: Matt Turner gentoo org> AuthorDate: Mon Dec 21 03:23:07 2020 + Commit: Matt Turner gentoo org> CommitDate: Mon Dec 21 03:24:54 2020 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=e0bce6f3 eclean: Remove unneeded __init__ to enable pytest Prevented the unit test from running: pym/gentoolkit/test/eclean/distsupport.py:435: PytestCollectionWarning: cannot collect test class 'TestDisfiles' because it has a __init__ constructor (from: pym/gentoolkit/test/eclean/test_search.py) Signed-off-by: Matt Turner gentoo.org> pym/gentoolkit/test/eclean/distsupport.py | 6 -- 1 file changed, 6 deletions(-) diff --git a/pym/gentoolkit/test/eclean/distsupport.py b/pym/gentoolkit/test/eclean/distsupport.py index 0fc2db8..da7cdbb 100644 --- a/pym/gentoolkit/test/eclean/distsupport.py +++ b/pym/gentoolkit/test/eclean/distsupport.py @@ -434,12 +434,6 @@ class OutputSimulator: class TestDisfiles: - def __init__(self): - self.workdir = None - self.target_file = None - self.target_symlink = None - self.test_filepaths = None - def setUp(self): # create the dist dir self.tmpdir = mkdtemp()
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/ekeyword/
commit: bb443542626c0ecb769c8ab0efc3bae9da8154c3 Author: Matt Turner gentoo org> AuthorDate: Mon Dec 21 03:09:55 2020 + Commit: Matt Turner gentoo org> CommitDate: Mon Dec 21 03:24:54 2020 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=bb443542 ekeyword: Fix unit test arch_status changed from a Dict[str] to Dict[Tuple[str, str]], but these bits of test data were not updated. Update the examples while we're here (e.g. arm64 is stable with stable profiles now). Fixes: 459cfba47d25 (ekeyword: Use now-common load_profile_data() from eshowkw) Signed-off-by: Matt Turner gentoo.org> pym/gentoolkit/ekeyword/test_ekeyword.py | 38 +++- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/pym/gentoolkit/ekeyword/test_ekeyword.py b/pym/gentoolkit/ekeyword/test_ekeyword.py index 3d23585..12a0b54 100755 --- a/pym/gentoolkit/ekeyword/test_ekeyword.py +++ b/pym/gentoolkit/ekeyword/test_ekeyword.py @@ -165,28 +165,26 @@ class TestProcessKeywords(unittest.TestCase): ekeyword.Op(None, 'all', None), ) arch_status = { - 'alpha': None, - 'arm': 'stable', - 'arm64': 'exp', - 'm68k': 'dev', + 'alpha': ('stable', '~arch'), + 'arm': ('stable', 'arch'), + 'm68k': ('exp', '~arch'), + 's390': ('exp', 'arch'), } - self._test('* ~alpha ~arm ~arm64 ~m68k ~mips ~arm-linux', ops, - '* ~alpha arm ~arm64 ~m68k ~mips ~arm-linux', arch_status) + self._test('* ~alpha ~arm ~m68k ~mips ~s390 ~arm-linux', ops, + '* ~alpha arm ~m68k ~mips s390 ~arm-linux', arch_status) def testAllUnstable(self): ops = ( ekeyword.Op('~', 'all', None), ) arch_status = { - 'alpha': None, - 'arm': 'stable', - 'arm64': 'exp', - 'm68k': 'dev', - 's390': 'dev', - 'sh': 'dev', + 'alpha': ('stable', '~arch'), + 'arm': ('stable', 'arch'), + 'm68k': ('exp', '~arch'), + 's390': ('exp', 'arch'), } - self._test('-* ~* * alpha arm arm64 m68k arm-linux', ops, - '-* ~* * ~alpha ~arm ~arm64 ~m68k ~arm-linux', arch_status) + self._test('-* ~* * alpha arm m68k s390 arm-linux', ops, + '-* ~* * ~alpha ~arm ~m68k ~s390 ~arm-linux', arch_status) def testAllMultiUnstableStable(self): ops = ( @@ -194,13 +192,13 @@ class TestProcessKeywords(unittest.TestCase): ekeyword.Op(None, 'all', None), ) arch_status = { - 'alpha': None, - 'arm': 'stable', - 'arm64': 'exp', - 'm68k': 'dev', + 'alpha': ('stable', '~arch'), + 'arm': ('stable', 'arch'), + 'm68k': ('exp', '~arch'), + 's390': ('exp', 'arch'), } - self._test('-* ~* * alpha arm arm64 m68k', ops, - '-* ~* * ~alpha arm ~arm64 ~m68k', arch_status) + self._test('-* ~* * alpha arm m68k s390', ops, + '-* ~* * ~alpha arm ~m68k s390', arch_status) def testAllDisabled(self): """Make sure ~all does not change -arch to ~arch"""
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/enalyze/, pym/gentoolkit/revdep_rebuild/, pym/gentoolkit/eclean/, ...
commit: 9601ad3b1b1e44c08f0eb35189cde05dd3a5e58d Author: Matt Turner gentoo org> AuthorDate: Sun Dec 20 22:12:42 2020 + Commit: Matt Turner gentoo org> CommitDate: Sun Dec 20 22:12:42 2020 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=9601ad3b Remove Python < 3 version checks Signed-off-by: Matt Turner gentoo.org> pym/gentoolkit/eclean/exclude.py | 2 -- pym/gentoolkit/enalyze/rebuild.py | 2 -- pym/gentoolkit/equery/uses.py | 2 -- pym/gentoolkit/equery/which.py| 2 -- pym/gentoolkit/helpers.py | 2 -- pym/gentoolkit/profile.py | 3 --- pym/gentoolkit/revdep_rebuild/analyse.py | 2 -- pym/gentoolkit/revdep_rebuild/assign.py | 6 -- pym/gentoolkit/revdep_rebuild/cache.py| 7 +-- pym/gentoolkit/revdep_rebuild/collect.py | 10 +- pym/gentoolkit/revdep_rebuild/settings.py | 9 + pym/gentoolkit/test/eclean/creator.py | 2 -- pym/gentoolkit/test/test_keyword.py | 2 -- 13 files changed, 3 insertions(+), 48 deletions(-) diff --git a/pym/gentoolkit/eclean/exclude.py b/pym/gentoolkit/eclean/exclude.py index ee5e1e1..45ecd52 100644 --- a/pym/gentoolkit/eclean/exclude.py +++ b/pym/gentoolkit/eclean/exclude.py @@ -6,8 +6,6 @@ import os import sys -if sys.hexversion < 0x300: - from io import open import re import portage from portage import _encodings, _unicode_encode diff --git a/pym/gentoolkit/enalyze/rebuild.py b/pym/gentoolkit/enalyze/rebuild.py index 4ad571f..3f3f4fd 100644 --- a/pym/gentoolkit/enalyze/rebuild.py +++ b/pym/gentoolkit/enalyze/rebuild.py @@ -12,8 +12,6 @@ what packages according to the Installed package database""" import os import sys -if sys.hexversion < 0x300: - from io import open import gentoolkit from gentoolkit.module_base import ModuleBase diff --git a/pym/gentoolkit/equery/uses.py b/pym/gentoolkit/equery/uses.py index 1260f56..dfb6f31 100644 --- a/pym/gentoolkit/equery/uses.py +++ b/pym/gentoolkit/equery/uses.py @@ -12,8 +12,6 @@ __docformat__ = 'epytext' import os import sys -if sys.hexversion < 0x300: - from io import open from functools import partial from getopt import gnu_getopt, GetoptError diff --git a/pym/gentoolkit/equery/which.py b/pym/gentoolkit/equery/which.py index 326e692..c7fabd7 100644 --- a/pym/gentoolkit/equery/which.py +++ b/pym/gentoolkit/equery/which.py @@ -14,8 +14,6 @@ __docformat__ = 'epytext' import os import sys -if sys.hexversion < 0x300: - from io import open from getopt import gnu_getopt, GetoptError diff --git a/pym/gentoolkit/helpers.py b/pym/gentoolkit/helpers.py index b4cc795..02ac20e 100644 --- a/pym/gentoolkit/helpers.py +++ b/pym/gentoolkit/helpers.py @@ -25,8 +25,6 @@ __docformat__ = 'epytext' import os import sys -if sys.hexversion < 0x300: - from io import open import re from functools import partial from itertools import chain diff --git a/pym/gentoolkit/profile.py b/pym/gentoolkit/profile.py index 01f823a..dcd02cc 100644 --- a/pym/gentoolkit/profile.py +++ b/pym/gentoolkit/profile.py @@ -15,9 +15,6 @@ import os.path import portage import sys -if sys.hexversion < 0x300: - from io import open - from portage import _encodings, _unicode_encode diff --git a/pym/gentoolkit/revdep_rebuild/analyse.py b/pym/gentoolkit/revdep_rebuild/analyse.py index 4269ade..6ce1568 100644 --- a/pym/gentoolkit/revdep_rebuild/analyse.py +++ b/pym/gentoolkit/revdep_rebuild/analyse.py @@ -6,8 +6,6 @@ import os import re import time import sys -if sys.hexversion < 0x300: - from io import open from portage import _encodings, _unicode_encode from portage.output import bold, blue, yellow, green diff --git a/pym/gentoolkit/revdep_rebuild/assign.py b/pym/gentoolkit/revdep_rebuild/assign.py index 1e5f3e9..3fa9299 100644 --- a/pym/gentoolkit/revdep_rebuild/assign.py +++ b/pym/gentoolkit/revdep_rebuild/assign.py @@ -15,12 +15,6 @@ import portage from portage import portdb from portage.output import bold, red, yellow, green -# Make all str conversions unicode -try: - str = unicode -except NameError: - pass - class _file_matcher(object): """ diff --git a/pym/gentoolkit/revdep_rebuild/cache.py b/pym/gentoolkit/revdep_rebuild/cache.py index 66fbd9d..f8b7841 100644 --- a/pym/gentoolkit/revdep_rebuild/cache.py +++ b/pym/gentoolkit/revdep_rebuild/cache.py @@ -6,11 +6,6 @@ Functions for reading, saving and verifying the data caches from portage import os import time import sys -if sys.hexversion < 0x300: - from io import open - _unicode = unicode # noqa -else: - _unicode = str from portage import _encodings, _unicode_encode from portage.output import red @@ -59,7 +54,7 @@ def save_cache(logger, to_save={}, temp_path=DEFAULTS['DEFAULT_TMP_DIR']): try: _file =
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/, pym/gentoolkit/eclean/, pym/gentoolkit/test/eclean/, ...
commit: 4c3ca2185c9bb71a028fb54953728c5a05807765 Author: Matt Turner gentoo org> AuthorDate: Sun Dec 20 22:12:46 2020 + Commit: Matt Turner gentoo org> CommitDate: Sun Dec 20 22:12:46 2020 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=4c3ca218 Remove inherits from object Signed-off-by: Matt Turner gentoo.org> pym/gentoolkit/cpv.py | 2 +- pym/gentoolkit/eclean/clean.py| 2 +- pym/gentoolkit/eclean/output.py | 2 +- pym/gentoolkit/eclean/pkgindex.py | 2 +- pym/gentoolkit/eclean/search.py | 2 +- pym/gentoolkit/enalyze/lib.py | 4 ++-- pym/gentoolkit/equery/belongs.py | 2 +- pym/gentoolkit/equery/check.py| 2 +- pym/gentoolkit/equery/depends.py | 2 +- pym/gentoolkit/formatters.py | 2 +- pym/gentoolkit/helpers.py | 4 ++-- pym/gentoolkit/keyword.py | 2 +- pym/gentoolkit/metadata.py| 8 pym/gentoolkit/module_base.py | 2 +- pym/gentoolkit/package.py | 2 +- pym/gentoolkit/revdep_rebuild/analyse.py | 2 +- pym/gentoolkit/revdep_rebuild/assign.py | 2 +- pym/gentoolkit/test/eclean/creator.py | 2 +- pym/gentoolkit/test/eclean/distsupport.py | 6 +++--- pym/gentoolkit/test/eclean/test_clean.py | 2 +- pym/gentoolkit/versionmatch.py| 2 +- 21 files changed, 28 insertions(+), 28 deletions(-) diff --git a/pym/gentoolkit/cpv.py b/pym/gentoolkit/cpv.py index 563dab8..5238e24 100644 --- a/pym/gentoolkit/cpv.py +++ b/pym/gentoolkit/cpv.py @@ -37,7 +37,7 @@ isvalid_rev_re = re.compile(r'(\d+|0\d+\.\d+)') # Classes # === -class CPV(object): +class CPV: """Provides methods on a category/package-version string. Will also correctly split just a package or package-version string. diff --git a/pym/gentoolkit/eclean/clean.py b/pym/gentoolkit/eclean/clean.py index 2b750e3..3f6fe45 100644 --- a/pym/gentoolkit/eclean/clean.py +++ b/pym/gentoolkit/eclean/clean.py @@ -11,7 +11,7 @@ import gentoolkit.pprinter as pp from gentoolkit.eclean.pkgindex import PkgIndex -class CleanUp(object): +class CleanUp: """Performs all cleaning actions to distfiles or package directories. @param controller: a progress output/user interaction controller function diff --git a/pym/gentoolkit/eclean/output.py b/pym/gentoolkit/eclean/output.py index 122d550..e2ed221 100644 --- a/pym/gentoolkit/eclean/output.py +++ b/pym/gentoolkit/eclean/output.py @@ -9,7 +9,7 @@ from portage.output import blue, yellow, teal, green, red from gentoolkit.pprinter import cpv, number -class OutputControl(object): +class OutputControl: """Outputs data according to predetermined options and handles any user interaction. diff --git a/pym/gentoolkit/eclean/pkgindex.py b/pym/gentoolkit/eclean/pkgindex.py index 6cf9000..46c734d 100644 --- a/pym/gentoolkit/eclean/pkgindex.py +++ b/pym/gentoolkit/eclean/pkgindex.py @@ -13,7 +13,7 @@ from gentoolkit.eprefix import EPREFIX import portage -class PkgIndex(object): +class PkgIndex: """Handle the cleaning of the binpkg Package Index file diff --git a/pym/gentoolkit/eclean/search.py b/pym/gentoolkit/eclean/search.py index 992949c..8f6e52f 100644 --- a/pym/gentoolkit/eclean/search.py +++ b/pym/gentoolkit/eclean/search.py @@ -50,7 +50,7 @@ def get_distdir(): distdir = get_distdir() -class DistfilesSearch(object): +class DistfilesSearch: """ @param output: verbose output method or (lambda x: None) to turn off diff --git a/pym/gentoolkit/enalyze/lib.py b/pym/gentoolkit/enalyze/lib.py index 8580bb7..50c7d11 100644 --- a/pym/gentoolkit/enalyze/lib.py +++ b/pym/gentoolkit/enalyze/lib.py @@ -17,7 +17,7 @@ from gentoolkit.flag import (reduce_flags, get_flags, get_all_cpv_use, import portage -class FlagAnalyzer(object): +class FlagAnalyzer: """Specialty functions for analysing an installed package's USE flags. Can be used for single or mulitple use without needing to be reset unless the system USE flags are changed. @@ -142,7 +142,7 @@ class FlagAnalyzer(object): return _flags -class KeywordAnalyser(object): +class KeywordAnalyser: """Specialty functions for analysing the installed package db for keyword useage and the packages that used them. diff --git a/pym/gentoolkit/equery/belongs.py b/pym/gentoolkit/equery/belongs.py index 8289366..1c9ab13 100644 --- a/pym/gentoolkit/equery/belongs.py +++ b/pym/gentoolkit/equery/belongs.py @@ -36,7 +36,7 @@ QUERY_OPTS = { # Classes # === -class BelongsPrinter(object): +class BelongsPrinter: """Outputs a formatted list of packages that claim to own a files.""" def __init__(self, verbose=True, name_only=False): diff --git a/pym/gentoolkit/equery/check.py b/pym/gentoolkit/equery/check.py index e965164..47eba98
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/enalyze/, pym/gentoolkit/test/equery/, pym/gentoolkit/equery/, ...
commit: eeb8a46876d546b64cc7e16f76c6eef4ef524b23 Author: Matt Turner gentoo org> AuthorDate: Sun Dec 20 22:12:39 2020 + Commit: Matt Turner gentoo org> CommitDate: Sun Dec 20 22:12:39 2020 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=eeb8a468 Remove $Header$ Signed-off-by: Matt Turner gentoo.org> bin/ekeyword | 2 -- bin/enalyze | 2 -- bin/epkginfo | 2 -- bin/equery| 2 -- bin/euse | 2 -- bin/imlate| 2 -- bin/revdep-rebuild| 2 -- pym/gentoolkit/__init__.py| 2 -- pym/gentoolkit/atom.py| 2 -- pym/gentoolkit/base.py| 2 -- pym/gentoolkit/cpv.py | 2 -- pym/gentoolkit/dbapi.py | 2 -- pym/gentoolkit/dependencies.py| 2 -- pym/gentoolkit/ekeyword/Makefile | 2 -- pym/gentoolkit/enalyze/__init__.py| 2 -- pym/gentoolkit/equery/__init__.py | 2 -- pym/gentoolkit/equery/belongs.py | 2 -- pym/gentoolkit/equery/changes.py | 2 -- pym/gentoolkit/equery/check.py| 2 -- pym/gentoolkit/equery/depends.py | 2 -- pym/gentoolkit/equery/depgraph.py | 2 -- pym/gentoolkit/equery/files.py| 2 -- pym/gentoolkit/equery/has.py | 2 -- pym/gentoolkit/equery/hasuse.py | 2 -- pym/gentoolkit/equery/list_.py| 2 -- pym/gentoolkit/equery/meta.py | 2 -- pym/gentoolkit/equery/size.py | 2 -- pym/gentoolkit/equery/uses.py | 2 -- pym/gentoolkit/equery/which.py| 2 -- pym/gentoolkit/formatters.py | 2 -- pym/gentoolkit/helpers.py | 2 -- pym/gentoolkit/keyword.py | 2 -- pym/gentoolkit/metadata.py| 2 -- pym/gentoolkit/module_base.py | 2 -- pym/gentoolkit/package.py | 2 -- pym/gentoolkit/pprinter.py| 2 -- pym/gentoolkit/query.py | 2 -- pym/gentoolkit/sets.py| 2 -- pym/gentoolkit/test/__init__.py | 2 -- pym/gentoolkit/test/eclean/__init__.py| 2 -- pym/gentoolkit/test/eclean/creator.py | 2 -- pym/gentoolkit/test/eclean/distsupport.py | 2 -- pym/gentoolkit/test/eclean/test_clean.py | 2 -- pym/gentoolkit/test/eclean/test_search.py | 2 -- pym/gentoolkit/test/equery/__init__.py| 2 -- pym/gentoolkit/test/test_atom.py | 2 -- pym/gentoolkit/test/test_cpv.py | 2 -- pym/gentoolkit/versionmatch.py| 2 -- 48 files changed, 96 deletions(-) diff --git a/bin/ekeyword b/bin/ekeyword index 2e3c78e..8767fe3 100755 --- a/bin/ekeyword +++ b/bin/ekeyword @@ -2,8 +2,6 @@ # # Copyright 2002-2017 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 or later -# -# $Header$ """Manage KEYWORDS in ebuilds easily. diff --git a/bin/enalyze b/bin/enalyze index a0bb29a..9e27bed 100755 --- a/bin/enalyze +++ b/bin/enalyze @@ -3,8 +3,6 @@ # Copyright 2010 Brian Dolbec # Copyright 2002-2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 or later -# -# $Header$ """'enalyze' is a flexible utility for Gentoo linux which can display various information about installed packages, such as the USE flags used and the diff --git a/bin/epkginfo b/bin/epkginfo index 4f87176..5d3aab2 100755 --- a/bin/epkginfo +++ b/bin/epkginfo @@ -2,8 +2,6 @@ # # Copyright 2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 or later -# -# $Header$ """Shortcut to equery meta""" diff --git a/bin/equery b/bin/equery index 77371d1..386194d 100755 --- a/bin/equery +++ b/bin/equery @@ -2,8 +2,6 @@ # # Copyright 2002-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 or later -# -# $Header$ """equery is a flexible utility for Gentoo linux which can display various information about packages, such as the files they own, their USE flags, diff --git a/bin/euse b/bin/euse index 263d0f2..c3b6638 100755 --- a/bin/euse +++ b/bin/euse @@ -2,8 +2,6 @@ # Disable globbing because "-*" and such is valid as a use flag. set -f -# $Header$ - # bash replacement for the original euse by Arun Bhanu # Author: Marius Mauch # Jared Hancock (Signigicant rewrite for package.use support) diff --git a/bin/imlate b/bin/imlate index 040d19e..cd4f7ab 100755 --- a/bin/imlate +++ b/bin/imlate @@ -2,8 +2,6 @@ # # Copyright 2002-2017 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 or later -# -# $Header$ """Manage KEYWORDS in ebuilds easily. diff --git a/bin/revdep-rebuild b/bin/revdep-rebuild index 24d349e..51783c5 100755 --- a/bin/revdep-rebuild +++
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/revdep_rebuild/, pym/gentoolkit/enalyze/, pym/gentoolkit/, ...
commit: aa28f4aa9a12bedce5a5834b009260d132706de5 Author: Matt Turner gentoo org> AuthorDate: Mon Dec 21 01:37:15 2020 + Commit: Matt Turner gentoo org> CommitDate: Mon Dec 21 01:38:18 2020 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=aa28f4aa Remove unused sys imports Reported by flake8. Signed-off-by: Matt Turner gentoo.org> pym/gentoolkit/eclean/exclude.py | 1 - pym/gentoolkit/enalyze/rebuild.py| 1 - pym/gentoolkit/helpers.py| 1 - pym/gentoolkit/revdep_rebuild/analyse.py | 1 - pym/gentoolkit/revdep_rebuild/cache.py | 1 - pym/gentoolkit/revdep_rebuild/collect.py | 1 - pym/gentoolkit/test/test_keyword.py | 1 - 7 files changed, 7 deletions(-) diff --git a/pym/gentoolkit/eclean/exclude.py b/pym/gentoolkit/eclean/exclude.py index 45ecd52..1da9523 100644 --- a/pym/gentoolkit/eclean/exclude.py +++ b/pym/gentoolkit/eclean/exclude.py @@ -5,7 +5,6 @@ import os -import sys import re import portage from portage import _encodings, _unicode_encode diff --git a/pym/gentoolkit/enalyze/rebuild.py b/pym/gentoolkit/enalyze/rebuild.py index 3f3f4fd..c0ac8cb 100644 --- a/pym/gentoolkit/enalyze/rebuild.py +++ b/pym/gentoolkit/enalyze/rebuild.py @@ -11,7 +11,6 @@ what packages according to the Installed package database""" import os -import sys import gentoolkit from gentoolkit.module_base import ModuleBase diff --git a/pym/gentoolkit/helpers.py b/pym/gentoolkit/helpers.py index a979ca7..e7185c3 100644 --- a/pym/gentoolkit/helpers.py +++ b/pym/gentoolkit/helpers.py @@ -24,7 +24,6 @@ __docformat__ = 'epytext' # === import os -import sys import re from functools import partial from itertools import chain diff --git a/pym/gentoolkit/revdep_rebuild/analyse.py b/pym/gentoolkit/revdep_rebuild/analyse.py index 3e46a51..bdd8306 100644 --- a/pym/gentoolkit/revdep_rebuild/analyse.py +++ b/pym/gentoolkit/revdep_rebuild/analyse.py @@ -5,7 +5,6 @@ import os import re import time -import sys from portage import _encodings, _unicode_encode from portage.output import bold, blue, yellow, green diff --git a/pym/gentoolkit/revdep_rebuild/cache.py b/pym/gentoolkit/revdep_rebuild/cache.py index f8b7841..ab0b7d7 100644 --- a/pym/gentoolkit/revdep_rebuild/cache.py +++ b/pym/gentoolkit/revdep_rebuild/cache.py @@ -5,7 +5,6 @@ Functions for reading, saving and verifying the data caches from portage import os import time -import sys from portage import _encodings, _unicode_encode from portage.output import red diff --git a/pym/gentoolkit/revdep_rebuild/collect.py b/pym/gentoolkit/revdep_rebuild/collect.py index 74a44f7..38ff48e 100644 --- a/pym/gentoolkit/revdep_rebuild/collect.py +++ b/pym/gentoolkit/revdep_rebuild/collect.py @@ -6,7 +6,6 @@ import re from portage import os import glob import stat -import sys import portage from portage import _encodings, _unicode_encode diff --git a/pym/gentoolkit/test/test_keyword.py b/pym/gentoolkit/test/test_keyword.py index 99a79b5..8ba5e30 100644 --- a/pym/gentoolkit/test/test_keyword.py +++ b/pym/gentoolkit/test/test_keyword.py @@ -1,4 +1,3 @@ -import sys import unittest from gentoolkit import keyword
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/ekeyword/, pym/gentoolkit/imlate/, pym/gentoolkit/equery/, bin/, ...
commit: d21a2fa94f571100e30f5b755e5050246bcfbbdd Author: Matt Turner gentoo org> AuthorDate: Sun Dec 20 22:12:31 2020 + Commit: Matt Turner gentoo org> CommitDate: Sun Dec 20 22:12:31 2020 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=d21a2fa9 Remove imports from __future__ gentoolkit supports only Python 3.6+ now, so these are not used. Signed-off-by: Matt Turner gentoo.org> bin/eclean | 3 --- bin/eclean-dist | 3 --- bin/eclean-pkg | 3 --- bin/ekeyword | 2 -- bin/enalyze | 2 -- bin/epkginfo | 2 -- bin/equery | 2 -- bin/euse | 8 bin/imlate | 2 -- bin/revdep-rebuild | 2 -- pym/gentoolkit/base.py | 2 -- pym/gentoolkit/dbapi.py | 2 -- pym/gentoolkit/eclean/clean.py | 3 --- pym/gentoolkit/eclean/cli.py | 3 --- pym/gentoolkit/eclean/exclude.py | 3 --- pym/gentoolkit/eclean/output.py | 3 --- pym/gentoolkit/eclean/pkgindex.py| 3 --- pym/gentoolkit/eclean/search.py | 3 --- pym/gentoolkit/ekeyword/ekeyword.py | 2 -- pym/gentoolkit/ekeyword/ekeyword_unittest.py | 2 -- pym/gentoolkit/enalyze/analyze.py| 2 -- pym/gentoolkit/enalyze/output.py | 2 -- pym/gentoolkit/enalyze/rebuild.py| 3 --- pym/gentoolkit/eprefix.py| 2 -- pym/gentoolkit/equery/__init__.py| 2 -- pym/gentoolkit/equery/belongs.py | 2 -- pym/gentoolkit/equery/changes.py | 2 -- pym/gentoolkit/equery/check.py | 2 -- pym/gentoolkit/equery/depends.py | 2 -- pym/gentoolkit/equery/depgraph.py| 2 -- pym/gentoolkit/equery/files.py | 2 -- pym/gentoolkit/equery/has.py | 2 -- pym/gentoolkit/equery/hasuse.py | 2 -- pym/gentoolkit/equery/list_.py | 2 -- pym/gentoolkit/equery/meta.py| 2 -- pym/gentoolkit/equery/size.py| 2 -- pym/gentoolkit/equery/uses.py| 2 -- pym/gentoolkit/equery/which.py | 2 -- pym/gentoolkit/eshowkw/keywords_header.py| 2 -- pym/gentoolkit/imlate/imlate.py | 3 --- pym/gentoolkit/module_base.py| 2 -- pym/gentoolkit/revdep_rebuild/analyse.py | 2 -- pym/gentoolkit/revdep_rebuild/assign.py | 2 -- pym/gentoolkit/revdep_rebuild/cache.py | 2 -- pym/gentoolkit/revdep_rebuild/collect.py | 2 -- pym/gentoolkit/revdep_rebuild/rebuild.py | 2 -- pym/gentoolkit/revdep_rebuild/settings.py| 2 -- pym/gentoolkit/revdep_rebuild/stuff.py | 2 -- pym/gentoolkit/test/eclean/creator.py| 3 --- pym/gentoolkit/test/eclean/distsupport.py| 2 -- pym/gentoolkit/test/eclean/test_clean.py | 2 -- pym/gentoolkit/test/eclean/test_search.py| 3 --- setup.py | 3 --- 53 files changed, 4 insertions(+), 122 deletions(-) diff --git a/bin/eclean b/bin/eclean index 715787b..90f9e55 100755 --- a/bin/eclean +++ b/bin/eclean @@ -4,9 +4,6 @@ Distributed under the terms of the GNU General Public License v2 """ -from __future__ import print_function - - # Meta: __author__ = "Thomas de Grenier de Latour (tgl), " + \ "modular re-write by: Brian Dolbec (dol-sen)" diff --git a/bin/eclean-dist b/bin/eclean-dist index 715787b..90f9e55 100755 --- a/bin/eclean-dist +++ b/bin/eclean-dist @@ -4,9 +4,6 @@ Distributed under the terms of the GNU General Public License v2 """ -from __future__ import print_function - - # Meta: __author__ = "Thomas de Grenier de Latour (tgl), " + \ "modular re-write by: Brian Dolbec (dol-sen)" diff --git a/bin/eclean-pkg b/bin/eclean-pkg index 715787b..90f9e55 100755 --- a/bin/eclean-pkg +++ b/bin/eclean-pkg @@ -4,9 +4,6 @@ Distributed under the terms of the GNU General Public License v2 """ -from __future__ import print_function - - # Meta: __author__ = "Thomas de Grenier de Latour (tgl), " + \ "modular re-write by: Brian Dolbec (dol-sen)" diff --git a/bin/ekeyword b/bin/ekeyword index 72b3f95..2e3c78e 100755 --- a/bin/ekeyword +++ b/bin/ekeyword @@ -13,8 +13,6 @@ the current list as they appear, and ebuilds are processed as they appear. """ -from __future__ import print_function - import os import sys # This block ensures that ^C interrupts are handled quietly. diff --git a/bin/enalyze b/bin/enalyze index 5991f60..a0bb29a 100755 --- a/bin/enalyze +++ b/bin/enalyze @@ -12,8 +12,6 @@ packages that use them. It can also be used to help rebuild /etc/portage/packag files in the event of corruption, and
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/
commit: f14b6198d1dd9cb7f4a83f3822e4a1782a5581e8 Author: Brian Dolbec gentoo org> AuthorDate: Tue Oct 13 14:04:07 2020 + Commit: Brian Dolbec gentoo org> CommitDate: Tue Oct 13 14:13:02 2020 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=f14b6198 metadata.py: Fix duplicated use flag text bug 748129 Regression from commit: 517581df206766 link: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=517581df206766fabf10273cde565e0a6dc62829 Gentoo bug: https://bugs.gentoo.org/748129 Signed-off-by: Brian Dolbec gentoo.org> pym/gentoolkit/metadata.py | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pym/gentoolkit/metadata.py b/pym/gentoolkit/metadata.py index c3dba98..0b58392 100644 --- a/pym/gentoolkit/metadata.py +++ b/pym/gentoolkit/metadata.py @@ -101,8 +101,11 @@ class _Useflag(object): if node.text: _desc = node.text for child in node.iter(): - _desc += child.text if child.text else '' - _desc += child.tail if child.tail else '' + # 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)
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/
commit: 517581df206766fabf10273cde565e0a6dc62829 Author: Mikk Margus Möll ttu ee> AuthorDate: Wed Oct 7 20:00:51 2020 + Commit: Georgy Yakovlev gentoo org> CommitDate: Fri Oct 9 06:29:09 2020 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=517581df metadata: Drop deprecated ElementTree methods Closes: https://github.com/gentoo/gentoolkit/pull/11 Signed-off-by: Georgy Yakovlev gentoo.org> pym/gentoolkit/metadata.py | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pym/gentoolkit/metadata.py b/pym/gentoolkit/metadata.py index 22c249e..c3dba98 100644 --- a/pym/gentoolkit/metadata.py +++ b/pym/gentoolkit/metadata.py @@ -73,8 +73,7 @@ class _Maintainer(object): self.description = None self.restrict = node.get('restrict') self.status = node.get('status') - maint_attrs = node.getchildren() - for attr in maint_attrs: + for attr in node.iter(): setattr(self, attr.tag, attr.text) def __repr__(self): @@ -101,7 +100,7 @@ class _Useflag(object): _desc = '' if node.text: _desc = node.text - for child in node.getchildren(): + for child in node.iter(): _desc += child.text if child.text else '' _desc += child.tail if child.tail else '' # This takes care of tabs and newlines left from the file @@ -213,7 +212,7 @@ class MetaData(object): if herd in ('no-herd', 'maintainer-wanted', 'maintainer-needed'): return None - for node in self._herdstree.getiterator('herd'): + for node in self._herdstree.iter('herd'): if node.findtext('name') == herd: return node.findtext('email') @@ -283,7 +282,7 @@ class MetaData(object): return self._useflags self._useflags = [] - for node in self._xml_tree.getiterator('flag'): + for node in self._xml_tree.iter('flag'): self._useflags.append(_Useflag(node)) return self._useflags
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eclean/
commit: c0b355cf51ca73ad9dd52a0f5c1aebf807be42fc Author: Zac Medico gentoo org> AuthorDate: Tue Jun 9 01:54:46 2020 + Commit: Zac Medico gentoo org> CommitDate: Tue Jun 9 01:57:07 2020 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=c0b355cf eclean --changed-deps: fix EAPI logic (bug 727596) Use separate variables for binary package and corresponding ebuild EAPI values, since the ebuild EAPI may have changed. This avoids a possible InvalidAtom exception as reported in bug 727596. Bug: https://bugs.gentoo.org/727596 Signed-off-by: Zac Medico gentoo.org> pym/gentoolkit/eclean/search.py | 18 ++ 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/pym/gentoolkit/eclean/search.py b/pym/gentoolkit/eclean/search.py index 51edc63..f68aacf 100644 --- a/pym/gentoolkit/eclean/search.py +++ b/pym/gentoolkit/eclean/search.py @@ -490,12 +490,12 @@ class DistfilesSearch(object): return clean_me, saved -def _deps_equal(deps_a, deps_b, eapi, uselist=None): +def _deps_equal(deps_a, eapi_a, deps_b, eapi_b, 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, token_class=Atom) - deps_b = use_reduce(deps_b, uselist=uselist, eapi=eapi, token_class=Atom) + 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_slots(deps_a) strip_slots(deps_b) return deps_a == deps_b @@ -578,12 +578,14 @@ def findPackages( if not options['changed-deps']: continue - keys = ('RDEPEND', 'PDEPEND') - binpkg_deps = ' '.join(bin_dbapi.aux_get(cpv, keys)) - ebuild_deps = ' '.join(port_dbapi.aux_get(cpv, keys)) - uselist = bin_dbapi.aux_get(cpv, ['USE'])[0].split() + dep_keys = ('RDEPEND', 'PDEPEND') + keys = ('EAPI', 'USE') + dep_keys + binpkg_metadata = dict(zip(keys, bin_dbapi.aux_get(cpv, keys))) + ebuild_metadata = dict(zip(keys, port_dbapi.aux_get(cpv, keys))) - if _deps_equal(binpkg_deps, ebuild_deps, cpv.eapi, uselist): + if _deps_equal(' '.join(binpkg_metadata[key] for key in dep_keys), binpkg_metadata['EAPI'], + ' '.join(ebuild_metadata[key] for key in dep_keys), ebuild_metadata['EAPI'], + frozenset(binpkg_metadata['USE'].split())): continue if destructive and var_dbapi.cpv_exists(cpv):
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/, pym/gentoolkit/test/, ...
commit: 5ed5adad0197d06d6f3dbe7d4ea16b2bf7e4ed2d Author: Michał Górny gentoo org> AuthorDate: Fri Apr 24 08:25:10 2020 + Commit: Michał Górny gentoo org> CommitDate: Fri Apr 24 08:25:10 2020 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=5ed5adad profile: Add initial support for arches.desc Signed-off-by: Michał Górny gentoo.org> .../tests/profiles/arches-desc/profiles/arch.list | 45 .../profiles/arches-desc/profiles/arches.desc | 17 ++ .../profiles/arches-desc/profiles/profiles.desc| 295 + pym/gentoolkit/profile.py | 28 +- pym/gentoolkit/test/test_profile.py| 12 + 5 files changed, 394 insertions(+), 3 deletions(-) diff --git a/pym/gentoolkit/ekeyword/tests/profiles/arches-desc/profiles/arch.list b/pym/gentoolkit/ekeyword/tests/profiles/arches-desc/profiles/arch.list new file mode 100644 index 000..e4787c0 --- /dev/null +++ b/pym/gentoolkit/ekeyword/tests/profiles/arches-desc/profiles/arch.list @@ -0,0 +1,45 @@ +alpha +amd64 +amd64-fbsd +arm +arm64 +hppa +ia64 +m68k +mips +ppc +ppc64 +s390 +sh +sparc +sparc-fbsd +x86 +x86-fbsd + +# Prefix keywords +ppc-aix +x86-freebsd +x64-freebsd +sparc64-freebsd +hppa-hpux +ia64-hpux +x86-interix +amd64-linux +arm-linux +ia64-linux +ppc64-linux +x86-linux +ppc-macos +x86-macos +x64-macos +m68k-mint +x86-netbsd +ppc-openbsd +x86-openbsd +x64-openbsd +sparc-solaris +sparc64-solaris +x64-solaris +x86-solaris +x86-winnt +x86-cygwin diff --git a/pym/gentoolkit/ekeyword/tests/profiles/arches-desc/profiles/arches.desc b/pym/gentoolkit/ekeyword/tests/profiles/arches-desc/profiles/arches.desc new file mode 100644 index 000..ca9f946 --- /dev/null +++ b/pym/gentoolkit/ekeyword/tests/profiles/arches-desc/profiles/arches.desc @@ -0,0 +1,17 @@ +alpha testing +amd64 stable +amd64-fbsd testing +armstable +arm64 stable +hppa stable +ia64 testing +m68k testing +mips testing +ppcstable +ppc64 stable +s390 stable +sh stable +sparc stable +sparc-fbsd testing +x86stable +x86-fbsd testing diff --git a/pym/gentoolkit/ekeyword/tests/profiles/arches-desc/profiles/profiles.desc b/pym/gentoolkit/ekeyword/tests/profiles/arches-desc/profiles/profiles.desc new file mode 100644 index 000..be751a8 --- /dev/null +++ b/pym/gentoolkit/ekeyword/tests/profiles/arches-desc/profiles/profiles.desc @@ -0,0 +1,295 @@ +# +# This is a list of valid profiles for each architecture. This file is used by +# repoman when doing a repoman scan or repoman full. +# DO NOT ADD PROFILES WITH A "die" or "exit" IN THEM OR IT KILLS REPOMAN +# +#layout: +#arch profile_directory status + +# Alpha Profiles +alpha default/linux/alpha/13.0stable +alpha default/linux/alpha/13.0/desktopstable +alpha default/linux/alpha/13.0/desktop/gnome stable +alpha default/linux/alpha/13.0/desktop/gnome/systemd stable +alpha default/linux/alpha/13.0/desktop/kdestable +alpha default/linux/alpha/13.0/desktop/kde/systemdstable +alpha default/linux/alpha/13.0/developer stable + +# AMD64 Profiles +amd64 default/linux/amd64/13.0stable +amd64 default/linux/amd64/13.0/selinuxdev +amd64 default/linux/amd64/13.0/desktopstable +amd64 default/linux/amd64/13.0/desktop/gnome stable +amd64 default/linux/amd64/13.0/desktop/gnome/systemd stable +amd64 default/linux/amd64/13.0/desktop/kdestable +amd64 default/linux/amd64/13.0/desktop/kde/systemdstable +amd64 default/linux/amd64/13.0/developer stable +amd64 default/linux/amd64/13.0/no-multilibdev +amd64 default/linux/amd64/13.0/x32dev + +# ARM Profiles +arm default/linux/arm/13.0 stable +arm default/linux/arm/13.0/desktop dev +arm default/linux/arm/13.0/desktop/gnomedev +arm default/linux/arm/13.0/desktop/gnome/systemddev +arm default/linux/arm/13.0/desktop/kde dev +arm default/linux/arm/13.0/desktop/kde/systemd dev +arm default/linux/arm/13.0/developerdev +arm default/linux/arm/13.0/armv4dev +arm default/linux/arm/13.0/armv4/desktopdev +arm default/linux/arm/13.0/armv4/desktop/gnome dev +arm default/linux/arm/13.0/armv4/desktop/kdedev +arm default/linux/arm/13.0/armv4/developer
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/ekeyword/
commit: 459cfba47d2522553d076ebaabf656ce8f29cf11 Author: Michał Górny gentoo org> AuthorDate: Fri Apr 24 07:55:49 2020 + Commit: Michał Górny gentoo org> CommitDate: Fri Apr 24 07:56:24 2020 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=459cfba4 ekeyword: Use now-common load_profile_data() from eshowkw This also fixes 'all' to process all architectures using stable keywords and not just these having stable profiles. Signed-off-by: Michał Górny gentoo.org> pym/gentoolkit/ekeyword/ekeyword.py | 62 ++-- pym/gentoolkit/ekeyword/ekeyword_unittest.py | 36 2 files changed, 3 insertions(+), 95 deletions(-) diff --git a/pym/gentoolkit/ekeyword/ekeyword.py b/pym/gentoolkit/ekeyword/ekeyword.py index cf2a15e..a86a9c2 100755 --- a/pym/gentoolkit/ekeyword/ekeyword.py +++ b/pym/gentoolkit/ekeyword/ekeyword.py @@ -47,6 +47,8 @@ import re import subprocess import sys +from gentoolkit.profile import load_profile_data + import portage from portage.output import colorize, nocolor @@ -179,7 +181,7 @@ def process_keywords(keywords, ops, arch_status=None): if op is None: # Process just stable keywords. arches = [k for k, v in arch_status.items() - if v == 'stable' and k in old_arches] + if v[1] == 'arch' and k in old_arches] else: # Process all possible keywords. We use the arch_status as a # master list. If it lacks some keywords, then we might miss @@ -346,64 +348,6 @@ def portage_settings(): return portage.db[portage.root]['vartree'].settings -def load_profile_data(portdir=None, repo=None): - """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 - - Returns: - A dict mapping the keyword to its preferred state: - {'x86': 'stable', 'mips': 'dev', ...} - """ - if repo is None: - repo = portage_settings().repositories.mainRepo().name - if portdir is None: - portdir = portage_settings().repositories[repo].location - - arch_status = {} - - try: - arch_list = os.path.join(portdir, 'profiles', 'arch.list') - with open(arch_list) as f: - for line in f: - line = line.split('#', 1)[0].strip() - if line: - arch_status[line] = None - except IOError: - pass - - try: - profile_status = { - 'stable': 0, - 'dev': 1, - 'exp': 2, - None: 3, - } - profiles_list = os.path.join(portdir, 'profiles', 'profiles.desc') - with open(profiles_list) as f: - for line in f: - line = line.split('#', 1)[0].split() - if line: - arch, _profile, status = line - arch_status.setdefault(arch, status) - curr_status = profile_status[arch_status[arch]] - new_status = profile_status[status] - if new_status < curr_status: - arch_status[arch] = status - except IOError: - pass - - if arch_status: - arch_status['all'] = None - else: - warning('could not read profile files: %s' % arch_list) - warning('will not be able to verify args are correct') - - return arch_status - - def arg_to_op(arg): """Convert a command line |arg| to an Op""" arch_prefixes = ('-', '~', '^') diff --git a/pym/gentoolkit/ekeyword/ekeyword_unittest.py b/pym/gentoolkit/ekeyword/ekeyword_unittest.py index 5e66afe..7446914 100755 --- a/pym/gentoolkit/ekeyword/ekeyword_unittest.py +++ b/pym/gentoolkit/ekeyword/ekeyword_unittest.py @@ -343,42 +343,6 @@ class TestProcessEbuild(unittest.TestCase): self.assertEqual(m.call_count, 0) -class TestLoadProfileData(unittest.TestCase): - """Tests for load_profile_data""" - - def _test(self, subdir): - portdir = os.path.join(TESTDIR, 'profiles', subdir) - return ekeyword.load_profile_data(portdir=portdir) - - def testLoadBoth(self): - """Test loading both arch.list and profiles.desc""" - ret = self._test('both') -
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/
commit: 39e6451899c28ef20c844c5186fdd2316f2cfbd4 Author: Michał Górny gentoo org> AuthorDate: Fri Apr 24 08:00:41 2020 + Commit: Michał Górny gentoo org> CommitDate: Fri Apr 24 08:00:41 2020 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=39e64518 profile: Update ~arch list Signed-off-by: Michał Górny gentoo.org> pym/gentoolkit/profile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pym/gentoolkit/profile.py b/pym/gentoolkit/profile.py index 945362d..031b497 100644 --- a/pym/gentoolkit/profile.py +++ b/pym/gentoolkit/profile.py @@ -82,9 +82,9 @@ def load_profile_data(portdir=None, repo='gentoo'): warning('will not be able to verify args are correct') # TODO: support arches.desc once the GLEP is finalized - # for now, we just hardcode ~mips + *-* (fbsd, prefix) + # for now, we just hardcode everything + *-* (fbsd, prefix) for k, v in arch_status.items(): - if k in ('alpha', 'mips', 'riscv') or '-' in k: + if k in ('alpha', 'ia64', 'm68k', 'mips', 'riscv') or '-' in k: arch_status[k] = (v, '~arch') else: arch_status[k] = (v, 'arch')
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/test/, pym/gentoolkit/eshowkw/, pym/gentoolkit/
commit: 1a18160c8200fb444878538b127b30bb461e4c42 Author: Michał Górny gentoo org> AuthorDate: Fri Apr 24 07:42:44 2020 + Commit: Michał Górny gentoo org> CommitDate: Fri Apr 24 07:42:44 2020 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=1a18160c Extract profile reading code from eshowkw, with tests from ekeyword Signed-off-by: Michał Górny gentoo.org> pym/gentoolkit/eshowkw/keywords_header.py | 78 +- pym/gentoolkit/profile.py | 92 +++ pym/gentoolkit/test/test_profile.py | 49 3 files changed, 142 insertions(+), 77 deletions(-) diff --git a/pym/gentoolkit/eshowkw/keywords_header.py b/pym/gentoolkit/eshowkw/keywords_header.py index f98f11a..31261dc 100644 --- a/pym/gentoolkit/eshowkw/keywords_header.py +++ b/pym/gentoolkit/eshowkw/keywords_header.py @@ -6,87 +6,11 @@ from __future__ import print_function __all__ = ['keywords_header'] -import portage -import os -import sys -if sys.hexversion < 0x300: - from io import open -from portage import _encodings, _unicode_encode from portage import settings as ports from gentoolkit.eshowkw.display_pretty import colorize_string from gentoolkit.eshowkw.display_pretty import align_string +from gentoolkit.profile import load_profile_data -# Copied from ekeyword -def warning(msg): - """Write |msg| as a warning to stderr""" - print('warning: %s' % msg, file=sys.stderr) - - -# Copied from ekeyword, modified to support arch vs ~arch status -def load_profile_data(portdir=None, repo='gentoo'): - """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 - - 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 - - arch_status = {} - - try: - arch_list = os.path.join(portdir, 'profiles', 'arch.list') - with open(_unicode_encode(arch_list, encoding=_encodings['fs']), - encoding=_encodings['content']) as f: - for line in f: - line = line.split('#', 1)[0].strip() - if line: - arch_status[line] = None - except IOError: - pass - - try: - profile_status = { - 'stable': 0, - 'dev': 1, - 'exp': 2, - None: 3, - } - profiles_list = os.path.join(portdir, 'profiles', 'profiles.desc') - with open(_unicode_encode(profiles_list, encoding=_encodings['fs']), - encoding=_encodings['content']) as f: - for line in f: - line = line.split('#', 1)[0].split() - if line: - arch, _profile, status = line - arch_status.setdefault(arch, status) - curr_status = profile_status[arch_status[arch]] - new_status = profile_status[status] - if new_status < curr_status: - arch_status[arch] = status - except IOError: - pass - - if arch_status: - arch_status['all'] = None - else: - warning('could not read profile files: %s' % arch_list) - warning('will not be able to verify args are correct') - - # TODO: support arches.desc once the GLEP is finalized - # for now, we just hardcode ~mips + *-* (fbsd, prefix) - for k, v in arch_status.items(): - if k in ('alpha', 'mips', 'riscv') or '-' in k: - arch_status[k] = (v, '~arch') - else: - arch_status[k] = (v, 'arch') - - return arch_status def gen_arch_list(status): _arch_status = load_profile_data() diff --git a/pym/gentoolkit/profile.py b/pym/gentoolkit/profile.py new file mode 100644 index 000..945362d --- /dev/null +++ b/pym/gentoolkit/profile.py @@ -0,0 +1,92 @@ +#!/usr/bin/python +# Copyright 2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 +# +# Licensed under the GNU General Public License, v2 + +"""Routines to load profile information for ekeyword/eshowkw""" + +__all__ = ( + 'load_profile_data', +) + + +import os.path +import portage +import sys + +if sys.hexversion < 0x300: +
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eclean/
commit: 98cdccea8f0abc88d360c0c7143263b210910611 Author: Matt Turner gentoo org> AuthorDate: Tue Feb 18 21:39:08 2020 + Commit: Matt Turner gentoo org> CommitDate: Wed Mar 11 23:33:01 2020 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=98cdccea eclean: Add option to delete binpkgs with changed deps Signed-off-by: Matt Turner gentoo.org> pym/gentoolkit/eclean/cli.py| 7 ++- pym/gentoolkit/eclean/search.py | 24 +++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/pym/gentoolkit/eclean/cli.py b/pym/gentoolkit/eclean/cli.py index 1a99b3e..39aafd3 100644 --- a/pym/gentoolkit/eclean/cli.py +++ b/pym/gentoolkit/eclean/cli.py @@ -147,6 +147,8 @@ def printUsage(_error=None, help=None): or help in ('all','packages'): print( "Available", yellow("options"),"for the", green("packages"),"action:", file=out) + print( yellow(" --changed-deps")+ + " - delete packages for which ebuild dependencies have changed", file=out) print( yellow(" -i, --ignore-failure")+ " - ignore failure to locate PKGDIR", file=out) print( file=out) @@ -263,6 +265,8 @@ def parseArgs(options={}): options['size-limit'] = parseSize(a) elif o in ("-v", "--verbose") and not options['quiet']: options['verbose'] = True + elif o in ("--changed-deps"): + options['changed-deps'] = True elif o in ("-i", "--ignore-failure"): options['ignore-failure'] = True else: @@ -290,7 +294,7 @@ def parseArgs(options={}): getopt_options['short']['distfiles'] = "fs:" getopt_options['long']['distfiles'] = ["fetch-restricted", "size-limit="] getopt_options['short']['packages'] = "i" - getopt_options['long']['packages'] = ["ignore-failure"] + getopt_options['long']['packages'] = ["ignore-failure", "changed-deps"] # set default options, except 'nocolor', which is set in main() options['interactive'] = False options['pretend'] = False @@ -303,6 +307,7 @@ def parseArgs(options={}): options['fetch-restricted'] = False options['size-limit'] = 0 options['verbose'] = False + options['changed-deps'] = False options['ignore-failure'] = False # if called by a well-named symlink, set the action accordingly: action = None diff --git a/pym/gentoolkit/eclean/search.py b/pym/gentoolkit/eclean/search.py index 0efefdb..51edc63 100644 --- a/pym/gentoolkit/eclean/search.py +++ b/pym/gentoolkit/eclean/search.py @@ -13,6 +13,8 @@ import sys from functools import partial import portage +from portage.dep import Atom, use_reduce +from portage.dep._slot_operator import strip_slots import gentoolkit.pprinter as pp from gentoolkit.eclean.exclude import (exclDictMatchCP, exclDictExpand, @@ -488,6 +490,17 @@ class DistfilesSearch(object): return clean_me, saved +def _deps_equal(deps_a, deps_b, eapi, 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, token_class=Atom) + deps_b = use_reduce(deps_b, uselist=uselist, eapi=eapi, token_class=Atom) + strip_slots(deps_a) + strip_slots(deps_b) + return deps_a == deps_b + + def findPackages( options, exclude=None, @@ -562,7 +575,16 @@ def findPackages( # Exclude if binpkg exists in the porttree and not --deep if not destructive and port_dbapi.cpv_exists(cpv): - continue + if not options['changed-deps']: + continue + + keys = ('RDEPEND', 'PDEPEND') + binpkg_deps = ' '.join(bin_dbapi.aux_get(cpv, keys)) + ebuild_deps = ' '.join(port_dbapi.aux_get(cpv, keys)) + uselist = bin_dbapi.aux_get(cpv, ['USE'])[0].split() + + if _deps_equal(binpkg_deps, ebuild_deps, cpv.eapi, uselist): + continue if destructive and var_dbapi.cpv_exists(cpv): # Exclude if an instance of the package is installed due to
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eclean/
commit: e4f75fd355cfee672f64a1f9c42a19894e9f7703 Author: Matt Turner gentoo org> AuthorDate: Tue Feb 18 21:05:00 2020 + Commit: Matt Turner gentoo org> CommitDate: Sat Mar 7 06:07:38 2020 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=e4f75fd3 eclean: Rewrite findPackages() I found the original code to be nearly incomprehensible. Instead of populating a dict of potential binpkgs to remove and then removing from the to-be-removed list, just selectively add to-be-removed packages. Signed-off-by: Matt Turner gentoo.org> pym/gentoolkit/eclean/search.py | 113 +++- 1 file changed, 55 insertions(+), 58 deletions(-) diff --git a/pym/gentoolkit/eclean/search.py b/pym/gentoolkit/eclean/search.py index 58bd97e..0efefdb 100644 --- a/pym/gentoolkit/eclean/search.py +++ b/pym/gentoolkit/eclean/search.py @@ -498,89 +498,86 @@ def findPackages( port_dbapi=portage.db[portage.root]["porttree"].dbapi, var_dbapi=portage.db[portage.root]["vartree"].dbapi ): - """Find all obsolete binary packages. - - XXX: packages are found only by symlinks. - Maybe i should also return .tbz2 files from All/ that have - no corresponding symlinks. + """Find obsolete binary packages. @param options: dict of options determined at runtime - @param exclude: an exclusion dict as defined in - exclude.parseExcludeFile class. - @param destructive: boolean, defaults to False - @param time_limit: integer time value as returned by parseTime() - @param package_names: boolean, defaults to False. - used only if destructive=True - @param pkgdir: path to the binary package dir being checked + @type options: dict + @param exclude: exclusion dict (as defined in the exclude.parseExcludeFile class) + @type exclude: dict, optional + @param destructive: binpkg is obsolete if not installed (default: `False`) + @type destructive: bool, optional + @param time_limit: exclude binpkg if newer than time value as returned by parseTime() + @type time_limit: int, optional + @param package_names: exclude all binpkg versions if package is installed + (used with `destructive=True`) (default: `False`) + @type package_names: bool, optional + @param pkgdir: path to the binpkg cache (PKGDIR) + @type pkgdir: str @param port_dbapi: defaults to portage.db[portage.root]["porttree"].dbapi - can be overridden for tests. - @param var_dbapi: defaults to portage.db[portage.root]["vartree"].dbapi - can be overridden for tests. + Can be overridden for tests. + @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 clean_me i.e. {'cat/pkg-ver.tbz2': [filepath],} """ if exclude is None: exclude = {} - clean_me = {} - # create a full package dictionary - # now do an access test, os.walk does not error for "no read permission" + # Access test, os.walk does not error for "no read permission" try: test = os.listdir(pkgdir) del test except EnvironmentError as er: if options['ignore-failure']: exit(0) - print( pp.error("Error accessing PKGDIR." ), file=sys.stderr) - print( pp.error("(Check your make.conf file and environment)."), file=sys.stderr) - print( pp.error("Error: %s" %str(er)), file=sys.stderr) + print(pp.error("Error accessing PKGDIR."), file=sys.stderr) + print(pp.error("(Check your make.conf file and environment)."), file=sys.stderr) + print(pp.error("Error: %s" % str(er)), file=sys.stderr) exit(1) - # if portage supports FEATURES=binpkg-multi-instance, then - # cpv_all can return multiple instances per cpv, where - # instances are distinguishable by some extra attributes - # provided by portage's _pkg_str class + # Create a dictionary of all installed packages + if destructive and package_names: + installed = dict.fromkeys(var_dbapi.cp_all()) + else: + installed = {} + + # Dictionary of binary packages to clean. Organized as cpv->[pkgs] in order + # to support FEATURES=binpkg-multi-instance. + dead_binpkgs = {} + bin_dbapi = portage.binarytree(pkgdir=pkgdir, settings=var_dbapi.settings).dbapi for cpv in bin_dbapi.cpv_all(): -
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/revdep_rebuild/
commit: c6d2400dccc2b5334bfab5f82f1a8bf1ab38f06c Author: Zac Medico gentoo org> AuthorDate: Fri Feb 14 18:04:53 2020 + Commit: Zac Medico gentoo org> CommitDate: Fri Feb 14 18:09:43 2020 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=c6d2400d revdep-rebuild: encode Popen args as utf-8 bytes (bug 709610) Prevent this Popen exception: UnicodeEncodeError: 'ascii' codec can't encode character '\xe8' in position 20: ordinal not in range(128) Bug: https://bugs.gentoo.org/709610#c0 Signed-off-by: Zac Medico gentoo.org> pym/gentoolkit/revdep_rebuild/stuff.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pym/gentoolkit/revdep_rebuild/stuff.py b/pym/gentoolkit/revdep_rebuild/stuff.py index 3b0a980..002eb4b 100644 --- a/pym/gentoolkit/revdep_rebuild/stuff.py +++ b/pym/gentoolkit/revdep_rebuild/stuff.py @@ -19,6 +19,7 @@ def call_program(args): @param, args: arument list to pass to subprocess @return str ''' + args = [arg if isinstance(arg, bytes) else arg.encode('utf-8') for arg in args] subp = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = subp.communicate() stdout = stdout.decode('utf-8')
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/revdep_rebuild/, pym/gentoolkit/test/, pym/gentoolkit/, ...
commit: cd4584ed5934381ff967f4a031b31b8c2e55b530 Author: Michał Górny gentoo org> AuthorDate: Sun Jan 26 15:15:02 2020 + Commit: Michał Górny gentoo org> CommitDate: Sun Jan 26 15:15:02 2020 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=cd4584ed Modernize test assertions Signed-off-by: Michał Górny gentoo.org> pym/gentoolkit/cpv.py | 4 ++-- pym/gentoolkit/revdep_rebuild/settings.py | 6 +++--- pym/gentoolkit/test/eclean/test_search.py | 10 +- pym/gentoolkit/test/equery/test_init.py | 8 pym/gentoolkit/test/test_cpv.py | 8 pym/gentoolkit/test/test_helpers.py | 16 pym/gentoolkit/test/test_keyword.py | 10 +- pym/gentoolkit/test/test_query.py | 14 +++--- 8 files changed, 38 insertions(+), 38 deletions(-) diff --git a/pym/gentoolkit/cpv.py b/pym/gentoolkit/cpv.py index 169c833..2e8e167 100644 --- a/pym/gentoolkit/cpv.py +++ b/pym/gentoolkit/cpv.py @@ -28,8 +28,8 @@ from gentoolkit import errors # Globals # === -isvalid_version_re = re.compile(r"^(?:cvs\\.)?(?:\\d+)(?:\\.\\d+)*[a-z]?" - r"(?:_(p(?:re)?|beta|alpha|rc)\\d*)*$") +isvalid_version_re = re.compile(r"^(?:cvs\.)?(?:\d+)(?:\.\d+)*[a-z]?" + r"(?:_(p(?:re)?|beta|alpha|rc)\d*)*$") isvalid_cat_re = re.compile(r"^(?:[a-zA-Z0-9][-a-zA-Z0-9+._]*(?:/(?!$))?)+$") _pkg_re = re.compile(r"^[a-zA-Z0-9+._]+$") # Prefix specific revision is of the form -r0+.+ diff --git a/pym/gentoolkit/revdep_rebuild/settings.py b/pym/gentoolkit/revdep_rebuild/settings.py index ca8d5fa..718fee7 100644 --- a/pym/gentoolkit/revdep_rebuild/settings.py +++ b/pym/gentoolkit/revdep_rebuild/settings.py @@ -151,15 +151,15 @@ def parse_revdep_config(revdep_confdir): line = line.strip() #first check for comment, we do not want to regex all lines if not line.startswith('#'): - match = re.match(r'LD_LIBRARY_MASK=\\"([^"]+)\\"', line) + match = re.match(r'LD_LIBRARY_MASK=\"([^"]+)"', line) if match is not None: masked_files += ' ' + match.group(1) continue - match = re.match(r'SEARCH_DIRS_MASK=\\"([^"]+)\\"', line) + match = re.match(r'SEARCH_DIRS_MASK=\"([^"]+)"', line) if match is not None: masked_dirs += ' ' + match.group(1) continue - match = re.match(r'SEARCH_DIRS=\\"([^"]+)\\"', line) + match = re.match(r'SEARCH_DIRS="([^"]+)"', line) if match is not None: search_dirs += ' ' + match.group(1) continue diff --git a/pym/gentoolkit/test/eclean/test_search.py b/pym/gentoolkit/test/eclean/test_search.py index 4533909..6dc26a2 100755 --- a/pym/gentoolkit/test/eclean/test_search.py +++ b/pym/gentoolkit/test/eclean/test_search.py @@ -166,12 +166,12 @@ class TestCheckLimits(unittest.TestCase): test['results'].sort() #print("actual=", run_results[i]) #print("should-be=", test['results']) - self.failUnlessEqual(run_results[i], test["results"], + self.assertEqual(run_results[i], test["results"], "/ntest_check_limits, test# %d, test=%s, diff=%s" %(i, test['test'], str(set(run_results[i]).difference(test['results']))) ) test['output'].sort() - self.failUnlessEqual(run_callbacks[i], test['output']) + self.assertEqual(run_callbacks[i], test['output']) class TestFetchRestricted(unittest.TestCase): @@ -290,7 +290,7 @@ class TestFetchRestricted(unittest.TestCase): else: test = "FAILED" print("comparing %s, %s" %(key, item), test) - self.failUnlessEqual(sorted(testdata[item]), sorted(results[item]), + self.assertEqual(sorted(testdata[item]), sorted(results[item]), "\n%s: %s %s data does not match\nresult=" %(test_name, key, item) +\ str(results[item]) + "\ntestdata=" + str(testdata[item])) @@ -530,7 +530,7 @@ class TestNonDestructive(unittest.TestCase): print("comparing %s, %s..." %(key, item), test) if test == "FAILED":
[gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eshowkw/
commit: e98fd5881b7248670cb9c8a4daff537551e1d55e Author: Michał Górny gentoo org> AuthorDate: Sun Jan 26 14:59:20 2020 + Commit: Michał Górny gentoo org> CommitDate: Sun Jan 26 14:59:32 2020 + URL:https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=e98fd588 eshowkw: Add alpha to ~arch-only Signed-off-by: Michał Górny gentoo.org> pym/gentoolkit/eshowkw/keywords_header.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pym/gentoolkit/eshowkw/keywords_header.py b/pym/gentoolkit/eshowkw/keywords_header.py index c17a777..f98f11a 100644 --- a/pym/gentoolkit/eshowkw/keywords_header.py +++ b/pym/gentoolkit/eshowkw/keywords_header.py @@ -81,7 +81,7 @@ def load_profile_data(portdir=None, repo='gentoo'): # TODO: support arches.desc once the GLEP is finalized # for now, we just hardcode ~mips + *-* (fbsd, prefix) for k, v in arch_status.items(): - if k in ('mips', 'riscv') or '-' in k: + if k in ('alpha', 'mips', 'riscv') or '-' in k: arch_status[k] = (v, '~arch') else: arch_status[k] = (v, 'arch')