summaryrefslogtreecommitdiff
path: root/apt-pkg/cacheiterators.h
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2014-06-13 08:35:32 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2014-11-10 17:23:29 +0100
commit50ef3344c3afaaf9943142906b2f976a0337d264 (patch)
treeb13f20f54089d8a0930066c5c006348865767b1b /apt-pkg/cacheiterators.h
parent3a2b39ee602dd5a98b8fdaee2f1c8e0b13a276e2 (diff)
deprecate the Section member from package struct
A version belongs to a section and has hence a section member of its own. A package on the other hand can have multiple versions from different sections. This was "solved" by using the section which was parsed first as order of sources.list defines, but that is obviously a horribly unpredictable thing. Users are way better of with the Section() as returned by the version they are dealing with. It is likely the same for all versions of a package, but in the few cases it isn't, it is important (like packages moving from main/* to contrib/* or into oldlibs …). Backport of 7a66977 which actually instantly removes the member.
Diffstat (limited to 'apt-pkg/cacheiterators.h')
-rw-r--r--apt-pkg/cacheiterators.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h
index 2fdf8404d..513f40f17 100644
--- a/apt-pkg/cacheiterators.h
+++ b/apt-pkg/cacheiterators.h
@@ -160,7 +160,9 @@ class pkgCache::PkgIterator: public Iterator<Package, PkgIterator> {
// Accessors
inline const char *Name() const {return S->Name == 0?0:Owner->StrP + S->Name;}
- inline const char *Section() const {return S->Section == 0?0:Owner->StrP + S->Section;}
+ // Versions have sections - and packages can have different versions with different sections
+ // so this interface is broken by design. Run as fast as you can to Version.Section().
+ APT_DEPRECATED inline const char *Section() const {return S->Section == 0?0:Owner->StrP + S->Section;}
inline bool Purge() const {return S->CurrentState == pkgCache::State::Purge ||
(S->CurrentVer == 0 && S->CurrentState == pkgCache::State::NotInstalled);}
inline const char *Arch() const {return S->Arch == 0?0:Owner->StrP + S->Arch;}