From: Jason Stubbs <jstubbs@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Subject: Re: [gentoo-dev] Dirt: To shove under the rug or not shove under the rug? (aka another round of USE_EXPAND)
Date: Wed, 28 Sep 2005 13:21:09 +0900 [thread overview]
Message-ID: <200509281321.09879.jstubbs@gentoo.org> (raw)
In-Reply-To: <200509281258.20894.jstubbs@gentoo.org>
[-- Attachment #1: Type: text/plain, Size: 994 bytes --]
On Wednesday 28 September 2005 12:58, Jason Stubbs wrote:
> On Wednesday 28 September 2005 00:35, Donnie Berkholz wrote:
> > IUSE_VIDEO_CARDS="radeon sis mga"
> > IUSE_INPUT_DEVICES="synaptics wacom"
>
> So, my patch (even though it works) puts these flags into an IUSE_EXPAND
> variable and would require an upgrade on the CVS server to get correct
> cache generation for users.
>
> What are the exact reasons for not wanting to put the expanded flags
> directly into IUSE? If it's just a matter of the horrid display existing
> tools would give, the functionality can go in and IUSE updated after the
> functional versions are stabled. Are there any reasons beyond that?
And a patch to do it the IUSE way. Note the size difference below even though
both patches end up with the same output for the end user. Also note that
this way doesn't require an upgrade on the CVS server.
$ wc -c verbose-IUSE*
3698 verbose-IUSE-support.patch
6110 verbose-IUSE_EXPAND-support.patch
--
Jason Stubbs
[-- Attachment #2: verbose-IUSE-support.patch --]
[-- Type: text/x-diff, Size: 3698 bytes --]
diff -uNr 2.0-original/bin/emerge 2.0/bin/emerge
--- 2.0-original/bin/emerge 2005-09-28 12:24:10.000000000 +0900
+++ 2.0/bin/emerge 2005-09-28 13:17:00.000000000 +0900
@@ -1466,6 +1466,28 @@
if "--verbose" in myopts:
overlays = string.split(portage.settings['PORTDIR_OVERLAY'])
+ use_expand = portage.settings["USE_EXPAND"].lower().split()
+ use_expand_hidden = portage.settings["USE_EXPAND_HIDDEN"].lower().split()
+
+ def create_use_string(iuse, cur_use, old_use, masked_use):
+ usestr=""
+ for flag in iuse:
+ usechange=""
+ if old_use:
+ if (flag in old_use and flag not in cur_use) or (flag not in old_use and flag in cur_use):
+ usechange="*"
+
+ if flag in cur_use:
+ if usechange == "*":
+ substr = green("+"+flag)
+ else:
+ substr = red("+"+flag)
+ elif flag in masked_use:
+ substr = blue("(-"+flag+")")
+ else:
+ substr = blue("-"+flag)
+ usestr += substr + usechange + " "
+ return usestr
if "--tree" in myopts:
mylist.reverse()
@@ -1568,8 +1590,13 @@
portage.writemsg("!!! Error getting IUSE (report this to bugs.gentoo.org)\n")
portage.writemsg("!!! %s\n" % x)
iuse_split = []
+
+ iuse_split = portage.unique_array(iuse_split)
iuse_split.sort()
- old_use=None
+
+ cur_use = self.applied_useflags[x[2]]
+
+ old_use = []
if myoldbest:
pkg=myoldbest
else:
@@ -1581,24 +1608,38 @@
raise # Needed else can't exit
except:
pass
- iuse=""
- now_use=self.applied_useflags[x[2]]
- for ebuild_iuse in portage_util.unique_array(iuse_split):
- usechange=""
- if old_use:
- if (old_use.count(ebuild_iuse) and not now_use.count(ebuild_iuse)) or (not old_use.count(ebuild_iuse) and now_use.count(ebuild_iuse)):
- usechange="*"
-
- if ebuild_iuse in self.applied_useflags[x[2]]:
- if usechange == "*":
- iuse=green("+"+ebuild_iuse)
- else:
- iuse=red("+"+ebuild_iuse)
- elif ebuild_iuse in portage.settings.usemask:
- iuse=blue("(-"+ebuild_iuse+")")
- else:
- iuse=blue("-"+ebuild_iuse)
- verboseadd+=iuse+usechange+" "
+
+ reg_use = []
+ exp_map = {}
+ for flag in iuse_split:
+ found = False
+ for var in use_expand:
+ if flag.startswith(var+"_"):
+ if var in exp_map:
+ exp_map[var]+= [flag[len(var)+1:]]
+ else:
+ exp_map[var] = [flag[len(var)+1:]]
+ found = True
+ break
+ if not found:
+ reg_use.append(flag)
+
+ verboseadd += create_use_string(reg_use, cur_use, old_use, portage.settings.usemask)
+
+ for var in use_expand:
+ if var not in exp_map:
+ continue
+ expcur = []
+ expold = []
+ expmask = []
+ for flag in exp_map[var]:
+ if var+"_"+flag in cur_use:
+ expcur+= [flag]
+ if var+"_"+flag in old_use:
+ expold+= [flag]
+ if var+"_"+flag in portage.settings.usemask:
+ expmask+= [flag]
+ verboseadd += var.upper()+'="'+create_use_string(exp_map[var],expcur,expold,expmask).strip()+'" '
# size verbose
mysize=0
diff -uNr 2.0-original/pym/portage.py 2.0/pym/portage.py
--- 2.0-original/pym/portage.py 2005-09-28 12:24:10.000000000 +0900
+++ 2.0/pym/portage.py 2005-09-28 13:03:40.000000000 +0900
@@ -1392,7 +1392,7 @@
if self.has_key(var):
for x in string.split(self[var]):
mystr = string.lower(var)+"_"+x
- if mystr not in usesplit:
+ if mystr not in usesplit and mystr not in self.usemask:
usesplit.append(mystr)
# Pre-Pend ARCH variable to USE settings so '-*' in env doesn't kill arch.
prev parent reply other threads:[~2005-09-28 4:25 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-27 9:23 [gentoo-dev] Dirt: To shove under the rug or not shove under the rug? (aka another round of USE_EXPAND) Jason Stubbs
2005-09-27 9:38 ` Diego 'Flameeyes' Pettenò
2005-09-27 10:12 ` Jason Stubbs
2005-09-27 10:41 ` Diego 'Flameeyes' Pettenò
2005-09-27 12:51 ` Jason Stubbs
2005-09-27 13:44 ` Diego 'Flameeyes' Pettenò
2005-09-27 14:07 ` Kito
2005-09-27 16:27 ` Stephen Bennett
2005-09-27 16:48 ` Brian Harring
2005-09-27 14:25 ` Jason Stubbs
2005-09-27 15:40 ` [gentoo-dev] " Duncan
2005-09-27 12:38 ` [gentoo-dev] " Chris Gianelloni
2005-09-27 15:36 ` Donnie Berkholz
2005-09-27 10:54 ` Thomas de Grenier de Latour
2005-09-27 12:31 ` Jason Stubbs
2005-09-27 12:35 ` Chris Gianelloni
2005-09-27 13:07 ` Thomas de Grenier de Latour
2005-09-27 13:50 ` Chris Gianelloni
2005-09-27 14:20 ` Jason Stubbs
2005-09-27 15:35 ` Donnie Berkholz
2005-09-28 1:23 ` Jason Stubbs
2005-09-28 3:13 ` Jason Stubbs
2005-09-28 3:58 ` Jason Stubbs
2005-09-28 4:19 ` Donnie Berkholz
2005-09-28 4:45 ` Jason Stubbs
2005-09-28 6:23 ` Donnie Berkholz
2005-09-28 8:03 ` Jason Stubbs
2005-09-28 4:21 ` Jason Stubbs [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200509281321.09879.jstubbs@gentoo.org \
--to=jstubbs@gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox