diff options
author | Sam James <sam@gentoo.org> | 2023-07-15 06:53:04 +0100 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2023-07-15 06:53:04 +0100 |
commit | bc6dd02f549c26e481a7fccea87cee02afb052d5 (patch) | |
tree | 46905b211aca937fd8de015a2dfa1d84bf33f338 | |
parent | multiplex.tree: fix config name and type (diff) | |
download | pkgcore-bc6dd02f549c26e481a7fccea87cee02afb052d5.tar.gz pkgcore-bc6dd02f549c26e481a7fccea87cee02afb052d5.tar.bz2 pkgcore-bc6dd02f549c26e481a7fccea87cee02afb052d5.zip |
Revert "multiplex.tree: fix config name and type"
This reverts commit ef79d4dcc640658b335fd80cd69bc743d566010a.
As discussed on IRC, temporary fix for live users.
Bug: https://github.com/pkgcore/pkgcheck/issues/602
Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r-- | src/pkgcore/ebuild/resolver.py | 2 | ||||
-rw-r--r-- | src/pkgcore/pkgsets/live_rebuild_set.py | 2 | ||||
-rw-r--r-- | src/pkgcore/repository/multiplex.py | 24 | ||||
-rw-r--r-- | src/pkgcore/repository/util.py | 5 | ||||
-rw-r--r-- | src/pkgcore/resolver/plan.py | 18 | ||||
-rw-r--r-- | src/pkgcore/scripts/pclean.py | 11 | ||||
-rw-r--r-- | src/pkgcore/scripts/pquery.py | 2 | ||||
-rw-r--r-- | tests/repository/test_multiplex.py | 2 |
8 files changed, 35 insertions, 31 deletions
diff --git a/src/pkgcore/ebuild/resolver.py b/src/pkgcore/ebuild/resolver.py index 153550db..f257a773 100644 --- a/src/pkgcore/ebuild/resolver.py +++ b/src/pkgcore/ebuild/resolver.py @@ -147,7 +147,7 @@ class empty_tree_merge_plan(plan.merge_plan): super().__init__(dbs, *args, **kwds) # XXX *cough*, hack. self.default_dbs = multiplex.tree( - x for x in self.all_raw_dbs if not x.livefs + *[x for x in self.all_raw_dbs if not x.livefs] ) diff --git a/src/pkgcore/pkgsets/live_rebuild_set.py b/src/pkgcore/pkgsets/live_rebuild_set.py index 7a864720..baa2d93f 100644 --- a/src/pkgcore/pkgsets/live_rebuild_set.py +++ b/src/pkgcore/pkgsets/live_rebuild_set.py @@ -25,7 +25,7 @@ class EclassConsumerSet(VersionedInstalled): if not pkgs: # pkg is installed but no longer in any repo, just ignore it. continue - assert len(pkgs) == 1, f"I do not know what I am doing: {pkgs}" + assert len(pkgs) == 1, "I do not know what I am doing: %r" % (pkgs,) pkg = pkgs[0] if self.eclasses.isdisjoint(pkg.data.get("_eclasses_", ())): yield atom diff --git a/src/pkgcore/repository/multiplex.py b/src/pkgcore/repository/multiplex.py index 9234046f..e4679993 100644 --- a/src/pkgcore/repository/multiplex.py +++ b/src/pkgcore/repository/multiplex.py @@ -81,15 +81,14 @@ class tree(prototype.tree): pkgcore_config_type = ConfigHint(types={"repos": "refs:repo"}, typename="repo") - def __init__(self, repos): + def __init__(self, *trees): super().__init__() - repos = tuple(repos) - for x in repos: + for x in trees: if not hasattr(x, "itermatch"): raise errors.InitializationError( f"{x} is not a repository tree derivative" ) - self.trees = repos + self.trees = trees def _get_categories(self, *optional_category): d = set() @@ -228,9 +227,10 @@ class tree(prototype.tree): self.trees += (other,) return self elif isinstance(other, tree): - return tree(self.trees + other.trees) + return tree(*(self.trees + other.trees)) raise TypeError( - f"cannot add {other.__class__.__name__!r} and {self.__class__.__name__!r} objects" + "cannot add '%s' and '%s' objects" + % (self.__class__.__name__, other.__class__.__name__) ) def __radd__(self, other): @@ -239,13 +239,19 @@ class tree(prototype.tree): self.trees = (other,) + self.trees return self elif isinstance(other, tree): - return tree(other.trees + self.trees) + return tree(*(other.trees + self.trees)) raise TypeError( - f"cannot add {other.__class__.__name__!r} and {self.__class__.__name__!r} objects" + "cannot add '%s' and '%s' objects" + % (other.__class__.__name__, self.__class__.__name__) ) def __repr__(self): - return f"<{self.__class__.__module__}.{self.__class__.__name__} trees={getattr(self, 'trees', 'unset')!r} @{id(self):#8x}>" + return "<%s.%s trees=%r @%#8x>" % ( + self.__class__.__module__, + self.__class__.__name__, + getattr(self, "trees", "unset"), + id(self), + ) @property def pkg_masks(self): diff --git a/src/pkgcore/repository/util.py b/src/pkgcore/repository/util.py index 9cd29eee..013c16bd 100644 --- a/src/pkgcore/repository/util.py +++ b/src/pkgcore/repository/util.py @@ -76,7 +76,7 @@ class RepositoryGroup(DictMixin): def __init__(self, repos=(), combined=None): self.repos = tuple(repos) if combined is None: - combined = multiplex.tree(self.repos) + combined = multiplex.tree(*self.repos) self.combined = combined itermatch = klass.alias_attr("combined.itermatch") @@ -137,7 +137,8 @@ class RepositoryGroup(DictMixin): elif isinstance(other, (list, tuple)): return RepositoryGroup(tuple(other) + self.repos) raise TypeError( - f"cannot add {other.__class__.__name__!r} and {self.__class__.__name__!r} objects" + "cannot add '%s' and '%s' objects" + % (other.__class__.__name__, self.__class__.__name__) ) @classmethod diff --git a/src/pkgcore/resolver/plan.py b/src/pkgcore/resolver/plan.py index 5276b271..90edb81f 100644 --- a/src/pkgcore/resolver/plan.py +++ b/src/pkgcore/resolver/plan.py @@ -335,9 +335,11 @@ class merge_plan: self.state = state.plan_state() vdb_state_filter_restrict = MutableContainmentRestriction(self.state.vdb_filter) self.livefs_dbs = multiplex.tree( - filtered.tree(x, vdb_state_filter_restrict) - for x in self.all_raw_dbs - if x.livefs + *[ + filtered.tree(x, vdb_state_filter_restrict) + for x in self.all_raw_dbs + if x.livefs + ] ) self.insoluble = set() @@ -1064,12 +1066,6 @@ class merge_plan: @classmethod def prefer_reuse_strategy(cls, dbs): return multiplex.tree( - ( - misc.multiplex_sorting_repo( - highest_iter_sort, cls.just_livefs_dbs(dbs) - ), - misc.multiplex_sorting_repo( - highest_iter_sort, cls.just_nonlivefs_dbs(dbs) - ), - ) + misc.multiplex_sorting_repo(highest_iter_sort, cls.just_livefs_dbs(dbs)), + misc.multiplex_sorting_repo(highest_iter_sort, cls.just_nonlivefs_dbs(dbs)), ) diff --git a/src/pkgcore/scripts/pclean.py b/src/pkgcore/scripts/pclean.py index e1efdbd3..c319b9b9 100644 --- a/src/pkgcore/scripts/pclean.py +++ b/src/pkgcore/scripts/pclean.py @@ -275,10 +275,11 @@ class _UnfilteredRepos(DictMixin): try: return self.unfiltered_repos[key] except KeyError: - unfiltered_repo = multiplex.tree( - self.domain.filter_repo(repo, key=()) - for repo in self.domain.ebuild_repos_unfiltered - ) + repos = [] + kwargs = {key: ()} + for repo in self.domain.ebuild_repos_unfiltered: + repos.append(self.domain.filter_repo(repo, **kwargs)) + unfiltered_repo = multiplex.tree(*repos) self.unfiltered_repos[key] = unfiltered_repo return unfiltered_repo @@ -415,7 +416,7 @@ def _dist_validate_args(parser, namespace): distdir = namespace.domain.distdir repo = namespace.repo if repo is None: - repo = multiplex.tree(get_virtual_repos(namespace.domain.source_repos, False)) + repo = multiplex.tree(*get_virtual_repos(namespace.domain.source_repos, False)) all_dist_files = set(os.path.basename(f) for f in listdir_files(distdir)) target_files = set() diff --git a/src/pkgcore/scripts/pquery.py b/src/pkgcore/scripts/pquery.py index c09ac618..7a8922ba 100644 --- a/src/pkgcore/scripts/pquery.py +++ b/src/pkgcore/scripts/pquery.py @@ -697,7 +697,7 @@ def bind_add_query(*args, **kwds): help="extended atom matching of pkgs", ) def matches_finalize(targets, namespace): - repos = multiplex.tree(namespace.repos) + repos = multiplex.tree(*namespace.repos) # If current working dir is in a repo, build a path restriction; otherwise # match everything. diff --git a/tests/repository/test_multiplex.py b/tests/repository/test_multiplex.py index 93833367..5977241d 100644 --- a/tests/repository/test_multiplex.py +++ b/tests/repository/test_multiplex.py @@ -38,7 +38,7 @@ class TestMultiplex: ) self.tree1 = SimpleTree(self.d1) self.tree2 = SimpleTree(self.d2) - self.ctree = self.kls((self.tree1, self.tree2)) + self.ctree = self.kls(self.tree1, self.tree2) def test_iter(self): assert sorted(x.cpvstr for x in self.ctree) == sorted( |