public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Tomas Chvatal" <scarabeus@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoo-bumpchecker:master commit in: modules/
Date: Sun, 20 Feb 2011 13:56:35 +0000 (UTC)	[thread overview]
Message-ID: <be54c034a8cc6c4ed064797d346e4659aebe4b29.scarabeus@gentoo> (raw)

commit:     be54c034a8cc6c4ed064797d346e4659aebe4b29
Author:     Tomas Chvatal <scarabeus <AT> gentoo <DOT> org>
AuthorDate: Sun Feb 20 13:56:28 2011 +0000
Commit:     Tomas Chvatal <scarabeus <AT> gentoo <DOT> org>
CommitDate: Sun Feb 20 13:56:28 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-bumpchecker.git;a=commit;h=be54c034

Cleanup the mess in portage_module. God we really need to rewrite this tool...

---
 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():



             reply	other threads:[~2011-02-20 13:56 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-20 13:56 Tomas Chvatal [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-02-20 21:03 [gentoo-commits] proj/gentoo-bumpchecker:master commit in: modules/ Nirbheek Chauhan
2011-03-15 13:19 Tomas Chvatal
2011-03-26  2:59 Nirbheek Chauhan
2011-06-07 16:36 Nirbheek Chauhan
2011-09-04 19:27 Mart Raudsepp
2012-11-21 23:42 Gilles Dartiguelongue
2017-03-03 23:50 Mart Raudsepp
2017-03-03 23:50 Mart Raudsepp
2017-03-03 23:50 Mart Raudsepp
2017-03-03 23:50 Mart Raudsepp
2017-03-03 23:50 Mart Raudsepp
2017-03-03 23:50 Mart Raudsepp
2017-03-03 23:50 Mart Raudsepp
2017-03-03 23:50 Mart Raudsepp
2017-03-11 14:09 Mart Raudsepp
2017-03-20 23:12 Mart Raudsepp
2017-03-21  1:59 Mart Raudsepp
2017-03-21  1:59 Mart Raudsepp
2017-03-21  2:29 Mart Raudsepp
2017-03-21  2:29 Mart Raudsepp
2017-03-21  2:29 Mart Raudsepp
2017-03-21  2:57 Mart Raudsepp
2017-10-31 23:12 Mart Raudsepp
2019-01-16  0:27 Mart Raudsepp
2019-03-26 13:33 Mart Raudsepp
2019-08-24 16:38 Mart Raudsepp
2021-04-14 22:57 Matt Turner
2021-04-14 22:57 Matt Turner
2021-12-11 22:11 Mart Raudsepp
2022-03-27  4:48 Matt Turner
2022-07-16 20:16 Mart Raudsepp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=be54c034a8cc6c4ed064797d346e4659aebe4b29.scarabeus@gentoo \
    --to=scarabeus@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox