diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-10-09 10:06:55 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-10-09 10:06:55 +0000 |
commit | 6e6d7fcf8321d31bddbd37823b310b50658bed95 (patch) | |
tree | 38b2d90b8f666c7d2b7aca5450d53470a5f42a2d /pym/portage/dbapi/virtual.py | |
parent | 386a74a800015f21934b0e452e25855591c83647 (diff) | |
download | portage-6e6d7fcf8321d31bddbd37823b310b50658bed95.tar.gz portage-6e6d7fcf8321d31bddbd37823b310b50658bed95.tar.bz2 portage-6e6d7fcf8321d31bddbd37823b310b50658bed95.zip |
Bug #149816 - Implement visibility filtering support for
binary packages. This works by creating a virtual filtered
repository that can be composed of multiple package types,
including ebuilds, binary packages, and installed packages.
svn path=/main/trunk/; revision=8012
Diffstat (limited to 'pym/portage/dbapi/virtual.py')
-rw-r--r-- | pym/portage/dbapi/virtual.py | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/pym/portage/dbapi/virtual.py b/pym/portage/dbapi/virtual.py index 30f51ceaf..65ac0a8d0 100644 --- a/pym/portage/dbapi/virtual.py +++ b/pym/portage/dbapi/virtual.py @@ -10,7 +10,14 @@ class fakedbapi(dbapi): """A fake dbapi that allows consumers to inject/remove packages to/from it portage.settings is required to maintain the dbAPI. """ - def __init__(self, settings=None): + def __init__(self, settings=None, exclusive_slots=True): + """ + @param exclusive_slots: When True, injecting a package with SLOT + metadata causes an existing package in the same slot to be + automatically removed (default is True). + @type exclusive_slots: Boolean + """ + self._exclusive_slots = exclusive_slots self.cpvdict = {} self.cpdict = {} if settings is None: @@ -46,12 +53,19 @@ class fakedbapi(dbapi): return self.cpvdict.keys() def cpv_inject(self, mycpv, metadata=None): - """Adds a cpv from the list of available packages.""" + """Adds a cpv to the list of available packages. See the + exclusive_slots constructor parameter for behavior with + respect to SLOT metadata. + @param mycpv: cpv for the package to inject + @type mycpv: str + @param metadata: dictionary of raw metadata for aux_get() calls + @param metadata: dict + """ self._clear_cache() mycp = cpv_getkey(mycpv) self.cpvdict[mycpv] = metadata myslot = None - if metadata: + if self._exclusive_slots and metadata: myslot = metadata.get("SLOT", None) if myslot and mycp in self.cpdict: # If necessary, remove another package in the same SLOT. |