diff options
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/algorithms.cc | 93 | ||||
-rw-r--r-- | apt-pkg/contrib/mmap.cc | 6 |
2 files changed, 46 insertions, 53 deletions
diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index dd0928562..51573df54 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: algorithms.cc,v 1.24 1999/09/30 06:30:34 jgg Exp $ +// $Id: algorithms.cc,v 1.25 1999/10/02 04:14:53 jgg Exp $ /* ###################################################################### Algorithms - A set of misc algorithms @@ -524,10 +524,11 @@ bool pkgProblemResolver::DoUpgrade(pkgCache::PkgIterator Pkg) pkgCache::DepIterator Start = D; pkgCache::DepIterator End = D; unsigned char State = 0; - for (bool LastOR = true; D.end() == false && LastOR == true; D++) + for (bool LastOR = true; D.end() == false && LastOR == true;) { State |= Cache[D]; LastOR = (D->CompareOp & pkgCache::Dep::Or) == pkgCache::Dep::Or; + D++; if (LastOR == true) End = D; } @@ -535,52 +536,54 @@ bool pkgProblemResolver::DoUpgrade(pkgCache::PkgIterator Pkg) // We only worry about critical deps. if (End.IsCritical() != true) continue; - - // Dep is ok - if ((Cache[End] & pkgDepCache::DepGInstall) == pkgDepCache::DepGInstall) - continue; - - // Hm, the group is broken.. I have no idea how to handle this - if (Start != End) - { - clog << "Note, a broken or group was found in " << Pkg.Name() << "." << endl; - Fail = true; - break; - } - - // Do not change protected packages - PkgIterator P = Start.SmartTargetPkg(); - if ((Flags[P->ID] & Protected) == Protected) + + // Iterate over all the members in the or group + while (1) { - if (Debug == true) - clog << " Reinet Failed because of protected " << P.Name() << endl; - Fail = true; - break; - } + // Dep is ok now + if ((Cache[End] & pkgDepCache::DepGInstall) == pkgDepCache::DepGInstall) + break; + + // Do not change protected packages + PkgIterator P = Start.SmartTargetPkg(); + if ((Flags[P->ID] & Protected) == Protected) + { + if (Debug == true) + clog << " Reinet Failed because of protected " << P.Name() << endl; + Fail = true; + break; + } - // Upgrade the package if the candidate version will fix the problem. - if ((Cache[Start] & pkgDepCache::DepCVer) == pkgDepCache::DepCVer) - { - if (DoUpgrade(P) == false) + // Upgrade the package if the candidate version will fix the problem. + if ((Cache[Start] & pkgDepCache::DepCVer) == pkgDepCache::DepCVer) + { + if (DoUpgrade(P) == false) + { + if (Debug == true) + clog << " Reinst Failed because of " << P.Name() << endl; + Fail = true; + break; + } + } + else { + /* We let the algorithm deal with conflicts on its next iteration, + it is much smarter than us */ + if (Start->Type == pkgCache::Dep::Conflicts) + continue; + if (Debug == true) - clog << " Reinst Failed because of " << P.Name() << endl; + clog << " Reinst Failed early because of " << Start.TargetPkg().Name() << endl; Fail = true; break; - } - } - else - { - /* We let the algorithm deal with conflicts on its next iteration, - it is much smarter than us */ - if (End->Type == pkgCache::Dep::Conflicts) - continue; + } - if (Debug == true) - clog << " Reinst Failed early because of " << Start.TargetPkg().Name() << endl; - Fail = true; + if (Start == End) + break; + Start++; + } + if (Fail == true) break; - } } // Undo our operations - it might be smart to undo everything this did.. @@ -737,16 +740,6 @@ bool pkgProblemResolver::Resolve(bool BrokenFix) InOr = Start != End; - // Hm, the group is broken.. I have no idea how to handle this -/* if (Start != End) - { - if (Debug == true) - clog << "Note, a broken or group was found in " << I.Name() << "." << endl; - if ((Flags[I->ID] & Protected) != Protected) - Cache.MarkDelete(I); - break; - }*/ - if (Debug == true) clog << "Package " << I.Name() << " has broken dep on " << Start.TargetPkg().Name() << endl; diff --git a/apt-pkg/contrib/mmap.cc b/apt-pkg/contrib/mmap.cc index 42777a8ac..230e133a5 100644 --- a/apt-pkg/contrib/mmap.cc +++ b/apt-pkg/contrib/mmap.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: mmap.cc,v 1.19 1999/08/30 04:20:26 jgg Exp $ +// $Id: mmap.cc,v 1.20 1999/10/02 04:14:54 jgg Exp $ /* ###################################################################### MMap Class - Provides 'real' mmap or a faked mmap using read(). @@ -117,7 +117,7 @@ bool MMap::Sync() #ifdef _POSIX_SYNCHRONIZED_IO if ((Flags & ReadOnly) != ReadOnly) if (msync((char *)Base,iSize,MS_SYNC) != 0) - return _error->Error("msync","Unable to write mmap"); + return _error->Errno("msync","Unable to write mmap"); #endif return true; } @@ -134,7 +134,7 @@ bool MMap::Sync(unsigned long Start,unsigned long Stop) unsigned long PSize = sysconf(_SC_PAGESIZE); if ((Flags & ReadOnly) != ReadOnly) if (msync((char *)Base+(int)(Start/PSize)*PSize,Stop - Start,MS_SYNC) != 0) - return _error->Error("msync","Unable to write mmap"); + return _error->Errno("msync","Unable to write mmap"); #endif return true; } |