do not allow to reinstall a package if can be updated

This commit is contained in:
guinux 2013-10-26 12:43:44 +02:00
parent 18b0395f1f
commit f8d30c03ac
2 changed files with 9 additions and 10 deletions

View File

@ -367,20 +367,18 @@ class PamacDBusService(dbus.service.Object):
def CheckUpdates(self): def CheckUpdates(self):
updates = 0 updates = 0
_ignorepkgs = [] _ignorepkgs = set()
for group in self.handle.ignoregrps: for group in self.handle.ignoregrps:
db = self.handle.get_localdb() db = self.handle.get_localdb()
grp = db.read_grp(group) grp = db.read_grp(group)
if grp: if grp:
name, pkg_list = grp name, pkg_list = grp
for pkg in pkg_list: for pkg in pkg_list:
if not pkg.name in _ignorepkgs: _ignorepkgs.add(pkg.name)
_ignorepkgs.append(pkg.name)
for name in self.handle.ignorepkgs: for name in self.handle.ignorepkgs:
pkg = self.handle.get_localdb().get_pkg(name) pkg = self.handle.get_localdb().get_pkg(name)
if pkg: if pkg:
if not pkg.name in _ignorepkgs: _ignorepkgs.add(pkg.name)
_ignorepkgs.append(pkg.name)
if config.syncfirst: if config.syncfirst:
for name in config.syncfirst: for name in config.syncfirst:
pkg = self.handle.get_localdb().get_pkg(name) pkg = self.handle.get_localdb().get_pkg(name)

View File

@ -492,11 +492,12 @@ def on_list_treeview_button_press_event(treeview, event):
item.connect('activate', mark_to_remove, liststore[treeiter][0]) item.connect('activate', mark_to_remove, liststore[treeiter][0])
right_click_menu.append(item) right_click_menu.append(item)
if transaction.get_syncpkg(liststore[treeiter][0].name): if transaction.get_syncpkg(liststore[treeiter][0].name):
item = Gtk.ImageMenuItem(_('Reinstall')) if not pyalpm.sync_newversion(liststore[treeiter][0], transaction.syncdbs):
item.set_image(Gtk.Image.new_from_pixbuf(to_reinstall_icon)) item = Gtk.ImageMenuItem(_('Reinstall'))
item.set_always_show_image(True) item.set_image(Gtk.Image.new_from_pixbuf(to_reinstall_icon))
item.connect('activate', mark_to_reinstall, liststore[treeiter][0]) item.set_always_show_image(True)
right_click_menu.append(item) item.connect('activate', mark_to_reinstall, liststore[treeiter][0])
right_click_menu.append(item)
optdeps_strings = liststore[treeiter][0].optdepends optdeps_strings = liststore[treeiter][0].optdepends
if optdeps_strings: if optdeps_strings:
available_optdeps = [] available_optdeps = []