- // Compute a single dependency element (glob or)
- pkgCache::DepIterator Start;
- pkgCache::DepIterator End;
- D.GlobOr(Start,End);
-
- if (End->Type == pkgCache::Dep::Depends)
- Bad = true;
-
- // Check for dependanices that have not been unpacked, probably due to loops.
- while (End->Type == pkgCache::Dep::Depends) {
- PkgIterator DepPkg;
- VerIterator InstallVer;
- SPtrArray<Version *> VList = Start.AllTargets();
-
- for (Version **I = VList; *I != 0; I++) {
- VerIterator Ver(Cache,*I);
- DepPkg = Ver.ParentPkg();
-
- if (!Bad) continue;
-
- InstallVer = VerIterator(Cache,Cache[DepPkg].InstallVer);
- VerIterator CandVer(Cache,Cache[DepPkg].CandidateVer);
-
- if (Debug && false) {
- if (Ver==0) {
- cout << " Checking if " << Ver << " of " << DepPkg.Name() << " satisfies this dependancy" << endl;
- } else {
- cout << " Checking if " << Ver.VerStr() << " of " << DepPkg.Name() << " satisfies this dependancy" << endl;
- }
-
- if (DepPkg.CurrentVer()==0) {
- cout << " CurrentVer " << DepPkg.CurrentVer() << " IsNow " << List->IsNow(DepPkg) << " NeedsNothing " << (DepPkg.State() == PkgIterator::NeedsNothing) << endl;
- } else {
- cout << " CurrentVer " << DepPkg.CurrentVer().VerStr() << " IsNow " << List->IsNow(DepPkg) << " NeedsNothing " << (DepPkg.State() == PkgIterator::NeedsNothing) << endl;
- }
-
- if (InstallVer==0) {
- cout << " InstallVer " << InstallVer << endl;
- } else {
- cout << " InstallVer " << InstallVer.VerStr() << endl;
- }
- if (CandVer != 0)
- cout << " CandVer " << CandVer.VerStr() << endl;
-
- cout << " Keep " << Cache[DepPkg].Keep() << " Unpacked " << List->IsFlag(DepPkg,pkgOrderList::UnPacked) << " Configured " << List->IsFlag(DepPkg,pkgOrderList::Configured) << endl;
-
- }
-
- // Check if it satisfies this dependancy
- if (DepPkg.CurrentVer() == Ver && List->IsNow(DepPkg) == true &&
- DepPkg.State() == PkgIterator::NeedsNothing)
- {
- Bad = false;
- continue;
- }
-
- if (Cache[DepPkg].InstallVer == *I && !List->IsNow(DepPkg)) {
- Bad = false;
- continue;
- }
- }
-
- if (InstallVer != 0 && Bad) {
- Bad = false;
- // Found a break, so unpack the package
- List->Flag(Pkg,pkgOrderList::Loop);
- if (!List->IsFlag(DepPkg,pkgOrderList::Loop)) {
- if (Debug)
- cout << " Unpacking " << DepPkg.Name() << " to avoid loop" << endl;
- SmartUnPack(DepPkg, false);
- }
- }
-
- if (Start==End) {
- if (Bad && Debug) {
- if (!List->IsFlag(DepPkg,pkgOrderList::Loop)) {
- _error->Warning("Could not satisfy dependancies for %s",Pkg.Name());
- }
- }
- break;
-
- } else {
- Start++;
- }
+ /* Do lockstep M-A:same unpacking in two phases:
+ First unpack all installed architectures, then the not installed.
+ This way we avoid that M-A: enabled packages are installed before
+ their older non-M-A enabled packages are replaced by newer versions */
+ bool const installed = Pkg->CurrentVer != 0;
+ if (installed == true && Install(Pkg,FileNames[Pkg->ID]) == false)
+ return false;
+ for (PkgIterator P = Pkg.Group().PackageList();
+ P.end() == false; P = Pkg.Group().NextPkg(P))
+ {
+ if (P->CurrentVer == 0 || P == Pkg || List->IsFlag(P,pkgOrderList::UnPacked) == true ||
+ Cache[P].InstallVer == 0 || (P.CurrentVer() == Cache[P].InstallVer &&
+ (Cache[Pkg].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall))
+ continue;
+ if (SmartUnPack(P, false, Depth + 1) == false)
+ return false;
+ }
+ if (installed == false && Install(Pkg,FileNames[Pkg->ID]) == false)
+ return false;
+ for (PkgIterator P = Pkg.Group().PackageList();
+ P.end() == false; P = Pkg.Group().NextPkg(P))
+ {
+ if (P->CurrentVer != 0 || P == Pkg || List->IsFlag(P,pkgOrderList::UnPacked) == true ||
+ Cache[P].InstallVer == 0 || (P.CurrentVer() == Cache[P].InstallVer &&
+ (Cache[Pkg].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall))
+ continue;
+ if (SmartUnPack(P, false, Depth + 1) == false)
+ return false;