summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt-pkg/cacheiterators.h6
-rw-r--r--apt-pkg/cacheset.h11
-rw-r--r--apt-pkg/deb/deblistparser.cc3
-rw-r--r--apt-pkg/depcache.cc2
-rw-r--r--apt-pkg/pkgcache.cc11
-rw-r--r--apt-pkg/pkgcache.h5
6 files changed, 26 insertions, 12 deletions
diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h
index 2fdf8404d..f2aae7272 100644
--- a/apt-pkg/cacheiterators.h
+++ b/apt-pkg/cacheiterators.h
@@ -160,7 +160,11 @@ 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. It used to return the section of the "first parsed
+ // package stanza", but as this can potentially be anything it now returns the section of the
+ // newest version instead (if any). aka: Run as fast as you can to Version.Section().
+ APT_DEPRECATED const char *Section() const;
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;}
diff --git a/apt-pkg/cacheset.h b/apt-pkg/cacheset.h
index dde4e221e..36f41c34d 100644
--- a/apt-pkg/cacheset.h
+++ b/apt-pkg/cacheset.h
@@ -118,7 +118,16 @@ public:
inline const char *Name() const {return getPkg().Name(); }
inline std::string FullName(bool const Pretty) const { return getPkg().FullName(Pretty); }
inline std::string FullName() const { return getPkg().FullName(); }
- inline const char *Section() const {return getPkg().Section(); }
+ APT_DEPRECATED inline const char *Section() const {
+#if __GNUC__ >= 4
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
+ return getPkg().Section();
+#if __GNUC__ >= 4
+ #pragma GCC diagnostic pop
+#endif
+ }
inline bool Purge() const {return getPkg().Purge(); }
inline const char *Arch() const {return getPkg().Arch(); }
inline pkgCache::GrpIterator Group() const { return getPkg().Group(); }
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index 4447b54dd..192a281db 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -255,9 +255,6 @@ MD5SumValue debListParser::Description_md5()
bool debListParser::UsePackage(pkgCache::PkgIterator &Pkg,
pkgCache::VerIterator &Ver)
{
- if (Pkg->Section == 0)
- Pkg->Section = UniqFindTagWrite("Section");
-
string const static myArch = _config->Find("APT::Architecture");
// Possible values are: "all", "native", "installed" and "none"
// The "installed" mode is handled by ParseStatus(), See #544481 and friends.
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index c25672d1c..492d16029 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -1225,7 +1225,7 @@ bool pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
continue;
}
// now check if we should consider it a automatic dependency or not
- if(InstPkg->CurrentVer == 0 && Pkg->Section != 0 && ConfigValueInSubTree("APT::Never-MarkAuto-Sections", Pkg.Section()))
+ if(InstPkg->CurrentVer == 0 && InstVer->Section != 0 && ConfigValueInSubTree("APT::Never-MarkAuto-Sections", InstVer.Section()))
{
if(DebugAutoInstall == true)
std::clog << OutputInDepth(Depth) << "Setting NOT as auto-installed (direct "
diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc
index 8326741ed..b1ed0129d 100644
--- a/apt-pkg/pkgcache.cc
+++ b/apt-pkg/pkgcache.cc
@@ -527,7 +527,10 @@ operator<<(std::ostream& out, pkgCache::PkgIterator Pkg)
out << " -> " << candidate;
if ( newest != "none" && candidate != newest)
out << " | " << newest;
- out << " > ( " << string(Pkg.Section()==0?"none":Pkg.Section()) << " )";
+ if (Pkg->VersionList == 0)
+ out << " > ( none )";
+ else
+ out << " > ( " << string(Pkg.VersionList().Section()==0?"unknown":Pkg.VersionList().Section()) << " )";
return out;
}
/*}}}*/
@@ -1039,3 +1042,9 @@ bool pkgCache::PrvIterator::IsMultiArchImplicit() const
return false;
}
/*}}}*/
+APT_DEPRECATED APT_PURE const char * pkgCache::PkgIterator::Section() const {/*{{{*/
+ if (S->VersionList == 0)
+ return 0;
+ return VersionList().Section();
+}
+ /*}}}*/
diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h
index f57c31b98..0ce2a2878 100644
--- a/apt-pkg/pkgcache.h
+++ b/apt-pkg/pkgcache.h
@@ -392,11 +392,6 @@ struct pkgCache::Package
map_pointer_t VersionList; // Version
/** \brief index to the installed version */
map_pointer_t CurrentVer; // Version
- /** \brief indicates the deduced section
-
- Should be the index to the string "Unknown" or to the section
- of the last parsed item. */
- map_stringitem_t Section;
/** \brief index of the group this package belongs to */
map_pointer_t Group; // Group the Package belongs to