summaryrefslogtreecommitdiff
path: root/apt-pkg/algorithms.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2010-03-18 23:54:12 +0100
committerDavid Kalnischkies <kalnischkies@gmail.com>2010-03-18 23:54:12 +0100
commitc67dc114eafe034b8223ce3df6474f7c25f150a8 (patch)
tree756f6af6a63a57a38b87d44f31cb000d7d6e49d9 /apt-pkg/algorithms.cc
parente426a5ff1cd02797b29f5781be4d6fc8bdf44610 (diff)
parent8d4c859d0d20687a8ffcf9e1d60466d061c2e24d (diff)
merge MultiArch-ABI. We don't support MultiArch yet (as most other tools),
but we support the usage of the new ABI so libapt users can start to prepare for MultiArch (Closes: #536029)
Diffstat (limited to 'apt-pkg/algorithms.cc')
-rw-r--r--apt-pkg/algorithms.cc62
1 files changed, 53 insertions, 9 deletions
diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc
index 34da745de..f8a9e210c 100644
--- a/apt-pkg/algorithms.cc
+++ b/apt-pkg/algorithms.cc
@@ -83,13 +83,28 @@ void pkgSimulate::Describe(PkgIterator Pkg,ostream &out,bool Current,bool Candid
bool pkgSimulate::Install(PkgIterator iPkg,string /*File*/)
{
// Adapt the iterator
- PkgIterator Pkg = Sim.FindPkg(iPkg.Name());
+ PkgIterator Pkg = Sim.FindPkg(iPkg.Name(), iPkg.Arch());
Flags[Pkg->ID] = 1;
cout << "Inst ";
Describe(Pkg,cout,true,true);
Sim.MarkInstall(Pkg,false);
-
+
+ if (strcmp(Pkg.Arch(),"all") == 0)
+ {
+ pkgCache::GrpIterator G = Pkg.Group();
+ pkgCache::GrpIterator iG = iPkg.Group();
+ for (pkgCache::PkgIterator P = G.FindPkg("any"); P.end() != true; P = G.NextPkg(P))
+ {
+ if (strcmp(P.Arch(), "all") == 0)
+ continue;
+ if (iG.FindPkg(P.Arch())->CurrentVer == 0)
+ continue;
+ Flags[P->ID] = 1;
+ Sim.MarkInstall(P, false);
+ }
+ }
+
// Look for broken conflicts+predepends.
for (PkgIterator I = Sim.PkgBegin(); I.end() == false; I++)
{
@@ -131,9 +146,22 @@ bool pkgSimulate::Install(PkgIterator iPkg,string /*File*/)
bool pkgSimulate::Configure(PkgIterator iPkg)
{
// Adapt the iterator
- PkgIterator Pkg = Sim.FindPkg(iPkg.Name());
+ PkgIterator Pkg = Sim.FindPkg(iPkg.Name(), iPkg.Arch());
Flags[Pkg->ID] = 2;
+
+ if (strcmp(Pkg.Arch(),"all") == 0)
+ {
+ pkgCache::GrpIterator G = Pkg.Group();
+ for (pkgCache::PkgIterator P = G.FindPkg("any"); P.end() != true; P = G.NextPkg(P))
+ {
+ if (strcmp(P.Arch(), "all") == 0)
+ continue;
+ if (Flags[P->ID] == 1)
+ Flags[P->ID] = 2;
+ }
+ }
+
// Sim.MarkInstall(Pkg,false);
if (Sim[Pkg].InstBroken() == true)
{
@@ -181,10 +209,26 @@ bool pkgSimulate::Configure(PkgIterator iPkg)
bool pkgSimulate::Remove(PkgIterator iPkg,bool Purge)
{
// Adapt the iterator
- PkgIterator Pkg = Sim.FindPkg(iPkg.Name());
+ PkgIterator Pkg = Sim.FindPkg(iPkg.Name(), iPkg.Arch());
Flags[Pkg->ID] = 3;
Sim.MarkDelete(Pkg);
+
+ if (strcmp(Pkg.Arch(),"all") == 0)
+ {
+ pkgCache::GrpIterator G = Pkg.Group();
+ pkgCache::GrpIterator iG = iPkg.Group();
+ for (pkgCache::PkgIterator P = G.FindPkg("any"); P.end() != true; P = G.NextPkg(P))
+ {
+ if (strcmp(P.Arch(), "all") == 0)
+ continue;
+ if (iG.FindPkg(P.Arch())->CurrentVer == 0)
+ continue;
+ Flags[P->ID] = 3;
+ Sim.MarkDelete(P);
+ }
+ }
+
if (Purge == true)
cout << "Purg ";
else
@@ -491,11 +535,11 @@ void pkgProblemResolver::MakeScores()
// Important Required Standard Optional Extra
signed short PrioMap[] = {
0,
- _config->FindI("pkgProblemResolver::Scores::Important",3),
- _config->FindI("pkgProblemResolver::Scores::Required",2),
- _config->FindI("pkgProblemResolver::Scores::Standard",1),
- _config->FindI("pkgProblemResolver::Scores::Optional",-1),
- _config->FindI("pkgProblemResolver::Scores::Extra",-2)
+ (signed short) _config->FindI("pkgProblemResolver::Scores::Important",3),
+ (signed short) _config->FindI("pkgProblemResolver::Scores::Required",2),
+ (signed short) _config->FindI("pkgProblemResolver::Scores::Standard",1),
+ (signed short) _config->FindI("pkgProblemResolver::Scores::Optional",-1),
+ (signed short) _config->FindI("pkgProblemResolver::Scores::Extra",-2)
};
signed short PrioEssentials = _config->FindI("pkgProblemResolver::Scores::Essentials",100);
signed short PrioInstalledAndNotObsolete = _config->FindI("pkgProblemResolver::Scores::NotObsolete",1);