summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2014-11-07 16:45:18 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2014-11-08 14:28:28 +0100
commit765190e493645e13b5651625d87fd9c8db910a85 (patch)
tree880990c3eca3c131345c2289d426a989a498fb53 /apt-pkg
parentdce45dbe97531de6806707445da97d3f22285db8 (diff)
guard ABI changes for SourcePkg/Ver in pkgCache
Git-Dch: Ignore
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/cacheiterators.h2
-rw-r--r--apt-pkg/deb/deblistparser.cc2
-rw-r--r--apt-pkg/deb/dpkgpm.cc11
-rw-r--r--apt-pkg/edsp.cc7
-rw-r--r--apt-pkg/pkgcache.h2
5 files changed, 23 insertions, 1 deletions
diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h
index b0c02d4a2..f8f4c05ce 100644
--- a/apt-pkg/cacheiterators.h
+++ b/apt-pkg/cacheiterators.h
@@ -215,12 +215,14 @@ class pkgCache::VerIterator : public Iterator<Version, VerIterator> {
// Accessors
inline const char *VerStr() const {return S->VerStr == 0?0:Owner->StrP + S->VerStr;}
inline const char *Section() const {return S->Section == 0?0:Owner->StrP + S->Section;}
+#if APT_PKG_ABI >= 413
/** \brief source package name this version comes from
Always contains the name, even if it is the same as the binary name */
inline const char *SourcePkgName() const {return Owner->StrP + S->SourcePkgName;}
/** \brief source version this version comes from
Always contains the version string, even if it is the same as the binary version */
inline const char *SourceVerStr() const {return Owner->StrP + S->SourceVerStr;}
+#endif
inline const char *Arch() const {
if ((S->MultiArch & pkgCache::Version::All) == pkgCache::Version::All)
return "all";
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index 42db341b3..462818a03 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -141,6 +141,7 @@ bool debListParser::NewVersion(pkgCache::VerIterator &Ver)
map_stringitem_t const idx = StoreString(pkgCacheGenerator::SECTION, Start, Stop - Start);
Ver->Section = idx;
}
+#if APT_PKG_ABI >= 413
// Parse the source package name
pkgCache::GrpIterator const G = Ver.ParentPkg().Group();
Ver->SourcePkgName = G->Name;
@@ -192,6 +193,7 @@ bool debListParser::NewVersion(pkgCache::VerIterator &Ver)
}
}
}
+#endif
Ver->MultiArch = ParseMultiArch(true);
// Archive Size
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index 0cded32e1..3f6039e0d 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -1684,7 +1684,7 @@ void pkgDPkgPM::WriteApportReport(const char *pkgpath, const char *errormsg)
if (apportPkg.end() == true || apportPkg->CurrentVer == 0)
return;
- string pkgname, reportfile, srcpkgname, pkgver, arch;
+ string pkgname, reportfile, pkgver, arch;
string::size_type pos;
FILE *report;
@@ -1823,7 +1823,16 @@ void pkgDPkgPM::WriteApportReport(const char *pkgpath, const char *errormsg)
time_t now = time(NULL);
fprintf(report, "Date: %s" , ctime(&now));
fprintf(report, "Package: %s %s\n", pkgname.c_str(), pkgver.c_str());
+#if APT_PKG_ABI >= 413
fprintf(report, "SourcePackage: %s\n", Ver.SourcePkgName());
+#else
+ pkgRecords Recs(Cache);
+ pkgRecords::Parser &Parse = Recs.Lookup(Ver.FileList());
+ std::string srcpkgname = Parse.SourcePkg();
+ if(srcpkgname.empty())
+ srcpkgname = pkgname;
+ fprintf(report, "SourcePackage: %s\n", srcpkgname.c_str());
+#endif
fprintf(report, "ErrorMessage:\n %s\n", errormsg);
// ensure that the log is flushed
diff --git a/apt-pkg/edsp.cc b/apt-pkg/edsp.cc
index 2ba914b16..3c6a7e30f 100644
--- a/apt-pkg/edsp.cc
+++ b/apt-pkg/edsp.cc
@@ -96,7 +96,14 @@ void EDSP::WriteScenarioVersion(pkgDepCache &Cache, FILE* output, pkgCache::PkgI
pkgCache::VerIterator const &Ver)
{
fprintf(output, "Package: %s\n", Pkg.Name());
+#if APT_PKG_ABI >= 413
fprintf(output, "Source: %s\n", Ver.SourcePkgName());
+#else
+ pkgRecords Recs(Cache);
+ pkgRecords::Parser &rec = Recs.Lookup(Ver.FileList());
+ string srcpkg = rec.SourcePkg().empty() ? Pkg.Name() : rec.SourcePkg();
+ fprintf(output, "Source: %s\n", srcpkg.c_str());
+#endif
fprintf(output, "Architecture: %s\n", Ver.Arch());
fprintf(output, "Version: %s\n", Ver.VerStr());
if (Pkg.CurrentVer() == Ver)
diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h
index 4f8568205..a7b7fa539 100644
--- a/apt-pkg/pkgcache.h
+++ b/apt-pkg/pkgcache.h
@@ -510,12 +510,14 @@ struct pkgCache::Version
map_stringitem_t VerStr;
/** \brief section this version is filled in */
map_stringitem_t Section;
+#if APT_PKG_ABI >= 413
/** \brief source package name this version comes from
Always contains the name, even if it is the same as the binary name */
map_stringitem_t SourcePkgName;
/** \brief source version this version comes from
Always contains the version string, even if it is the same as the binary version */
map_stringitem_t SourceVerStr;
+#endif
/** \brief Multi-Arch capabilities of a package version */
enum VerMultiArch { None = 0, /*!< is the default and doesn't trigger special behaviour */