summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2010-02-10 22:45:58 +0100
committerDavid Kalnischkies <kalnischkies@gmail.com>2010-02-10 22:45:58 +0100
commit67e0766f0eab85ce1aeacee75fc6b200f36996c9 (patch)
treed3b28a7e8d75f523f0787da6609956257909a938
parent302578f3b286540a327c822d8be3ccbb4fa47d0a (diff)
Foreign Versions add an implicit Provides to the other packages in the group
-rw-r--r--apt-pkg/deb/deblistparser.cc55
-rw-r--r--apt-pkg/pkgcachegen.cc7
-rw-r--r--apt-pkg/pkgcachegen.h4
3 files changed, 42 insertions, 24 deletions
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index 26841d3d2..b6082cdd5 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -618,29 +618,46 @@ bool debListParser::ParseProvides(pkgCache::VerIterator Ver)
{
const char *Start;
const char *Stop;
- if (Section.Find("Provides",Start,Stop) == false)
- return true;
-
- string Package;
- string Version;
- unsigned int Op;
-
- while (1)
+ if (Section.Find("Provides",Start,Stop) == true)
{
- Start = ParseDepends(Start,Stop,Package,Version,Op);
- if (Start == 0)
- return _error->Error("Problem parsing Provides line");
- if (Op != pkgCache::Dep::NoOp) {
- _error->Warning("Ignoring Provides line with DepCompareOp for package %s", Package.c_str());
- } else {
- if (NewProvides(Ver,Package,Version) == false)
- return false;
+ string Package;
+ string Version;
+ string const Arch = Ver.Arch();
+ unsigned int Op;
+
+ while (1)
+ {
+ Start = ParseDepends(Start,Stop,Package,Version,Op);
+ if (Start == 0)
+ return _error->Error("Problem parsing Provides line");
+ if (Op != pkgCache::Dep::NoOp) {
+ _error->Warning("Ignoring Provides line with DepCompareOp for package %s", Package.c_str());
+ } else {
+ if (NewProvides(Ver, Package, Arch, Version) == false)
+ return false;
+ }
+
+ if (Start == Stop)
+ break;
}
+ }
- if (Start == Stop)
- break;
+ if (Ver->MultiArch != pkgCache::Version::Foreign)
+ return true;
+
+ std::vector<string> const archs = APT::Configuration::getArchitectures();
+ if (archs.size() <= 1)
+ return true;
+
+ string const Package = Ver.ParentPkg().Name();
+ string const Version = Ver.VerStr();
+ for (std::vector<string>::const_iterator a = archs.begin();
+ a != archs.end(); ++a)
+ {
+ if (NewProvides(Ver, Package, *a, Version) == false)
+ return false;
}
-
+
return true;
}
/*}}}*/
diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc
index 037c0cb63..ebda325f7 100644
--- a/apt-pkg/pkgcachegen.cc
+++ b/apt-pkg/pkgcachegen.cc
@@ -668,13 +668,14 @@ bool pkgCacheGenerator::ListParser::NewDepends(pkgCache::VerIterator Ver,
// ---------------------------------------------------------------------
/* */
bool pkgCacheGenerator::ListParser::NewProvides(pkgCache::VerIterator Ver,
- const string &PackageName,
+ const string &PkgName,
+ const string &PkgArch,
const string &Version)
{
pkgCache &Cache = Owner->Cache;
// We do not add self referencing provides
- if (unlikely(Ver.ParentPkg().Name() == PackageName))
+ if (Ver.ParentPkg().Name() == PkgName && PkgArch == Ver.Arch())
return true;
// Get a structure
@@ -693,7 +694,7 @@ bool pkgCacheGenerator::ListParser::NewProvides(pkgCache::VerIterator Ver,
// Locate the target package
pkgCache::PkgIterator Pkg;
- if (unlikely(Owner->NewPackage(Pkg,PackageName,string(Ver.Arch())) == false))
+ if (unlikely(Owner->NewPackage(Pkg,PkgName, PkgArch) == false))
return false;
// Link it to the package
diff --git a/apt-pkg/pkgcachegen.h b/apt-pkg/pkgcachegen.h
index ca5d74a9f..46d0cd893 100644
--- a/apt-pkg/pkgcachegen.h
+++ b/apt-pkg/pkgcachegen.h
@@ -104,8 +104,8 @@ class pkgCacheGenerator::ListParser
bool NewDepends(pkgCache::VerIterator Ver,const string &Package, const string &Arch,
const string &Version,unsigned int Op,
unsigned int Type);
- bool NewProvides(pkgCache::VerIterator Ver,const string &Package,
- const string &Version);
+ bool NewProvides(pkgCache::VerIterator Ver,const string &PkgName,
+ const string &PkgArch, const string &Version);
public: