From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 6A5B3138CEE for ; Fri, 26 Jun 2015 22:32:14 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 57328E0871; Fri, 26 Jun 2015 22:32:10 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id DEA7DE084E for ; Fri, 26 Jun 2015 22:32:07 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 4300D340A84 for ; Fri, 26 Jun 2015 22:32:06 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 806BC735 for ; Fri, 26 Jun 2015 22:32:03 +0000 (UTC) From: "Gilles Dartiguelongue" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Gilles Dartiguelongue" Message-ID: <1435236383.9a712ebe4e2495134421a3df88ebe9962b6fa50e.eva@gentoo> Subject: [gentoo-commits] proj/gnome:gen_archlist_cleanup commit in: scripts/ X-VCS-Repository: proj/gnome X-VCS-Files: scripts/gen_archlist.py X-VCS-Directories: scripts/ X-VCS-Committer: eva X-VCS-Committer-Name: Gilles Dartiguelongue X-VCS-Revision: 9a712ebe4e2495134421a3df88ebe9962b6fa50e X-VCS-Branch: gen_archlist_cleanup Date: Fri, 26 Jun 2015 22:32:03 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: a722a9cd-e99b-4bca-93b7-af8f4c4906fa X-Archives-Hash: 4c2740514f5adc4c6e9d5602731f0d3b commit: 9a712ebe4e2495134421a3df88ebe9962b6fa50e Author: Gilles Dartiguelongue gentoo org> AuthorDate: Wed Jun 24 14:39:56 2015 +0000 Commit: Gilles Dartiguelongue gentoo org> CommitDate: Thu Jun 25 12:46:23 2015 +0000 URL: https://gitweb.gentoo.org/proj/gnome.git/commit/?id=9a712ebe scripts/gen_archlist: fix gen_cpv_kws to use arguments from command line * Change the cpv_kw format to a tuple, there is no point in using a list. * Move/edit some lines around to expose logic in a clearer way. * Retrieve arguments from command line. * Add some comments. scripts/gen_archlist.py | 47 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/scripts/gen_archlist.py b/scripts/gen_archlist.py index 15d5b02..6e00ec1 100755 --- a/scripts/gen_archlist.py +++ b/scripts/gen_archlist.py @@ -63,7 +63,6 @@ STABLE = True ############### # Preparation # ############### -ALL_CPV_KWS = [] ARCHES = None if STABLE: @@ -299,10 +298,15 @@ def kws_wanted(current_kws, target_kws): return wanted -def gen_cpv_kws(cpv, kws_aim, depgraph): - depgraph.add(cpv) - cpv_kw_list = [[cpv, kws_wanted(get_kws(cpv, arches=ALL_ARCHES), kws_aim)]] - if not cpv_kw_list[0][1]: +def gen_cpv_kws(cpv, kws_aim, depgraph, check_dependencies, new_release): + """Build a list of CPV-Keywords. + + If `check_dependencies` is True, append dependencies that need to be + updated to the list. + """ + wanted = kws_wanted(get_kws(cpv, arches=ALL_ARCHES), kws_aim) + + if not wanted: # This happens when cpv has less keywords than kws_aim # Usually happens when a dep was an || dep, or under a USE-flag # which is masked in some profiles. We make all deps strict in @@ -313,23 +317,33 @@ def gen_cpv_kws(cpv, kws_aim, depgraph): debug('MEH') nothing_to_be_done(cpv, type='dep') return None + wanted = get_kws(cpv, arches=make_unstable(kws_aim)) - cpv_kw_list = [[cpv, wanted]] - if CHECK_DEPS and not issystempackage(cpv): - deps = get_best_deps(cpv, cpv_kw_list[0][1], release=NEW_REL) + + cpv_kw_list = [(cpv, wanted)] + + if check_dependencies and not issystempackage(cpv): + deps = get_best_deps(cpv, wanted, release=new_release) if EXTREME_DEBUG: debug('The deps of %s are %s' % (cpv, deps)) + for dep in deps: if dep in depgraph: + # XXX: assumes that `kws_aim` of previously added cpv is + # larger than current continue + depgraph.add(dep) - # Assumes that keyword deps are OK if STABLE - dep_deps = gen_cpv_kws(dep, cpv_kw_list[0][1], depgraph) + # XXX: Assumes that dependencies are keyworded the same than cpv + dep_deps = gen_cpv_kws(dep, wanted, depgraph, check_dependencies, + new_release) dep_deps.reverse() - for i in dep_deps: - # Make sure we don't already have the same [cpv, [kws]] - if i not in ALL_CPV_KWS and i not in cpv_kw_list: - cpv_kw_list.append(i) + + for cpv_kw_tuple in dep_deps: + # Make sure we don't already have the same [(cpv, kws)] + if cpv_kw_tuple not in cpv_kw_list: + cpv_kw_list.append(cpv_kw_tuple) + cpv_kw_list.reverse() return cpv_kw_list @@ -533,7 +547,10 @@ def main(): nothing_to_be_done(cpv) continue - ALL_CPV_KWS += fix_nesting(gen_cpv_kws(cpv, kws_missing, set())) + ALL_CPV_KWS += fix_nesting( + gen_cpv_kws(cpv, kws_missing, set([cpv]), + args.check_dependencies, args.new_version) + ) if args.check_dependencies: ALL_CPV_KWS.append(LINE_SEP)