From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/
Date: Sat, 24 Sep 2011 19:05:16 +0000 (UTC) [thread overview]
Message-ID: <5076fa35cdcba5a092f16c2004e90d4d84c01044.zmedico@gentoo> (raw)
commit: 5076fa35cdcba5a092f16c2004e90d4d84c01044
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 24 19:05:00 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Sep 24 19:05:00 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=5076fa35
portdbapi: move repo loop to _iter_visible
This allows use to avoid using a set to eliminate duplicates, since we
can break out of the repo loop as soon as a given cpv is found to be
visible.
---
pym/portage/dbapi/porttree.py | 123 +++++++++++++++++++++-------------------
1 files changed, 65 insertions(+), 58 deletions(-)
diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
index e4cf9a6..aaa69fa 100644
--- a/pym/portage/dbapi/porttree.py
+++ b/pym/portage/dbapi/porttree.py
@@ -874,22 +874,9 @@ class portdbapi(dbapi):
elif level == "match-visible":
# find all visible matches
- if mydep.repo is not None or len(self.porttrees) == 1:
- myval = list(self._iter_visible(
- self.xmatch("match-all", mydep),
- mytree=mytree))
- else:
- myval = set()
- # We iterate over self.porttrees, since it's common to
- # tweak this attribute in order to adjust match behavior.
- for tree in self.porttrees:
- repo = self.repositories.get_name_for_location(tree)
- myval.update(self._iter_visible(
- self.xmatch("match-all", mydep.with_repo(repo)),
- mytree=tree))
- myval = list(myval)
- if len(myval) > 1:
- self._cpv_sort_ascending(myval)
+ myval = self.xmatch("match-all", mydep)
+ if myval:
+ myval = list(self._iter_visible(myval, myrepo=mydep.repo))
elif level == "minimum-all":
# Find the minimum matching version. This is optimized to
@@ -1016,24 +1003,24 @@ class portdbapi(dbapi):
def match(self, mydep, use_cache=1):
return self.xmatch("match-visible", mydep)
- def gvisible(self, mylist, mytree=None):
+ def gvisible(self, mylist):
warnings.warn("The 'gvisible' method of "
"portage.dbapi.porttree.portdbapi "
"is deprecated, and the functionality "
"has been combined into the 'visible' method",
DeprecationWarning, stacklevel=2)
- return self.visible(mylist, mytree=mytree)
+ return self.visible(mylist)
- def visible(self, cpv_iter, mytree=None):
+ def visible(self, cpv_iter):
"""
Return a list containing only visible packages.
"""
- if mylist is None:
+ if cpv_iter is None:
return []
- return list(self._iter_visible(iter(cpv_iter), mytree=mytree))
+ return list(self._iter_visible(iter(cpv_iter)))
- def _iter_visible(self, cpv_iter, mytree=None):
+ def _iter_visible(self, cpv_iter, myrepo=None):
"""
Return a new list containing only visible packages.
"""
@@ -1043,46 +1030,66 @@ class portdbapi(dbapi):
chost = self.settings.get('CHOST', '')
accept_chost = self.settings._accept_chost
getMaskAtom = self.settings._getMaskAtom
+
+ if len(self.porttrees) == 1:
+ repos = [None]
+ elif myrepo is not None:
+ repos = [myrepo]
+ else:
+ # We iterate over self.porttrees, since it's common to
+ # tweak this attribute in order to adjust match behavior.
+ repos = []
+ for tree in reversed(self.porttrees):
+ repos.append(self.repositories.get_name_for_location(tree))
+
for mycpv in cpv_iter:
- metadata.clear()
- try:
- metadata.update(zip(aux_keys,
- self.aux_get(mycpv, aux_keys, mytree=mytree)))
- except KeyError:
- continue
- except PortageException as e:
- writemsg("!!! Error: aux_get('%s', %s)\n" % (mycpv, aux_keys),
- noiselevel=-1)
- writemsg("!!! %s\n" % (e,), noiselevel=-1)
- del e
- continue
- eapi = metadata["EAPI"]
- if not eapi_is_supported(eapi):
- continue
- if _eapi_is_deprecated(eapi):
- continue
- if not metadata["SLOT"]:
- continue
- if getMaskAtom(mycpv, metadata):
- continue
- if self.settings._getMissingKeywords(mycpv, metadata):
- continue
- if local_config:
- metadata['CHOST'] = chost
- if not accept_chost(mycpv, metadata):
- continue
- metadata["USE"] = ""
- if "?" in metadata["LICENSE"] or "?" in metadata["PROPERTIES"]:
- self.doebuild_settings.setcpv(mycpv, mydb=metadata)
- metadata['USE'] = self.doebuild_settings['PORTAGE_USE']
+ for repo in repos:
+ metadata.clear()
try:
- if self.settings._getMissingLicenses(mycpv, metadata):
+ metadata.update(zip(aux_keys,
+ self.aux_get(mycpv, aux_keys, myrepo=repo)))
+ except KeyError:
+ continue
+ except PortageException as e:
+ writemsg("!!! Error: aux_get('%s', %s)\n" %
+ (mycpv, aux_keys), noiselevel=-1)
+ writemsg("!!! %s\n" % (e,), noiselevel=-1)
+ del e
+ continue
+ eapi = metadata["EAPI"]
+ if not eapi_is_supported(eapi):
+ continue
+ if _eapi_is_deprecated(eapi):
+ continue
+ if not metadata["SLOT"]:
+ continue
+ if getMaskAtom(mycpv, metadata):
+ continue
+ if self.settings._getMissingKeywords(mycpv, metadata):
+ continue
+ if local_config:
+ metadata['CHOST'] = chost
+ if not accept_chost(mycpv, metadata):
continue
- if self.settings._getMissingProperties(mycpv, metadata):
+ metadata["USE"] = ""
+ if "?" in metadata["LICENSE"] or \
+ "?" in metadata["PROPERTIES"]:
+ self.doebuild_settings.setcpv(mycpv, mydb=metadata)
+ metadata['USE'] = \
+ self.doebuild_settings['PORTAGE_USE']
+ try:
+ if self.settings._getMissingLicenses(
+ mycpv, metadata):
+ continue
+ if self.settings._getMissingProperties(
+ mycpv, metadata):
+ continue
+ except InvalidDependString:
continue
- except InvalidDependString:
- continue
- yield mycpv
+
+ yield mycpv
+ # only yield a given cpv once
+ break
def close_portdbapi_caches():
for i in portdbapi.portdbapi_instances:
next reply other threads:[~2011-09-24 19:05 UTC|newest]
Thread overview: 288+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-24 19:05 Zac Medico [this message]
-- strict thread matches above, loose matches on Subject: below --
2018-07-16 5:27 [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/ Zac Medico
2018-07-15 21:40 Zac Medico
2018-07-14 23:58 Zac Medico
2018-06-26 20:24 Zac Medico
2018-04-30 6:29 Zac Medico
2018-04-29 21:29 Zac Medico
2018-04-24 6:56 Zac Medico
2018-04-23 19:53 Zac Medico
2018-04-23 18:52 Zac Medico
2018-04-17 17:18 Zac Medico
2018-04-13 1:23 Zac Medico
2018-04-11 1:47 Zac Medico
2018-04-10 22:17 Zac Medico
2018-04-10 1:33 Zac Medico
2018-03-16 21:11 Michał Górny
2018-02-28 18:41 Zac Medico
2017-11-21 19:27 Zac Medico
2017-11-21 1:34 Zac Medico
2017-11-14 3:15 Zac Medico
2017-10-15 0:59 Zac Medico
2017-08-27 9:33 Fabian Groffen
2017-02-28 22:07 Michał Górny
2017-02-28 22:07 Michał Górny
2016-11-10 20:25 Zac Medico
2016-06-19 22:17 Zac Medico
2016-06-02 15:48 Zac Medico
2016-03-05 8:21 Zac Medico
2016-01-24 10:33 Zac Medico
2015-09-24 20:30 Zac Medico
2015-05-16 19:14 Zac Medico
2015-05-09 7:33 Zac Medico
2015-05-04 5:15 Zac Medico
2015-05-02 23:11 Zac Medico
2015-04-29 4:20 Zac Medico
2015-04-06 5:07 Zac Medico
2015-04-01 19:16 Zac Medico
2015-03-04 21:37 Zac Medico
2015-03-04 21:37 Zac Medico
2015-03-04 21:37 Zac Medico
2015-02-17 18:31 Zac Medico
2014-12-17 22:13 Zac Medico
2014-12-15 16:28 Arfrever Frehtes Taifersar Arahesis
2014-12-07 23:14 Zac Medico
2014-12-07 23:14 Zac Medico
2014-12-07 23:14 Zac Medico
2014-12-07 0:58 Zac Medico
2014-11-18 3:00 Zac Medico
2014-11-02 18:22 Zac Medico
2014-09-11 23:37 Zac Medico
2014-04-04 23:01 Brian Dolbec
2014-02-24 0:53 Alexander Berntsen
2014-02-07 22:35 Chris Reffett
2014-01-19 8:16 Arfrever Frehtes Taifersar Arahesis
2013-12-05 15:38 Brian Dolbec
2013-09-17 23:32 Zac Medico
2013-08-12 3:23 Zac Medico
2013-08-04 22:09 Zac Medico
2013-07-07 3:23 Zac Medico
2013-06-08 5:48 Zac Medico
2013-06-08 3:00 Zac Medico
2013-06-08 2:49 Zac Medico
2013-06-07 20:52 Arfrever Frehtes Taifersar Arahesis
2013-06-02 22:48 Zac Medico
2013-05-17 2:06 Zac Medico
2013-05-15 7:40 Zac Medico
2013-05-07 3:49 Zac Medico
2013-05-06 8:18 Zac Medico
2013-04-12 17:23 Zac Medico
2013-04-01 17:28 Zac Medico
2013-03-16 5:39 Zac Medico
2013-03-16 5:30 Zac Medico
2013-03-16 1:46 Zac Medico
2013-01-28 21:19 Zac Medico
2013-01-24 18:29 Zac Medico
2013-01-17 14:20 Zac Medico
2013-01-10 14:06 Zac Medico
2013-01-06 20:50 Zac Medico
2013-01-03 22:42 Zac Medico
2012-12-30 9:36 Zac Medico
2012-12-28 22:45 Zac Medico
2012-12-27 3:10 Zac Medico
2012-12-24 21:12 Zac Medico
2012-12-24 21:06 Zac Medico
2012-12-24 20:21 Zac Medico
2012-12-10 8:55 Zac Medico
2012-12-10 8:39 Zac Medico
2012-11-26 3:27 Zac Medico
2012-11-15 0:03 Zac Medico
2012-10-30 23:11 Zac Medico
2012-10-25 19:49 Zac Medico
2012-10-25 15:42 Zac Medico
2012-10-25 15:33 Zac Medico
2012-10-25 15:31 Zac Medico
2012-10-25 9:35 Zac Medico
2012-10-25 9:32 Zac Medico
2012-10-25 8:23 Zac Medico
2012-10-25 6:59 Zac Medico
2012-10-18 3:32 Zac Medico
2012-10-18 0:48 Zac Medico
2012-10-09 2:02 Zac Medico
2012-10-07 22:02 Zac Medico
2012-09-26 3:47 Zac Medico
2012-09-16 21:16 Zac Medico
2012-09-16 21:01 Zac Medico
2012-08-08 20:52 Zac Medico
2012-08-08 20:34 Zac Medico
2012-08-02 20:22 Zac Medico
2012-08-02 0:57 Zac Medico
2012-07-31 23:10 Arfrever Frehtes Taifersar Arahesis
2012-07-12 20:58 Zac Medico
2012-07-05 3:28 Zac Medico
2012-07-02 22:27 Zac Medico
2012-07-02 21:41 Zac Medico
2012-07-01 20:07 Zac Medico
2012-07-01 8:11 Zac Medico
2012-06-24 21:01 Zac Medico
2012-06-24 19:16 Zac Medico
2012-06-23 20:39 Zac Medico
2012-06-23 1:14 Zac Medico
2012-06-15 23:43 Zac Medico
2012-06-12 6:41 Zac Medico
2012-05-17 20:08 Zac Medico
2012-05-14 23:56 Zac Medico
2012-05-14 0:46 Zac Medico
2012-05-14 0:29 Zac Medico
2012-05-09 22:29 Zac Medico
2012-05-05 16:54 Zac Medico
2012-04-22 20:34 Zac Medico
2012-04-18 1:48 Zac Medico
2012-03-23 17:28 Zac Medico
2012-03-18 22:40 Zac Medico
2012-02-23 5:31 Zac Medico
2012-02-23 3:07 Zac Medico
2012-02-15 22:28 Zac Medico
2012-02-15 22:17 Zac Medico
2012-02-11 18:46 Zac Medico
2012-02-09 5:17 Zac Medico
2012-02-09 5:05 Zac Medico
2012-01-27 22:02 Zac Medico
2012-01-11 16:02 Zac Medico
2011-12-22 19:43 Zac Medico
2011-12-22 0:32 Zac Medico
2011-12-22 0:29 Zac Medico
2011-12-21 23:16 Zac Medico
2011-12-21 22:58 Zac Medico
2011-12-20 20:27 Zac Medico
2011-12-10 19:41 Zac Medico
2011-12-10 7:04 Zac Medico
2011-12-01 20:34 Zac Medico
2011-11-27 21:00 Zac Medico
2011-11-26 1:54 Arfrever Frehtes Taifersar Arahesis
2011-10-30 0:00 Zac Medico
2011-10-29 5:35 Zac Medico
2011-10-29 4:17 Zac Medico
2011-10-28 18:03 Zac Medico
2011-10-25 14:52 Zac Medico
2011-10-19 21:19 Zac Medico
2011-10-17 5:21 Zac Medico
2011-10-16 5:59 Zac Medico
2011-10-15 20:29 Zac Medico
2011-10-14 0:24 Zac Medico
2011-10-05 4:27 Zac Medico
2011-10-02 20:02 Zac Medico
2011-09-27 16:46 Zac Medico
2011-09-27 14:58 Zac Medico
2011-09-24 22:24 Zac Medico
2011-09-24 22:03 Zac Medico
2011-09-24 21:44 Zac Medico
2011-09-24 21:32 Zac Medico
2011-09-24 21:18 Zac Medico
2011-09-24 20:47 Zac Medico
2011-09-24 20:15 Zac Medico
2011-09-24 19:50 Zac Medico
2011-09-24 19:27 Zac Medico
2011-09-24 18:29 Zac Medico
2011-09-24 18:13 Zac Medico
2011-09-23 20:50 Zac Medico
2011-09-23 20:01 Zac Medico
2011-09-23 19:53 Zac Medico
2011-09-23 18:19 Zac Medico
2011-09-23 1:48 Zac Medico
2011-09-23 0:53 Zac Medico
2011-09-07 17:36 Zac Medico
2011-09-02 15:08 Zac Medico
2011-09-01 8:43 Zac Medico
2011-09-01 6:46 Zac Medico
2011-08-30 2:09 Zac Medico
2011-08-06 11:10 Zac Medico
2011-08-04 23:09 Zac Medico
2011-08-02 8:56 Zac Medico
2011-08-01 12:32 Zac Medico
2011-07-29 20:27 Zac Medico
2011-07-29 7:22 Zac Medico
2011-07-28 11:29 Zac Medico
2011-07-27 1:51 Zac Medico
2011-07-23 18:47 Zac Medico
2011-07-12 19:50 Zac Medico
2011-07-08 6:46 Zac Medico
2011-07-01 4:02 Zac Medico
2011-06-29 11:37 Zac Medico
2011-06-17 20:57 Zac Medico
2011-06-13 22:14 Zac Medico
2011-06-11 3:41 Zac Medico
2011-06-10 17:20 Zac Medico
2011-06-10 12:21 Zac Medico
2011-06-10 12:04 Zac Medico
2011-06-06 11:52 Zac Medico
2011-06-05 9:18 Zac Medico
2011-06-05 9:01 Zac Medico
2011-06-05 8:55 Zac Medico
2011-06-05 8:14 Zac Medico
2011-06-05 7:23 Zac Medico
2011-06-05 7:10 Zac Medico
2011-06-04 2:13 Zac Medico
2011-06-03 11:20 Zac Medico
2011-06-03 10:16 Zac Medico
2011-06-03 2:38 Zac Medico
2011-05-27 2:38 Zac Medico
2011-05-27 2:15 Zac Medico
2011-05-27 0:01 Zac Medico
2011-05-26 2:34 Zac Medico
2011-05-26 1:39 Zac Medico
2011-05-26 0:57 Zac Medico
2011-05-25 5:10 Zac Medico
2011-05-25 5:02 Zac Medico
2011-05-25 4:37 Zac Medico
2011-05-25 4:08 Zac Medico
2011-05-24 10:40 Zac Medico
2011-05-21 14:23 Zac Medico
2011-05-21 13:15 Zac Medico
2011-05-18 5:38 Zac Medico
2011-05-18 5:27 Zac Medico
2011-05-16 1:26 Zac Medico
2011-05-16 0:22 Zac Medico
2011-05-15 23:20 Zac Medico
2011-05-15 9:32 Zac Medico
2011-05-15 4:32 Zac Medico
2011-05-15 2:55 Zac Medico
2011-05-15 2:44 Zac Medico
2011-05-14 23:55 Zac Medico
2011-05-14 22:56 Arfrever Frehtes Taifersar Arahesis
2011-05-14 22:14 Zac Medico
2011-05-14 21:41 Zac Medico
2011-05-14 21:25 Zac Medico
2011-05-12 19:02 Zac Medico
2011-05-12 17:51 Zac Medico
2011-05-12 7:09 Zac Medico
2011-05-12 5:35 Zac Medico
2011-05-12 1:16 Zac Medico
2011-05-10 19:53 Zac Medico
2011-05-10 5:05 Zac Medico
2011-05-10 4:47 Zac Medico
2011-05-09 20:36 Zac Medico
2011-05-09 6:25 Zac Medico
2011-05-09 4:52 Zac Medico
2011-05-08 20:46 Zac Medico
2011-05-08 20:19 Zac Medico
2011-05-08 19:35 Zac Medico
2011-05-08 7:30 Zac Medico
2011-05-08 4:53 Zac Medico
2011-05-08 4:53 Zac Medico
2011-05-03 3:02 Zac Medico
2011-03-27 22:38 Zac Medico
2011-03-27 21:26 Zac Medico
2011-03-27 20:57 Zac Medico
2011-03-27 6:09 Zac Medico
2011-03-26 23:26 Zac Medico
2011-03-26 18:01 Zac Medico
2011-03-26 8:23 Zac Medico
2011-03-26 2:43 Zac Medico
2011-03-26 2:43 Zac Medico
2011-03-25 20:53 Zac Medico
2011-03-25 10:39 Zac Medico
2011-03-25 10:13 Zac Medico
2011-03-25 9:47 Zac Medico
2011-03-25 8:25 Zac Medico
2011-03-25 8:12 Zac Medico
2011-03-16 20:58 Zac Medico
2011-03-07 17:34 Zac Medico
2011-03-02 19:49 Zac Medico
2011-03-02 18:54 Zac Medico
2011-03-01 21:23 Zac Medico
2011-03-01 21:05 Zac Medico
2011-03-01 20:43 Zac Medico
2011-03-01 20:08 Zac Medico
2011-03-01 18:07 Zac Medico
2011-02-14 4:02 Zac Medico
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=5076fa35cdcba5a092f16c2004e90d4d84c01044.zmedico@gentoo \
--to=zmedico@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