* [gentoo-portage-dev] [PATCH] Colorize packages in user sets (bug 577720)
@ 2016-03-20 14:33 Adam Mills
2016-03-29 8:35 ` Alexander Berntsen
2016-04-18 6:24 ` Alexander Berntsen
0 siblings, 2 replies; 9+ messages in thread
From: Adam Mills @ 2016-03-20 14:33 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
---
man/color.map.5 | 11 ++++++++++
pym/_emerge/resolver/output.py | 39 ++++++++++++++++++++++------------
pym/_emerge/resolver/output_helpers.py | 8 ++++---
pym/portage/_sets/base.py | 3 +++
pym/portage/_sets/files.py | 3 +++
pym/portage/output.py | 39 ++++++++++++++++++----------------
6 files changed, 68 insertions(+), 35 deletions(-)
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/pym/_emerge/resolver/output.py b/pym/_emerge/resolver/output.py
index 400617d..4cb8393 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,22 +705,27 @@ 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 the 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:
- system = system_set.findAtomForPackage(
- pkg, modified_use=self.conf.pkg_use_enabled(pkg))
- world = world_set.findAtomForPackage(
- pkg, modified_use=self.conf.pkg_use_enabled(pkg))
+ for set_name in root_config.sets:
+ if set_name == "system":
+ system = root_config.sets[set_name].findAtomForPackage(
+ pkg, modified_use=self.conf.pkg_use_enabled(pkg))
+ elif set_name == "selected":
+ world = root_config.sets[set_name].findAtomForPackage(
+ pkg, modified_use=self.conf.pkg_use_enabled(pkg))
+ elif user_set is None and root_config.sets[set_name].isUserSet():
+ user_set = root_config.sets[set_name].findAtomForPackage(
+ pkg, modified_use=self.conf.pkg_use_enabled(pkg))
if not (self.conf.oneshot or world) and \
pkg.root == self.conf.target_root and \
self.conf.favorites.findAtomForPackage(
@@ -726,7 +737,7 @@ class Display(object):
except InvalidDependString:
# This is reported elsewhere if relevant.
pass
- return system, world
+ return user_set, system, world
@staticmethod
@@ -863,8 +874,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..801774f 100644
--- a/pym/_emerge/resolver/output_helpers.py
+++ b/pym/_emerge/resolver/output_helpers.py
@@ -596,7 +596,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 +613,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/base.py b/pym/portage/_sets/base.py
index ee20d36..a73fb93 100644
--- a/pym/portage/_sets/base.py
+++ b/pym/portage/_sets/base.py
@@ -173,6 +173,9 @@ class PackageSet(object):
cpv_slot_list):
yield atom
+ def isUserSet(self):
+ return False
+
class EditablePackageSet(PackageSet):
def __init__(self, allow_wildcard=False, allow_repo=False):
diff --git a/pym/portage/_sets/files.py b/pym/portage/_sets/files.py
index e045701..7f844ef 100644
--- a/pym/portage/_sets/files.py
+++ b/pym/portage/_sets/files.py
@@ -174,6 +174,9 @@ class StaticFileSet(EditablePackageSet):
greedy=greedy, dbapi=trees["vartree"].dbapi)
return rValue
multiBuilder = classmethod(multiBuilder)
+
+ def isUserSet(self):
+ return True
class ConfigFileSet(PackageSet):
def __init__(self, filename):
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] 9+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] Colorize packages in user sets (bug 577720)
2016-03-20 14:33 [gentoo-portage-dev] [PATCH] Colorize packages in user sets (bug 577720) Adam Mills
@ 2016-03-29 8:35 ` Alexander Berntsen
2016-04-16 16:51 ` Zac Medico
2016-04-18 6:24 ` Alexander Berntsen
1 sibling, 1 reply; 9+ messages in thread
From: Alexander Berntsen @ 2016-03-29 8:35 UTC (permalink / raw
To: gentoo-portage-dev
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
On 20/03/16 15:33, Adam Mills wrote:
> + for set_name in root_config.sets:
> + if set_name == "system":
> + system = root_config.sets[set_name].findAtomForPackage(
> + pkg, modified_use=self.conf.pkg_use_enabled(pkg))
> + elif set_name == "selected":
> + world = root_config.sets[set_name].findAtomForPackage(
> + pkg, modified_use=self.conf.pkg_use_enabled(pkg))
> + elif user_set is None and root_config.sets[set_name].isUserSet():
> + user_set = root_config.sets[set_name].findAtomForPackage(
> + pkg, modified_use=self.conf.pkg_use_enabled(pkg))
This is really silly. At the very least try to not repeat yourself so
much.
The patch otherwise looks OK, and the idea is OK by me. Unless someone
has any big objections, I can probably merge a cleaned up patch.
- --
Alexander
bernalex@gentoo.org
https://secure.plaimi.net/~alexander
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAEBCgAGBQJW+j5tAAoJENQqWdRUGk8BKpYP/iG5tLtEv7Zf7AbPOj4Dkt1V
t25DMqUU0+uq3Wu0AsUsGYxg8K4dFMZ3+t54w4aykF5/lGNz/cz+O1NFy7WgQ/Y4
9pxkPIQ8py9FX8uh4Hm5/fplBJ5RP1CvvftLeImpKx/B2GTqtLDx0EYehfqRqWNa
2Hx6TE1GH3bbvQgJpl65L4c30JfIBP4pcW95EzUc4XFE87KV0abFFsPLc8sEewp8
NXDDvLZnC+8+BKlLuhyZArxfDp02kQWLd7ho3Uq1rB1LVTUCbxLkV8F9UHtCX9/w
XyyGkg/Xe4Ev1oLcMuEGWGcoQDdLA03CrTzZ59TYIrP2+/0EBCXfNPSy9SLehIew
N+RpgRqc6ecRVq4Nm5NbHfcYmieSKIJD9KPlLqFOShdLEn92gZp2syKkKd+R5JwE
voKVGMgAiJinZkNtwp/j4wgCoLf++I4FJ4BOWAkc7gkKOaDT7UnK2q3M9n6DTNtP
kbyB0cRMSbyMN75vLi2LdB37xC7a2aWCNUi0ssL183bocxhtcRUCxpUsA+dRnGWP
dKCoMzoYVcEARxbzukoJ1vuF+GN+tMoIHfAaXiAhTkwENn+s64b3pYy7tDRBjLxt
Wi3Fvh9h2ipU42wc0p8puZmT9v+60rcUKbNCjLQD9lEX9nh6bR91gB7FlPzU/ss8
Kqz55vBVouA/Fwkn+qZi
=TBB6
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] Colorize packages in user sets (bug 577720)
2016-03-29 8:35 ` Alexander Berntsen
@ 2016-04-16 16:51 ` Zac Medico
2016-04-16 17:22 ` Zac Medico
0 siblings, 1 reply; 9+ messages in thread
From: Zac Medico @ 2016-04-16 16:51 UTC (permalink / raw
To: gentoo-portage-dev
On 03/29/2016 01:35 AM, Alexander Berntsen wrote:
> On 20/03/16 15:33, Adam Mills wrote:
>> + for set_name in root_config.sets:
>> + if set_name == "system":
>> + system = root_config.sets[set_name].findAtomForPackage(
>> + pkg, modified_use=self.conf.pkg_use_enabled(pkg))
>> + elif set_name == "selected":
>> + world = root_config.sets[set_name].findAtomForPackage(
>> + pkg, modified_use=self.conf.pkg_use_enabled(pkg))
>> + elif user_set is None and root_config.sets[set_name].isUserSet():
>> + user_set = root_config.sets[set_name].findAtomForPackage(
>> + pkg, modified_use=self.conf.pkg_use_enabled(pkg))
> This is really silly. At the very least try to not repeat yourself so
> much.
In order to avoid the loop, all of the user sets could be combined into
a single InternalPackageSet instance, for indexing purposes.
As is, the logic is wrong because the user_set should be an accumulator,
assigned with an operator like |= since you don't what this variable to
toggle back and forth in the loop.
> The patch otherwise looks OK, and the idea is OK by me. Unless someone
> has any big objections, I can probably merge a cleaned up patch.
As discussed in the meeting today, the above loop needs to be fixed
before we can merge this.
--
Thanks,
Zac
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] Colorize packages in user sets (bug 577720)
2016-04-16 16:51 ` Zac Medico
@ 2016-04-16 17:22 ` Zac Medico
0 siblings, 0 replies; 9+ messages in thread
From: Zac Medico @ 2016-04-16 17:22 UTC (permalink / raw
To: gentoo-portage-dev
On 04/16/2016 09:51 AM, Zac Medico wrote:
> On 03/29/2016 01:35 AM, Alexander Berntsen wrote:
>> On 20/03/16 15:33, Adam Mills wrote:
>>> + for set_name in root_config.sets:
>>> + if set_name == "system":
>>> + system = root_config.sets[set_name].findAtomForPackage(
>>> + pkg, modified_use=self.conf.pkg_use_enabled(pkg))
>>> + elif set_name == "selected":
>>> + world = root_config.sets[set_name].findAtomForPackage(
>>> + pkg, modified_use=self.conf.pkg_use_enabled(pkg))
>>> + elif user_set is None and root_config.sets[set_name].isUserSet():
>>> + user_set = root_config.sets[set_name].findAtomForPackage(
>>> + pkg, modified_use=self.conf.pkg_use_enabled(pkg))
>> This is really silly. At the very least try to not repeat yourself so
>> much.
>
> In order to avoid the loop, all of the user sets could be combined into
> a single InternalPackageSet instance, for indexing purposes.
To clarify, a combined user sets InternalPackageSet instance will
convert this from a O(N) sequential search loop to a O(1) hash table lookup.
--
Thanks,
Zac
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] Colorize packages in user sets (bug 577720)
2016-03-20 14:33 [gentoo-portage-dev] [PATCH] Colorize packages in user sets (bug 577720) Adam Mills
2016-03-29 8:35 ` Alexander Berntsen
@ 2016-04-18 6:24 ` Alexander Berntsen
2016-04-18 16:02 ` Zac Medico
1 sibling, 1 reply; 9+ messages in thread
From: Alexander Berntsen @ 2016-04-18 6:24 UTC (permalink / raw
To: gentoo-portage-dev
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
On 20/03/16 15:33, Adam Mills wrote:
> + def isUserSet(self): + return False +
Furthermore, this makes no sense and needs to go.
- --
Alexander
bernalex@gentoo.org
https://secure.plaimi.net/~alexander
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAEBCgAGBQJXFH22AAoJENQqWdRUGk8Bjx0P/22kcx+y/MulWUDHl31kIKoG
T1WqdW4dqDv/1xGCFvpAQWX8w04cHRs2AxzKWdWNWqDi53LAAHaRMX/8VhxoV/3Y
zQtZfeT7CFfX5Mtn5NLVG5C6/Xvemo2NjKSQqF76TH+CUUVDCr1lP73kned/vwV4
Hj4JNgrQamsMpzdsmU/UvyHClh9rvLwulc3+7vIaaY9UB5wUDsVJfs7MwtO0xEau
7YnAv6gvm501JDxrFyzes8524ghPBsQmoVLaDTpEl+ilF+k3qEdJ8vZJ7bth+FUC
qvjpjI4hZf09SBI6z5MfnXTepyjL8iqV4+l28jjm3JWDMYVrKCbjGAnMllUH3bZD
gYQBCKzqCsdwgA3THHESMJnHGxcmMymaBbqUzqYobvPjNSgsdPOmG9bNoZxlbVJu
TMtNuHQQKxkn7/UeEHvCE6XGPcLLzGD7fxYlj18LyXfbI8LnZAK9bcX45jK3dWGp
LCp/S0M9fgox1wkUWy8TU7DFwM5MQ9q9ZmmfhaAuPS37Zt08TiUf6HEz8R21y24/
eanNTHPrL18CqFkBRrXqBFLIFuYF+fUH+wEZ6gWVBUxTj/IH/U4PnlKRFlwbFP9o
Txs9VETI10Z2vilAUwyhP3uQa4pfsGH6RDkUFKFJt3TPPneOPKlNh7VFeQP23EMk
TtowE5+ZvgYh5e/juBxU
=eHbc
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] Colorize packages in user sets (bug 577720)
2016-04-18 6:24 ` Alexander Berntsen
@ 2016-04-18 16:02 ` Zac Medico
[not found] ` <CACpZFvb5MvZ2-p=smXTXBXRmSYHdEUn62ms=hT7exhPpAw6G6A@mail.gmail.com>
0 siblings, 1 reply; 9+ messages in thread
From: Zac Medico @ 2016-04-18 16:02 UTC (permalink / raw
To: gentoo-portage-dev
On 04/17/2016 11:24 PM, Alexander Berntsen wrote:
> On 20/03/16 15:33, Adam Mills wrote:
>> + def isUserSet(self): + return False +
> Furthermore, this makes no sense and needs to go.
Taking the world_candidate attribute as an example, this could be a
boolean attribute that's set in the [usersets] section in
cnf/sets/portage.conf.
--
Thanks,
Zac
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] Colorize packages in user sets (bug 577720)
[not found] ` <CACpZFvb5MvZ2-p=smXTXBXRmSYHdEUn62ms=hT7exhPpAw6G6A@mail.gmail.com>
@ 2016-04-18 20:14 ` Adam Mills
2016-04-18 20:34 ` Zac Medico
2016-04-19 6:14 ` Alexander Berntsen
0 siblings, 2 replies; 9+ messages in thread
From: Adam Mills @ 2016-04-18 20:14 UTC (permalink / raw
To: gentoo-portage-dev
Thanks for all the feedback so far. I probably should have just filed
the bug
and left it at that, but I'm committed now.
I've done my best to incorporate all of the suggestions here, and
submitted a
new patch rev 3. I have a few questions about details I'm pretty sure
still
need improvement:
1) In order to build the InternalPackageSet only once, I used the
_DisplayConfig target_root, instead of using pkg.root in the
check_sets
method. I'm not sure of the pkg.root purpose, but if there can be
different
roots, the InternalPackageSet would have to be created for each
package.
If that's the case, it could be moved to the check_sets method, and
created
for each package.
2) I added the new InternalPackageSet as a new member of the
_DisplayConfig
class. Let me know if there's somewhere more appropriate, especially
after
the feedback from #1.
3) Is there a better method available for merging PackageSets?
Thanks,
Adam
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] Colorize packages in user sets (bug 577720)
2016-04-18 20:14 ` Adam Mills
@ 2016-04-18 20:34 ` Zac Medico
2016-04-19 6:14 ` Alexander Berntsen
1 sibling, 0 replies; 9+ messages in thread
From: Zac Medico @ 2016-04-18 20:34 UTC (permalink / raw
To: gentoo-portage-dev
On 04/18/2016 01:14 PM, Adam Mills wrote:
> Thanks for all the feedback so far. I probably should have just filed
> the bug
> and left it at that, but I'm committed now.
>
> I've done my best to incorporate all of the suggestions here, and
> submitted a
> new patch rev 3. I have a few questions about details I'm pretty sure still
> need improvement:
>
> 1) In order to build the InternalPackageSet only once, I used the
> _DisplayConfig target_root, instead of using pkg.root in the check_sets
> method. I'm not sure of the pkg.root purpose, but if there can be
> different
> roots, the InternalPackageSet would have to be created for each package.
> If that's the case, it could be moved to the check_sets method, and
> created
> for each package.
You should create the InternalPackageSet for each root, since each root
has its own package sets.
> 2) I added the new InternalPackageSet as a new member of the _DisplayConfig
> class. Let me know if there's somewhere more appropriate, especially
> after
> the feedback from #1.
I guess that's fine, since we're not using it anywhere else.
> 3) Is there a better method available for merging PackageSets?
Yes, you should add all of the atoms to it at once, because each update
calls _updateAtomMap which is expensive. For example, use something like
this:
user_sets =
InternalPackageSet(initial_atoms=itertools.chain.from_iterable(pkgset.getAtoms()
for pkgset in pkgsets if pkgset.user_set))
--
Thanks,
Zac
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] Colorize packages in user sets (bug 577720)
2016-04-18 20:14 ` Adam Mills
2016-04-18 20:34 ` Zac Medico
@ 2016-04-19 6:14 ` Alexander Berntsen
1 sibling, 0 replies; 9+ messages in thread
From: Alexander Berntsen @ 2016-04-19 6:14 UTC (permalink / raw
To: gentoo-portage-dev
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
On 18/04/16 22:14, Adam Mills wrote:
> Thanks for all the feedback so far. I probably should have just
> filed the bug and left it at that, but I'm committed now.
It's great that you're trying to get a patch into the project! By
incorporating Zac's feedback, you'll be an expert in no time. ;)
Thanks a lot for your time and effort!
- --
Alexander
bernalex@gentoo.org
https://secure.plaimi.net/~alexander
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAEBCgAGBQJXFczNAAoJENQqWdRUGk8BygsP/1hBWJYvXh1EXriGUuc3/IyY
aKZmM8g1u7cGbTIZAfFRhIA3u6xaxVDLnR7Flpsa0KVZUuE5u9zDdS1vvRycjXbR
ghnw/MVXw7xLhQhFWOUpIjk61kRg27zvGvKCW9OZ57OdXmFVaV8xcrQIUqhxWkld
upezbAv1cf6Jqk3CUVlDaPO0wEffoKjp+ZB9yRxJ+7a4D2tqV2o3PmI5e+MWM8uo
ckzZnK7H/b7ax9ncuXYGrpPSyfDMJVyagvnLPdSAYGbtLZEC8x5L4pEp0UxgbPJH
NheLY69DRvQ/QyLd3fOnyrVGYD04+dLQPT6MoIkzPFqILOW+67kkXmuJTh69U9Vi
q32d4HTS9LTniGuFh0BazeAjkviAMkuETeG8hvxTtheWCnBtUGh7WBTISTMnOage
5HiVCos6UwQrTWtGJGjqL+mi8e6Ipl9ZahYI/rerzN3bayLmOIFPzC0e5a642gg0
ZGuahuTQYRTu2kofn7Bj7mWbuXBPIK5/GFmo/uOPRool5ib2LoT7Xbea1A5GMXOF
rfWibaIljSeiyCs+KD/7O+hlvwRqFtsqgdTDzZP64LaftsTHJS+cHmf2Hxf3Jtmm
8o9DGKiB+tKh5nyT2gXMUxrkKIHOa6rBgpv/IDKZPiVSuA4KtHVpttHMAEqul6Rl
mMaoIMj+50GThhYTWNG+
=ewM2
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2016-04-19 6:14 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-20 14:33 [gentoo-portage-dev] [PATCH] Colorize packages in user sets (bug 577720) Adam Mills
2016-03-29 8:35 ` Alexander Berntsen
2016-04-16 16:51 ` Zac Medico
2016-04-16 17:22 ` Zac Medico
2016-04-18 6:24 ` Alexander Berntsen
2016-04-18 16:02 ` Zac Medico
[not found] ` <CACpZFvb5MvZ2-p=smXTXBXRmSYHdEUn62ms=hT7exhPpAw6G6A@mail.gmail.com>
2016-04-18 20:14 ` Adam Mills
2016-04-18 20:34 ` Zac Medico
2016-04-19 6:14 ` Alexander Berntsen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox