diff options
author | 2011-02-20 14:56:28 +0100 | |
---|---|---|
committer | 2011-02-20 14:56:28 +0100 | |
commit | be54c034a8cc6c4ed064797d346e4659aebe4b29 (patch) | |
tree | 40fdf216d8c7b061b4bcb4d638514cebda7078ad | |
parent | gnome_module: fix fetching of GNOME 3.0 version lists (diff) | |
download | gentoo-bumpchecker-be54c034a8cc6c4ed064797d346e4659aebe4b29.tar.gz gentoo-bumpchecker-be54c034a8cc6c4ed064797d346e4659aebe4b29.tar.bz2 gentoo-bumpchecker-be54c034a8cc6c4ed064797d346e4659aebe4b29.zip |
Cleanup the mess in portage_module. God we really need to rewrite this tool...
-rw-r--r-- | modules/portage_module.py | 47 |
1 files changed, 9 insertions, 38 deletions
diff --git a/modules/portage_module.py b/modules/portage_module.py index eb2243a..2d2b7d7 100644 --- a/modules/portage_module.py +++ b/modules/portage_module.py @@ -69,9 +69,6 @@ def best_version_test(package1, package2): # having the overhead of calling it each time and getting the output. def find_latest_package_in_tree(package_name, portdbapi=None): try: - if portdbapi is None: - portdbapi = portage.db['/'][get_dbtree()].dbapi - mylist = portdbapi.match(package_name) return portage.best(mylist) except KeyError: @@ -83,42 +80,25 @@ def find_packages_in_tree(package_list, portdir=None, all_overlays=False, overla #overlays = ["/home/allanon/cvs/gnome"] portage_versions = [] - portdbsettings = portage.db['/'][get_dbtree()].settings - portdbapi = portage.db['/'][get_dbtree()].dbapi - old_dbapi = None - olddbapi_kw = None + if all_overlays is False: + overlays = '' + if overlay_list is not None: + overlays = overlay_list if stable is not False: # stable - mysettings = portage.config(clone=portdbsettings) - mysettings['ACCEPT_KEYWORDS'] = 'amd64' # the arch I care for :] - olddbapi_kw = portdbapi - portdbapi = portage.portdbapi(mysettings['PORTDIR'], mysettings=mysettings) + keywords = 'amd64' # the arch I care for :] else: #testing - mysettings = portage.config(clone=portdbsettings) - mysettings['ACCEPT_KEYWORDS'] = 'amd64 ~amd64' # the arch I care for :] - olddbapi_kw = portdbapi - portdbapi = portage.portdbapi(mysettings['PORTDIR'], mysettings=mysettings) + keywords = 'amd64 ~amd64' # the arch I care for :] if portdir is not None: - mysettings = portage.config(clone=portdbsettings) - mysettings['PORTDIR'] = portdir - olddbapi = portdbapi - portdbapi = portage.portdbapi(mysettings['PORTDIR']) + mysettings = portage.config(env={'PORTDIR_OVERLAY': overlays, 'KEYWORDS': keywords, 'PORTDIR': portdir}) else: - portdir = portdbsettings['PORTDIR'] + mysettings = portage.config(env={'PORTDIR_OVERLAY': overlays, 'KEYWORDS': keywords}) - if all_overlays is False: - # Prune list of trees to be scanned - oldporttrees = portdbapi.porttrees - portdbapi.porttrees = [os.path.realpath(portdir)] - - # Now append the overlays we want. First resolve to absolute paths. - if overlay_list is not None: - portdbapi.porttrees += \ - [ os.path.realpath(overlay) for overlay in overlay_list ] + portdbapi = portage.portdbapi(mysettings=mysettings) for package in package_list: best_package = find_latest_package_in_tree(package.name, portdbapi) @@ -129,15 +109,6 @@ def find_packages_in_tree(package_list, portdir=None, all_overlays=False, overla # Need to account for slotted packages here portage_versions.append(package_module.Package(best_package)) - # Restore portdb trees list - if all_overlays is False: - portdbapi.porttrees = oldporttrees - - if olddbapi_kw is not None: - portage.dbapi = olddbapi_kw - if old_dbapi is not None: - portage.dbapi = old_dbapi - return portage_versions def tests(): |