summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorMichael Vogt <egon@bottom>2006-10-02 01:12:29 +0200
committerMichael Vogt <egon@bottom>2006-10-02 01:12:29 +0200
commit5f23b53e0978d985415bf53249d5bd4acfafc66a (patch)
tree00ac4b9c283a32fe324a097c0f7e4e7cb17c4145 /apt-pkg
parentdd09a217ac0d331f4a0324cf42559da5d35edc9a (diff)
parent320854985be0fe14491385ca349783ab8a9d7797 (diff)
* merged from apt--auto-mark
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/algorithms.cc9
-rw-r--r--apt-pkg/depcache.cc17
2 files changed, 17 insertions, 9 deletions
diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc
index ac9d3be0b..55f44fbd5 100644
--- a/apt-pkg/algorithms.cc
+++ b/apt-pkg/algorithms.cc
@@ -1229,8 +1229,13 @@ void pkgProblemResolver::InstallProtect()
{
if ((Flags[I->ID] & ToRemove) == ToRemove)
Cache.MarkDelete(I);
- else
- Cache.MarkInstall(I, false, 0, false);
+ else
+ {
+ // preserver the information if the package was auto
+ // or manual installed
+ bool autoInst = (Cache[I].Flags & pkgCache::Flag::Auto);
+ Cache.MarkInstall(I, false, 0, !autoInst);
+ }
}
}
}
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index 446bbe402..0a364f6ca 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -703,9 +703,17 @@ void pkgDepCache::MarkKeep(PkgIterator const &Pkg, bool Soft, bool FromUser)
// We dont even try to keep virtual packages..
if (Pkg->VersionList == 0)
return;
-
+#if 0 // reseting the autoflag here means we lose the
+ // auto-mark information if a user selects a package for removal
+ // but changes his mind then and sets it for keep again
+ // - this makes sense as default when all Garbage dependencies
+ // are automatically marked for removal (as aptitude does).
+ // setting a package for keep then makes it no longer autoinstalled
+ // for all other use-case this action is rather suprising
if(FromUser && !P.Marked)
P.Flags &= ~Flag::Auto;
+#endif
+
RemoveSizes(Pkg);
RemoveStates(Pkg);
@@ -934,10 +942,6 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
<< " as dep of " << Pkg.Name()
<< std::endl;
MarkInstall(InstPkg, true, Depth + 1, false, ForceImportantDeps);
- // Set the autoflag, after MarkInstall because MarkInstall
- // unsets it
- if (P->CurrentVer == 0)
- PkgState[InstPkg->ID].Flags |= Flag::Auto;
}
continue;
}
@@ -1325,8 +1329,7 @@ bool pkgDepCache::Sweep()
StateCache &state=PkgState[p->ID];
// if it is not marked and it is installed, it's garbage
- if(!state.Marked && (!p.CurrentVer().end() || state.Install()) &&
- !state.Delete())
+ if(!state.Marked && (!p.CurrentVer().end() || state.Install()))
{
state.Garbage=true;
if(_config->FindB("Debug::pkgAutoRemove",false))