summaryrefslogtreecommitdiff
path: root/apt-pkg/deb
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/deb')
-rw-r--r--apt-pkg/deb/deblistparser.cc84
-rw-r--r--apt-pkg/deb/debsrcrecords.cc8
-rw-r--r--apt-pkg/deb/dpkgpm.cc19
3 files changed, 52 insertions, 59 deletions
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index 9201e6a54..edc001abb 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -67,23 +67,12 @@ string debListParser::Package() {
/*}}}*/
// ListParser::Architecture - Return the package arch /*{{{*/
// ---------------------------------------------------------------------
-/* This will return the Architecture of the package this section describes
- Note that architecture "all" packages will get the architecture of the
- Packages file parsed here. */
+/* This will return the Architecture of the package this section describes */
string debListParser::Architecture() {
- string const Result = Section.FindS("Architecture");
- if (Result.empty() == true || Result == "all")
- {
- if (Arch.empty() == true)
- /* FIXME: this is a problem for installed arch all
- packages as we don't know from which arch this
- package was installed - and therefore which
- dependency this package resolves. */
- return _config->Find("APT::Architecture");
- else
- return Arch;
- }
- return Result;
+ std::string const Arch = Section.FindS("Architecture");
+ if (Arch.empty() == true)
+ return _config->Find("APT::Architecture");
+ return Arch;
}
/*}}}*/
// ListParser::ArchitectureAll /*{{{*/
@@ -112,27 +101,30 @@ bool debListParser::NewVersion(pkgCache::VerIterator &Ver)
Ver->Section = UniqFindTagWrite("Section");
// Parse multi-arch
- if (Section.FindS("Architecture") == "all")
- /* Arch all packages can't have a Multi-Arch field,
- but we need a special treatment for them nonetheless */
- Ver->MultiArch = pkgCache::Version::All;
- else
- {
- string const MultiArch = Section.FindS("Multi-Arch");
- if (MultiArch.empty() == true)
- Ver->MultiArch = pkgCache::Version::None;
- else if (MultiArch == "same")
- Ver->MultiArch = pkgCache::Version::Same;
- else if (MultiArch == "foreign")
- Ver->MultiArch = pkgCache::Version::Foreign;
- else if (MultiArch == "allowed")
- Ver->MultiArch = pkgCache::Version::Allowed;
- else
+ string const MultiArch = Section.FindS("Multi-Arch");
+ if (MultiArch.empty() == true)
+ Ver->MultiArch = pkgCache::Version::None;
+ else if (MultiArch == "same") {
+ // Parse multi-arch
+ if (Section.FindS("Architecture") == "all")
{
- _error->Warning("Unknown Multi-Arch type »%s« for package »%s«",
- MultiArch.c_str(), Section.FindS("Package").c_str());
+ /* Arch all packages can't be Multi-Arch: same */
+ _error->Warning("Architecture: all package '%s' can't be Multi-Arch: same",
+ Section.FindS("Package").c_str());
Ver->MultiArch = pkgCache::Version::None;
}
+ else
+ Ver->MultiArch = pkgCache::Version::Same;
+ }
+ else if (MultiArch == "foreign")
+ Ver->MultiArch = pkgCache::Version::Foreign;
+ else if (MultiArch == "allowed")
+ Ver->MultiArch = pkgCache::Version::Allowed;
+ else
+ {
+ _error->Warning("Unknown Multi-Arch type '%s' for package '%s'",
+ MultiArch.c_str(), Section.FindS("Package").c_str());
+ Ver->MultiArch = pkgCache::Version::None;
}
// Archive Size
@@ -150,24 +142,6 @@ bool debListParser::NewVersion(pkgCache::VerIterator &Ver)
Ver->Priority = pkgCache::State::Extra;
}
- if (Ver->MultiArch == pkgCache::Version::All)
- {
- /* We maintain a "pseudo" arch=all package for architecture all versions
- on which these versions can depend on. This pseudo package is many used
- for downloading/installing: The other pseudo-packages will degenerate
- to a NOP in the download/install step - this package will ensure that
- it is downloaded only one time and installed only one time -- even if
- the architecture bound versions coming in and out on regular basis. */
- if (strcmp(Ver.Arch(true),"all") == 0)
- return true;
- else if (MultiArchEnabled == true)
- {
- // our pseudo packages have no size to not confuse the fetcher
- Ver->Size = 0;
- Ver->InstalledSize = 0;
- }
- }
-
if (ParseDepends(Ver,"Depends",pkgCache::Dep::Depends) == false)
return false;
if (ParseDepends(Ver,"Pre-Depends",pkgCache::Dep::PreDepends) == false)
@@ -644,7 +618,7 @@ bool debListParser::ParseDepends(pkgCache::VerIterator &Ver,
return true;
string Package;
- string const pkgArch = Ver.Arch(true);
+ string const pkgArch = Ver.Arch();
string Version;
unsigned int Op;
@@ -683,7 +657,7 @@ bool debListParser::ParseProvides(pkgCache::VerIterator &Ver)
{
string Package;
string Version;
- string const Arch = Ver.Arch(true);
+ string const Arch = Ver.Arch();
unsigned int Op;
while (1)
@@ -768,7 +742,7 @@ bool debListParser::Step()
if (Architecture == Arch)
return true;
- if (Architecture == "all")
+ if (Architecture == "all" && Arch == _config->Find("APT::Architecture"))
return true;
}
diff --git a/apt-pkg/deb/debsrcrecords.cc b/apt-pkg/deb/debsrcrecords.cc
index 21336e1af..749305005 100644
--- a/apt-pkg/deb/debsrcrecords.cc
+++ b/apt-pkg/deb/debsrcrecords.cc
@@ -14,6 +14,7 @@
#include <apt-pkg/error.h>
#include <apt-pkg/strutl.h>
#include <apt-pkg/configuration.h>
+#include <apt-pkg/aptconfiguration.h>
using std::max;
/*}}}*/
@@ -111,7 +112,9 @@ bool debSrcRecordParser::Files(vector<pkgSrcRecords::File> &List)
string Base = Sect.FindS("Directory");
if (Base.empty() == false && Base[Base.length()-1] != '/')
Base += '/';
-
+
+ std::vector<std::string> const compExts = APT::Configuration::getCompressorExtensions();
+
// Iterate over the entire list grabbing each triplet
const char *C = Files.c_str();
while (*C != 0)
@@ -144,7 +147,8 @@ bool debSrcRecordParser::Files(vector<pkgSrcRecords::File> &List)
}
F.Type = string(F.Path,Tmp+1,Pos-Tmp);
- if (F.Type == "gz" || F.Type == "bz2" || F.Type == "lzma" || F.Type == "tar")
+ if (std::find(compExts.begin(), compExts.end(), std::string(".").append(F.Type)) != compExts.end() ||
+ F.Type == "tar")
{
Pos = Tmp-1;
continue;
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index 7d0d34a46..7b0955b96 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -881,7 +881,10 @@ bool pkgDPkgPM::Go(int OutStatusFd)
// Generate the argument list
const char *Args[MaxArgs + 50];
-
+ // keep track of allocated strings for multiarch package names
+ char *Packages[MaxArgs + 50];
+ unsigned int pkgcount = 0;
+
// Now check if we are within the MaxArgs limit
//
// this code below is problematic, because it may happen that
@@ -989,13 +992,20 @@ bool pkgDPkgPM::Go(int OutStatusFd)
}
else
{
+ string const nativeArch = _config->Find("APT::Architecture");
for (;I != J && Size < MaxArgBytes; I++)
{
if((*I).Pkg.end() == true)
continue;
if (I->Op == Item::Configure && disappearedPkgs.find(I->Pkg.Name()) != disappearedPkgs.end())
continue;
- Args[n++] = I->Pkg.Name();
+ if (I->Pkg.Arch() == nativeArch || !strcmp(I->Pkg.Arch(), "all"))
+ Args[n++] = I->Pkg.Name();
+ else
+ {
+ Packages[pkgcount] = strdup(I->Pkg.FullName(false).c_str());
+ Args[n++] = Packages[pkgcount++];
+ }
Size += strlen(Args[n-1]);
}
}
@@ -1145,6 +1155,11 @@ bool pkgDPkgPM::Go(int OutStatusFd)
sigemptyset(&sigmask);
sigprocmask(SIG_BLOCK,&sigmask,&original_sigmask);
+ /* clean up the temporary allocation for multiarch package names in
+ the parent, so we don't leak memory when we return. */
+ for (unsigned int i = 0; i < pkgcount; i++)
+ free(Packages[i]);
+
// the result of the waitpid call
int res;
int select_ret;