summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt-pkg/deb/debmetaindex.cc16
-rw-r--r--apt-pkg/deb/debmetaindex.h6
-rw-r--r--apt-pkg/indexfile.h4
-rw-r--r--apt-pkg/makefile2
-rw-r--r--apt-pkg/metaindex.cc44
-rw-r--r--apt-pkg/metaindex.h16
-rw-r--r--cmdline/apt-get.cc12
7 files changed, 40 insertions, 60 deletions
diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc
index 345b1ec11..504877558 100644
--- a/apt-pkg/deb/debmetaindex.cc
+++ b/apt-pkg/deb/debmetaindex.cc
@@ -35,7 +35,6 @@ string debReleaseIndex::Info(const char *Type, string const &Section, string con
return Info;
}
-#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR < 13)
string debReleaseIndex::MetaIndexInfo(const char *Type) const
{
string Info = ::URI::SiteOnly(URI) + ' ';
@@ -71,6 +70,21 @@ string debReleaseIndex::MetaIndexURI(const char *Type) const
Res += Type;
return Res;
}
+
+#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
+std::string debReleaseIndex::LocalFileName() const
+{
+ // see if we have a InRelease file
+ std::string PathInRelease = MetaIndexFile("InRelease");
+ if (FileExists(PathInRelease))
+ return PathInRelease;
+
+ // and if not return the normal one
+ if (FileExists(PathInRelease))
+ return MetaIndexFile("Release");
+
+ return "";
+}
#endif
string debReleaseIndex::IndexURISuffix(const char *Type, string const &Section, string const &Arch) const
diff --git a/apt-pkg/deb/debmetaindex.h b/apt-pkg/deb/debmetaindex.h
index fc0b7f948..9f488898d 100644
--- a/apt-pkg/deb/debmetaindex.h
+++ b/apt-pkg/deb/debmetaindex.h
@@ -45,6 +45,12 @@ class debReleaseIndex : public metaIndex {
std::string MetaIndexInfo(const char *Type) const;
std::string MetaIndexFile(const char *Types) const;
std::string MetaIndexURI(const char *Type) const;
+#else
+ virtual std::string MetaIndexInfo(const char *Type) const;
+ virtual std::string MetaIndexFile(const char *Types) const;
+ virtual std::string MetaIndexURI(const char *Type) const;
+
+ virtual std::string LocalFileName() const;
#endif
std::string IndexURI(const char *Type, std::string const &Section, std::string const &Arch="native") const;
diff --git a/apt-pkg/indexfile.h b/apt-pkg/indexfile.h
index 1d34dc773..2d433b60a 100644
--- a/apt-pkg/indexfile.h
+++ b/apt-pkg/indexfile.h
@@ -78,10 +78,10 @@ class pkgIndexFile
virtual bool Exists() const = 0;
virtual bool HasPackages() const = 0;
virtual unsigned long Size() const = 0;
- virtual bool Merge(pkgCacheGenerator &/*Gen*/,OpProgress* /*Prog*/) const { return false; };
+ virtual bool Merge(pkgCacheGenerator &Gen, OpProgress* Prog) const { return false; };
__deprecated virtual bool Merge(pkgCacheGenerator &Gen, OpProgress &Prog) const
{ return Merge(Gen, &Prog); };
- virtual bool MergeFileProvides(pkgCacheGenerator &/*Gen*/,OpProgress* /*Prog*/) const {return true;};
+ virtual bool MergeFileProvides(pkgCacheGenerator &Gen,OpProgress* Prog) const {return true;};
__deprecated virtual bool MergeFileProvides(pkgCacheGenerator &Gen, OpProgress &Prog) const
{return MergeFileProvides(Gen, &Prog);};
virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
diff --git a/apt-pkg/makefile b/apt-pkg/makefile
index 108632695..a90131f80 100644
--- a/apt-pkg/makefile
+++ b/apt-pkg/makefile
@@ -41,7 +41,7 @@ SOURCE+= pkgcache.cc version.cc depcache.cc \
pkgrecords.cc algorithms.cc acquire.cc\
acquire-worker.cc acquire-method.cc init.cc clean.cc \
srcrecords.cc cachefile.cc versionmatch.cc policy.cc \
- pkgsystem.cc indexfile.cc metaindex.cc pkgcachegen.cc acquire-item.cc \
+ pkgsystem.cc indexfile.cc pkgcachegen.cc acquire-item.cc \
indexrecords.cc vendor.cc vendorlist.cc cdrom.cc indexcopy.cc \
aptconfiguration.cc cachefilter.cc cacheset.cc edsp.cc \
install-progress.cc upgrade.cc update.cc
diff --git a/apt-pkg/metaindex.cc b/apt-pkg/metaindex.cc
deleted file mode 100644
index 2292ac388..000000000
--- a/apt-pkg/metaindex.cc
+++ /dev/null
@@ -1,44 +0,0 @@
-
-#include <apt-pkg/strutl.h>
-
-#include "init.h"
-#include "metaindex.h"
-
-
-#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
-string metaIndex::MetaIndexInfo(const char *Type) const
-{
- string Info = ::URI::SiteOnly(URI) + ' ';
- if (Dist[Dist.size() - 1] == '/')
- {
- if (Dist != "/")
- Info += Dist;
- }
- else
- Info += Dist;
- Info += " ";
- Info += Type;
- return Info;
-}
-
-string metaIndex::MetaIndexFile(const char *Type) const
-{
- return _config->FindDir("Dir::State::lists") +
- URItoFileName(MetaIndexURI(Type));
-}
-
-string metaIndex::MetaIndexURI(const char *Type) const
-{
- string Res;
-
- if (Dist == "/")
- Res = URI;
- else if (Dist[Dist.size()-1] == '/')
- Res = URI + Dist;
- else
- Res = URI + "dists/" + Dist + "/";
-
- Res += Type;
- return Res;
-}
-#endif
diff --git a/apt-pkg/metaindex.h b/apt-pkg/metaindex.h
index 6503f7dc8..147154227 100644
--- a/apt-pkg/metaindex.h
+++ b/apt-pkg/metaindex.h
@@ -34,18 +34,22 @@ class metaIndex
virtual std::string GetDist() const {return Dist;}
virtual const char* GetType() const {return Type;}
+ // interface to to query it
+#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
+ virtual std::string MetaIndexInfo(const char *Type) const {return "";};
+ virtual std::string MetaIndexFile(const char *Types) const {return "";};
+ virtual std::string MetaIndexURI(const char *Type) const {return "";};
+
+ // returns the path of the local file (or "" if its not available)
+ virtual std::string LocalFileName() const {return "";};
+#endif
+
// Interface for acquire
virtual std::string ArchiveURI(std::string const& File) const = 0;
virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) const = 0;
virtual std::vector<pkgIndexFile *> *GetIndexFiles() = 0;
virtual bool IsTrusted() const = 0;
-#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
- virtual std::string MetaIndexInfo(const char *Type) const;
- virtual std::string MetaIndexFile(const char *Types) const;
- virtual std::string MetaIndexURI(const char *Type) const;
-#endif
-
metaIndex(std::string const &URI, std::string const &Dist,
char const * const Type)
: Indexes(NULL), Type(Type), URI(URI), Dist(Dist)
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index c38fd2d31..7e59f3d67 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -136,16 +136,12 @@ bool TryToInstallBuildDep(pkgCache::PkgIterator Pkg,pkgCacheFile &Cache,
/*}}}*/
-// FIXME: move into more generic code (metaindex ?)
+// helper that can go wit hthe next ABI break
#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR < 13)
std::string MetaIndexFileNameOnDisk(metaIndex *metaindex)
{
// FIXME: this cast is the horror, the horror
debReleaseIndex *r = (debReleaseIndex*)metaindex;
-#else
-std::string MetaIndexFileNameOnDisk(metaIndex *r)
-{
-#endif
// see if we have a InRelease file
std::string PathInRelease = r->MetaIndexFile("InRelease");
@@ -158,7 +154,7 @@ std::string MetaIndexFileNameOnDisk(metaIndex *r)
return "";
}
-
+#endif
// GetReleaseForSourceRecord - Return Suite for the given srcrecord /*{{{*/
// ---------------------------------------------------------------------
@@ -178,7 +174,11 @@ 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 != "")
{
indexRecords records;