summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Burrows <dburrows@debian.org>2009-09-05 09:23:44 -0700
committerDaniel Burrows <dburrows@debian.org>2009-09-05 09:23:44 -0700
commiteb1427c415500fa7e5401d310e0120ad07b76e3a (patch)
treeee5ed9cebfee2725e4d52f5e951befe1d05a7e3b
parentff7764854d31b55107571bb89b5883310ea88cc3 (diff)
downloadaptitude-eb1427c415500fa7e5401d310e0120ad07b76e3a.tar.gz
Don't let the apt greedy resolver remove packages; ask the user to handle conflicts instead.
Triggered by the observation that aptitude was removing grub without any user interaction, which I believe is caused by the greedy resolver.
-rw-r--r--doc/en/aptitude.xml20
-rw-r--r--src/generic/apt/aptcache.cc23
2 files changed, 30 insertions, 13 deletions
diff --git a/doc/en/aptitude.xml b/doc/en/aptitude.xml
index e9001c29..eaa2204b 100644
--- a/doc/en/aptitude.xml
+++ b/doc/en/aptitude.xml
@@ -10289,10 +10289,22 @@ e: Examine !: Apply .: Next ,: Previous</screen>
<seg><literal>Aptitude::Auto-Install</literal></seg>
<seg><literal>true</literal></seg>
<seg>
- If this option is <literal>true</literal>,
- &aptitude; will automatically attempt to fulfill
- the dependencies of a package when you select it
- for installation.
+ If this option is <literal>true</literal>, &aptitude;
+ will automatically attempt to fulfill the dependencies
+ of a package when you mark a package to be installed
+ or upgraded.
+ </seg>
+ </seglistitem>
+
+ <seglistitem id='configAuto-Install-Remove-Ok'>
+ <seg><literal>Aptitude::Auto-Install-Remove-Ok</literal></seg>
+ <seg><literal>false</literal></seg>
+ <seg>
+ If this option is <literal>true</literal>, &aptitude;
+ will automatically remove conflicting packages when
+ you mark a package to be installed or upgraded.
+ Normally these conflicts are flagged and you must
+ handle them manually.
</seg>
</seglistitem>
diff --git a/src/generic/apt/aptcache.cc b/src/generic/apt/aptcache.cc
index 23c4165b..409def42 100644
--- a/src/generic/apt/aptcache.cc
+++ b/src/generic/apt/aptcache.cc
@@ -2356,15 +2356,20 @@ bool aptitudeDepCache::IsDeleteOk(const pkgCache::PkgIterator &pkg,
unsigned long Depth,
bool FromUser)
{
- const aptitude_state &estate = get_ext_state(pkg);
-
- if(estate.selection_state == pkgCache::State::Hold)
+ if(!aptcfg->FindB(PACKAGE "::Auto-Install-Remove-Ok", false))
+ return false;
+ else
{
- LOG_INFO(Loggers::getAptitudeAptCache(),
- "Refusing to remove the held package "
- << pkg.Name());
- return false;
- }
+ const aptitude_state &estate = get_ext_state(pkg);
- return true;
+ if(estate.selection_state == pkgCache::State::Hold)
+ {
+ LOG_INFO(Loggers::getAptitudeAptCache(),
+ "Refusing to remove the held package "
+ << pkg.Name());
+ return false;
+ }
+
+ return true;
+ }
}