Ejemplo n.º 1
0
 def upgradeAll(self):
     transaction = Transaction(self._ctrl.getCache())
     transaction.setState(self._changeset)
     for pkg in self._ctrl.getCache().getPackages():
         if pkg.installed:
             transaction.enqueue(pkg, UPGRADE)
     transaction.setPolicy(PolicyUpgrade)
     transaction.run()
     changeset = transaction.getChangeSet()
     if changeset != self._changeset:
         if self.confirmChange(self._changeset, changeset):
             self.saveUndo()
             self._changeset.setState(changeset)
             self.changedMarks()
             if self.askYesNo(_("Apply marked changes now?"), True):
                 self.applyChanges()
     else:
         self.showStatus(_("No interesting upgrades available!"))
Ejemplo n.º 2
0
 def upgradeAll(self):
     transaction = Transaction(self._ctrl.getCache())
     transaction.setState(self._changeset)
     for pkg in self._ctrl.getCache().getPackages():
         if pkg.installed:
             transaction.enqueue(pkg, UPGRADE)
     transaction.setPolicy(PolicyUpgrade)
     transaction.run()
     changeset = transaction.getChangeSet()
     if changeset != self._changeset:
         if self.confirmChange(self._changeset, changeset):
             self.saveUndo()
             self._changeset.setState(changeset)
             self.changedMarks()
             if self.askYesNo(_("Apply marked changes now?"), True):
                 self.applyChanges()
     else:
         self.showStatus(_("No interesting upgrades available!"))
Ejemplo n.º 3
0
 def actOnPackages(self, pkgs, op=None):
     cache = self._ctrl.getCache()
     transaction = Transaction(cache, policy=PolicyInstall)
     transaction.setState(self._changeset)
     changeset = transaction.getChangeSet()
     if op is None:
         if not [pkg for pkg in pkgs if pkg not in changeset]:
             op = KEEP
         else:
             for pkg in pkgs:
                 if not pkg.installed:
                     op = INSTALL
                     break
             else:
                 op = REMOVE
     if op is REMOVE:
         transaction.setPolicy(PolicyRemove)
     policy = transaction.getPolicy()
     for pkg in pkgs:
         if op is KEEP:
             transaction.enqueue(pkg, op)
         elif op in (REMOVE, REINSTALL, FIX):
             if pkg.installed:
                 transaction.enqueue(pkg, op)
                 if op is REMOVE:
                     for _pkg in cache.getPackages(pkg.name):
                         if not _pkg.installed:
                             policy.setLocked(_pkg, True)
         elif op is INSTALL:
             if not pkg.installed:
                 transaction.enqueue(pkg, op)
     transaction.run()
     if op is FIX:
         expected = 0
     else:
         expected = 1
     if self.confirmChange(self._changeset, changeset, expected):
         self.saveUndo()
         self._changeset.setState(changeset)
         pkgs.extend(changeset)
         self.changedMarks(pkgs)