summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2013-12-05 08:24:00 +0100
committerMichael Vogt <mvo@debian.org>2013-12-05 08:24:00 +0100
commit44633bd7cac1ce68d4e475285a0f45b7a8952a7f (patch)
tree3e3af83bb955b9f49f38239d490b5173bb0b9ac4 /apt-pkg
parentb10b0c4aac5d0648125d4203eea6900032efb7ba (diff)
parent7014e1482942d00b66eb30061b0cf5d2a7b3ebf3 (diff)
Merge branch 'debian/sid' into ubuntu/master
Conflicts: apt-pkg/deb/dpkgpm.cc cmdline/apt-key.in debian/control doc/apt-key.8.xml doc/makefile doc/po/apt-doc.pot doc/po/de.po doc/po/es.po doc/po/fr.po doc/po/it.po doc/po/ja.po doc/po/pl.po doc/po/pt.po doc/po/pt_BR.po
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/contrib/fileutl.cc3
-rw-r--r--apt-pkg/deb/debmetaindex.cc17
-rw-r--r--apt-pkg/deb/debmetaindex.h7
-rw-r--r--apt-pkg/indexfile.h4
-rw-r--r--apt-pkg/indexrecords.cc5
-rw-r--r--apt-pkg/indexrecords.h1
-rw-r--r--apt-pkg/init.cc10
-rw-r--r--apt-pkg/metaindex.h24
8 files changed, 52 insertions, 19 deletions
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index 3a6bdfe2e..7fbe4d604 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -1545,6 +1545,9 @@ bool FileFd::Skip(unsigned long long Over)
/* */
bool FileFd::Truncate(unsigned long long To)
{
+ // truncating /dev/null is always successful - as we get an error otherwise
+ if (To == 0 && FileName == "/dev/null")
+ return true;
#if defined HAVE_ZLIB || defined HAVE_BZ2
if (d != NULL && (d->gz != NULL || d->bz2 != NULL))
return FileFdError("Truncating compressed files is not implemented (%s)", FileName.c_str());
diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc
index b597b6f3c..504877558 100644
--- a/apt-pkg/deb/debmetaindex.cc
+++ b/apt-pkg/deb/debmetaindex.cc
@@ -1,4 +1,3 @@
-// ijones, walters
#include <config.h>
#include <apt-pkg/debmetaindex.h>
@@ -72,6 +71,22 @@ string debReleaseIndex::MetaIndexURI(const char *Type) const
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
{
string Res ="";
diff --git a/apt-pkg/deb/debmetaindex.h b/apt-pkg/deb/debmetaindex.h
index b9ecab97c..cef8d68f7 100644
--- a/apt-pkg/deb/debmetaindex.h
+++ b/apt-pkg/deb/debmetaindex.h
@@ -3,6 +3,7 @@
#define PKGLIB_DEBMETAINDEX_H
#include <apt-pkg/metaindex.h>
+#include <apt-pkg/init.h>
#include <map>
#include <string>
@@ -39,9 +40,15 @@ class debReleaseIndex : public metaIndex {
virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) const;
std::vector <struct IndexTarget *>* ComputeIndexTargets() const;
std::string Info(const char *Type, std::string const &Section, std::string const &Arch="") const;
+
std::string MetaIndexInfo(const char *Type) const;
std::string MetaIndexFile(const char *Types) const;
std::string MetaIndexURI(const char *Type) const;
+
+#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
+ virtual std::string LocalFileName() const;
+#endif
+
std::string IndexURI(const char *Type, std::string const &Section, std::string const &Arch="native") const;
std::string IndexURISuffix(const char *Type, std::string const &Section, std::string const &Arch="native") const;
std::string SourceIndexURI(const char *Type, const std::string &Section) 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/indexrecords.cc b/apt-pkg/indexrecords.cc
index 8a72ca151..f8097c3c6 100644
--- a/apt-pkg/indexrecords.cc
+++ b/apt-pkg/indexrecords.cc
@@ -27,6 +27,11 @@ string indexRecords::GetDist() const
return this->Dist;
}
+string indexRecords::GetSuite() const
+{
+ return this->Suite;
+}
+
bool indexRecords::CheckDist(const string MaybeDist) const
{
return (this->Dist == MaybeDist
diff --git a/apt-pkg/indexrecords.h b/apt-pkg/indexrecords.h
index a98b939bc..d003ec0fa 100644
--- a/apt-pkg/indexrecords.h
+++ b/apt-pkg/indexrecords.h
@@ -46,6 +46,7 @@ class indexRecords
virtual bool Load(std::string Filename);
std::string GetDist() const;
+ std::string GetSuite() const;
time_t GetValidUntil() const;
virtual bool CheckDist(const std::string MaybeDist) const;
std::string GetExpectedDist() const;
diff --git a/apt-pkg/init.cc b/apt-pkg/init.cc
index 4818174ac..a2e58fae2 100644
--- a/apt-pkg/init.cc
+++ b/apt-pkg/init.cc
@@ -44,16 +44,8 @@ bool pkgInitConfig(Configuration &Cnf)
Cnf.CndSet("APT::Install-Suggests", false);
Cnf.CndSet("Dir","/");
- // State
+ // State
Cnf.CndSet("Dir::State","var/lib/apt/");
-
- /* Just in case something goes horribly wrong, we can fall back to the
- old /var/state paths.. */
- struct stat St;
- if (stat("/var/lib/apt/.",&St) != 0 &&
- stat("/var/state/apt/.",&St) == 0)
- Cnf.CndSet("Dir::State","var/state/apt/");
-
Cnf.CndSet("Dir::State::lists","lists/");
Cnf.CndSet("Dir::State::cdroms","cdroms.list");
Cnf.CndSet("Dir::State::mirrors","mirrors/");
diff --git a/apt-pkg/metaindex.h b/apt-pkg/metaindex.h
index 5783735ff..18a90a29d 100644
--- a/apt-pkg/metaindex.h
+++ b/apt-pkg/metaindex.h
@@ -5,6 +5,7 @@
#include <string>
#include <apt-pkg/pkgcache.h>
#include <apt-pkg/indexfile.h>
+#include <apt-pkg/init.h>
#ifndef APT_8_CLEANER_HEADERS
#include <apt-pkg/srcrecords.h>
@@ -28,27 +29,36 @@ class metaIndex
public:
-
// Various accessors
virtual std::string GetURI() const {return URI;}
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)
+ // 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 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;
- metaIndex(std::string const &URI, std::string const &Dist, char const * const Type) :
- Indexes(NULL), Type(Type), URI(URI), Dist(Dist) {
+ metaIndex(std::string const &URI, std::string const &Dist,
+ char const * const Type)
+ : Indexes(NULL), Type(Type), URI(URI), Dist(Dist)
+ {
+ /* nothing */
}
- virtual ~metaIndex() {
+ virtual ~metaIndex()
+ {
if (Indexes == 0)
return;
- for (std::vector<pkgIndexFile *>::iterator I = (*Indexes).begin(); I != (*Indexes).end(); ++I)
+ for (std::vector<pkgIndexFile *>::iterator I = (*Indexes).begin();
+ I != (*Indexes).end(); ++I)
delete *I;
delete Indexes;
}