diff options
author | necoro <> | 2007-06-18 15:32:23 +0000 |
---|---|---|
committer | necoro <> | 2007-06-18 15:32:23 +0000 |
commit | ae7f2d4cc94dcbc2c0d19dfb4d0154589e117cd5 (patch) | |
tree | b517b46bf38bdc9e752041d50eb76547f3df9d10 /portato/backend | |
parent | 095494f8811ee3667c82c4e2240df98558991b19 (diff) | |
download | portato-ae7f2d4cc94dcbc2c0d19dfb4d0154589e117cd5.tar.gz portato-ae7f2d4cc94dcbc2c0d19dfb4d0154589e117cd5.tar.bz2 portato-ae7f2d4cc94dcbc2c0d19dfb4d0154589e117cd5.zip |
added updated list to Qt
Diffstat (limited to '')
-rw-r--r-- | portato/backend/portage/package.py | 2 | ||||
-rw-r--r-- | portato/backend/portage/system.py | 62 | ||||
-rw-r--r-- | portato/backend/system_interface.py | 9 |
3 files changed, 47 insertions, 26 deletions
diff --git a/portato/backend/portage/package.py b/portato/backend/portage/package.py index d22d203..d819f2d 100644 --- a/portato/backend/portage/package.py +++ b/portato/backend/portage/package.py @@ -48,7 +48,7 @@ class PortagePackage (Package): def is_overlay(self): dir,ovl = self._settings.porttree.dbapi.findname2(self._cpv) - return ovl != self._settings.settings["PORTDIR"] + return ovl != self._settings.settings["PORTDIR"] and str(ovl) != "0" def get_overlay_path (self): dir,ovl = self._settings.porttree.dbapi.findname2(self._cpv) diff --git a/portato/backend/portage/system.py b/portato/backend/portage/system.py index 50224a9..ecdab4d 100644 --- a/portato/backend/portage/system.py +++ b/portato/backend/portage/system.py @@ -188,8 +188,8 @@ class PortageSystem (SystemInterface): if pkg: resolved.append(pkg) else: - unresolved.append(cpv) - return (resolved, self.geneticize_list(unresolved)) + unresolved.append(self.find_best_match(cpv, True)) + return (resolved, unresolved) def find_system_packages (self): pkglist = self.settings.settings.packages @@ -263,6 +263,38 @@ class PortageSystem (SystemInterface): def reload_settings (self): self.settings.load() + def get_new_packages (self, packages): + """Gets a list of packages and returns the best choice for each in the portage tree. + + @param packages: the list of packages + @type packages: string[] + @returns: the list of packages + @rtype: backend.Package[]""" + + new_packages = [] + for p in packages: + inst = self.find_installed_packages(p) + if len(inst) > 1: + myslots = set() + for i in inst: # get the slots of the installed packages + myslots.add(i.get_package_settings("SLOT")) + + myslots.add(self.find_best_match(p).get_package_settings("SLOT")) # add the slot of the best package in portage + for slot in myslots: + new_packages.append(\ + self.find_best(\ + [x.get_cpv() for x in self.find_packages("%s:%s" % (i.get_cp(), slot))]\ + )) + else: + new_packages.append(self.find_best_match(p)) + + return new_packages + + def get_updated_packages (self): + packages = self.get_new_packages(self.find_all_installed_packages(withVersion = False)) + packages = [x for x in packages if x is not None and not x.is_installed()] + return packages + def update_world (self, newuse = False, deep = False): # read world file world = open(portage.WORLD_FILE) @@ -276,27 +308,7 @@ class PortageSystem (SystemInterface): # append system packages packages.extend(unique_array([p.get_cp() for p in self.find_all_system_packages()])) - - def get_new_packages (packages): - new_packages = [] - for p in packages: - inst = self.find_installed_packages(p) - if len(inst) > 1: - myslots = set() - for i in inst: # get the slots of the installed packages - myslots.add(i.get_package_settings("SLOT")) - - myslots.add(self.find_best_match(p).get_package_settings("SLOT")) # add the slot of the best package in portage - for slot in myslots: - new_packages.append(\ - self.find_best(\ - [x.get_cpv() for x in self.find_packages("%s:%s" % (i.get_cp(), slot))]\ - )) - else: - new_packages.append(self.find_best_match(p)) - - return new_packages - + checked = [] updating = [] raw_checked = [] @@ -354,7 +366,7 @@ class PortageSystem (SystemInterface): for i in p.get_matched_dep_packages(state[0]): if i not in raw_checked: raw_checked.append(i) - bm = get_new_packages([i]) + bm = self.get_new_packages([i]) if not bm: debug("Bug? No best match could be found:",i) else: @@ -362,7 +374,7 @@ class PortageSystem (SystemInterface): if not pkg: continue check(pkg, state[1]) - for p in get_new_packages(packages): + for p in self.get_new_packages(packages): if not p: continue # if a masked package is installed we have "None" here check(p, True) diff --git a/portato/backend/system_interface.py b/portato/backend/system_interface.py index 9af0b33..3ce401c 100644 --- a/portato/backend/system_interface.py +++ b/portato/backend/system_interface.py @@ -191,6 +191,15 @@ class SystemInterface: raise NotImplementedError + def get_updated_packages (self): + """Returns the packages for which a newer package is available in the portage tree and installable (thus not masked). + This differs from update_world as it takes all installed packages into account but ignores changed useflags. + + @returns: the list of new packages + @rtype: backend.Package[]""" + + raise NotImplementedError + def get_use_desc (self, flag, package = None): """Returns the description of a specific useflag or None if no desc was found. If a package is given (in the <cat>/<name> format) the local use descriptions are searched too. |