From: "Gilles Dartiguelongue" <eva@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gnome:gen_archlist_cleanup commit in: scripts/
Date: Fri, 26 Jun 2015 22:32:03 +0000 (UTC) [thread overview]
Message-ID: <1435236379.813f7fbce53580a4e7302f9d4ce6f40e5410d965.eva@gentoo> (raw)
commit: 813f7fbce53580a4e7302f9d4ce6f40e5410d965
Author: Gilles Dartiguelongue <eva <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 24 13:17:47 2015 +0000
Commit: Gilles Dartiguelongue <eva <AT> gentoo <DOT> org>
CommitDate: Thu Jun 25 12:46:19 2015 +0000
URL: https://gitweb.gentoo.org/proj/gnome.git/commit/?id=813f7fbc
scripts/gen_archlist: rewrite max_kws logic
Not sure if everything is still the same but it got more comments and
looks easier to read.
scripts/gen_archlist.py | 53 +++++++++++++++++++++++++++++--------------------
1 file changed, 32 insertions(+), 21 deletions(-)
diff --git a/scripts/gen_archlist.py b/scripts/gen_archlist.py
index 9b60f03..15d5b02 100755
--- a/scripts/gen_archlist.py
+++ b/scripts/gen_archlist.py
@@ -248,8 +248,9 @@ def get_best_deps(cpv, kws, release=None):
def max_kws(cpv, release=None):
- """
- Given a cpv, find the intersection of "most keywords it can have" and
+ """Build `cpv` maximum expected keyword coverage.
+
+ Find the intersection of "most keywords it can have" and
"keywords it has", and returns a sorted list
If STABLE; makes sure it has unstable keywords right now
@@ -257,21 +258,29 @@ def max_kws(cpv, release=None):
Returns [] if current cpv has best keywords
Returns None if no cpv has keywords
"""
- current_kws = get_kws(cpv, arches=ALL_ARCHES)
- maximum_kws = [] # Maximum keywords that a cpv has
- missing_kws = []
- for atom in match_wanted_atoms('<='+cpv, release):
+ current_kws = set(get_kws(cpv, arches=ALL_ARCHES))
+ maximum_kws = set() # Maximum keywords that a cpv has
+ missing_kws = set()
+
+ # Build best keyword coverage for `cpv`
+ for atom in match_wanted_atoms('<=' + cpv, release):
kws = get_kws(atom)
- if len(kws) > len(maximum_kws):
- maximum_kws = kws
- for kw in kws:
- if kw not in missing_kws+current_kws:
- if STABLE and '~'+kw not in current_kws:
- continue
- missing_kws.append(kw)
- missing_kws.sort()
- if maximum_kws != []:
- return missing_kws
+
+ # Consider stable keywords only
+ if STABLE:
+ kws = [kwd for kwd in kws if not kwd.startswith('~')]
+
+ maximum_kws.update(set(kws))
+
+ # Build list of keywords missing to achieve best coverage
+ for kwd in maximum_kws:
+ # Skip stable keywords with no corresponding unstable keyword in `cpv`
+ if STABLE and '~' + kwd not in current_kws:
+ continue
+ missing_kws.add(kwd)
+
+ if maximum_kws:
+ return sorted(missing_kws)
else:
# No cpv has the keywords we need
return None
@@ -513,15 +522,17 @@ def main():
continue
kws_missing = max_kws(cpv, release=args.old_version)
- if kws_missing == []:
- # Current cpv has the max keywords => nothing to do
- nothing_to_be_done(cpv)
- continue
- elif kws_missing is None:
+ if kws_missing is None:
debug('No versions with stable keywords for %s' % cpv)
# No cpv with stable keywords => select latest
arches = make_unstable(ARCHES)
kws_missing = [kw[1:] for kw in get_kws(cpv, arches)]
+
+ elif not kws_missing:
+ # Current cpv has the max keywords => nothing to do
+ nothing_to_be_done(cpv)
+ continue
+
ALL_CPV_KWS += fix_nesting(gen_cpv_kws(cpv, kws_missing, set()))
if args.check_dependencies:
ALL_CPV_KWS.append(LINE_SEP)
next reply other threads:[~2015-06-26 22:32 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-26 22:32 Gilles Dartiguelongue [this message]
-- strict thread matches above, loose matches on Subject: below --
2015-09-06 16:53 [gentoo-commits] proj/gnome:gen_archlist_cleanup commit in: scripts/ Gilles Dartiguelongue
2015-06-26 22:32 Gilles Dartiguelongue
2015-06-26 22:32 Gilles Dartiguelongue
2015-06-26 22:32 Gilles Dartiguelongue
2015-06-26 22:32 Gilles Dartiguelongue
2015-06-26 22:32 Gilles Dartiguelongue
2015-06-26 22:32 Gilles Dartiguelongue
2015-06-26 22:32 Gilles Dartiguelongue
2015-06-26 22:32 Gilles Dartiguelongue
2015-06-26 22:32 Gilles Dartiguelongue
2015-06-26 22:32 Gilles Dartiguelongue
2015-06-26 22:32 Gilles Dartiguelongue
2015-06-26 22:32 Gilles Dartiguelongue
2015-06-26 22:32 Gilles Dartiguelongue
2015-06-26 22:32 Gilles Dartiguelongue
2015-06-26 22:32 Gilles Dartiguelongue
2015-06-26 22:32 Gilles Dartiguelongue
2015-06-26 22:32 Gilles Dartiguelongue
2015-06-26 22:32 Gilles Dartiguelongue
2015-06-26 22:32 Gilles Dartiguelongue
2015-06-26 22:32 Gilles Dartiguelongue
2015-06-24 12:14 Gilles Dartiguelongue
2015-06-24 12:14 Gilles Dartiguelongue
2015-06-24 12:14 Gilles Dartiguelongue
2015-06-24 12:14 Gilles Dartiguelongue
2015-06-24 12:14 Gilles Dartiguelongue
2015-06-24 12:14 Gilles Dartiguelongue
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=1435236379.813f7fbce53580a4e7302f9d4ce6f40e5410d965.eva@gentoo \
--to=eva@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