public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eshowkw/
Date: Fri, 26 Jan 2018 23:25:41 +0000 (UTC)	[thread overview]
Message-ID: <1516978250.97595e02fc8eced9a1a54d246a4163fae6badcaf.mgorny@gentoo> (raw)

commit:     97595e02fc8eced9a1a54d246a4163fae6badcaf
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 23 12:30:02 2018 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Jan 26 14:50:50 2018 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=97595e02

eshowkw: Sort pure ~arch arches after stable keyword arches

To match the new ordering on Bugzilla, order arches with pure ~arch
keywords after those having stable keywords. The idea behind it is to
make it easier to determine which arches to CC on stablereqs.

The pure ~arch arch list is hardcoded for now to mips + *-* (fbsd,
prefix). However, in the future it will be replaced by status defined
by arches.desc once that GLEP is finalized.

 pym/gentoolkit/eshowkw/keywords_header.py | 31 +++++++++++++++++++++++++------
 1 file changed, 25 insertions(+), 6 deletions(-)

diff --git a/pym/gentoolkit/eshowkw/keywords_header.py b/pym/gentoolkit/eshowkw/keywords_header.py
index 1a1a422..c9f2381 100644
--- a/pym/gentoolkit/eshowkw/keywords_header.py
+++ b/pym/gentoolkit/eshowkw/keywords_header.py
@@ -15,7 +15,7 @@ from portage.output import colorize
 from gentoolkit.eshowkw.display_pretty import colorize_string
 from gentoolkit.eshowkw.display_pretty import align_string
 
-# Copied from ekeyword
+# Copied from ekeyword, modified to support arch vs ~arch status
 def load_profile_data(portdir=None, repo='gentoo'):
 	"""Load the list of known arches from the tree
 
@@ -25,7 +25,7 @@ def load_profile_data(portdir=None, repo='gentoo'):
 
 	Returns:
 	  A dict mapping the keyword to its preferred state:
-	  {'x86': 'stable', 'mips': 'dev', ...}
+	  {'x86': ('stable', 'arch'), 'mips': ('dev', '~arch'), ...}
 	"""
 	if portdir is None:
 		portdir = portage.db[portage.root]['vartree'].settings.repositories[repo].location
@@ -71,16 +71,28 @@ def load_profile_data(portdir=None, repo='gentoo'):
 		warning('could not read profile files: %s' % arch_list)
 		warning('will not be able to verify args are correct')
 
+	# TODO: support arches.desc once the GLEP is finalized
+	# for now, we just hardcode ~mips + *-* (fbsd, prefix)
+	for k, v in arch_status.items():
+		if k == 'mips' or '-' in k:
+			arch_status[k] = (v, '~arch')
+		else:
+			arch_status[k] = (v, 'arch')
+
 	return arch_status
 
 def gen_arch_list(status):
 	_arch_status = load_profile_data()
 	if status == "stable":
-		return [arch for arch in _arch_status if _arch_status[arch] == "stable"]
+		return [arch for arch in _arch_status if _arch_status[arch][0] == "stable"]
 	elif status == "dev":
-		return [arch for arch in _arch_status if _arch_status[arch] == "dev"]
+		return [arch for arch in _arch_status if _arch_status[arch][0] == "dev"]
 	elif status == "exp":
-		return [arch for arch in _arch_status if _arch_status[arch] == "exp"]
+		return [arch for arch in _arch_status if _arch_status[arch][0] == "exp"]
+	elif status == "arch":
+		return [arch for arch in _arch_status if _arch_status[arch][1] == "arch"]
+	elif status == "~arch":
+		return [arch for arch in _arch_status if _arch_status[arch][1] == "~arch"]
 	else:
 		raise TypeError
 
@@ -88,6 +100,7 @@ class keywords_header:
 	__IMPARCHS = gen_arch_list("stable")
 	__DEV_ARCHS = gen_arch_list("dev")
 	__EXP_ARCHS = gen_arch_list("exp")
+	__TESTING_KW_ARCHS = gen_arch_list("~arch")
 	__ADDITIONAL_FIELDS = [ 'eapi', 'unused', 'slot' ]
 	__EXTRA_FIELDS = [ 'repo' ]
 
@@ -128,7 +141,13 @@ class keywords_header:
 					levels[kw] = level
 					break
 
-		normal.sort(key=lambda kw: (levels.get(kw, 99), kw.count('-'), kw))
+		# sort by, in order (to match Bugzilla):
+		# 1. arch, then ~arch
+		# 2. profile stability
+		# 3. short keywords, then long (prefix, fbsd)
+		# 4. keyword name
+		normal.sort(key=lambda kw: (kw in self.__TESTING_KW_ARCHS,
+			levels.get(kw, 99), kw.count('-'), kw))
 		return normal
 
 	def __readAdditionalFields(self):


             reply	other threads:[~2018-01-26 23:25 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-26 23:25 Michał Górny [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-07-09  1:49 [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eshowkw/ Mike Gilbert
2022-06-08 20:11 Brian Dolbec
2022-06-08  1:19 Brian Dolbec
2022-06-08  0:12 Brian Dolbec
2020-01-26 15:20 Michał Górny
2019-05-11 20:26 Michał Górny
2018-01-26 23:25 Michał Górny
2018-01-26 23:25 Michał Górny
2018-01-26 23:25 Michał Górny
2018-01-26 23:25 Michał Górny
2018-01-26 23:25 Michał Górny
2018-01-26 23:25 Michał Górny
2018-01-26 23:25 Michał Górny
2016-11-23 23:26 Zac Medico
2016-07-03 17:59 Zac Medico
2016-07-03 17:53 Zac Medico
2016-07-03  4:23 Zac Medico
2016-04-06 17:25 Paul Varner
2016-03-31 22:10 Paul Varner
2016-03-17 21:39 Dirkjan Ochtman
2015-11-19 11:59 Justin Lecher
2015-11-17 10:19 Justin Lecher

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=1516978250.97595e02fc8eced9a1a54d246a4163fae6badcaf.mgorny@gentoo \
    --to=mgorny@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