diff options
-rw-r--r-- | doc/config/sets.docbook | 8 | ||||
-rw-r--r-- | pym/portage/sets/dbapi.py | 13 |
2 files changed, 19 insertions, 2 deletions
diff --git a/doc/config/sets.docbook b/doc/config/sets.docbook index ec8ff9a2a..35beef41d 100644 --- a/doc/config/sets.docbook +++ b/doc/config/sets.docbook @@ -124,6 +124,7 @@ [installed category packages] class = portage.sets.dbapi.CategorySet multiset = true + repository = vartree name_pattern = $category/* </programlisting> </para> @@ -438,6 +439,13 @@ <listitem><para><varname>category</varname>: Required. The name of an existing ebuild category which should be used to create the package set.</para> </listitem> + <listitem><para><varname>repository</varname>: Optional, defaults to + <parameter>porttree</parameter>. It determines which repository class should + be used to create the package set. Valid values for this option are: + <parameter>porttree</parameter> (normal ebuild repository), + <parameter>vartree</parameter> (installed package repository) + and <parameter>bintree</parameter> (local binary package repository).</para> + </listitem> <listitem><para><varname>only_visible</varname>: Optional, defaults to <parameter>true</parameter>. When set to <parameter>true</parameter> the set will only include visible packages, when set to <parameter>false</parameter> it will also include masked packages. diff --git a/pym/portage/sets/dbapi.py b/pym/portage/sets/dbapi.py index f2e7dd110..a5d7c7153 100644 --- a/pym/portage/sets/dbapi.py +++ b/pym/portage/sets/dbapi.py @@ -232,6 +232,13 @@ class CategorySet(PackageSet): myatoms.append(cp) self._setAtoms(myatoms) + def _builderGetRepository(cls, options, repositories): + repository = options.get("repository", "porttree") + if not repository in repositories: + raise SetConfigError(_("invalid repository class '%s'") % repository) + return repository + _builderGetRepository = classmethod(_builderGetRepository) + def _builderGetVisible(cls, options): return get_boolean(options, "only_visible", True) _builderGetVisible = classmethod(_builderGetVisible) @@ -244,9 +251,10 @@ class CategorySet(PackageSet): if not category in settings.categories: raise SetConfigError(_("invalid category name '%s'") % category) + repository = cls._builderGetRepository(options, trees.keys()) visible = cls._builderGetVisible(options) - return CategorySet(category, dbapi=trees["porttree"].dbapi, only_visible=visible) + return CategorySet(category, dbapi=trees[repository].dbapi, only_visible=visible) singleBuilder = classmethod(singleBuilder) def multiBuilder(cls, options, settings, trees): @@ -260,6 +268,7 @@ class CategorySet(PackageSet): else: categories = settings.categories + repository = cls._builderGetRepository(options, trees.keys()) visible = cls._builderGetVisible(options) name_pattern = options.get("name_pattern", "$category/*") @@ -267,7 +276,7 @@ class CategorySet(PackageSet): raise SetConfigError(_("name_pattern doesn't include $category placeholder")) for cat in categories: - myset = CategorySet(cat, trees["porttree"].dbapi, only_visible=visible) + myset = CategorySet(cat, trees[repository].dbapi, only_visible=visible) myname = name_pattern.replace("$category", cat) myname = myname.replace("${category}", cat) rValue[myname] = myset |