Bug#686726: python-apt: mark_upgrade misuses FromUser to set auto-installed
Package: python-apt
Version: 0.8.7
Severity: normal
Tags: patch
Dear Maintainer,
Package.mark_upgrade uses FromUser for it's side effect of setting a
package as auto-installed (or not). However, FromUser is also
influential in pkgDepCache::IsModeChangeOk to determine whether an
action should override a dpkg hold, etc..
Perhaps mark_upgrade should expose FromUser to the caller as
mark_install does and keep track of auto-installed itself, as per the
attached patch.
I wonder if there is also demand for exposing the other mark_install
options (for example, using AutoInst=false to use a custom dependency
resolution).
Regards
=== modified file 'apt/package.py'
--- old/apt/package.py 2012-03-27 09:21:20 +0000
+++ new/apt/package.py 2012-09-05 03:18:49 +0000
@@ -1292,11 +1292,12 @@
fixer.resolve(True)
self._pcache.cache_post_change()
- def mark_upgrade(self):
+ def mark_upgrade(self, from_user=True):
"""Mark a package for upgrade."""
if self.is_upgradable:
- from_user = not self._pcache._depcache.is_auto_installed(self._pkg)
+ auto = self.is_auto_installed
self.mark_install(from_user=from_user)
+ self.mark_auto(auto)
else:
# FIXME: we may want to throw a exception here
sys.stderr.write(("MarkUpgrade() called on a non-upgrable pkg: "
Reply to: