summaryrefslogtreecommitdiff
path: root/apt-pkg/packagemanager.cc
diff options
context:
space:
mode:
authorChristopher Baines <cbaines8@gmail.com>2011-08-16 18:00:01 +0100
committerChristopher Baines <cbaines8@gmail.com>2011-08-16 18:00:01 +0100
commitb57257d2993aaf8c0cf9d6f0ea8ebd0208112bc5 (patch)
treeb98099dc7eee429f3ca3d257cbfe0ff4b5298821 /apt-pkg/packagemanager.cc
parentd41d0e0113208aa1752344a13e8a962a1ad4f76e (diff)
Fixed a problem where the loop flag would be removed prematurely.
SmartConfigure xserver-xorg-video-apm (1:1.2.3-0ubuntu1) SmartConfigure xserver-xorg-core (2:1.9.0-0ubuntu7.3) <- Loop flag set on xserver-xorg-core SmartConfigure xserver-xorg (1:7.5+6ubuntu3) SmartConfigure xserver-xorg-core (2:1.9.0-0ubuntu7.3) (Only Correct Dependancies) <- Loop flag removed prematurely SmartConfigure libpciaccess0 (0.12.0-1) SmartConfigure libpixman-1-0 (0.18.4-1) SmartConfigure xserver-xorg-video-all (1:7.5+6ubuntu3) SmartConfigure xserver-xorg-video-apm (1:1.2.3-0ubuntu1) (Only Correct Dependancies) SmartConfigure xserver-xorg-core (2:1.9.0-0ubuntu7.3) <- Incorrectly detects first run as no loop flag Also applied this fix to the SmartUnpack method.
Diffstat (limited to 'apt-pkg/packagemanager.cc')
-rw-r--r--apt-pkg/packagemanager.cc49
1 files changed, 34 insertions, 15 deletions
diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc
index 53bb507b6..b5d353602 100644
--- a/apt-pkg/packagemanager.cc
+++ b/apt-pkg/packagemanager.cc
@@ -371,18 +371,27 @@ bool pkgPackageManager::SmartConfigure(PkgIterator Pkg, int const Depth)
// Check if the version that is going to be installed will satisfy the dependancy
if (Cache[DepPkg].InstallVer == *I) {
if (List->IsFlag(DepPkg,pkgOrderList::UnPacked)) {
- if (PkgLoop && List->IsFlag(DepPkg,pkgOrderList::Loop)) {
+ if (List->IsFlag(DepPkg,pkgOrderList::Loop) && PkgLoop) {
// This dependancy has already been dealt with by another SmartConfigure on Pkg
Bad = false;
break;
+ } else if (List->IsFlag(Pkg,pkgOrderList::Loop)) {
+ /* Check for a loop to prevent one forming
+ If A depends on B and B depends on A, SmartConfigure will
+ just hop between them if this is not checked. Dont remove the
+ loop flag after finishing however as loop is already set.
+ This means that there is another SmartConfigure call for this
+ package and it will remove the loop flag */
+ Bad = !SmartConfigure(DepPkg, Depth + 1);
+ } else {
+ /* Check for a loop to prevent one forming
+ If A depends on B and B depends on A, SmartConfigure will
+ just hop between them if this is not checked */
+ List->Flag(Pkg,pkgOrderList::Loop);
+ Bad = !SmartConfigure(DepPkg, Depth + 1);
+ List->RmFlag(Pkg,pkgOrderList::Loop);
}
- /* Check for a loop to prevent one forming
- If A depends on B and B depends on A, SmartConfigure will
- just hop between them if this is not checked */
- List->Flag(Pkg,pkgOrderList::Loop);
// If SmartConfigure was succesfull, Bad is false, so break
- Bad = !SmartConfigure(DepPkg, Depth + 1);
- List->RmFlag(Pkg,pkgOrderList::Loop);
if (!Bad) break;
} else if (List->IsFlag(DepPkg,pkgOrderList::Configured)) {
Bad = false;
@@ -678,18 +687,28 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate, int c
// Check if it needs to be unpacked
if (List->IsFlag(BrokenPkg,pkgOrderList::InList) && Cache[BrokenPkg].Delete() == false &&
List->IsNow(BrokenPkg)) {
- if (PkgLoop && List->IsFlag(BrokenPkg,pkgOrderList::Loop)) {
+ if (List->IsFlag(BrokenPkg,pkgOrderList::Loop) && PkgLoop) {
// This dependancy has already been dealt with by another SmartUnPack on Pkg
break;
- }
- List->Flag(Pkg,pkgOrderList::Loop);
- // Found a break, so unpack the package
- if (Debug)
- cout << OutputInDepth(Depth) << " Unpacking " << BrokenPkg.Name() << " to avoid break" << endl;
+ } else if (List->IsFlag(Pkg,pkgOrderList::Loop)) {
+ /* Found a break, so unpack the package, but dont remove loop as already set.
+ This means that there is another SmartUnPack call for this
+ package and it will remove the loop flag. */
+ if (Debug)
+ cout << OutputInDepth(Depth) << " Unpacking " << BrokenPkg.Name() << " to avoid break" << endl;
+
+ SmartUnPack(BrokenPkg, false, Depth + 1);
+ } else {
+ List->Flag(Pkg,pkgOrderList::Loop);
+ // Found a break, so unpack the package
+ if (Debug)
+ cout << OutputInDepth(Depth) << " Unpacking " << BrokenPkg.Name() << " to avoid break" << endl;
- SmartUnPack(BrokenPkg, false, Depth + 1);
- List->RmFlag(Pkg,pkgOrderList::Loop);
+ SmartUnPack(BrokenPkg, false, Depth + 1);
+ List->RmFlag(Pkg,pkgOrderList::Loop);
+ }
}
+
// Check if a package needs to be removed
if (Cache[BrokenPkg].Delete() == true && !List->IsFlag(BrokenPkg,pkgOrderList::Configured)) {
if (Debug)