diff options
author | 2008-06-02 17:12:51 +0530 | |
---|---|---|
committer | 2008-06-02 21:26:34 +0530 | |
commit | 2e9d29c32f64c45bd21952a57f253eedbbee6c2b (patch) | |
tree | 44ed62193118b6ec392a090e65a0a62f4efe8501 | |
parent | Provide finer-grained control over scanning of overlays (diff) | |
download | gentoo-bumpchecker-2e9d29c32f64c45bd21952a57f253eedbbee6c2b.tar.gz gentoo-bumpchecker-2e9d29c32f64c45bd21952a57f253eedbbee6c2b.tar.bz2 gentoo-bumpchecker-2e9d29c32f64c45bd21952a57f253eedbbee6c2b.zip |
Add a -p/--portdir option to specify an alternate PORTDIR
-rwxr-xr-x | gentoo-bumpchecker.py | 1 | ||||
-rw-r--r-- | modules/clioptions_module.py | 3 | ||||
-rw-r--r-- | modules/portage_module.py | 16 |
3 files changed, 18 insertions, 2 deletions
diff --git a/gentoo-bumpchecker.py b/gentoo-bumpchecker.py index 609e677..0486336 100755 --- a/gentoo-bumpchecker.py +++ b/gentoo-bumpchecker.py @@ -35,6 +35,7 @@ if __name__ == '__main__': import portage_module packages_in_portage = \ portage_module.find_packages_in_tree(release_packages, \ + options.get_arguments().portdir, \ options.get_arguments().all_overlays, \ options.get_arguments().overlays) diff --git a/modules/clioptions_module.py b/modules/clioptions_module.py index 4f3046b..7f180e4 100644 --- a/modules/clioptions_module.py +++ b/modules/clioptions_module.py @@ -27,6 +27,9 @@ class Options: self.parser.add_option("-n", "--nextrev", action="store_true", dest="nextrev", default=False, help="Check for a minor revision newer than the given one") + self.parser.add_option("-p", "--portdir", + dest="portdir", default=None, + help="Specify an alternate tree to use as PORTDIR") self.parser.add_option("--all-overlays", action="store_true", dest="all_overlays", default=False, diff --git a/modules/portage_module.py b/modules/portage_module.py index dcd44e2..f3e37c6 100644 --- a/modules/portage_module.py +++ b/modules/portage_module.py @@ -65,17 +65,26 @@ def find_latest_package_in_tree(package_name, portdb=None): return None # finds the latest available version of a package -def find_packages_in_tree(package_list, all_overlays=False, overlay_list=None): +def find_packages_in_tree(package_list, portdir=None, all_overlays=False, overlay_list=None): # this value needs to be configurable from cl #overlays = ["/home/allanon/cvs/gnome"] portage_versions = [] portdb = portage.db['/'][get_dbtree()] + old_dbapi = None + if portdir is not None: + mysettings = portage.config(clone=portdb.settings) + mysettings['PORTDIR'] = portdir + olddbapi = portdb.dbapi + portdb.dbapi = portage.portdbapi(portdir, mysettings) + else: + portdir = portdb.settings['PORTDIR'] + if all_overlays is False: # Prune list of trees to be scanned oldporttrees = portdb.dbapi.porttrees - portdb.dbapi.porttrees = [os.path.realpath(portdb.settings['PORTDIR'])] + portdb.dbapi.porttrees = [os.path.realpath(portdir)] # Now append the overlays we want. First resolve to absolute paths. if overlay_list is not None: @@ -94,6 +103,9 @@ def find_packages_in_tree(package_list, all_overlays=False, overlay_list=None): # Restore portdb trees list if all_overlays is False: portdb.dbapi.porttrees = oldporttrees + + if old_dbapi is not None: + portage.dbapi = old_dbapi return portage_versions |