public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eshowkw/
@ 2022-06-08  1:19 Brian Dolbec
  0 siblings, 0 replies; 23+ messages in thread
From: Brian Dolbec @ 2022-06-08  1:19 UTC (permalink / raw
  To: gentoo-commits

commit:     4695379c1921865d7763669580ac909ea94db90d
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Wed Jun  8 01:16:13 2022 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Wed Jun  8 01:16:13 2022 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=4695379c

eshowkw: Correctly fix row alignment issue bug 503366

Reverts: 42cf522c06080d
Changes the content_length correctly for versionlist output

Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/gentoolkit/eshowkw/__init__.py       | 2 +-
 pym/gentoolkit/eshowkw/display_pretty.py | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/pym/gentoolkit/eshowkw/__init__.py b/pym/gentoolkit/eshowkw/__init__.py
index ba6c076..c33c47a 100644
--- a/pym/gentoolkit/eshowkw/__init__.py
+++ b/pym/gentoolkit/eshowkw/__init__.py
@@ -49,7 +49,7 @@ def process_display(package, keywords, dbapi):
         content.extend(sep)
         content.extend(keywords.extra)
         header_length = keywords.length
-        content_length = portdata.version_length
+        content_length = portdata.version_length - 1
     display(content, header, header_length, content_length, portdata.cp, topper)
 
 

diff --git a/pym/gentoolkit/eshowkw/display_pretty.py b/pym/gentoolkit/eshowkw/display_pretty.py
index 47d18d1..0629d7e 100644
--- a/pym/gentoolkit/eshowkw/display_pretty.py
+++ b/pym/gentoolkit/eshowkw/display_pretty.py
@@ -29,8 +29,7 @@ def display(
     # data
     corner_image = ["".ljust(plain_width) for x in range(rotated_height)]
     if toplist != "archlist":
-        # DON'T add the first list item which is: "-------", it will throw the row alignment off
-        corner_image.extend(plain_list[1:])
+        corner_image.extend(plain_list)
     data_printout = [
         "%s%s" % (x, y)
         for x, y in zip_longest(corner_image, rotated_list, fillvalue=corner_image[0])


^ permalink raw reply related	[flat|nested] 23+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eshowkw/
@ 2022-07-09  1:49 Mike Gilbert
  0 siblings, 0 replies; 23+ messages in thread
From: Mike Gilbert @ 2022-07-09  1:49 UTC (permalink / raw
  To: gentoo-commits

commit:     707b0340d69da92d6e3c72892c190a1e3fd0c2e1
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Sat Jul  9 01:35:41 2022 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Sat Jul  9 01:35:41 2022 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=707b0340

eshowkw: make black happy

Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 pym/gentoolkit/eshowkw/display_pretty.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/gentoolkit/eshowkw/display_pretty.py b/pym/gentoolkit/eshowkw/display_pretty.py
index 82fd446..9a769f9 100644
--- a/pym/gentoolkit/eshowkw/display_pretty.py
+++ b/pym/gentoolkit/eshowkw/display_pretty.py
@@ -125,6 +125,6 @@ class string_rotator:
             if x.find("+ -") != -1:
                 x = x.replace(" ", "-")
             # strip all chars and remove empty lines
-            if not strip or len(x.strip(" |-")) > 0 or '-' in x:
+            if not strip or len(x.strip(" |-")) > 0 or "-" in x:
                 tmp.append(x)
         return tmp


^ permalink raw reply related	[flat|nested] 23+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eshowkw/
@ 2022-06-08 20:11 Brian Dolbec
  0 siblings, 0 replies; 23+ messages in thread
From: Brian Dolbec @ 2022-06-08 20:11 UTC (permalink / raw
  To: gentoo-commits

commit:     84fc1ec271328e064da8b2537112b724e5a4c3b5
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Wed Jun  8 20:06:01 2022 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Wed Jun  8 20:06:01 2022 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=84fc1ec2

eshowkw: Fix missing dash for -r? ebuilds in versionlist output

Turns out the real issue causing the row alignment issue was this.
The code inadvertently dropped the dash display which in turn caused the
 row alignment issue.

 Reverts: 4695379c1921865d7763669580ac909ea94db90d
 Gentoo-bug-url: https://bugs.gentoo.org/503366

Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/gentoolkit/eshowkw/__init__.py       | 2 +-
 pym/gentoolkit/eshowkw/display_pretty.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/pym/gentoolkit/eshowkw/__init__.py b/pym/gentoolkit/eshowkw/__init__.py
index c33c47a..ba6c076 100644
--- a/pym/gentoolkit/eshowkw/__init__.py
+++ b/pym/gentoolkit/eshowkw/__init__.py
@@ -49,7 +49,7 @@ def process_display(package, keywords, dbapi):
         content.extend(sep)
         content.extend(keywords.extra)
         header_length = keywords.length
-        content_length = portdata.version_length - 1
+        content_length = portdata.version_length
     display(content, header, header_length, content_length, portdata.cp, topper)
 
 

diff --git a/pym/gentoolkit/eshowkw/display_pretty.py b/pym/gentoolkit/eshowkw/display_pretty.py
index 0629d7e..82fd446 100644
--- a/pym/gentoolkit/eshowkw/display_pretty.py
+++ b/pym/gentoolkit/eshowkw/display_pretty.py
@@ -125,6 +125,6 @@ class string_rotator:
             if x.find("+ -") != -1:
                 x = x.replace(" ", "-")
             # strip all chars and remove empty lines
-            if not strip or len(x.strip(" |-")) > 0:
+            if not strip or len(x.strip(" |-")) > 0 or '-' in x:
                 tmp.append(x)
         return tmp


^ permalink raw reply related	[flat|nested] 23+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eshowkw/
@ 2022-06-08  0:12 Brian Dolbec
  0 siblings, 0 replies; 23+ messages in thread
From: Brian Dolbec @ 2022-06-08  0:12 UTC (permalink / raw
  To: gentoo-commits

commit:     42cf522c06080d3b92d7c87d3e00d93d3a7e1a7f
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  7 23:55:35 2022 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Wed Jun  8 00:09:54 2022 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=42cf522c

eshowkw: Fix bug 503366 row alignment issue

The first element in the plain_list was a "------" string.  This was causing
the corner image to throw off the row alignment between the two columns.
This fix corrects the alignment, but removes the "------" above the keywords
to complete the header seperator line.

Gentoo-bug-url: https://bugs.gentoo.org/503366

Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/gentoolkit/eshowkw/display_pretty.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/pym/gentoolkit/eshowkw/display_pretty.py b/pym/gentoolkit/eshowkw/display_pretty.py
index d58036a..47d18d1 100644
--- a/pym/gentoolkit/eshowkw/display_pretty.py
+++ b/pym/gentoolkit/eshowkw/display_pretty.py
@@ -1,4 +1,4 @@
-# 	vim:fileencoding=utf-8
+#   vim:fileencoding=utf-8
 # Copyright 2010 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
@@ -29,7 +29,8 @@ def display(
     # data
     corner_image = ["".ljust(plain_width) for x in range(rotated_height)]
     if toplist != "archlist":
-        corner_image.extend(plain_list)
+        # DON'T add the first list item which is: "-------", it will throw the row alignment off
+        corner_image.extend(plain_list[1:])
     data_printout = [
         "%s%s" % (x, y)
         for x, y in zip_longest(corner_image, rotated_list, fillvalue=corner_image[0])


^ permalink raw reply related	[flat|nested] 23+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eshowkw/
@ 2020-01-26 15:20 Michał Górny
  0 siblings, 0 replies; 23+ messages in thread
From: Michał Górny @ 2020-01-26 15:20 UTC (permalink / raw
  To: gentoo-commits

commit:     e98fd5881b7248670cb9c8a4daff537551e1d55e
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 26 14:59:20 2020 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Jan 26 14:59:32 2020 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=e98fd588

eshowkw: Add alpha to ~arch-only

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 pym/gentoolkit/eshowkw/keywords_header.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/gentoolkit/eshowkw/keywords_header.py b/pym/gentoolkit/eshowkw/keywords_header.py
index c17a777..f98f11a 100644
--- a/pym/gentoolkit/eshowkw/keywords_header.py
+++ b/pym/gentoolkit/eshowkw/keywords_header.py
@@ -81,7 +81,7 @@ def load_profile_data(portdir=None, repo='gentoo'):
 	# 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 in ('mips', 'riscv') or '-' in k:
+		if k in ('alpha', 'mips', 'riscv') or '-' in k:
 			arch_status[k] = (v, '~arch')
 		else:
 			arch_status[k] = (v, 'arch')


^ permalink raw reply related	[flat|nested] 23+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eshowkw/
@ 2019-05-11 20:26 Michał Górny
  0 siblings, 0 replies; 23+ messages in thread
From: Michał Górny @ 2019-05-11 20:26 UTC (permalink / raw
  To: gentoo-commits

commit:     31a8a27b0851c783bb7ec82d14435e5d7d0faf49
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat May 11 20:24:26 2019 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat May 11 20:24:26 2019 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=31a8a27b

eshowkw: Add riscv to ~arch-only arches

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 pym/gentoolkit/eshowkw/keywords_header.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/gentoolkit/eshowkw/keywords_header.py b/pym/gentoolkit/eshowkw/keywords_header.py
index ab9117e..c17a777 100644
--- a/pym/gentoolkit/eshowkw/keywords_header.py
+++ b/pym/gentoolkit/eshowkw/keywords_header.py
@@ -81,7 +81,7 @@ def load_profile_data(portdir=None, repo='gentoo'):
 	# 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:
+		if k in ('mips', 'riscv') or '-' in k:
 			arch_status[k] = (v, '~arch')
 		else:
 			arch_status[k] = (v, 'arch')


^ permalink raw reply related	[flat|nested] 23+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eshowkw/
@ 2018-01-26 23:25 Michał Górny
  0 siblings, 0 replies; 23+ messages in thread
From: Michał Górny @ 2018-01-26 23:25 UTC (permalink / raw
  To: gentoo-commits

commit:     ed4a76633d69d6312b8572bc16cc758cbc36b94e
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 23 12:12:59 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=ed4a7663

eshowkw: Stop wrongly classifying *-fbsd as Prefix

 pym/gentoolkit/eshowkw/keywords_header.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/pym/gentoolkit/eshowkw/keywords_header.py b/pym/gentoolkit/eshowkw/keywords_header.py
index 9b00d17..86e9bc5 100644
--- a/pym/gentoolkit/eshowkw/keywords_header.py
+++ b/pym/gentoolkit/eshowkw/keywords_header.py
@@ -99,7 +99,9 @@ class keywords_header:
 
 	@staticmethod
 	def __isPrefix(k):
-		return len(k.split('-')) != 1
+		spl = k.split('-')
+		# *-fbsd are not prefix
+		return len(spl) > 1 and spl[1] != 'fbsd'
 
 	def __sortKeywords(self, keywords, prefix = False, required_keywords = []):
 		"""Sort keywords: order by status (IMP, then DEV, then EXP, then


^ permalink raw reply related	[flat|nested] 23+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eshowkw/
@ 2018-01-26 23:25 Michał Górny
  0 siblings, 0 replies; 23+ messages in thread
From: Michał Górny @ 2018-01-26 23:25 UTC (permalink / raw
  To: gentoo-commits

commit:     76eadba35e05de28ba52ea3f48b9651702ae293e
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 23 12:16:44 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=76eadba3

eshowkw: Remove meaningless duplicate sort of Prefix keywords

 pym/gentoolkit/eshowkw/keywords_header.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/pym/gentoolkit/eshowkw/keywords_header.py b/pym/gentoolkit/eshowkw/keywords_header.py
index 9eedbcf..a4934bc 100644
--- a/pym/gentoolkit/eshowkw/keywords_header.py
+++ b/pym/gentoolkit/eshowkw/keywords_header.py
@@ -118,7 +118,6 @@ class keywords_header:
 		normal = [k for k in keywords if not self.__isPrefix(k)]
 		if prefix:
 			longer = [k for k in keywords if self.__isPrefix(k)]
-			longer.sort()
 			normal.extend(longer)
 
 		lists = self.__IMPARCHS, self.__DEV_ARCHS, self.__EXP_ARCHS


^ permalink raw reply related	[flat|nested] 23+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eshowkw/
@ 2018-01-26 23:25 Michał Górny
  0 siblings, 0 replies; 23+ messages in thread
From: Michał Górny @ 2018-01-26 23:25 UTC (permalink / raw
  To: gentoo-commits

commit:     ba6be5523dfd11bd675be2d705d0f6ba3dec3a0c
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 23 12:14:29 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=ba6be552

eshowkw: Sort all multi-component keywords after normal

Add component count (implied by the count of '-' separators) to sort
criteria. This ensures that *-fbsd sorts after regular arches, much like
we list it in Bugzilla.

 pym/gentoolkit/eshowkw/keywords_header.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/gentoolkit/eshowkw/keywords_header.py b/pym/gentoolkit/eshowkw/keywords_header.py
index 86e9bc5..9eedbcf 100644
--- a/pym/gentoolkit/eshowkw/keywords_header.py
+++ b/pym/gentoolkit/eshowkw/keywords_header.py
@@ -129,7 +129,7 @@ class keywords_header:
 					levels[kw] = level
 					break
 
-		normal.sort(key=lambda kw: (levels.get(kw, 99), kw))
+		normal.sort(key=lambda kw: (levels.get(kw, 99), kw.count('-'), kw))
 		return normal
 
 	def __readAdditionalFields(self):


^ permalink raw reply related	[flat|nested] 23+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eshowkw/
@ 2018-01-26 23:25 Michał Górny
  0 siblings, 0 replies; 23+ messages in thread
From: Michał Górny @ 2018-01-26 23:25 UTC (permalink / raw
  To: gentoo-commits

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


^ permalink raw reply related	[flat|nested] 23+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eshowkw/
@ 2018-01-26 23:25 Michał Górny
  0 siblings, 0 replies; 23+ messages in thread
From: Michał Górny @ 2018-01-26 23:25 UTC (permalink / raw
  To: gentoo-commits

commit:     1a7f870b68741331f69b07e8227685e70c964202
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 23 12:11:13 2018 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Jan 26 14:50:47 2018 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=1a7f870b

eshowkw: Split Prefix keyword test into separate function

 pym/gentoolkit/eshowkw/keywords_header.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/pym/gentoolkit/eshowkw/keywords_header.py b/pym/gentoolkit/eshowkw/keywords_header.py
index 9c6538c..9b00d17 100644
--- a/pym/gentoolkit/eshowkw/keywords_header.py
+++ b/pym/gentoolkit/eshowkw/keywords_header.py
@@ -1,5 +1,5 @@
 #	vim:fileencoding=utf-8
-# Copyright 2001-2010 Gentoo Foundation
+# Copyright 2001-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 __all__ = ['keywords_header']
@@ -97,6 +97,10 @@ class keywords_header:
 		return [x for x in ports.archlist()
 			if not x.startswith('~')]
 
+	@staticmethod
+	def __isPrefix(k):
+		return len(k.split('-')) != 1
+
 	def __sortKeywords(self, keywords, prefix = False, required_keywords = []):
 		"""Sort keywords: order by status (IMP, then DEV, then EXP, then
 		prefix), then by name."""
@@ -109,10 +113,9 @@ class keywords_header:
 			if len(tmpkeywords) != 0:
 				keywords = tmpkeywords
 
-		normal = [k for k in keywords if len(k.split('-')) == 1]
+		normal = [k for k in keywords if not self.__isPrefix(k)]
 		if prefix:
-			longer = [k for k in keywords
-				if len(k.split('-')) != 1]
+			longer = [k for k in keywords if self.__isPrefix(k)]
 			longer.sort()
 			normal.extend(longer)
 


^ permalink raw reply related	[flat|nested] 23+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eshowkw/
@ 2018-01-26 23:25 Michał Górny
  0 siblings, 0 replies; 23+ messages in thread
From: Michał Górny @ 2018-01-26 23:25 UTC (permalink / raw
  To: gentoo-commits

commit:     70b2518f12f63071f0192c23826188bd456698e7
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 23 21:42:19 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=70b2518f

eshowkw: Always group Prefix keywords last

Always group all Prefix keywords after other types of keywords. This
not only ensures that fbsd sorts first but more importantly stabilizes
the LHS output between regular and -P variant -- that is, -P always adds
additional keywords at the end.

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

diff --git a/pym/gentoolkit/eshowkw/keywords_header.py b/pym/gentoolkit/eshowkw/keywords_header.py
index ce3e8d4..6557f60 100644
--- a/pym/gentoolkit/eshowkw/keywords_header.py
+++ b/pym/gentoolkit/eshowkw/keywords_header.py
@@ -142,12 +142,16 @@ class keywords_header:
 					break
 
 		# sort by, in order (to match Bugzilla):
-		# 1. arch, then ~arch
-		# 2. profile stability
-		# 3. short keywords, then long (prefix, fbsd)
-		# 4. keyword name in reverse component order
-		normal.sort(key=lambda kw: (kw in self.__TESTING_KW_ARCHS,
-			levels.get(kw, 99), kw.count('-'), list(reversed(kw.split('-')))))
+		# 1. non-prefix, then prefix (stable output between -P and not)
+		# 2. arch, then ~arch
+		# 3. profile stability
+		# 4. short keywords, then long (prefix, fbsd)
+		# 5. keyword name in reverse component order
+		normal.sort(key=lambda kw: (self.__isPrefix(kw),
+			kw in self.__TESTING_KW_ARCHS,
+			levels.get(kw, 99),
+			kw.count('-'),
+			list(reversed(kw.split('-')))))
 		return normal
 
 	def __readAdditionalFields(self):


^ permalink raw reply related	[flat|nested] 23+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eshowkw/
@ 2018-01-26 23:25 Michał Górny
  0 siblings, 0 replies; 23+ messages in thread
From: Michał Górny @ 2018-01-26 23:25 UTC (permalink / raw
  To: gentoo-commits

commit:     9dce326531f94f2f34865efce6eb7f0f5060d016
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 23 12:19:52 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=9dce3265

eshowkw: Group stable and dev arches together (to match Bugzilla)

Since dev profile status implies working towards stable status, and we
are currently working on improving the status of dev arches
(in particular preventing new depgraph breakages from being committed),
we have switched Bugzilla to display both statuses alongside. Update
eshowkw to use the same output ordering.

 pym/gentoolkit/eshowkw/keywords_header.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/gentoolkit/eshowkw/keywords_header.py b/pym/gentoolkit/eshowkw/keywords_header.py
index a4934bc..1a1a422 100644
--- a/pym/gentoolkit/eshowkw/keywords_header.py
+++ b/pym/gentoolkit/eshowkw/keywords_header.py
@@ -120,7 +120,7 @@ class keywords_header:
 			longer = [k for k in keywords if self.__isPrefix(k)]
 			normal.extend(longer)
 
-		lists = self.__IMPARCHS, self.__DEV_ARCHS, self.__EXP_ARCHS
+		lists = (self.__IMPARCHS + self.__DEV_ARCHS), self.__EXP_ARCHS
 		levels = {}
 		for kw in normal:
 			for level, ls in enumerate(lists):


^ permalink raw reply related	[flat|nested] 23+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eshowkw/
@ 2018-01-26 23:25 Michał Górny
  0 siblings, 0 replies; 23+ messages in thread
From: Michał Górny @ 2018-01-26 23:25 UTC (permalink / raw
  To: gentoo-commits

commit:     6013556194c0af9cb5a61d9ffb9879c31c4669e9
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 23 21:38:46 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=60135561

eshowkw: Group Prefix keywords by system

Sort keywords by reversed component list rather than combined name,
in order to group Prefix keywords by system. Requested by Ulrich Müller.

 pym/gentoolkit/eshowkw/keywords_header.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pym/gentoolkit/eshowkw/keywords_header.py b/pym/gentoolkit/eshowkw/keywords_header.py
index c9f2381..ce3e8d4 100644
--- a/pym/gentoolkit/eshowkw/keywords_header.py
+++ b/pym/gentoolkit/eshowkw/keywords_header.py
@@ -145,9 +145,9 @@ class keywords_header:
 		# 1. arch, then ~arch
 		# 2. profile stability
 		# 3. short keywords, then long (prefix, fbsd)
-		# 4. keyword name
+		# 4. keyword name in reverse component order
 		normal.sort(key=lambda kw: (kw in self.__TESTING_KW_ARCHS,
-			levels.get(kw, 99), kw.count('-'), kw))
+			levels.get(kw, 99), kw.count('-'), list(reversed(kw.split('-')))))
 		return normal
 
 	def __readAdditionalFields(self):


^ permalink raw reply related	[flat|nested] 23+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eshowkw/
@ 2016-11-23 23:26 Zac Medico
  0 siblings, 0 replies; 23+ messages in thread
From: Zac Medico @ 2016-11-23 23:26 UTC (permalink / raw
  To: gentoo-commits

commit:     b4c059f6908965981816134d97d68e528ecbe75e
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 22 17:45:28 2016 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Nov 23 23:24:09 2016 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=b4c059f6

eshowkw: distinguish repository of installed package (bug 600486)

X-Gentoo-bug: 600486
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=600486
Acked-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/gentoolkit/eshowkw/keywords_content.py | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/pym/gentoolkit/eshowkw/keywords_content.py b/pym/gentoolkit/eshowkw/keywords_content.py
index b6ad118..18926b4 100644
--- a/pym/gentoolkit/eshowkw/keywords_content.py
+++ b/pym/gentoolkit/eshowkw/keywords_content.py
@@ -101,21 +101,21 @@ class keywords_content:
 	class VersionChecker:
 		def __getVersions(self, packages):
 			"""Obtain properly aligned version strings without colors."""
-			revlength = max([len(self.__getRevision(x)) for x in packages])
-			return  [self.__separateVersion(x, revlength) for x in packages]
+			revlength = max([len(self.__getRevision(x)) for x, repo in packages])
+			return  [self.__separateVersion(x, repo, revlength) for x, repo in packages]
 
 		def __getRevision(self, cpv):
 			"""Get revision informations for each package for nice further alignment"""
 			rev = port.catpkgsplit(cpv)[3]
 			return rev if rev != 'r0' else ''
 
-		def __separateVersion(self, cpv, revlength):
-			return self.__modifyVersionInfo(cpv, port.versions.cpv_getversion(cpv), revlength)
+		def __separateVersion(self, cpv, repo, revlength):
+			return self.__modifyVersionInfo(cpv, repo, port.versions.cpv_getversion(cpv), revlength)
 
-		def __modifyVersionInfo(self, cpv, pv, revlength):
+		def __modifyVersionInfo(self, cpv, repo, pv, revlength):
 			"""Prefix and suffix version with string based on whether version is installed or masked and its revision."""
 			mask = self.__getMaskStatus(cpv)
-			install = self.__getInstallStatus(cpv)
+			install = self.__getInstallStatus(cpv, repo)
 
 			# calculate suffix length
 			currevlen = len(self.__getRevision(cpv))
@@ -149,9 +149,9 @@ class keywords_content:
 			return False
 
 
-		def __getInstallStatus(self, cpv):
+		def __getInstallStatus(self, cpv, repo):
 			"""Check if package version we test is installed."""
-			return self.vartree.cpv_exists(cpv)
+			return bool(self.vartree.match("=%s::%s" % (cpv, repo)))
 
 		def __init__(self, packages):
 			"""Query all relevant data for version data formatting"""
@@ -344,7 +344,7 @@ class keywords_content:
 		self.slot_length = max([len(x) for x in self.slots])
 		repositories_length = max([len(x) for x in self.repositories])
 		self.keyword_length = len(keywords_list)
-		vers =self.VersionChecker(packages)
+		vers =self.VersionChecker(list(zip(packages, self.repositories)))
 		self.versions = vers.versions
 		masks = vers.masks
 		self.version_length = max([len(x) for x in self.versions])


^ permalink raw reply related	[flat|nested] 23+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eshowkw/
@ 2016-07-03 17:59 Zac Medico
  0 siblings, 0 replies; 23+ messages in thread
From: Zac Medico @ 2016-07-03 17:59 UTC (permalink / raw
  To: gentoo-commits

commit:     bb6912e1264137a3ba52d4fdc491ab26b2644a07
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Jul  3 17:55:43 2016 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Jul  3 17:59:13 2016 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=bb6912e1

eshowkw: remove unused portage.db import

 pym/gentoolkit/eshowkw/__init__.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/pym/gentoolkit/eshowkw/__init__.py b/pym/gentoolkit/eshowkw/__init__.py
index 42a3860..707c266 100644
--- a/pym/gentoolkit/eshowkw/__init__.py
+++ b/pym/gentoolkit/eshowkw/__init__.py
@@ -12,7 +12,6 @@ from portage import output as porto
 from portage import settings as ports
 from portage import config as portc
 from portage import portdbapi as portdbapi
-from portage import db as portdb
 
 from gentoolkit.eshowkw.keywords_header import keywords_header
 from gentoolkit.eshowkw.keywords_content import keywords_content


^ permalink raw reply related	[flat|nested] 23+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eshowkw/
@ 2016-07-03 17:53 Zac Medico
  0 siblings, 0 replies; 23+ messages in thread
From: Zac Medico @ 2016-07-03 17:53 UTC (permalink / raw
  To: gentoo-commits

commit:     84aa6c743581222a3f4a8a855dbcb77a2774c5b6
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Jul  3 06:08:13 2016 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Jul  3 17:50:27 2016 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=84aa6c74

eshowkw: migrate to PORTAGE_REPOSITORIES (bug 587856)

Since PORTDIR_OVERLAY is deprecated, migrate to PORTAGE_REPOSITORIES.

X-Gentoo-bug: 587856
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=587856

 pym/gentoolkit/eshowkw/__init__.py | 32 +++++++++++++++++++++++++++-----
 1 file changed, 27 insertions(+), 5 deletions(-)

diff --git a/pym/gentoolkit/eshowkw/__init__.py b/pym/gentoolkit/eshowkw/__init__.py
index ded166d..42a3860 100644
--- a/pym/gentoolkit/eshowkw/__init__.py
+++ b/pym/gentoolkit/eshowkw/__init__.py
@@ -1,5 +1,5 @@
 #	vim:fileencoding=utf-8
-# Copyright 2010 Gentoo Foundation
+# Copyright 2010-2016 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 __package__ = 'gentoolkit.eshowkw'
@@ -122,10 +122,32 @@ def main(argv, indirect = False):
 			msg_err = 'No ebuilds at "%s"' % currdir
 			raise SystemExit(msg_err)
 		package= '%s/%s' % (os.path.basename(os.path.abspath('../')), os.path.basename(currdir))
-		ourtree = os.path.abspath('../../')
-		overlays = '%s %s' % (ports['PORTDIR_OVERLAY'], ourtree)
-		mysettings = portc(local_config=False, env={'PORTDIR_OVERLAY': overlays})
-		dbapi = portdbapi(mysettings=mysettings)
+		ourtree = os.path.realpath('../..')
+		ourstat = os.stat(ourtree)
+		ourstat = (ourstat.st_ino, ourstat.st_dev)
+		for repo in ports.repositories:
+			try:
+				repostat = os.stat(repo.location)
+			except OSError:
+				continue
+			if ourstat == (repostat.st_ino, repostat.st_dev):
+				dbapi = portdbapi(mysettings=portc(local_config=False))
+				break
+		else:
+			repos = {}
+			for repo in ports.repositories:
+				repos[repo.name] = repo.location
+
+			with open(os.path.join(ourtree, 'profiles', 'repo_name'),
+				'rt') as f:
+				repo_name = f.readline().strip()
+
+			repos[repo_name] = ourtree
+			repos = ''.join('[{}]\nlocation={}\n'.format(k, v)
+				for k, v in repos.items())
+			mysettings = portc(local_config=False,
+				env={'PORTAGE_REPOSITORIES': repos})
+			dbapi = portdbapi(mysettings=mysettings)
 		# specify that we want just our nice tree we are in cwd
 		dbapi.porttrees = [ourtree]
 		process_display(package, keywords, dbapi)


^ permalink raw reply related	[flat|nested] 23+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eshowkw/
@ 2016-07-03  4:23 Zac Medico
  0 siblings, 0 replies; 23+ messages in thread
From: Zac Medico @ 2016-07-03  4:23 UTC (permalink / raw
  To: gentoo-commits

commit:     a1262c6ff59120b4fd089275006148accfa078de
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Jul  3 04:21:37 2016 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Jul  3 04:23:21 2016 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=a1262c6f

eshowkw: use portage.root for prefix support

 pym/gentoolkit/eshowkw/keywords_header.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/gentoolkit/eshowkw/keywords_header.py b/pym/gentoolkit/eshowkw/keywords_header.py
index 1b9af0d..9c6538c 100644
--- a/pym/gentoolkit/eshowkw/keywords_header.py
+++ b/pym/gentoolkit/eshowkw/keywords_header.py
@@ -28,7 +28,7 @@ def load_profile_data(portdir=None, repo='gentoo'):
 	  {'x86': 'stable', 'mips': 'dev', ...}
 	"""
 	if portdir is None:
-		portdir = portage.db['/']['vartree'].settings.repositories[repo].location
+		portdir = portage.db[portage.root]['vartree'].settings.repositories[repo].location
 
 	arch_status = {}
 


^ permalink raw reply related	[flat|nested] 23+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eshowkw/
@ 2016-04-06 17:25 Paul Varner
  0 siblings, 0 replies; 23+ messages in thread
From: Paul Varner @ 2016-04-06 17:25 UTC (permalink / raw
  To: gentoo-commits

commit:     e4dda3ef193b109f30051f5a116158dfe23922bb
Author:     Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Wed Apr  6 17:21:32 2016 +0000
Commit:     Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Wed Apr  6 17:21:32 2016 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=e4dda3ef

eshowkw: Fix previous commit to not always turn on prefix

Mistakenly was checking highlight_arch instead of opts.arch to
see if any architectures were specified.  This had the effect of
always enabling the prefix architectures.

 pym/gentoolkit/eshowkw/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/gentoolkit/eshowkw/__init__.py b/pym/gentoolkit/eshowkw/__init__.py
index c00d7cb..ded166d 100644
--- a/pym/gentoolkit/eshowkw/__init__.py
+++ b/pym/gentoolkit/eshowkw/__init__.py
@@ -102,7 +102,7 @@ def main(argv, indirect = False):
 		porto.nocolor()
 
 	# Imply prefix if user specified any architectures (Bug 578496)
-	if len(highlight_arch) > 0:
+	if len(opts.arch) > 0:
 		prefix = True
 
 	keywords = keywords_header(prefix, highlight_arch, order)


^ permalink raw reply related	[flat|nested] 23+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eshowkw/
@ 2016-03-31 22:10 Paul Varner
  0 siblings, 0 replies; 23+ messages in thread
From: Paul Varner @ 2016-03-31 22:10 UTC (permalink / raw
  To: gentoo-commits

commit:     99bdbe3d832a3dabb7e9fb9c50cb9c4e1baf2f02
Author:     Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 31 22:06:28 2016 +0000
Commit:     Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Thu Mar 31 22:06:28 2016 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=99bdbe3d

eshowkw: Imply prefix when specifing an arch

This fixes bug 578496. When a user specifies and architecture, we should
just display it regardless of its prefix status.

 pym/gentoolkit/eshowkw/__init__.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/pym/gentoolkit/eshowkw/__init__.py b/pym/gentoolkit/eshowkw/__init__.py
index d46a773..c00d7cb 100644
--- a/pym/gentoolkit/eshowkw/__init__.py
+++ b/pym/gentoolkit/eshowkw/__init__.py
@@ -100,6 +100,11 @@ def main(argv, indirect = False):
 	if not color and not sys.stdout.isatty():
 		# disable colors
 		porto.nocolor()
+
+	# Imply prefix if user specified any architectures (Bug 578496)
+	if len(highlight_arch) > 0:
+		prefix = True
+
 	keywords = keywords_header(prefix, highlight_arch, order)
 	if len(package) > 0:
 		mysettings = portc(local_config=False)


^ permalink raw reply related	[flat|nested] 23+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eshowkw/
@ 2016-03-17 21:39 Dirkjan Ochtman
  0 siblings, 0 replies; 23+ messages in thread
From: Dirkjan Ochtman @ 2016-03-17 21:39 UTC (permalink / raw
  To: gentoo-commits

commit:     bde283951ef3c07a9476f4508ac5b57a5e634b64
Author:     Dirkjan Ochtman <dirkjan <AT> ochtman <DOT> nl>
AuthorDate: Thu Mar 17 21:39:23 2016 +0000
Commit:     Dirkjan Ochtman <djc <AT> gentoo <DOT> org>
CommitDate: Thu Mar 17 21:39:23 2016 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=bde28395

Sort eshowkw headers by arch status first

 pym/gentoolkit/eshowkw/keywords_header.py | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/pym/gentoolkit/eshowkw/keywords_header.py b/pym/gentoolkit/eshowkw/keywords_header.py
index 7bf71d0..bc5c0c5 100644
--- a/pym/gentoolkit/eshowkw/keywords_header.py
+++ b/pym/gentoolkit/eshowkw/keywords_header.py
@@ -92,9 +92,10 @@ class keywords_header:
 		return [x for x in ports.archlist()
 			if not x.startswith('~')]
 
-	@staticmethod
-	def __sortKeywords(keywords, prefix = False, required_keywords = []):
-		"""Sort keywords with short archs first"""
+	def __sortKeywords(self, keywords, prefix = False, required_keywords = []):
+		"""Sort keywords: order by status (IMP, then DEV, then EXP, then
+		prefix), then by name."""
+
 		# user specified only some keywords to display
 		if len(required_keywords) != 0:
 			tmpkeywords = [k for k in keywords
@@ -103,15 +104,22 @@ class keywords_header:
 			if len(tmpkeywords) != 0:
 				keywords = tmpkeywords
 
-		normal = [k for k in keywords
-			if len(k.split('-')) == 1]
-		normal.sort()
-
+		normal = [k for k in keywords if len(k.split('-')) == 1]
 		if prefix:
 			longer = [k for k in keywords
 				if len(k.split('-')) != 1]
 			longer.sort()
 			normal.extend(longer)
+
+		lists = self.__IMPARCHS, self.__DEV_ARCHS, self.__EXP_ARCHS
+		levels = {}
+		for kw in normal:
+			for level, ls in enumerate(lists):
+				if kw in ls:
+					levels[kw] = level
+					break
+
+		normal.sort(key=lambda kw: (levels.get(kw, 99), kw))
 		return normal
 
 	def __readAdditionalFields(self):


^ permalink raw reply related	[flat|nested] 23+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eshowkw/
@ 2015-11-19 11:59 Justin Lecher
  0 siblings, 0 replies; 23+ messages in thread
From: Justin Lecher @ 2015-11-19 11:59 UTC (permalink / raw
  To: gentoo-commits

commit:     239b0c9b6ea62189f6ce69f72a291a4f8c9fa463
Author:     Justin Lecher <jlec <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 19 11:56:32 2015 +0000
Commit:     Justin Lecher <jlec <AT> gentoo <DOT> org>
CommitDate: Thu Nov 19 11:56:32 2015 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=239b0c9b

Get status of arch from profile

The stable, dev, exp status of the arches was hardcoded.
This change copies the code form ekeyword to read the status from profiles
directly.

Signed-off-by: Justin Lecher <jlec <AT> gentoo.org>

 pym/gentoolkit/eshowkw/keywords_header.py | 76 +++++++++++++++++++++++++++++--
 1 file changed, 73 insertions(+), 3 deletions(-)

diff --git a/pym/gentoolkit/eshowkw/keywords_header.py b/pym/gentoolkit/eshowkw/keywords_header.py
index 320406e..aaf1e8c 100644
--- a/pym/gentoolkit/eshowkw/keywords_header.py
+++ b/pym/gentoolkit/eshowkw/keywords_header.py
@@ -4,14 +4,84 @@
 
 __all__ = ['keywords_header']
 
+import portage
+import os
 from portage import settings as ports
 from portage.output import colorize
 from gentoolkit.eshowkw.display_pretty import colorize_string
 from gentoolkit.eshowkw.display_pretty import align_string
 
+# Copied from ekeyword
+def load_profile_data(portdir=None, repo='gentoo'):
+	"""Load the list of known arches from the tree
+
+	Args:
+	  portdir: The repository to load all data from (and ignore |repo|)
+	  repo: Look up this repository by name to locate profile data
+
+	Returns:
+	  A dict mapping the keyword to its preferred state:
+	  {'x86': 'stable', 'mips': 'dev', ...}
+	"""
+	if portdir is None:
+		portdir = portage.db['/']['vartree'].settings.repositories[repo].location
+
+	arch_status = {}
+
+	try:
+		arch_list = os.path.join(portdir, 'profiles', 'arch.list')
+		with open(arch_list) as f:
+			for line in f:
+				line = line.split('#', 1)[0].strip()
+				if line:
+					arch_status[line] = None
+	except IOError:
+		pass
+
+	try:
+		profile_status = {
+			'stable': 0,
+			'dev': 1,
+			'exp': 2,
+			None: 3,
+		}
+		profiles_list = os.path.join(portdir, 'profiles', 'profiles.desc')
+		with open(profiles_list) as f:
+			for line in f:
+				line = line.split('#', 1)[0].split()
+				if line:
+					arch, _profile, status = line
+					arch_status.setdefault(arch, status)
+					curr_status = profile_status[arch_status[arch]]
+					new_status = profile_status[status]
+					if new_status < curr_status:
+						arch_status[arch] = status
+	except IOError:
+		pass
+
+	if arch_status:
+		arch_status['all'] = None
+	else:
+		warning('could not read profile files: %s' % arch_list)
+		warning('will not be able to verify args are correct')
+
+	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"]
+	elif status == "dev":
+		return [arch for arch in _arch_status if _arch_status[arch] == "dev"]
+	elif status == "exp":
+		return [arch for arch in _arch_status if _arch_status[arch] == "exp"]
+	else:
+		raise TypeError
+
 class keywords_header:
-	__IMPARCHS = [ 'arm', 'amd64', 'x86' ]
-	__UNSTABLE_ARCHS = [ 'arm64', 'm68k', 'mips', 's390', 'sh' ]
+	__IMPARCHS = gen_arch_list("stable")
+	__DEV_ARCHS = gen_arch_list("dev")
+	__EXP_ARCHS = gen_arch_list("exp")
 	__ADDITIONAL_FIELDS = [ 'eapi', 'unused', 'slot' ]
 	__EXTRA_FIELDS = [ 'repo' ]
 
@@ -61,7 +131,7 @@ class keywords_header:
 			keyword = '%'.join(list(keyword))
 			if tmp2 in self.__IMPARCHS:
 				tmp.append(colorize_string('darkyellow', keyword))
-			elif tmp2 in self.__UNSTABLE_ARCHS:
+			elif tmp2 in self.__EXP_ARCHS:
 				tmp.append(colorize_string('darkgray', keyword))
 			else:
 				tmp.append(keyword)


^ permalink raw reply related	[flat|nested] 23+ messages in thread
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eshowkw/
@ 2015-11-17 10:19 Justin Lecher
  0 siblings, 0 replies; 23+ messages in thread
From: Justin Lecher @ 2015-11-17 10:19 UTC (permalink / raw
  To: gentoo-commits

commit:     95b5655ae01c0185a9539d1921509277fa778102
Author:     Denis Romanchuk <den4ikkss <AT> gmail <DOT> com>
AuthorDate: Mon Nov 16 04:01:21 2015 +0000
Commit:     Justin Lecher <jlec <AT> gentoo <DOT> org>
CommitDate: Tue Nov 17 10:18:17 2015 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=95b5655a

Add eapi column to the eshowkw

Signed-off-by: Justin Lecher <jlec <AT> gentoo.org>

 pym/gentoolkit/eshowkw/__init__.py         |  5 +---
 pym/gentoolkit/eshowkw/keywords_content.py | 42 ++++++++++++++++++++++--------
 pym/gentoolkit/eshowkw/keywords_header.py  |  2 +-
 3 files changed, 33 insertions(+), 16 deletions(-)

diff --git a/pym/gentoolkit/eshowkw/__init__.py b/pym/gentoolkit/eshowkw/__init__.py
index a20dac9..d46a773 100644
--- a/pym/gentoolkit/eshowkw/__init__.py
+++ b/pym/gentoolkit/eshowkw/__init__.py
@@ -72,7 +72,7 @@ def process_args(argv):
 	parser.add_argument('-P', '--prefix', action='store_true', default=False,
 		help='Display prefix keywords in output.')
 	parser.add_argument('-S', '--ignore-slot', action='store_true', default=False,
-		help='Treat slots as irelevant during detection of redundant pacakges.')
+		help='Treat slots as irelevant during detection of redundant packages.')
 
 	return parser.parse_args(args=argv)
 
@@ -83,9 +83,6 @@ def main(argv, indirect = False):
 	opts = process_args(argv)
 	ignore_slots = opts.ignore_slot
 	use_overlays = opts.overlays
-	# user can do both --arch=a,b,c or --arch a b c
-	if len(opts.arch) > 1:
-		opts.arch = ','.join(opts.arch)
 	highlight_arch = ''.join(opts.arch).split(',')
 	bold = opts.bold
 	order = opts.align

diff --git a/pym/gentoolkit/eshowkw/keywords_content.py b/pym/gentoolkit/eshowkw/keywords_content.py
index 2e6c0fa..b6ad118 100644
--- a/pym/gentoolkit/eshowkw/keywords_content.py
+++ b/pym/gentoolkit/eshowkw/keywords_content.py
@@ -164,7 +164,7 @@ class keywords_content:
 	def __packages_sort(package_content):
 		"""
 		Sort packages queried based on version and slot
-		%% pn , repo, slot, keywords
+		%% pn , repo, slot, eapi, keywords
 		"""
 		from operator import itemgetter
 
@@ -208,8 +208,8 @@ class keywords_content:
 						# version is not allowed by portage or unset
 						continue
 					# obtain related data from metadata and append to the pkg list
-					keywords, slot = self.__getMetadata(pdb, mysplit[0]+'/'+pf, oroot)
-					mypkgs.append([mysplit[0]+'/'+pf, oroot, slot, keywords])
+					keywords, slot, eapi = self.__getMetadata(pdb, mysplit[0]+'/'+pf, oroot)
+					mypkgs.append([mysplit[0]+'/'+pf, oroot, slot, eapi, keywords])
 
 		self.__packages_sort(mypkgs)
 		return mypkgs
@@ -226,7 +226,7 @@ class keywords_content:
 	def __getMetadata(pdb, package, repo):
 		"""Obtain all required metadata from portage auxdb"""
 		try:
-			metadata = pdb.aux_get(package, ['KEYWORDS', 'SLOT'], repo)
+			metadata = pdb.aux_get(package, ['KEYWORDS', 'SLOT', 'EAPI'], repo)
 		except KeyError:
 			# portage prints out more verbose error for us if we were lucky
 			raise SystemExit('Failed to obtain metadata')
@@ -303,24 +303,42 @@ class keywords_content:
 		return tmp
 
 	@staticmethod
-	def __prepareContentResult(versions, keywords, redundant, slots, slot_length, repos, linesep):
+	def __formatEapis(eapis, repos, repos_configs, length):
+		"""Align eapis items properly"""
+		# % are used as separators for further split so we wont loose spaces and coloring
+		tmp = []
+		for eapi, repo in zip(eapis, repos):
+			tmp_eapi = eapi
+			eapi = align_string(eapi, 'left', length)
+			eapi = '%'.join(list(eapi))
+			if repos_configs[repo].eapi_is_banned(tmp_eapi):
+				eapi = colorize_string('red', eapi)
+			elif repos_configs[repo].eapi_is_deprecated(tmp_eapi):
+				eapi = colorize_string('yellow', eapi)
+			else:
+				eapi = colorize_string('green', eapi)
+			tmp.append(eapi)
+		return tmp
+
+	@staticmethod
+	def __prepareContentResult(versions, keywords, eapi, redundant, slots, slot_length, repos, linesep):
 		"""Parse version fields into one list with proper separators"""
 		content = []
 		oldslot = ''
 		fieldsep = '% %|% %'
 		normsep = '% %'
-		for v, k, r, s, t in zip(versions, keywords, redundant, slots, repos):
+		for v, k, e, r, s, t in zip(versions, keywords, eapi, redundant, slots, repos):
 			if oldslot != s:
 				oldslot = s
 				content.append(linesep)
 			else:
 				s = '%'.join(list(''.rjust(slot_length)))
-			content.append('%s%s%s%s%s%s%s%s%s' % (v, fieldsep, k, fieldsep, r, normsep, s, fieldsep, t))
+			content.append('%s%s%s%s%s%s%s%s%s%s%s' % (v, fieldsep, k, fieldsep, e, normsep, r, normsep, s, fieldsep, t))
 		return content
 
 	def __init__(self, package, keywords_list, porttree, ignoreslots = False, content_align = 'bottom', usebold = False, toplist = 'archlist'):
 		"""Query all relevant data from portage databases."""
-		packages, self.repositories, self.slots, self.keywords = self.__checkExist(porttree, package)
+		packages, self.repositories, self.slots, self.eapi, self.keywords = self.__checkExist(porttree, package)
 		# convert repositories from path to name
 		self.repositories = [porttree.getRepositoryName(x) for x in self.repositories]
 		self.slot_length = max([len(x) for x in self.slots])
@@ -336,16 +354,18 @@ class keywords_content:
 
 		ver = self.__formatVersions(self.versions, content_align, self.version_length)
 		kws = self.__formatKeywords(self.keywords, keywords_list, usebold, toplist)
+		repos_configs = porttree.repositories.prepos
+		eap = self.__formatEapis(self.eapi, self.repositories, repos_configs, 1)
 		red = self.__formatAdditional(self.redundant, 'purple', redundant_length)
 		slt = self.__formatAdditional(self.slots, 'bold', self.slot_length)
 		rep = self.__formatAdditional(self.repositories, 'yellow', repositories_length)
-		# those + nubers are spaces in printout. keywords are multiplied also because of that
+		# those + numbers are spaces in printout. keywords are multiplied also because of that
 		linesep = '%s+%s+%s+%s' % (''.ljust(self.version_length+1, '-'),
 			''.ljust(self.keyword_length*2+1, '-'),
-			''.ljust(redundant_length+self.slot_length+3, '-'),
+			''.ljust(redundant_length+self.slot_length+1+4, '-'),
 			''.ljust(repositories_length+1, '-')
 		)
 
-		self.content = self.__prepareContentResult(ver, kws, red, slt, self.slot_length, rep, linesep)
+		self.content = self.__prepareContentResult(ver, kws, eap, red, slt, self.slot_length, rep, linesep)
 		self.content_length = len(linesep)
 		self.cp = port.cpv_getkey(packages[0])

diff --git a/pym/gentoolkit/eshowkw/keywords_header.py b/pym/gentoolkit/eshowkw/keywords_header.py
index 610fcaf..320406e 100644
--- a/pym/gentoolkit/eshowkw/keywords_header.py
+++ b/pym/gentoolkit/eshowkw/keywords_header.py
@@ -12,7 +12,7 @@ from gentoolkit.eshowkw.display_pretty import align_string
 class keywords_header:
 	__IMPARCHS = [ 'arm', 'amd64', 'x86' ]
 	__UNSTABLE_ARCHS = [ 'arm64', 'm68k', 'mips', 's390', 'sh' ]
-	__ADDITIONAL_FIELDS = [ 'unused', 'slot' ]
+	__ADDITIONAL_FIELDS = [ 'eapi', 'unused', 'slot' ]
 	__EXTRA_FIELDS = [ 'repo' ]
 
 	@staticmethod


^ permalink raw reply related	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2022-07-09  1:49 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-08  1:19 [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eshowkw/ Brian Dolbec
  -- strict thread matches above, loose matches on Subject: below --
2022-07-09  1:49 Mike Gilbert
2022-06-08 20:11 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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox