def start(self): os.environ["APT_LISTCHANGES_FRONTEND"] = "none" # Do not suspend during the update process self.sleep_cookie = inhibit_sleep() if self.action == self.ACTION_INSTALL: # Get the packages which should be installed and update pkgs_install = [] pkgs_upgrade = [] pkgs_remove = [] # Get a fresh cache in case update-manager's is outdated to # skip operations that already took place fresh_cache = Cache(rootdir=self.window_main.cache.rootdir) for pkg in self.window_main.cache: try: if pkg.marked_install and \ not fresh_cache[pkg.name].is_installed: pkgname = pkg.name if pkg.is_auto_installed: pkgname += "#auto" pkgs_install.append(pkgname) elif (pkg.marked_upgrade and fresh_cache[pkg.name].is_upgradable): pkgs_upgrade.append(pkg.name) elif (pkg.marked_delete and fresh_cache[pkg.name].is_installed): pkgs_remove.append(pkg.name) except KeyError: # pkg missing from fresh_cache can't be modified pass self.commit(pkgs_install, pkgs_upgrade, pkgs_remove) else: self.update()
def start(self): os.environ["APT_LISTCHANGES_FRONTEND"] = "none" # Do not suspend during the update process (self.sleep_dev, self.sleep_cookie) = inhibit_sleep() if self.action == self.ACTION_INSTALL: # Get the packages which should be installed and update pkgs_install = [] pkgs_upgrade = [] for pkg in self.window_main.cache: if pkg.marked_install: pkgs_install.append(pkg.name) elif pkg.marked_upgrade: pkgs_upgrade.append(pkg.name) self.commit(pkgs_install, pkgs_upgrade) else: self.update()
def start(self): os.environ["APT_LISTCHANGES_FRONTEND"] = "none" # Do not suspend during the update process (self.sleep_dev, self.sleep_cookie) = inhibit_sleep() if self.action == self.ACTION_INSTALL: # Get the packages which should be installed and update pkgs_install = [] pkgs_upgrade = [] for pkg in self.window_main.cache: if pkg.marked_install: pkgname = pkg.name if pkg.is_auto_installed: pkgname += "#auto" pkgs_install.append(pkgname) elif pkg.marked_upgrade: pkgs_upgrade.append(pkg.name) self.commit(pkgs_install, pkgs_upgrade) else: self.update()