diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2009-12-02 17:24:56 +0100 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2009-12-02 17:24:56 +0100 |
commit | f3ceaca7a648f7d93fa88106910151e69f498801 (patch) | |
tree | b2bf899c035363fbc0b561f1006a787cb06527f0 /apt-pkg/packagemanager.cc | |
parent | 5085e660679cdbb51783702898c42000d5db4fba (diff) | |
parent | 16d7341fce96b089aa2a1c241acd0a72209bcd7f (diff) |
merge from the debian-sid branch
Diffstat (limited to 'apt-pkg/packagemanager.cc')
-rw-r--r-- | apt-pkg/packagemanager.cc | 50 |
1 files changed, 32 insertions, 18 deletions
diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc index 019a1db1f..7be6e72f2 100644 --- a/apt-pkg/packagemanager.cc +++ b/apt-pkg/packagemanager.cc @@ -57,7 +57,10 @@ bool pkgPackageManager::GetArchives(pkgAcquire *Owner,pkgSourceList *Sources, if (CreateOrderList() == false) return false; - if (List->OrderUnpack() == false) + bool const ordering = + _config->FindB("PackageManager::UnpackAll",true) ? + List->OrderUnpack() : List->OrderCritical(); + if (ordering == false) return _error->Error("Internal ordering error"); for (pkgOrderList::iterator I = List->begin(); I != List->end(); I++) @@ -122,7 +125,7 @@ bool pkgPackageManager::FixMissing() /* This adds the immediate flag to the pkg and recursively to the dependendies */ -void pkgPackageManager::ImmediateAdd(PkgIterator I, bool UseInstallVer) +void pkgPackageManager::ImmediateAdd(PkgIterator I, bool UseInstallVer, unsigned const int &Depth) { DepIterator D; @@ -140,12 +143,16 @@ void pkgPackageManager::ImmediateAdd(PkgIterator I, bool UseInstallVer) for ( /* nothing */ ; D.end() == false; D++) if (D->Type == pkgCache::Dep::Depends || D->Type == pkgCache::Dep::PreDepends) { + // ignore dependencies if no instal/upgrade/remove is going to happen + if (D.TargetPkg() == 0 || Cache[D.TargetPkg()].Keep()) + continue; + if(!List->IsFlag(D.TargetPkg(), pkgOrderList::Immediate)) { if(Debug) - clog << "ImmediateAdd(): Adding Immediate flag to " << I.Name() << endl; + clog << OutputInDepth(Depth) << "ImmediateAdd(): Adding Immediate flag to " << D.TargetPkg() << " cause of " << D.DepType() << " " << I.Name() << endl; List->Flag(D.TargetPkg(),pkgOrderList::Immediate); - ImmediateAdd(D.TargetPkg(), UseInstallVer); + ImmediateAdd(D.TargetPkg(), UseInstallVer, Depth + 1); } } return; @@ -163,7 +170,7 @@ bool pkgPackageManager::CreateOrderList() delete List; List = new pkgOrderList(&Cache); - bool NoImmConfigure = !_config->FindB("APT::Immediate-Configure",true); + static bool const NoImmConfigure = !_config->FindB("APT::Immediate-Configure",true); // Generate the list of affected packages and sort it for (PkgIterator I = Cache.PkgBegin(); I.end() == false; I++) @@ -266,13 +273,16 @@ bool pkgPackageManager::ConfigureAll() if (OList.OrderConfigure() == false) return false; - + + std::string const conf = _config->Find("PackageManager::Configure","all"); + bool const ConfigurePkgs = (conf == "all"); + // Perform the configuring for (pkgOrderList::iterator I = OList.begin(); I != OList.end(); I++) { PkgIterator Pkg(Cache,*I); - if (Configure(Pkg) == false) + if (ConfigurePkgs == true && Configure(Pkg) == false) return false; List->Flag(Pkg,pkgOrderList::Configured,pkgOrderList::States); @@ -294,19 +304,20 @@ bool pkgPackageManager::SmartConfigure(PkgIterator Pkg) if (DepAdd(OList,Pkg) == false) return false; - - if (OList.OrderConfigure() == false) - return false; - + + static std::string const conf = _config->Find("PackageManager::Configure","all"); + static bool const ConfigurePkgs = (conf == "all" || conf == "smart"); + + if (ConfigurePkgs == true) + if (OList.OrderConfigure() == false) + return false; + // Perform the configuring for (pkgOrderList::iterator I = OList.begin(); I != OList.end(); I++) { PkgIterator Pkg(Cache,*I); - if (Debug == true) - clog << " SmartConfigure on" << Pkg.Name() << endl; - - if (Configure(Pkg) == false) + if (ConfigurePkgs == true && Configure(Pkg) == false) return false; List->Flag(Pkg,pkgOrderList::Configured,pkgOrderList::States); @@ -590,9 +601,12 @@ pkgPackageManager::OrderResult pkgPackageManager::OrderInstall() Reset(); if (Debug == true) - clog << "Begining to order" << endl; + clog << "Beginning to order" << endl; - if (List->OrderUnpack(FileNames) == false) + bool const ordering = + _config->FindB("PackageManager::UnpackAll",true) ? + List->OrderUnpack(FileNames) : List->OrderCritical(); + if (ordering == false) { _error->Error("Internal ordering error"); return Failed; @@ -645,7 +659,7 @@ pkgPackageManager::OrderResult pkgPackageManager::OrderInstall() return Failed; DoneSomething = true; } - + // Final run through the configure phase if (ConfigureAll() == false) return Failed; |