* [gentoo-portage-dev] [PATCH v5] Colorize packages in user sets (bug 577720)
@ 2016-04-20 12:55 Adam Mills
2016-04-22 8:09 ` Alexander Berntsen
0 siblings, 1 reply; 4+ messages in thread
From: Adam Mills @ 2016-04-20 12:55 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: Adam Mills
Three new settings were added to /etc/portage/color.map:
PKG_MERGE_USER_SET, PKG_BINARY_MERGE_USER_SET, and
PKG_NOMERGE_USER_SET. These colors are applied when the package is
selected from a set in /etc/portage/sets/
X-Gentoo-bug: 577720
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=577720
---
[PATCH v5] Final touches. Almost there!
[PATCH v4] Created one InternalPackageSet for each root
[PATCH v3] Updates based on feedback from IRC meeting
[PATCH v2] Simplification of check_sets ref Alexander Berntsen's feedback_
cnf/sets/portage.conf | 1 +
doc/config/sets.docbook | 4 +++-
man/color.map.5 | 11 ++++++++++
man/portage.5 | 1 +
pym/_emerge/resolver/output.py | 25 +++++++++++++++-------
pym/_emerge/resolver/output_helpers.py | 17 ++++++++++++---
pym/portage/_sets/__init__.py | 8 +++++++
pym/portage/_sets/base.py | 1 +
pym/portage/output.py | 39 ++++++++++++++++++----------------
9 files changed, 77 insertions(+), 30 deletions(-)
diff --git a/cnf/sets/portage.conf b/cnf/sets/portage.conf
index ac282d9..e990620 100644
--- a/cnf/sets/portage.conf
+++ b/cnf/sets/portage.conf
@@ -49,6 +49,7 @@ class = portage.sets.files.StaticFileSet
multiset = true
directory = %(PORTAGE_CONFIGROOT)setc/portage/sets
world-candidate = True
+user-set = True
# Set to rebuild all packages that need a preserved lib that only remains due
# to FEATURES=preserve-libs
diff --git a/doc/config/sets.docbook b/doc/config/sets.docbook
index 749b775..02135d6 100644
--- a/doc/config/sets.docbook
+++ b/doc/config/sets.docbook
@@ -57,6 +57,8 @@
is missing)</para></listitem>
<listitem><para><varname>world-candidate</varname>, which determines if
given package should be added to the <varname>world</varname> set</para></listitem>
+ <listitem><para><varname>user-set</varname>, which determines if
+ given package should be colorized as a user set</para></listitem>
</itemizedlist>
<para>
Some handler classes might require additional options for their configuration,
@@ -93,7 +95,7 @@
but to indicate that the section should generate multiple sets it's
also necessary to set the <varname>multiset</varname> option to
<parameter>true</parameter>. The <varname>world-candidate</varname>
- option also supported like with
+ and <varname>user-set</varname> options are also supported like with
single sets (they'll apply to all sets generated by the section).
</para>
<para>
diff --git a/man/color.map.5 b/man/color.map.5
index 5543628..39f23f7 100644
--- a/man/color.map.5
+++ b/man/color.map.5
@@ -46,6 +46,9 @@ Defines color used for satisfied blockers.
\fBPKG_MERGE\fR = \fI"darkgreen"\fR
Defines color used for packages planned to be merged.
.TP
+\fBPKG_MERGE_USER_SET\fR = \fI"darkgreen"\fR
+Defines color used for packages planned to be merged from a user defined set.
+.TP
\fBPKG_MERGE_SYSTEM\fR = \fI"darkgreen"\fR
Defines color used for system packages planned to be merged.
.TP
@@ -55,6 +58,10 @@ Defines color used for world packages planned to be merged.
\fBPKG_BINARY_MERGE\fR = \fI"purple"\fR
Defines color used for packages planned to be merged using a binary package.
.TP
+\fBPKG_BINARY_MERGE_USER_SET\fR = \fI"purple"\fR
+Defines color used for packages planned to be merged using a binary package
+from a user defined set.
+.TP
\fBPKG_BINARY_MERGE_SYSTEM\fR = \fI"purple"\fR
Defines color used for system packages planned to be merged using a binary
package.
@@ -66,6 +73,10 @@ package.
\fBPKG_NOMERGE\fR = \fI"darkblue"\fR
Defines color used for packages not planned to be merged.
.TP
+\fBPKG_NOMERGE_USER_SET\fR = \fI"darkblue"\fR
+Defines color used for packages not planned to be merged from a user defined
+set.
+.TP
\fBPKG_NOMERGE_SYSTEM\fR = \fI"darkblue"\fR
Defines color used for system packages not planned to be merged.
.TP
diff --git a/man/portage.5 b/man/portage.5
index 7c2a8f7..3cc1f07 100644
--- a/man/portage.5
+++ b/man/portage.5
@@ -1114,6 +1114,7 @@ class = portage.sets.files.StaticFileSet
multiset = true
directory = %(PORTAGE_CONFIGROOT)setc/portage/sets
world-candidate = True
+user-set = True
[module-rebuild]
class = portage.sets.dbapi.OwnerSet
diff --git a/pym/_emerge/resolver/output.py b/pym/_emerge/resolver/output.py
index 400617d..7c70a3e 100644
--- a/pym/_emerge/resolver/output.py
+++ b/pym/_emerge/resolver/output.py
@@ -271,6 +271,8 @@ class Display(object):
return colorize("PKG_BINARY_MERGE_SYSTEM", pkg_str)
elif pkg_info.world:
return colorize("PKG_BINARY_MERGE_WORLD", pkg_str)
+ elif pkg_info.user_set:
+ return colorize("PKG_BINARY_MERGE_USER_SET", pkg_str)
else:
return colorize("PKG_BINARY_MERGE", pkg_str)
else:
@@ -278,6 +280,8 @@ class Display(object):
return colorize("PKG_MERGE_SYSTEM", pkg_str)
elif pkg_info.world:
return colorize("PKG_MERGE_WORLD", pkg_str)
+ elif pkg_info.user_set:
+ return colorize("PKG_MERGE_USER_SET", pkg_str)
else:
return colorize("PKG_MERGE", pkg_str)
elif pkg_info.operation == "uninstall":
@@ -287,6 +291,8 @@ class Display(object):
return colorize("PKG_NOMERGE_SYSTEM", pkg_str)
elif pkg_info.world:
return colorize("PKG_NOMERGE_WORLD", pkg_str)
+ elif pkg_info.user_set:
+ return colorize("PKG_NOMERGE_USER_SET", pkg_str)
else:
return colorize("PKG_NOMERGE", pkg_str)
@@ -699,18 +705,21 @@ class Display(object):
return
- def check_system_world(self, pkg):
- """Checks for any occurances of the package in the system or world sets
+ def check_sets(self, pkg):
+ """Checks for any occurances of the package in portage sets
@param pkg: _emerge.Package.Package instance
- @rtype system and world booleans
+ @rtype user_set, system, and world booleans
"""
root_config = self.conf.roots[pkg.root]
system_set = root_config.sets["system"]
world_set = root_config.sets["selected"]
- system = False
- world = False
+ user_set = None
+ system = None
+ world = None
try:
+ user_set = self.conf.user_sets[pkg.root].findAtomForPackage(
+ pkg, modified_use=self.conf.pkg_use_enabled(pkg))
system = system_set.findAtomForPackage(
pkg, modified_use=self.conf.pkg_use_enabled(pkg))
world = world_set.findAtomForPackage(
@@ -726,7 +735,7 @@ class Display(object):
except InvalidDependString:
# This is reported elsewhere if relevant.
pass
- return system, world
+ return user_set, system, world
@staticmethod
@@ -863,8 +872,8 @@ class Display(object):
self.oldlp = self.conf.columnwidth - 30
self.newlp = self.oldlp - 30
pkg_info.oldbest = self.convert_myoldbest(pkg, pkg_info)
- pkg_info.system, pkg_info.world = \
- self.check_system_world(pkg)
+ pkg_info.user_set, pkg_info.system, pkg_info.world = \
+ self.check_sets(pkg)
if 'interactive' in pkg.properties and \
pkg.operation == 'merge':
pkg_info.attr_display.interactive = True
diff --git a/pym/_emerge/resolver/output_helpers.py b/pym/_emerge/resolver/output_helpers.py
index 70f7bc0..f3b2abc 100644
--- a/pym/_emerge/resolver/output_helpers.py
+++ b/pym/_emerge/resolver/output_helpers.py
@@ -13,6 +13,7 @@ __all__ = (
import io
import re
import sys
+from itertools import chain
from portage import os
from portage import _encodings, _unicode_encode
@@ -213,6 +214,14 @@ class _DisplayConfig(object):
self.running_root = frozen_config._running_root
self.roots = frozen_config.roots
+ # Create a single merged user set for each root
+ self.user_sets = {}
+ for root_name, root in self.roots.items():
+ self.user_sets[root_name] = InternalPackageSet(initial_atoms= \
+ chain.from_iterable(pkgset.getAtoms() \
+ for pkgset in root.sets.values() \
+ if pkgset.user_set))
+
self.blocker_parents = dynamic_config._blocker_parents
self.reinstall_nodes = dynamic_config._reinstall_nodes
self.digraph = dynamic_config.digraph
@@ -596,7 +605,8 @@ class PkgInfo(object):
__slots__ = ("attr_display", "built", "cp",
"ebuild_path", "fetch_symbol", "merge",
"oldbest", "oldbest_list", "operation", "ordered", "previous_pkg",
- "repo_name", "repo_path_real", "slot", "sub_slot", "system", "use", "ver", "world")
+ "repo_name", "repo_path_real", "user_set", "slot", "sub_slot",
+ "system", "use", "ver", "world")
def __init__(self):
@@ -612,12 +622,13 @@ class PkgInfo(object):
self.previous_pkg = None
self.repo_path_real = ''
self.repo_name = ''
+ self.user_set = None
self.slot = ''
self.sub_slot = ''
- self.system = False
+ self.system = None
self.use = ''
self.ver = ''
- self.world = False
+ self.world = None
self.attr_display = PkgAttrDisplay()
class PkgAttrDisplay(SlotObject):
diff --git a/pym/portage/_sets/__init__.py b/pym/portage/_sets/__init__.py
index 91f9dd1..3203521 100644
--- a/pym/portage/_sets/__init__.py
+++ b/pym/portage/_sets/__init__.py
@@ -148,6 +148,7 @@ class SetConfig(object):
parser.set("usersets", "multiset", "true")
parser.set("usersets", "directory", "%(PORTAGE_CONFIGROOT)setc/portage/sets")
parser.set("usersets", "world-candidate", "true")
+ parser.set("usersets", "user-set", "true")
parser.remove_section("live-rebuild")
parser.add_section("live-rebuild")
@@ -176,6 +177,7 @@ class SetConfig(object):
if not setname in self.psets:
options["name"] = setname
options["world-candidate"] = "False"
+ options["user-set"] = "False"
# for the unlikely case that there is already a section with the requested setname
import random
@@ -244,6 +246,9 @@ class SetConfig(object):
if parser.has_option(sname, "world-candidate") and \
parser.getboolean(sname, "world-candidate"):
newsets[x].world_candidate = True
+ if parser.has_option(sname, "user-set") and \
+ parser.getboolean(sname, "user-set"):
+ newsets[x].user_set = True
self.psets.update(newsets)
else:
self.errors.append(_("Section '%(section)s' is configured as multiset, but '%(class)s' "
@@ -263,6 +268,9 @@ class SetConfig(object):
if parser.has_option(sname, "world-candidate") and \
parser.getboolean(sname, "world-candidate"):
self.psets[setname].world_candidate = True
+ if parser.has_option(sname, "user-set") and \
+ parser.getboolean(sname, "user-set"):
+ self.psets[setname].user_set = True
except SetConfigError as e:
self.errors.append(_("Configuration error in section '%s': %s") % (sname, str(e)))
continue
diff --git a/pym/portage/_sets/base.py b/pym/portage/_sets/base.py
index ee20d36..7be9aab 100644
--- a/pym/portage/_sets/base.py
+++ b/pym/portage/_sets/base.py
@@ -28,6 +28,7 @@ class PackageSet(object):
self.errors = []
self._nonatoms = set()
self.world_candidate = False
+ self.user_set = False
self._allow_wildcard = allow_wildcard
self._allow_repo = allow_repo
diff --git a/pym/portage/output.py b/pym/portage/output.py
index bb7542b..80c67e8 100644
--- a/pym/portage/output.py
+++ b/pym/portage/output.py
@@ -128,24 +128,27 @@ _styles["HILITE"] = ( "teal", )
_styles["BRACKET"] = ( "blue", )
# Portage functions
-_styles["INFORM"] = ( "darkgreen", )
-_styles["UNMERGE_WARN"] = ( "red", )
-_styles["SECURITY_WARN"] = ( "red", )
-_styles["MERGE_LIST_PROGRESS"] = ( "yellow", )
-_styles["PKG_BLOCKER"] = ( "red", )
-_styles["PKG_BLOCKER_SATISFIED"] = ( "darkblue", )
-_styles["PKG_MERGE"] = ( "darkgreen", )
-_styles["PKG_MERGE_SYSTEM"] = ( "darkgreen", )
-_styles["PKG_MERGE_WORLD"] = ( "green", )
-_styles["PKG_BINARY_MERGE"] = ( "purple", )
-_styles["PKG_BINARY_MERGE_SYSTEM"] = ( "purple", )
-_styles["PKG_BINARY_MERGE_WORLD"] = ( "fuchsia", )
-_styles["PKG_UNINSTALL"] = ( "red", )
-_styles["PKG_NOMERGE"] = ( "darkblue", )
-_styles["PKG_NOMERGE_SYSTEM"] = ( "darkblue", )
-_styles["PKG_NOMERGE_WORLD"] = ( "blue", )
-_styles["PROMPT_CHOICE_DEFAULT"] = ( "green", )
-_styles["PROMPT_CHOICE_OTHER"] = ( "red", )
+_styles["INFORM"] = ( "darkgreen", )
+_styles["UNMERGE_WARN"] = ( "red", )
+_styles["SECURITY_WARN"] = ( "red", )
+_styles["MERGE_LIST_PROGRESS"] = ( "yellow", )
+_styles["PKG_BLOCKER"] = ( "red", )
+_styles["PKG_BLOCKER_SATISFIED"] = ( "darkblue", )
+_styles["PKG_MERGE"] = ( "darkgreen", )
+_styles["PKG_MERGE_USER_SET"] = ( "darkgreen", )
+_styles["PKG_MERGE_SYSTEM"] = ( "darkgreen", )
+_styles["PKG_MERGE_WORLD"] = ( "green", )
+_styles["PKG_BINARY_MERGE"] = ( "purple", )
+_styles["PKG_BINARY_MERGE_USER_SET"] = ( "purple", )
+_styles["PKG_BINARY_MERGE_SYSTEM"] = ( "purple", )
+_styles["PKG_BINARY_MERGE_WORLD"] = ( "fuchsia", )
+_styles["PKG_UNINSTALL"] = ( "red", )
+_styles["PKG_NOMERGE"] = ( "darkblue", )
+_styles["PKG_NOMERGE_USER_SET"] = ( "darkblue", )
+_styles["PKG_NOMERGE_SYSTEM"] = ( "darkblue", )
+_styles["PKG_NOMERGE_WORLD"] = ( "blue", )
+_styles["PROMPT_CHOICE_DEFAULT"] = ( "green", )
+_styles["PROMPT_CHOICE_OTHER"] = ( "red", )
def _parse_color_map(config_root='/', onerror=None):
"""
--
2.7.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [gentoo-portage-dev] [PATCH v5] Colorize packages in user sets (bug 577720)
2016-04-20 12:55 [gentoo-portage-dev] [PATCH v5] Colorize packages in user sets (bug 577720) Adam Mills
@ 2016-04-22 8:09 ` Alexander Berntsen
2016-04-22 15:03 ` Zac Medico
0 siblings, 1 reply; 4+ messages in thread
From: Alexander Berntsen @ 2016-04-22 8:09 UTC (permalink / raw
To: gentoo-portage-dev
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Definitely a huge improvement over v1. Thanks a lot for taking the
time and making the effort. You've been a great contributor!
I'll leave the final word to Zac, but the patch looks OK to me now. If
it's OK by Zac, I'll merge it quick as.
- --
Alexander
bernalex@gentoo.org
https://secure.plaimi.net/~alexander
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAEBCgAGBQJXGdxWAAoJENQqWdRUGk8BTdAQAKovCndVdUvp1bS6AB0yNSUQ
SrAY/Uw/I80B4DAnSwCqkc3CC8rSkHLY0nfw71N4EOcYx3+gsl09tkCIEpL8VplF
mUCgaF9rIy27CXUtWMqbsGw5eS/M5txOYwPyt4+ku7e3kPMogevW3dT5/ohw/rbb
GkPygCch7veJki4Vd5ZaI2dcPy8kDfZJCptxIt72NfflWodNYWSjbpjXcu94QvOW
0GeSFUCZAmdNqb7C1PGi/78IL/OA3NmrBywEtqd2Ut/nuDFeAb5Q9Ff2b5tEBOOt
8w/p0FcLzwKcNxAjeuQE6/wSD+U31Xf+kHNiJuY7lOE0R8Ke6pDtzk7+lw7zGndr
Ncey4aZ3HxtLn++0OLz1mQFJo8hakXAO+fRRq3nBVe8pFREqmQKeNv9e7aamUPSj
pT4o2B0yhWwvyl8aD904ZiVAJmvUDdC9PXczdAgLaa+7RhPc3hpeOypFGzka8wvv
qGe55XHNoM3jrAMrlo/wJUwK8oWCkG7olm8lbwMa8/aYygbOnJSMQTIL3kU+dPAc
/Wt6tc9cmpNoI60mXeReGFrjn8yitHw181Rfb/mmck/Fh+ahH9SjwC3Gtvi7Z4il
BMv1HIgn4Wdoorg4qITeQmXF6eM8lFjsbklCk0vts80kPk0dl49aMZ4irzV91qMf
EkqTC413ZUvgscDPF/jC
=VacX
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [gentoo-portage-dev] [PATCH v5] Colorize packages in user sets (bug 577720)
2016-04-22 8:09 ` Alexander Berntsen
@ 2016-04-22 15:03 ` Zac Medico
2016-04-25 6:45 ` Alexander Berntsen
0 siblings, 1 reply; 4+ messages in thread
From: Zac Medico @ 2016-04-22 15:03 UTC (permalink / raw
To: gentoo-portage-dev
On 04/22/2016 01:09 AM, Alexander Berntsen wrote:
> Definitely a huge improvement over v1. Thanks a lot for taking the
> time and making the effort. You've been a great contributor!
>
> I'll leave the final word to Zac, but the patch looks OK to me now. If
> it's OK by Zac, I'll merge it quick as.
>
Looks good to me.
--
Thanks,
Zac
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [gentoo-portage-dev] [PATCH v5] Colorize packages in user sets (bug 577720)
2016-04-22 15:03 ` Zac Medico
@ 2016-04-25 6:45 ` Alexander Berntsen
0 siblings, 0 replies; 4+ messages in thread
From: Alexander Berntsen @ 2016-04-25 6:45 UTC (permalink / raw
To: gentoo-portage-dev
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
OK then. Pushed as 739845a6eab95fbc44eab1b7b938c860563631d7.
Thank you, Adam!
- --
Alexander
bernalex@gentoo.org
https://secure.plaimi.net/~alexander
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAEBCgAGBQJXHb0HAAoJENQqWdRUGk8B9ugQAMnyyb3wOaq5FtIIjqeQUaEm
gyNNQKDI/kyjvld38fd0BCr/6qeUFP+vEYVg0vQhsrTOgpbBwGt8MyBL1xJAmHp2
Fl1wr/an+LD4vq5rDTzNhiTzwRw5UuZ3biN4r/7uvtQrEn5BRI5mnZdjgy4XGu5o
KA1/bHSUm9fDNT0Md9APKuSyETnLtCBkpwvPejphwfEaGqWE53J7K4tzqvEr7Ijc
X5O/ZS8ZDW+M2DMfLOhBWR4PBWiMAlurCg4TdAmXajc92xIF8YGcyVQe/vb5XpI7
sgr+eGb8/i90janEwsPjwm90GaGsvGHn0tYQt18HkrvYY8hO4SfgFz/B4Ald24qn
NfMESV/5xbvcUpm+SyiKxriIpat8+gtQzwq4pm0cfom0MesQLu8T/x5JgwYQpaAR
6ePnuyDFt5ud+ri0W9vqDhZf6fszYCWTsxFoNxa/zgsU9ZGgXFPvHGl2PhP/JjHt
pMbdnsAmIvW80LHCVjpOVr+0eNqyZw1+fCpyPoAkFRSwk5tULXDdMCP6yjDdWkOu
uF5/SqSuAVb59h2BBQ6ftxSr31oZb2b/U55yQ7BPyIC0VOYunK5kWR5ydRUmTtYv
9s5Im04m6zJrVxe74dGe/4HoqZGcmNO+FXsXW6zfGJZRPy3cUF9P79ZCcOHagmTU
EPuXGMCsYGADsc8vX6Ml
=8eRG
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-04-25 6:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-20 12:55 [gentoo-portage-dev] [PATCH v5] Colorize packages in user sets (bug 577720) Adam Mills
2016-04-22 8:09 ` Alexander Berntsen
2016-04-22 15:03 ` Zac Medico
2016-04-25 6:45 ` Alexander Berntsen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox