Author: jgg
Date: 1999-10-22 05:58:54 GMT
Reinstall command
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// -*- 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
/* ######################################################################
Algorithms - A set of misc algorithms
/* We let the algorithm deal with conflicts on its next iteration,
it is much smarter than us */
if (Start->Type == pkgCache::Dep::Conflicts)
/* We let the algorithm deal with conflicts on its next iteration,
it is much smarter than us */
if (Start->Type == pkgCache::Dep::Conflicts)
if (Debug == true)
clog << " Reinst Failed early because of " << Start.TargetPkg().Name() << endl;
if (Debug == true)
clog << " Reinst Failed early because of " << Start.TargetPkg().Name() << endl;
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// -*- 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.
/* ######################################################################
Dependency Cache - Caches Dependency information.
- 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);
{
iUsrSize += Mult*((signed)P.InstVerIter(*this)->InstalledSize -
(signed)Pkg.CurrentVer()->InstalledSize);
// Installed, no upgrade
if (State.Upgradable() == false)
// Installed, no upgrade
if (State.Upgradable() == false)
if (State.Mode == ModeDelete)
iDelCount += Add;
if (State.Mode == ModeDelete)
iDelCount += Add;
+ else
+ if ((State.iFlags & ReInstall) == ReInstall)
+ iInstCount += Add;
+
+// 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. */
// StateCache::Update - Compute the various static display things /*{{{*/
// ---------------------------------------------------------------------
/* This is called whenever the Candidate version changes. */
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// -*- 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
/* ######################################################################
DepCache - Dependency Extension data for the cache
DepCandPolicy = (1 << 4), DepCandMin = (1 << 5)};
// These flags are used in StateCache::iFlags
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};
enum VersionTypes {NowVersion, InstallVersion, CandidateVersion};
enum ModeList {ModeDelete = 0, ModeKeep = 1, ModeInstall = 2};
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 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);
// This is for debuging
void Update(OpProgress *Prog = 0);
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// -*- 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
/* ######################################################################
Package Manager - Abstacts the package manager
if ((Cache[I].Keep() == true ||
Cache[I].InstVerIter(Cache) == I.CurrentVer()) &&
I.State() == pkgCache::PkgIterator::NeedsNothing &&
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;
(I.Purge() != false || Cache[I].Mode != pkgDepCache::ModeDelete ||
(Cache[I].iFlags & pkgDepCache::Purge) != pkgDepCache::Purge))
continue;
- 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;
{
_error->Error("Internal Error, trying to manipulate a kept package");
return Failed;
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// -*- 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
/* ######################################################################
apt-get - Cover for dpkg
{
unsigned long Upgrade = 0;
unsigned long Install = 0;
{
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)
for (pkgCache::PkgIterator I = Dep.PkgBegin(); I.end() == false; I++)
{
if (Dep[I].NewInstall() == true)
else
if (Dep[I].Upgrade() == true)
Upgrade++;
else
if (Dep[I].Upgrade() == true)
Upgrade++;
+ if (Dep[I].Delete() == false && (Dep[I].iFlags & pkgDepCache::ReInstall) == pkgDepCache::ReInstall)
+ ReInstall++;
}
out << Upgrade << " packages upgraded, " <<
}
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)
Dep.KeepCount() << " not upgraded." << endl;
if (Dep.BadCount() != 0)
return _error->Error("Internal Error, InstallPackages was called with broken packages!");
}
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;
Cache->BadCount() == 0)
return true;
Cache.MarkInstall(Pkg,false);
if (State.Install() == false)
{
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;
+ }
{0,"tar-only","APT::Get::tar-Only",0},
{0,"purge","APT::Get::Purge",0},
{0,"list-cleanup","APT::Get::List-Cleanup",0},
{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}};
{'c',"config-file",0,CommandLine::ConfigFile},
{'o',"option",0,CommandLine::ArbItem},
{0,0,0,0}};
* De-Refs Single Pure virtual packages. Closes: #42437
* Regexs for install. Closes: #35304
* Dependency reports now show OR group relations
* 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
-- Jason Gunthorpe <jgg@debian.org> Fri, 3 Sep 1999 09:04:28 -0700
dit(bf(--purge))
Use purge instead of remove for anything that would be removed.
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
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