summaryrefslogtreecommitdiff
path: root/apt-pkg/orderlist.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2009-09-15 23:52:04 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2009-09-15 23:52:04 +0200
commit5e312de78360736fa3ef505909ef84da211362ca (patch)
treee2ba262292d5ad06f7f6edcd43c1966aa0904146 /apt-pkg/orderlist.cc
parent3e9c4f702ed45f6201bae44b628c84db69436b05 (diff)
Add even more config options and try to handle configuration problems
arising if we upgrade essential or predependencies which need to be configured before even unpacking packages depending on them.
Diffstat (limited to 'apt-pkg/orderlist.cc')
-rw-r--r--apt-pkg/orderlist.cc74
1 files changed, 50 insertions, 24 deletions
diff --git a/apt-pkg/orderlist.cc b/apt-pkg/orderlist.cc
index 01b150722..e5bd8247d 100644
--- a/apt-pkg/orderlist.cc
+++ b/apt-pkg/orderlist.cc
@@ -174,22 +174,35 @@ bool pkgOrderList::DoRun()
bool pkgOrderList::OrderCritical()
{
FileList = 0;
-
+
Primary = &pkgOrderList::DepUnPackPre;
Secondary = 0;
RevDepends = 0;
Remove = 0;
LoopCount = 0;
-
+
// Sort
Me = this;
- qsort(List,End - List,sizeof(*List),&OrderCompareB);
-
+ qsort(List,End - List,sizeof(*List),&OrderCompareB);
+
if (DoRun() == false)
return false;
-
+
if (LoopCount != 0)
return _error->Error("Fatal, predepends looping detected");
+
+ if (Debug == true)
+ {
+ clog << "** Critical Unpack ordering done" << endl;
+
+ for (iterator I = List; I != End; I++)
+ {
+ PkgIterator P(Cache,*I);
+ if (IsNow(P) == true)
+ clog << " " << P.Name() << ' ' << IsMissing(P) << ',' << IsFlag(P,After) << endl;
+ }
+ }
+
return true;
}
/*}}}*/
@@ -205,7 +218,7 @@ bool pkgOrderList::OrderUnpack(string *FileList)
if (FileList != 0)
{
WipeFlags(After);
-
+
// Set the inlist flag
for (iterator I = List; I != End; I++)
{
@@ -214,7 +227,7 @@ bool pkgOrderList::OrderUnpack(string *FileList)
Flag(*I,After);
}
}
-
+
Primary = &pkgOrderList::DepUnPackCrit;
Secondary = &pkgOrderList::DepConfigure;
RevDepends = &pkgOrderList::DepUnPackDep;
@@ -225,11 +238,16 @@ bool pkgOrderList::OrderUnpack(string *FileList)
Me = this;
qsort(List,End - List,sizeof(*List),&OrderCompareA);
- if (Debug == true)
- clog << "** Pass A" << endl;
- if (DoRun() == false)
- return false;
-
+ if (_config->Find("PackageManager::Configure","all") == "all")
+ {
+ if (Debug == true)
+ clog << "** Pass A" << endl;
+ if (DoRun() == false)
+ return false;
+ }
+ else if (Debug == true)
+ clog << "** Skip A (same as B for non-all Configure)" << endl;
+
if (Debug == true)
clog << "** Pass B" << endl;
Secondary = 0;
@@ -243,7 +261,7 @@ bool pkgOrderList::OrderUnpack(string *FileList)
Remove = 0; // Otherwise the libreadline remove problem occures
if (DoRun() == false)
return false;
-
+
if (Debug == true)
clog << "** Pass D" << endl;
LoopCount = 0;
@@ -259,9 +277,9 @@ bool pkgOrderList::OrderUnpack(string *FileList)
{
PkgIterator P(Cache,*I);
if (IsNow(P) == true)
- clog << P.Name() << ' ' << IsMissing(P) << ',' << IsFlag(P,After) << endl;
+ clog << " " << P.Name() << ' ' << IsMissing(P) << ',' << IsFlag(P,After) << endl;
}
- }
+ }
return true;
}
@@ -286,29 +304,35 @@ bool pkgOrderList::OrderConfigure()
/* Higher scores order earlier */
int pkgOrderList::Score(PkgIterator Pkg)
{
+ static int const ScoreDelete = _config->FindI("OrderList::Score::Delete", 500);
+
// Removal is always done first
if (Cache[Pkg].Delete() == true)
- return 200;
-
+ return ScoreDelete;
+
// This should never happen..
if (Cache[Pkg].InstVerIter(Cache).end() == true)
return -1;
-
+
+ static int const ScoreEssential = _config->FindI("OrderList::Score::Essential", 200);
+ static int const ScoreImmediate = _config->FindI("OrderList::Score::Immediate", 10);
+ static int const ScorePreDepends = _config->FindI("OrderList::Score::PreDepends", 50);
+
int Score = 0;
if ((Pkg->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential)
- Score += 100;
+ Score += ScoreEssential;
if (IsFlag(Pkg,Immediate) == true)
- Score += 10;
-
- for (DepIterator D = Cache[Pkg].InstVerIter(Cache).DependsList();
+ Score += ScoreImmediate;
+
+ for (DepIterator D = Cache[Pkg].InstVerIter(Cache).DependsList();
D.end() == false; D++)
if (D->Type == pkgCache::Dep::PreDepends)
{
- Score += 50;
+ Score += ScorePreDepends;
break;
}
-
+
// Important Required Standard Optional Extra
signed short PrioMap[] = {0,5,4,3,1,0};
if (Cache[Pkg].InstVerIter(Cache)->Priority <= 5)
@@ -386,6 +410,7 @@ int pkgOrderList::OrderCompareA(const void *a, const void *b)
int ScoreA = Me->Score(A);
int ScoreB = Me->Score(B);
+
if (ScoreA > ScoreB)
return -1;
@@ -422,6 +447,7 @@ int pkgOrderList::OrderCompareB(const void *a, const void *b)
int ScoreA = Me->Score(A);
int ScoreB = Me->Score(B);
+
if (ScoreA > ScoreB)
return -1;