Bug#448627: pkgCache::Priority spuriously requires a pkgCache.
Package: apt
Version: 0.7.8
Severity: wishlist
pkgCache::Priority() looks up the localized string corresponding to a
priority level. The sum total of its content is:
--------- snip ---------
const char *pkgCache::Priority(unsigned char Prio)
{
const char *Mapping[] = {0,_("important"),_("required"),_("standard"),
_("optional"),_("extra")};
if (Prio < _count(Mapping))
return Mapping[Prio];
return 0;
}
--------- snip ---------
Nothing in there accesses the package cache! Yet, because this is
declared as a dynamic member of the package cache, code that needs to
manipulate priorities has to have a pointer to an initialized copy of
the package cache.
It would be better if this were not the case. While this seems like
it should ideally move to one of apt's global "information" classes, say
maybe pkgSystem, I would be happy to just have it turn into a static
method. (obviously in either case you'll want to leave a stub behind
for backwards compatibility)
Daniel
-- System Information:
Debian Release: lenny/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.22-2-686 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages apt depends on:
ii debian-archive-keyring 2007.07.31 GnuPG archive keys of the Debian a
ii libc6 2.6.1-6 GNU C Library: Shared libraries
ii libgcc1 1:4.2.2-3 GCC support library
ii libstdc++6 4.2.2-3 The GNU Standard C++ Library v3
apt recommends no packages.
-- no debconf information
Reply to: