Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH] Colorize packages in user sets (bug 577720)
Date: Sat, 16 Apr 2016 16:51:13
Message-Id: 57126D7C.2060505@gentoo.org
In Reply to: Re: [gentoo-portage-dev] [PATCH] Colorize packages in user sets (bug 577720) by Alexander Berntsen
1 On 03/29/2016 01:35 AM, Alexander Berntsen wrote:
2 > On 20/03/16 15:33, Adam Mills wrote:
3 >> + for set_name in root_config.sets:
4 >> + if set_name == "system":
5 >> + system = root_config.sets[set_name].findAtomForPackage(
6 >> + pkg, modified_use=self.conf.pkg_use_enabled(pkg))
7 >> + elif set_name == "selected":
8 >> + world = root_config.sets[set_name].findAtomForPackage(
9 >> + pkg, modified_use=self.conf.pkg_use_enabled(pkg))
10 >> + elif user_set is None and root_config.sets[set_name].isUserSet():
11 >> + user_set = root_config.sets[set_name].findAtomForPackage(
12 >> + pkg, modified_use=self.conf.pkg_use_enabled(pkg))
13 > This is really silly. At the very least try to not repeat yourself so
14 > much.
15
16 In order to avoid the loop, all of the user sets could be combined into
17 a single InternalPackageSet instance, for indexing purposes.
18
19 As is, the logic is wrong because the user_set should be an accumulator,
20 assigned with an operator like |= since you don't what this variable to
21 toggle back and forth in the loop.
22
23 > The patch otherwise looks OK, and the idea is OK by me. Unless someone
24 > has any big objections, I can probably merge a cleaned up patch.
25
26 As discussed in the meeting today, the above loop needs to be fixed
27 before we can merge this.
28 --
29 Thanks,
30 Zac

Replies