##################################################################### */
/*}}}*/
// Include Files /*{{{*/
+#include<config.h>
+
#include <apt-pkg/packagemanager.h>
#include <apt-pkg/orderlist.h>
#include <apt-pkg/depcache.h>
#include <apt-pkg/algorithms.h>
#include <apt-pkg/configuration.h>
#include <apt-pkg/sptr.h>
-
-#include <apti18n.h>
+
+#include <apti18n.h>
#include <iostream>
-#include <fcntl.h>
+#include <fcntl.h>
/*}}}*/
using namespace std;
if (ordering == false)
return _error->Error("Internal ordering error");
- for (pkgOrderList::iterator I = List->begin(); I != List->end(); I++)
+ for (pkgOrderList::iterator I = List->begin(); I != List->end(); ++I)
{
PkgIterator Pkg(Cache,*I);
FileNames[Pkg->ID] = string();
List->SetFileList(FileNames);
bool Bad = false;
- for (PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
+ for (PkgIterator I = Cache.PkgBegin(); I.end() == false; ++I)
{
if (List->IsMissing(I) == false)
continue;
D = I.CurrentVer().DependsList();
}
- for ( /* nothing */ ; D.end() == false; D++)
+ for ( /* nothing */ ; D.end() == false; ++D)
if (D->Type == pkgCache::Dep::Depends || D->Type == pkgCache::Dep::PreDepends)
{
if(!List->IsFlag(D.TargetPkg(), pkgOrderList::Immediate))
clog << "CreateOrderList(): Adding Immediate flag for all packages because of APT::Immediate-Configure-All" << endl;
// Generate the list of affected packages and sort it
- for (PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
+ for (PkgIterator I = Cache.PkgBegin(); I.end() == false; ++I)
{
// Ignore no-version packages
if (I->VersionList == 0)
bool pkgPackageManager::CheckRConflicts(PkgIterator Pkg,DepIterator D,
const char *Ver)
{
- for (;D.end() == false; D++)
+ for (;D.end() == false; ++D)
{
if (D->Type != pkgCache::Dep::Conflicts &&
D->Type != pkgCache::Dep::Obsoletes)
pkgOrderList OList(&Cache);
// Populate the order list
- for (pkgOrderList::iterator I = List->begin(); I != List->end(); I++)
+ for (pkgOrderList::iterator I = List->begin(); I != List->end(); ++I)
if (List->IsFlag(pkgCache::PkgIterator(Cache,*I),
pkgOrderList::UnPacked) == true)
OList.push_back(*I);
bool const ConfigurePkgs = (conf == "all");
// Perform the configuring
- for (pkgOrderList::iterator I = OList.begin(); I != OList.end(); I++)
+ for (pkgOrderList::iterator I = OList.begin(); I != OList.end(); ++I)
{
PkgIterator Pkg(Cache,*I);
if (ConfigurePkgs == true && Configure(Pkg) == false)
return false;
-
+
List->Flag(Pkg,pkgOrderList::Configured,pkgOrderList::States);
- if (Cache[Pkg].InstVerIter(Cache)->MultiArch == pkgCache::Version::Same)
+ if ((Cache[Pkg].InstVerIter(Cache)->MultiArch & pkgCache::Version::Same) == pkgCache::Version::Same)
for (PkgIterator P = Pkg.Group().PackageList();
P.end() == false; P = Pkg.Group().NextPkg(P))
{
if (Pkg->CurrentVer != 0)
{
for (DepIterator D = Pkg.RevDependsList(); D.end() == false &&
- IsEssential == false; D++)
+ IsEssential == false; ++D)
if (D->Type == pkgCache::Dep::Depends || D->Type == pkgCache::Dep::PreDepends)
if ((D.ParentPkg()->Flags & pkgCache::Flag::Essential) != 0)
IsEssential = true;
return _error->Error("Couldn't configure pre-depend %s for %s, "
"probably a dependency cycle.",
End.TargetPkg().Name(),Pkg.Name());
- Start++;
+ ++Start;
}
else
break;
return false;
for (PrvIterator P = instVer.ProvidesList();
- P.end() == false; P++)
- CheckRConflicts(Pkg,P.ParentPkg().RevDependsList(),P.ProvideVersion());
+ P.end() == false; ++P)
+ if (Pkg->Group != P.OwnerPkg()->Group)
+ CheckRConflicts(Pkg,P.ParentPkg().RevDependsList(),P.ProvideVersion());
- if (PkgLoop) return true;
+ if (PkgLoop)
+ return true;
List->Flag(Pkg,pkgOrderList::UnPacked,pkgOrderList::States);
- if (instVer->MultiArch == pkgCache::Version::Same)
+ if (Immediate == true && instVer->MultiArch == pkgCache::Version::Same)
+ {
+ /* 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))
+ P.end() == false; P = Pkg.Group().NextPkg(P))
{
- if (Pkg == P || List->IsFlag(P,pkgOrderList::UnPacked) == true ||
- Cache[P].InstallVer == 0 || (P.CurrentVer() == Cache[P].InstallVer &&
- (Cache[Pkg].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall))
- continue;
- SmartUnPack(P, false, Depth + 1);
+ 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(Install(Pkg,FileNames[Pkg->ID]) == false)
+ }
+ else if (Install(Pkg,FileNames[Pkg->ID]) == false)
return false;
if (Immediate == true) {
clog << "Done ordering" << endl;
bool DoneSomething = false;
- for (pkgOrderList::iterator I = List->begin(); I != List->end(); I++)
+ for (pkgOrderList::iterator I = List->begin(); I != List->end(); ++I)
{
PkgIterator Pkg(Cache,*I);
return Failed;
// Sanity check
- for (pkgOrderList::iterator I = List->begin(); I != List->end(); I++)
+ for (pkgOrderList::iterator I = List->begin(); I != List->end(); ++I)
{
if (List->IsFlag(*I,pkgOrderList::Configured) == false)
{