summaryrefslogtreecommitdiff
path: root/cmdline/apt-get.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2014-11-06 12:53:59 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2014-11-08 14:26:00 +0100
commitf105aaba433f5a8b9c4326dd0d704501bf07d1e5 (patch)
treee614eea939eedd34bfcb37e42c60261d2f654d60 /cmdline/apt-get.cc
parent60b64ffc3468579183abc1bac0179943d782a52e (diff)
better non-virtual metaIndex.LocalFileName() implementation
We can't add a new virtual method without breaking the ABI, but we can freely add new methods, so for older ABIs we just implement this method with a dynamic_cast, so that clients can be more ignorant about the API here and especially don't need to pull a very dirty trick by assuming internal knowledge (like apt-get did here).
Diffstat (limited to 'cmdline/apt-get.cc')
-rw-r--r--cmdline/apt-get.cc30
1 files changed, 2 insertions, 28 deletions
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index b6786faf8..e9e38debc 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -136,28 +136,6 @@ static bool TryToInstallBuildDep(pkgCache::PkgIterator Pkg,pkgCacheFile &Cache,
return true;
}
/*}}}*/
-
-
-// helper that can go wit hthe next ABI break
-#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR < 13)
-static std::string MetaIndexFileNameOnDisk(metaIndex *metaindex)
-{
- // FIXME: this cast is the horror, the horror
- debReleaseIndex *r = (debReleaseIndex*)metaindex;
-
- // see if we have a InRelease file
- std::string PathInRelease = r->MetaIndexFile("InRelease");
- if (FileExists(PathInRelease))
- return PathInRelease;
-
- // and if not return the normal one
- if (FileExists(PathInRelease))
- return r->MetaIndexFile("Release");
-
- return "";
-}
-#endif
-
// GetReleaseForSourceRecord - Return Suite for the given srcrecord /*{{{*/
// ---------------------------------------------------------------------
/* */
@@ -176,12 +154,8 @@ static std::string GetReleaseForSourceRecord(pkgSourceList *SrcList,
{
if (&CurrentIndexFile == (*IF))
{
-#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR < 13)
- std::string path = MetaIndexFileNameOnDisk(*S);
-#else
- std::string path = (*S)->LocalFileName();
-#endif
- if (path != "")
+ std::string const path = (*S)->LocalFileName();
+ if (path != "")
{
indexRecords records;
records.Load(path);