summaryrefslogtreecommitdiff
path: root/apt-pkg/deb
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2013-04-23 08:08:54 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2013-04-23 08:08:54 +0200
commit3444603f5ff2b4c4816e45e686e06e01df31cdc4 (patch)
treeb0e63e9bc86ca6d39f6987381ca7bfa64e186048 /apt-pkg/deb
parent52d5690b47bd4efe425fa23d9f6559bb44324cd1 (diff)
parent3278fe66567d149ea92c1afa78941f2bc3c71c85 (diff)
merged debian-sid branch and resolved conflicts
Diffstat (limited to 'apt-pkg/deb')
-rw-r--r--apt-pkg/deb/debindexfile.cc8
-rw-r--r--apt-pkg/deb/deblistparser.cc26
-rw-r--r--apt-pkg/deb/debmetaindex.cc32
-rw-r--r--apt-pkg/deb/debversion.cc11
-rw-r--r--apt-pkg/deb/dpkgpm.cc17
5 files changed, 55 insertions, 39 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 56d5297fc..db86bd698 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -284,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;
@@ -295,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++ = '=';
}
@@ -801,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;
@@ -819,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 bcc617da7..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();
@@ -236,16 +238,32 @@ bool debReleaseIndex::GetIndexes(pkgAcquire *Owner, bool const &GetAll) const
new pkgAcqIndex(Owner, (*Target)->URI, (*Target)->Description,
(*Target)->ShortDesc, HashString());
}
+
+ // this is normally created in pkgAcqMetaSig, but if we run
+ // in --print-uris mode, we add it here
+ if (tryInRelease == false)
+ new pkgAcqMetaIndex(Owner, MetaIndexURI("Release"),
+ MetaIndexInfo("Release"), "Release",
+ MetaIndexURI("Release.gpg"),
+ ComputeIndexTargets(),
+ new indexRecords (Dist));
}
- 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));
+ 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;
+ return true;
}
void debReleaseIndex::SetTrusted(bool const Trusted)
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 0e468b590..cb137729d 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())
{
@@ -1590,12 +1590,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);
@@ -1614,13 +1614,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);
@@ -1630,13 +1628,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);