aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Zamarin <arthurzam@gentoo.org>2023-07-14 20:57:47 +0300
committerArthur Zamarin <arthurzam@gentoo.org>2023-07-14 20:57:47 +0300
commitef79d4dcc640658b335fd80cd69bc743d566010a (patch)
treec4f60aa94e6846cb1a4ba430b61712ded675997f
parentmanifest: fix missing errors when all ebuilds for package are masked bad (diff)
downloadpkgcore-ef79d4dcc640658b335fd80cd69bc743d566010a.tar.gz
pkgcore-ef79d4dcc640658b335fd80cd69bc743d566010a.tar.bz2
pkgcore-ef79d4dcc640658b335fd80cd69bc743d566010a.zip
multiplex.tree: fix config name and type
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
-rw-r--r--src/pkgcore/ebuild/resolver.py2
-rw-r--r--src/pkgcore/pkgsets/live_rebuild_set.py2
-rw-r--r--src/pkgcore/repository/multiplex.py24
-rw-r--r--src/pkgcore/repository/util.py5
-rw-r--r--src/pkgcore/resolver/plan.py18
-rw-r--r--src/pkgcore/scripts/pclean.py11
-rw-r--r--src/pkgcore/scripts/pquery.py2
-rw-r--r--tests/repository/test_multiplex.py2
8 files changed, 31 insertions, 35 deletions
diff --git a/src/pkgcore/ebuild/resolver.py b/src/pkgcore/ebuild/resolver.py
index f257a773..153550db 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 baa2d93f..7a864720 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, "I do not know what I am doing: %r" % (pkgs,)
+ assert len(pkgs) == 1, f"I do not know what I am doing: {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 e4679993..9234046f 100644
--- a/src/pkgcore/repository/multiplex.py
+++ b/src/pkgcore/repository/multiplex.py
@@ -81,14 +81,15 @@ class tree(prototype.tree):
pkgcore_config_type = ConfigHint(types={"repos": "refs:repo"}, typename="repo")
- def __init__(self, *trees):
+ def __init__(self, repos):
super().__init__()
- for x in trees:
+ repos = tuple(repos)
+ for x in repos:
if not hasattr(x, "itermatch"):
raise errors.InitializationError(
f"{x} is not a repository tree derivative"
)
- self.trees = trees
+ self.trees = repos
def _get_categories(self, *optional_category):
d = set()
@@ -227,10 +228,9 @@ 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(
- "cannot add '%s' and '%s' objects"
- % (self.__class__.__name__, other.__class__.__name__)
+ f"cannot add {other.__class__.__name__!r} and {self.__class__.__name__!r} objects"
)
def __radd__(self, other):
@@ -239,19 +239,13 @@ 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(
- "cannot add '%s' and '%s' objects"
- % (other.__class__.__name__, self.__class__.__name__)
+ f"cannot add {other.__class__.__name__!r} and {self.__class__.__name__!r} objects"
)
def __repr__(self):
- return "<%s.%s trees=%r @%#8x>" % (
- self.__class__.__module__,
- self.__class__.__name__,
- getattr(self, "trees", "unset"),
- id(self),
- )
+ return f"<{self.__class__.__module__}.{self.__class__.__name__} trees={getattr(self, 'trees', 'unset')!r} @{id(self):#8x}>"
@property
def pkg_masks(self):
diff --git a/src/pkgcore/repository/util.py b/src/pkgcore/repository/util.py
index 013c16bd..9cd29eee 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,8 +137,7 @@ class RepositoryGroup(DictMixin):
elif isinstance(other, (list, tuple)):
return RepositoryGroup(tuple(other) + self.repos)
raise TypeError(
- "cannot add '%s' and '%s' objects"
- % (other.__class__.__name__, self.__class__.__name__)
+ f"cannot add {other.__class__.__name__!r} and {self.__class__.__name__!r} objects"
)
@classmethod
diff --git a/src/pkgcore/resolver/plan.py b/src/pkgcore/resolver/plan.py
index 90edb81f..5276b271 100644
--- a/src/pkgcore/resolver/plan.py
+++ b/src/pkgcore/resolver/plan.py
@@ -335,11 +335,9 @@ 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()
@@ -1066,6 +1064,12 @@ 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 c319b9b9..e1efdbd3 100644
--- a/src/pkgcore/scripts/pclean.py
+++ b/src/pkgcore/scripts/pclean.py
@@ -275,11 +275,10 @@ class _UnfilteredRepos(DictMixin):
try:
return self.unfiltered_repos[key]
except KeyError:
- repos = []
- kwargs = {key: ()}
- for repo in self.domain.ebuild_repos_unfiltered:
- repos.append(self.domain.filter_repo(repo, **kwargs))
- unfiltered_repo = multiplex.tree(*repos)
+ unfiltered_repo = multiplex.tree(
+ self.domain.filter_repo(repo, key=())
+ for repo in self.domain.ebuild_repos_unfiltered
+ )
self.unfiltered_repos[key] = unfiltered_repo
return unfiltered_repo
@@ -416,7 +415,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 7a8922ba..c09ac618 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 5977241d..93833367 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(