Bug#686221: libapt-pkg4.12: vci::FromString can not be reused with alternate pci::FromString
Package: libapt-pkg4.12
Version: 0.9.7.4
Severity: wishlist
Dear Maintainer,
The pci, vci constructors (FromString, FromRegex, etc.) are currently
static members. When vci::FromString seeks to find which packages to
use it calls pci::FromString and there is currently no way to tell vci
to use a different pci constructor.
In the example of aptitude, we would like to replace pci::FromString
so that it uses “FromPattern” instead of FromRegex. This means we
would have to also reimplement (i.e. copy-paste) vci::FromString to
use the new pci::FromString.
One way around this is to use virtual constructors on pci and vci. I
suspect this then requires aptitude to define it's own PackageSet,
etc. which derives from aptitude::pci and pkgCache::PackageSet. This
is also a fairly disruptive change to the current cache set design.
Perhaps a better solution, without the need to create derived
interface and container classes, is to use CacheSetHelper to redirect
to the appropriate constructor. Something like:
-- cacheset.cc:
virtual bool CacheSetHelper::PackagesFromString(pci, Cache, string)
{ return PackageContainerInterface::FromString(pci, Cache, string, *this); }
bool VersionContainerInterface::FromString(…) {
…
PackageSet pkgset;
if (onlyFromName == false)
helper.PackagesFromString(&pkgset, Cache, pkg, helper);
--
Something like that could also be used when matching arch so that the
helper instance defines the policy for whether wildcards return all
matches or not. See #686220.
Anyway, I plan to investigate these and maybe other options. Filing
here in case anyone has any thoughts on this.
Regards
-- System Information:
Debian Release: wheezy/sid
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Foreign Architectures: amd64
Kernel: Linux 2.6.32-5-686-bigmem (SMP w/1 CPU core)
Locale: LANG=en_AU.utf8, LC_CTYPE=en_AU.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages libapt-pkg4.12 depends on:
ii libbz2-1.0 1.0.6-1
ii libc6 2.13-34
ii libgcc1 1:4.7.1-2
ii libstdc++6 4.7.1-2
ii multiarch-support 2.13-26
ii zlib1g 1:1.2.7.dfsg-13
libapt-pkg4.12 recommends no packages.
libapt-pkg4.12 suggests no packages.
-- no debconf information
Reply to: