summaryrefslogtreecommitdiff
path: root/apt-pkg/deb
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/deb')
-rw-r--r--apt-pkg/deb/debindexfile.cc8
-rw-r--r--apt-pkg/deb/deblistparser.cc39
-rw-r--r--apt-pkg/deb/debmetaindex.cc31
-rw-r--r--apt-pkg/deb/debversion.cc11
-rw-r--r--apt-pkg/deb/dpkgpm.cc17
5 files changed, 58 insertions, 48 deletions
diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc
index de645bb6e..909dfcf47 100644
--- a/apt-pkg/deb/debindexfile.cc
+++ b/apt-pkg/deb/debindexfile.cc
@@ -22,6 +22,7 @@
#include <apt-pkg/strutl.h>
#include <apt-pkg/acquire-item.h>
#include <apt-pkg/debmetaindex.h>
+#include <apt-pkg/gpgv.h>
#include <sys/stat.h>
/*}}}*/
@@ -337,7 +338,12 @@ bool debPackagesIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
if (releaseExists == true || FileExists(ReleaseFile) == true)
{
- FileFd Rel(ReleaseFile,FileFd::ReadOnly);
+ FileFd Rel;
+ // Beware: The 'Release' file might be clearsigned in case the
+ // signature for an 'InRelease' file couldn't be checked
+ if (OpenMaybeClearSignedFile(ReleaseFile, Rel) == false)
+ return false;
+
if (_error->PendingError() == true)
return false;
Parser.LoadReleaseInfo(File,Rel,Section);
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index b84bd6fdd..db86bd698 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -28,12 +28,13 @@
using std::string;
-static debListParser::WordList PrioList[] = {{"important",pkgCache::State::Important},
- {"required",pkgCache::State::Required},
- {"standard",pkgCache::State::Standard},
- {"optional",pkgCache::State::Optional},
- {"extra",pkgCache::State::Extra},
- {}};
+static debListParser::WordList PrioList[] = {
+ {"required",pkgCache::State::Required},
+ {"important",pkgCache::State::Important},
+ {"standard",pkgCache::State::Standard},
+ {"optional",pkgCache::State::Optional},
+ {"extra",pkgCache::State::Extra},
+ {}};
// ListParser::debListParser - Constructor /*{{{*/
// ---------------------------------------------------------------------
@@ -283,7 +284,7 @@ unsigned short debListParser::VersionHash()
"Replaces",0};
unsigned long Result = INIT_FCS;
char S[1024];
- for (const char **I = Sections; *I != 0; I++)
+ for (const char * const *I = Sections; *I != 0; ++I)
{
const char *Start;
const char *End;
@@ -294,13 +295,13 @@ unsigned short debListParser::VersionHash()
of certain fields. dpkg also has the rather interesting notion of
reformatting depends operators < -> <= */
char *J = S;
- for (; Start != End; Start++)
+ for (; Start != End; ++Start)
{
- if (isspace(*Start) == 0)
- *J++ = tolower_ascii(*Start);
- if (*Start == '<' && Start[1] != '<' && Start[1] != '=')
- *J++ = '=';
- if (*Start == '>' && Start[1] != '>' && Start[1] != '=')
+ if (isspace(*Start) != 0)
+ continue;
+ *J++ = tolower_ascii(*Start);
+
+ if ((*Start == '<' || *Start == '>') && Start[1] != *Start && Start[1] != '=')
*J++ = '=';
}
@@ -800,13 +801,12 @@ bool debListParser::LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,
map_ptrloc const storage = WriteUniqString(component);
FileI->Component = storage;
- // FIXME: Code depends on the fact that Release files aren't compressed
+ // FIXME: should use FileFd and TagSection
FILE* release = fdopen(dup(File.Fd()), "r");
if (release == NULL)
return false;
char buffer[101];
- bool gpgClose = false;
while (fgets(buffer, sizeof(buffer), release) != NULL)
{
size_t len = 0;
@@ -818,15 +818,6 @@ bool debListParser::LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,
if (buffer[len] == '\0')
continue;
- // only evalute the first GPG section
- if (strncmp("-----", buffer, 5) == 0)
- {
- if (gpgClose == true)
- break;
- gpgClose = true;
- continue;
- }
-
// seperate the tag from the data
const char* dataStart = strchr(buffer + len, ':');
if (dataStart == NULL)
diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc
index 6c191fd95..7a88d71e3 100644
--- a/apt-pkg/deb/debmetaindex.cc
+++ b/apt-pkg/deb/debmetaindex.cc
@@ -229,6 +229,8 @@ vector <struct IndexTarget *>* debReleaseIndex::ComputeIndexTargets() const {
/*}}}*/
bool debReleaseIndex::GetIndexes(pkgAcquire *Owner, bool const &GetAll) const
{
+ bool const tryInRelease = _config->FindB("Acquire::TryInRelease", true);
+
// special case for --print-uris
if (GetAll) {
vector <struct IndexTarget *> *targets = ComputeIndexTargets();
@@ -239,18 +241,27 @@ bool debReleaseIndex::GetIndexes(pkgAcquire *Owner, bool const &GetAll) const
// this is normally created in pkgAcqMetaSig, but if we run
// in --print-uris mode, we add it here
- new pkgAcqMetaIndex(Owner, MetaIndexURI("Release"),
- MetaIndexInfo("Release"), "Release",
- MetaIndexURI("Release.gpg"),
- ComputeIndexTargets(),
- new indexRecords (Dist));
+ if (tryInRelease == false)
+ new pkgAcqMetaIndex(Owner, MetaIndexURI("Release"),
+ MetaIndexInfo("Release"), "Release",
+ MetaIndexURI("Release.gpg"),
+ ComputeIndexTargets(),
+ new indexRecords (Dist));
}
- new pkgAcqMetaSig(Owner, MetaIndexURI("Release.gpg"),
- MetaIndexInfo("Release.gpg"), "Release.gpg",
- MetaIndexURI("Release"), MetaIndexInfo("Release"), "Release",
- ComputeIndexTargets(),
- new indexRecords (Dist));
+ if (tryInRelease == true)
+ new pkgAcqMetaClearSig(Owner, MetaIndexURI("InRelease"),
+ MetaIndexInfo("InRelease"), "InRelease",
+ MetaIndexURI("Release"), MetaIndexInfo("Release"), "Release",
+ MetaIndexURI("Release.gpg"), MetaIndexInfo("Release.gpg"), "Release.gpg",
+ ComputeIndexTargets(),
+ new indexRecords (Dist));
+ else
+ new pkgAcqMetaSig(Owner, MetaIndexURI("Release.gpg"),
+ MetaIndexInfo("Release.gpg"), "Release.gpg",
+ MetaIndexURI("Release"), MetaIndexInfo("Release"), "Release",
+ ComputeIndexTargets(),
+ new indexRecords (Dist));
return true;
}
diff --git a/apt-pkg/deb/debversion.cc b/apt-pkg/deb/debversion.cc
index a02699a44..140561262 100644
--- a/apt-pkg/deb/debversion.cc
+++ b/apt-pkg/deb/debversion.cc
@@ -215,10 +215,15 @@ bool debVersioningSystem::CheckDep(const char *PkgVer,
return true;
if (PkgVer == 0 || PkgVer[0] == 0)
return false;
-
+ Op &= 0x0F;
+
+ // fast track for (equal) strings [by location] which are by definition equal versions
+ if (PkgVer == DepVer)
+ return Op == pkgCache::Dep::Equals || Op == pkgCache::Dep::LessEq || Op == pkgCache::Dep::GreaterEq;
+
// Perform the actual comparision.
- int Res = CmpVersion(PkgVer,DepVer);
- switch (Op & 0x0F)
+ int const Res = CmpVersion(PkgVer, DepVer);
+ switch (Op)
{
case pkgCache::Dep::LessEq:
if (Res <= 0)
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index 6cb8bc6b6..3bc31dc37 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -147,11 +147,11 @@ static
pkgCache::VerIterator FindNowVersion(const pkgCache::PkgIterator &Pkg)
{
pkgCache::VerIterator Ver;
- for (Ver = Pkg.VersionList(); Ver.end() == false; Ver++)
+ for (Ver = Pkg.VersionList(); Ver.end() == false; ++Ver)
{
pkgCache::VerFileIterator Vf = Ver.FileList();
pkgCache::PkgFileIterator F = Vf.File();
- for (F = Vf.File(); F.end() == false; F++)
+ for (F = Vf.File(); F.end() == false; ++F)
{
if (F && F.Archive())
{
@@ -1585,12 +1585,12 @@ void pkgDPkgPM::WriteApportReport(const char *pkgpath, const char *errormsg)
if (!logfile_name.empty())
{
FILE *log = NULL;
- char buf[1024];
fprintf(report, "DpkgTerminalLog:\n");
log = fopen(logfile_name.c_str(),"r");
if(log != NULL)
{
+ char buf[1024];
while( fgets(buf, sizeof(buf), log) != NULL)
fprintf(report, " %s", buf);
fclose(log);
@@ -1609,13 +1609,11 @@ void pkgDPkgPM::WriteApportReport(const char *pkgpath, const char *errormsg)
// attach dmesg log (to learn about segfaults)
if (FileExists("/bin/dmesg"))
{
- FILE *log = NULL;
- char buf[1024];
-
fprintf(report, "Dmesg:\n");
- log = popen("/bin/dmesg","r");
+ FILE *log = popen("/bin/dmesg","r");
if(log != NULL)
{
+ char buf[1024];
while( fgets(buf, sizeof(buf), log) != NULL)
fprintf(report, " %s", buf);
pclose(log);
@@ -1625,13 +1623,12 @@ void pkgDPkgPM::WriteApportReport(const char *pkgpath, const char *errormsg)
// attach df -l log (to learn about filesystem status)
if (FileExists("/bin/df"))
{
- FILE *log = NULL;
- char buf[1024];
fprintf(report, "Df:\n");
- log = popen("/bin/df -l","r");
+ FILE *log = popen("/bin/df -l","r");
if(log != NULL)
{
+ char buf[1024];
while( fgets(buf, sizeof(buf), log) != NULL)
fprintf(report, " %s", buf);
pclose(log);