diff options
-rw-r--r-- | apt-pkg/algorithms.cc | 4 | ||||
-rw-r--r-- | apt-pkg/depcache.cc | 32 | ||||
-rw-r--r-- | apt-pkg/depcache.h | 5 | ||||
-rw-r--r-- | apt-pkg/packagemanager.cc | 7 | ||||
-rw-r--r-- | cmdline/apt-get.cc | 28 | ||||
-rw-r--r-- | debian/changelog | 1 | ||||
-rw-r--r-- | doc/apt-get.8.yo | 3 |
7 files changed, 63 insertions, 17 deletions
diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index 596473a65..e784ce895 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.26 1999/10/22 04:05:47 jgg Exp $ +// $Id: algorithms.cc,v 1.27 1999/10/22 05:58:54 jgg Exp $ /* ###################################################################### Algorithms - A set of misc algorithms @@ -574,7 +574,7 @@ bool pkgProblemResolver::DoUpgrade(pkgCache::PkgIterator Pkg) /* We let the algorithm deal with conflicts on its next iteration, it is much smarter than us */ if (Start->Type == pkgCache::Dep::Conflicts) - continue; + break; if (Debug == true) clog << " Reinst Failed early because of " << Start.TargetPkg().Name() << endl; diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index 7b7d0b29d..707cb93cd 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: depcache.cc,v 1.20 1999/09/09 06:08:45 jgg Exp $ +// $Id: depcache.cc,v 1.21 1999/10/22 05:58:54 jgg Exp $ /* ###################################################################### Dependency Cache - Caches Dependency information. @@ -216,8 +216,9 @@ void pkgDepCache::AddSizes(const PkgIterator &Pkg,long Mult) } // Upgrading - if (Pkg->CurrentVer != 0 && P.InstallVer != (Version *)Pkg.CurrentVer() && - P.InstallVer != 0) + if (Pkg->CurrentVer != 0 && + (P.InstallVer != (Version *)Pkg.CurrentVer() || + (P.iFlags & ReInstall) == ReInstall) && P.InstallVer != 0) { iUsrSize += Mult*((signed)P.InstVerIter(*this)->InstalledSize - (signed)Pkg.CurrentVer()->InstalledSize); @@ -275,9 +276,13 @@ void pkgDepCache::AddStates(const PkgIterator &Pkg,int Add) // Installed, no upgrade if (State.Upgradable() == false) - { + { if (State.Mode == ModeDelete) iDelCount += Add; + else + if ((State.iFlags & ReInstall) == ReInstall) + iInstCount += Add; + return; } @@ -703,7 +708,24 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst) } } /*}}}*/ - +// DepCache::SetReInstall - Set the reinstallation flag /*{{{*/ +// --------------------------------------------------------------------- +/* */ +void pkgDepCache::SetReInstall(PkgIterator const &Pkg,bool To) +{ + RemoveSizes(Pkg); + RemoveStates(Pkg); + + StateCache &P = PkgState[Pkg->ID]; + if (To == true) + P.iFlags |= ReInstall; + else + P.iFlags &= ~ReInstall; + + AddStates(Pkg); + AddSizes(Pkg); +} + /*}}}*/ // StateCache::Update - Compute the various static display things /*{{{*/ // --------------------------------------------------------------------- /* This is called whenever the Candidate version changes. */ diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h index 9592e7035..6ce204e65 100644 --- a/apt-pkg/depcache.h +++ b/apt-pkg/depcache.h @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: depcache.h,v 1.11 1999/07/10 04:58:42 jgg Exp $ +// $Id: depcache.h,v 1.12 1999/10/22 05:58:54 jgg Exp $ /* ###################################################################### DepCache - Dependency Extension data for the cache @@ -60,7 +60,7 @@ class pkgDepCache : public pkgCache DepCandPolicy = (1 << 4), DepCandMin = (1 << 5)}; // These flags are used in StateCache::iFlags - enum InternalFlags {AutoKept = (1 << 0), Purge = (1 << 1)}; + enum InternalFlags {AutoKept = (1 << 0), Purge = (1 << 1), ReInstall = (1 << 2)}; enum VersionTypes {NowVersion, InstallVersion, CandidateVersion}; enum ModeList {ModeDelete = 0, ModeKeep = 1, ModeInstall = 2}; @@ -164,6 +164,7 @@ class pkgDepCache : public pkgCache void MarkKeep(PkgIterator const &Pkg,bool Soft = false); void MarkDelete(PkgIterator const &Pkg,bool Purge = false); void MarkInstall(PkgIterator const &Pkg,bool AutoInst = true); + void SetReInstall(PkgIterator const &Pkg,bool To); // This is for debuging void Update(OpProgress *Prog = 0); diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc index b76f78b3c..fad40c46a 100644 --- a/apt-pkg/packagemanager.cc +++ b/apt-pkg/packagemanager.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: packagemanager.cc,v 1.21 1999/09/30 06:30:34 jgg Exp $ +// $Id: packagemanager.cc,v 1.22 1999/10/22 05:58:54 jgg Exp $ /* ###################################################################### Package Manager - Abstacts the package manager @@ -157,6 +157,7 @@ bool pkgPackageManager::CreateOrderList() if ((Cache[I].Keep() == true || Cache[I].InstVerIter(Cache) == I.CurrentVer()) && I.State() == pkgCache::PkgIterator::NeedsNothing && + (Cache[I].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall && (I.Purge() != false || Cache[I].Mode != pkgDepCache::ModeDelete || (Cache[I].iFlags & pkgDepCache::Purge) != pkgDepCache::Purge)) continue; @@ -556,7 +557,9 @@ pkgPackageManager::OrderResult pkgPackageManager::OrderInstall() } // Sanity check - if (Cache[Pkg].Keep() == true && Pkg.State() == pkgCache::PkgIterator::NeedsNothing) + if (Cache[Pkg].Keep() == true && + Pkg.State() == pkgCache::PkgIterator::NeedsNothing && + (Cache[Pkg].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall) { _error->Error("Internal Error, trying to manipulate a kept package"); return Failed; diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 51ebe5f41..a30c9833d 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: apt-get.cc,v 1.82 1999/10/22 04:05:47 jgg Exp $ +// $Id: apt-get.cc,v 1.83 1999/10/22 05:58:54 jgg Exp $ /* ###################################################################### apt-get - Cover for dpkg @@ -408,6 +408,7 @@ void Stats(ostream &out,pkgDepCache &Dep) { unsigned long Upgrade = 0; unsigned long Install = 0; + unsigned long ReInstall = 0; for (pkgCache::PkgIterator I = Dep.PkgBegin(); I.end() == false; I++) { if (Dep[I].NewInstall() == true) @@ -415,11 +416,15 @@ void Stats(ostream &out,pkgDepCache &Dep) else if (Dep[I].Upgrade() == true) Upgrade++; + if (Dep[I].Delete() == false && (Dep[I].iFlags & pkgDepCache::ReInstall) == pkgDepCache::ReInstall) + ReInstall++; } out << Upgrade << " packages upgraded, " << - Install << " newly installed, " << - Dep.DelCount() << " to remove and " << + Install << " newly installed, "; + if (ReInstall != 0) + out << ReInstall << " reinstalled, "; + out << Dep.DelCount() << " to remove and " << Dep.KeepCount() << " not upgraded." << endl; if (Dep.BadCount() != 0) @@ -545,7 +550,7 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true,bool Saftey = return _error->Error("Internal Error, InstallPackages was called with broken packages!"); } - if (Cache->DelCount() == 0 && Cache->InstCount() == 0 && + if (Cache->DelCount() == 0 && Cache->InstCount() == 0 && Cache->BadCount() == 0) return true; @@ -837,8 +842,18 @@ bool TryToInstall(pkgCache::PkgIterator Pkg,pkgDepCache &Cache, Cache.MarkInstall(Pkg,false); if (State.Install() == false) { - if (AllowFail == true) - c1out << "Sorry, " << Pkg.Name() << " is already the newest version" << endl; + if (_config->FindB("APT::Get::ReInstall",false) == true) + { + if (Pkg->CurrentVer == 0 || Pkg.CurrentVer().Downloadable() == false) + c1out << "Sorry, re-installation of " << Pkg.Name() << " is not possible, it cannot be downloaded" << endl; + else + Cache.SetReInstall(Pkg,true); + } + else + { + if (AllowFail == true) + c1out << "Sorry, " << Pkg.Name() << " is already the newest version" << endl; + } } else ExpectedInst++; @@ -1621,6 +1636,7 @@ int main(int argc,const char *argv[]) {0,"tar-only","APT::Get::tar-Only",0}, {0,"purge","APT::Get::Purge",0}, {0,"list-cleanup","APT::Get::List-Cleanup",0}, + {0,"reinstall","APT::Get::ReInstall",0}, {'c',"config-file",0,CommandLine::ConfigFile}, {'o',"option",0,CommandLine::ArbItem}, {0,0,0,0}}; diff --git a/debian/changelog b/debian/changelog index 7ab220e46..7d3f8d59f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -23,6 +23,7 @@ apt (0.3.13.1) unstable; urgency=low * De-Refs Single Pure virtual packages. Closes: #42437 * Regexs for install. Closes: #35304 * Dependency reports now show OR group relations + * Re-Install feature. Cloes: #46961 -- Jason Gunthorpe <jgg@debian.org> Fri, 3 Sep 1999 09:04:28 -0700 diff --git a/doc/apt-get.8.yo b/doc/apt-get.8.yo index ac2cbab9a..cb716015b 100644 --- a/doc/apt-get.8.yo +++ b/doc/apt-get.8.yo @@ -216,6 +216,9 @@ command See bf(APT::Get::Print-URIs). dit(bf(--purge)) Use purge instead of remove for anything that would be removed. +dit(bf(--reinstall)) +Re-Install packages that are already installed and at the newest version. + dit(bf(--list-cleanup)) This option defaults to on, use bf(--no-list-cleanup) to turn it off. When on apt-get will automatically manage the contents of |