Don't keep records for packages not installed.
Allow to toggle marking reinstalled packages as manually reinstalled.
This commit is contained in:
parent
0834061d1f
commit
fc9209dd96
@ -78,7 +78,6 @@ class pkgCache::PkgIterator
|
|||||||
inline bool Purge() const {return Pkg->CurrentState == pkgCache::State::Purge ||
|
inline bool Purge() const {return Pkg->CurrentState == pkgCache::State::Purge ||
|
||||||
(Pkg->CurrentVer == 0 && Pkg->CurrentState == pkgCache::State::NotInstalled);};
|
(Pkg->CurrentVer == 0 && Pkg->CurrentState == pkgCache::State::NotInstalled);};
|
||||||
inline VerIterator VersionList() const;
|
inline VerIterator VersionList() const;
|
||||||
inline VerIterator TargetVer() const;
|
|
||||||
inline VerIterator CurrentVer() const;
|
inline VerIterator CurrentVer() const;
|
||||||
inline DepIterator RevDependsList() const;
|
inline DepIterator RevDependsList() const;
|
||||||
inline PrvIterator ProvidesList() const;
|
inline PrvIterator ProvidesList() const;
|
||||||
|
@ -334,6 +334,21 @@ void Configuration::CndSet(const char *Name,string Value)
|
|||||||
if (Itm->Value.empty() == true)
|
if (Itm->Value.empty() == true)
|
||||||
Itm->Value = Value;
|
Itm->Value = Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Configuration::CndSet(const char *Name,int Value)
|
||||||
|
{
|
||||||
|
Item *Itm = Lookup(Name,true);
|
||||||
|
if (Itm == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Itm->Value.empty())
|
||||||
|
{
|
||||||
|
Itm->Value = std::to_string(Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*}}}*/
|
/*}}}*/
|
||||||
// Configuration::Set - Set a value /*{{{*/
|
// Configuration::Set - Set a value /*{{{*/
|
||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
|
@ -83,6 +83,7 @@ class Configuration
|
|||||||
|
|
||||||
inline void Set(string Name,string Value) {Set(Name.c_str(),Value);};
|
inline void Set(string Name,string Value) {Set(Name.c_str(),Value);};
|
||||||
void CndSet(const char *Name,string Value);
|
void CndSet(const char *Name,string Value);
|
||||||
|
void CndSet(const char *Name,int Value);
|
||||||
void Set(const char *Name,string Value);
|
void Set(const char *Name,string Value);
|
||||||
void Set(const char *Name,int Value);
|
void Set(const char *Name,int Value);
|
||||||
|
|
||||||
|
@ -733,7 +733,10 @@ bool pkgDepCache::writeStateFile(OpProgress * const /*prog*/)
|
|||||||
{
|
{
|
||||||
StateCache const &stateCache = PkgState[iter->ID];
|
StateCache const &stateCache = PkgState[iter->ID];
|
||||||
|
|
||||||
if ((stateCache.Flags & Flag::Auto) == Flag::Auto)
|
/* if package is auto, it's an existing installed package or new installed package, write it */
|
||||||
|
if (((stateCache.Flags & Flag::Auto) == Flag::Auto)
|
||||||
|
&& (((stateCache.Mode == pkgDepCache::ModeKeep) && (iter->CurrentState == pkgCache::State::Installed))
|
||||||
|
|| (stateCache.Mode == pkgDepCache::ModeInstall)))
|
||||||
{
|
{
|
||||||
linestr = iter.Name();
|
linestr = iter.Name();
|
||||||
linestr += '\n';
|
linestr += '\n';
|
||||||
|
@ -193,6 +193,9 @@ bool rpmSystem::Initialize(Configuration &Cnf)
|
|||||||
// In apt-get it's called 'Dir::State::apt_mark_storage', but format used here is incompatible, due to that name is different
|
// In apt-get it's called 'Dir::State::apt_mark_storage', but format used here is incompatible, due to that name is different
|
||||||
Cnf.CndSet("Dir::State::apt_mark_storage", "apt_mark_storage");
|
Cnf.CndSet("Dir::State::apt_mark_storage", "apt_mark_storage");
|
||||||
|
|
||||||
|
// If set to true, apt-get reinstall will remove 'auto' mark from package
|
||||||
|
Cnf.CndSet("APT::Get::ReInstall::MarkManual", true);
|
||||||
|
|
||||||
#if RPM_VERSION >= 0x040201
|
#if RPM_VERSION >= 0x040201
|
||||||
const char *RPMOptions[] =
|
const char *RPMOptions[] =
|
||||||
{
|
{
|
||||||
|
@ -847,7 +847,13 @@ bool TryToInstall(pkgCache::PkgIterator Pkg,pkgDepCache &Cache,
|
|||||||
ioprintf(c1out,_("Reinstallation of %s %s is not possible, it cannot be downloaded.\n"),
|
ioprintf(c1out,_("Reinstallation of %s %s is not possible, it cannot be downloaded.\n"),
|
||||||
Pkg.Name(), Pkg.CurrentVer().VerStr());
|
Pkg.Name(), Pkg.CurrentVer().VerStr());
|
||||||
else
|
else
|
||||||
|
{
|
||||||
Cache.SetReInstall(Pkg,true);
|
Cache.SetReInstall(Pkg,true);
|
||||||
|
if (_config->FindB("APT::Get::ReInstall::MarkManual", true))
|
||||||
|
{
|
||||||
|
Cache.MarkAuto(Pkg, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user