summaryrefslogtreecommitdiff
path: root/geneticone/backend
diff options
context:
space:
mode:
Diffstat (limited to 'geneticone/backend')
-rw-r--r--geneticone/backend/__init__.py4
-rw-r--r--geneticone/backend/portage_helper.py28
2 files changed, 30 insertions, 2 deletions
diff --git a/geneticone/backend/__init__.py b/geneticone/backend/__init__.py
index 5238765..dbebd17 100644
--- a/geneticone/backend/__init__.py
+++ b/geneticone/backend/__init__.py
@@ -19,8 +19,8 @@ import gentoolkit
import portage
# this is set to "var/lib/portage/world" by default - so we add the leading /
-portage.WORLD_FILE = "/"+portage.WORLD_FILE
-portage.settings = None
+portage.WORLD_FILE = portage.settings["ROOT"]+portage.WORLD_FILE
+portage.settings = None # we use our own one ...
# portage tree vars
porttree = gentoolkit.porttree
diff --git a/geneticone/backend/portage_helper.py b/geneticone/backend/portage_helper.py
index 37a2b91..df0275f 100644
--- a/geneticone/backend/portage_helper.py
+++ b/geneticone/backend/portage_helper.py
@@ -236,6 +236,34 @@ def reload_settings ():
"""Reloads portage."""
gentoolkit.settings = portage.config(config_incrementals = copy.deepcopy(gentoolkit.settings.incrementals))
+def update_world (newuse = False, deep = False):
+ """Calculates the packages to get updated in an update world.
+
+ @param newuse: Checks if a use-flag has a different state then to install time.
+ @type newuse: boolean
+ @param deep: Not only check world packages but also there dependencies.
+ @type deep: boolean
+ @returns: a list containing of the tuple (new_package, old_package)
+ @rtype: (backend.Package, backend.Package)[]"""
+
+ world = open(portage.WORLD_FILE)
+ packages = []
+ for line in world:
+ line = line.strip()
+ if not len(line): continue # empty line
+ if line[0] == "#": continue
+ packages.append(find_best_match(line))
+ world.close()
+
+ updating = []
+ for p in packages:
+ if not p: continue # if a masked package is installed we have "None" here
+ if not p.is_installed():
+ old = find_installed_packages(p.get_cp())[0] # assume we have only one there; FIXME: slotted packages
+ updating.append((p, old))
+
+ return updating
+
use_descs = {}
local_use_descs = {}
def get_use_desc (flag, package = None):