diff options
author | necoro <> | 2006-10-15 21:42:18 +0000 |
---|---|---|
committer | necoro <> | 2006-10-15 21:42:18 +0000 |
commit | 48fa7e6ef10bcc87e263f1c52d7430bafa23fe21 (patch) | |
tree | bed61c8c997d1f4202b0abadb8ad678570bb713c /geneticone/backend/portage_helper.py | |
parent | 501571fadc81be83017968b098fb05b73a6043b1 (diff) | |
download | portato-48fa7e6ef10bcc87e263f1c52d7430bafa23fe21.tar.gz portato-48fa7e6ef10bcc87e263f1c52d7430bafa23fe21.tar.bz2 portato-48fa7e6ef10bcc87e263f1c52d7430bafa23fe21.zip |
Second level of "emerge --update"
Diffstat (limited to 'geneticone/backend/portage_helper.py')
-rw-r--r-- | geneticone/backend/portage_helper.py | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/geneticone/backend/portage_helper.py b/geneticone/backend/portage_helper.py index df0275f..9faf953 100644 --- a/geneticone/backend/portage_helper.py +++ b/geneticone/backend/portage_helper.py @@ -17,6 +17,8 @@ from portage_util import unique_array from geneticone.backend import * import package +from geneticone.helper import debug + def find_lambda (name): """Returns the function needed by all the find_all_*-functions. Returns None if no name is given. @@ -246,6 +248,7 @@ def update_world (newuse = False, deep = False): @returns: a list containing of the tuple (new_package, old_package) @rtype: (backend.Package, backend.Package)[]""" + # read world file world = open(portage.WORLD_FILE) packages = [] for line in world: @@ -255,13 +258,35 @@ def update_world (newuse = False, deep = False): packages.append(find_best_match(line)) world.close() + checked = [] 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 + def check (p, deep = False): + """Checks whether a package is updated or not.""" + if p.get_cp() in checked: return + else: checked.append(p.get_cp()) + + if not p.is_installed(): + old = find_installed_packages(p.get_cp()) + if old: + old = old[0] # assume we have only one there; FIXME: slotted packages + else: + debug("Bug? Not found installed one:",p.get_cp()) + return updating.append((p, old)) + p = old + + if deep: + for i in p.get_matched_dep_packages(): + bm = find_best_match(i) + if not bm: + debug("Bug? No best match could be found:",i) + else: + check(bm, deep) + for p in packages: + if not p: continue # if a masked package is installed we have "None" here + check(p, deep) + return updating use_descs = {} |