From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.43) id 1EKSUL-0006Ak-2e for garchives@archives.gentoo.org; Wed, 28 Sep 2005 03:20:09 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.5/8.13.5) with SMTP id j8S3BE9m003840; Wed, 28 Sep 2005 03:11:14 GMT Received: from smtp.gentoo.org (smtp.gentoo.org [134.68.220.30]) by robin.gentoo.org (8.13.5/8.13.5) with ESMTP id j8S36XYu015928 for ; Wed, 28 Sep 2005 03:06:33 GMT Received: from zh034158.ppp.dion.ne.jp ([222.3.34.158] helo=opteron246.suzuki-stubbs.home) by smtp.gentoo.org with esmtpa (Exim 4.43) id 1EKSO4-0008Re-LD for gentoo-dev@lists.gentoo.org; Wed, 28 Sep 2005 03:13:41 +0000 Received: by opteron246.suzuki-stubbs.home (Postfix, from userid 1000) id 6EE4C248944; Wed, 28 Sep 2005 12:13:53 +0900 (JST) From: Jason Stubbs 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 12:13:53 +0900 User-Agent: KMail/1.8.91 References: <200509271823.25788.jstubbs@gentoo.org> <433966D9.3040401@gentoo.org> <200509281023.50075.jstubbs@gentoo.org> In-Reply-To: <200509281023.50075.jstubbs@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@gentoo.org Reply-to: gentoo-dev@lists.gentoo.org MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_xpgODiumDaGDjnx" Message-Id: <200509281213.53108.jstubbs@gentoo.org> X-Archives-Salt: 2f7a3e5e-7fd3-43d1-a869-5c56face8ca8 X-Archives-Hash: 35891e448460194b0bdc6a8666c6760a --Boundary-00=_xpgODiumDaGDjnx Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline On Wednesday 28 September 2005 10:23, Jason Stubbs wrote: > On Wednesday 28 September 2005 00:35, Donnie Berkholz wrote: > > What I have done in my ebuilds using USE_EXPAND is add extra IUSE-like > > variables, for example: > > > > IUSE_VIDEO_CARDS="radeon sis mga" > > IUSE_INPUT_DEVICES="synaptics wacom" > > > > for `use video_cards_sis` etc.. > > > > This would allow for possible QA checks. Potentially, portage could look > > through and display things at --verbose like: > > > > [ebuild N ] x11-base/x11-drm-20050807 +dga -nls VIDEO_CARDS="+sis > > +mga -radeon" 538 kB [2] > > This output is exactly what my patch gives, but it currently works by > inspecting IUSE. However, it should be possible to indirectly pull the > information from the above flags instead. Adding support for a > USE_EXPAND_HIDDEN var should cover USERLAND and friends as well (although > those would still need to be defined in IUSE_USERLAND="...") Job's done! --Boundary-00=_xpgODiumDaGDjnx Content-Type: text/x-diff; charset="iso-8859-1"; name="verbose-USE_EXPAND-support.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="verbose-USE_EXPAND-support.patch" diff -uNr 2.0-original/bin/ebuild.sh 2.0/bin/ebuild.sh --- 2.0-original/bin/ebuild.sh 2005-09-26 11:48:16.000000000 +0900 +++ 2.0/bin/ebuild.sh 2005-09-28 11:32:47.000000000 +0900 @@ -129,7 +129,7 @@ local x # Make sure we have this USE flag in IUSE - if ! hasq "${u}" ${IUSE} ${E_IUSE} && ! hasq "${u}" ${PORTAGE_ARCHLIST} selinux; then + if ! hasq "${u}" ${IUSE} ${E_IUSE} ${IUSE_EXPAND} && ! hasq "${u}" ${PORTAGE_ARCHLIST} selinux; then echo "QA Notice: USE Flag '${u}' not in IUSE for ${CATEGORY}/${PF}" >&2 fi @@ -1870,6 +1870,17 @@ fi ;; depend) + # Create IUSE_EXPAND from child variables + for EXPAND_VAR in $USE_EXPAND; do + EXPAND_NAME="IUSE_${EXPAND_VAR}" + EXPAND_VAL="${!EXPAND_NAME}" + [ -z "${EXPAND_VAL}" ] && continue + LOWER_VAR="`echo ${EXPAND_VAR} | awk '{print tolower($0)}'`" + for VAL in ${EXPAND_VAL}; do + IUSE_EXPAND="${IUSE_EXPAND} ${LOWER_VAR}_${VAL}" + done + done + export SANDBOX_ON="0" set -f @@ -1899,13 +1910,13 @@ echo `echo "$PDEPEND"` >> $dbkey echo `echo "$PROVIDE"` >> $dbkey echo `echo "${EAPI:-0}"` >> $dbkey + echo `echo "${IUSE_EXPAND}"` >> $dbkey echo `echo "$UNUSED_01"` >> $dbkey echo `echo "$UNUSED_02"` >> $dbkey echo `echo "$UNUSED_03"` >> $dbkey echo `echo "$UNUSED_04"` >> $dbkey echo `echo "$UNUSED_05"` >> $dbkey echo `echo "$UNUSED_06"` >> $dbkey - echo `echo "$UNUSED_07"` >> $dbkey set +f #make sure it is writable by our group: exit 0 diff -uNr 2.0-original/bin/emerge 2.0/bin/emerge --- 2.0-original/bin/emerge 2005-09-27 13:16:09.000000000 +0900 +++ 2.0/bin/emerge 2005-09-28 12:09:49.000000000 +0900 @@ -1466,6 +1466,31 @@ 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() + for exp in use_expand[:]: + if exp in use_expand_hidden: + use_expand.remove(exp) + + 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() @@ -1558,18 +1583,29 @@ try: if x[0] == "binary": iuse_split = string.split(portage.db["/"]["bintree"].dbapi.aux_get(x[2],["IUSE"])[0]) + iuse_expand_split = portage.db["/"]["bintree"].dbapi.aux_get(x[2],["IUSE_EXPAND"])[0].split() elif x[0] == "ebuild": iuse_split = string.split(portage.portdb.aux_get(x[2],["IUSE"])[0]) + iuse_expand_split = portage.portdb.aux_get(x[2],["IUSE_EXPAND"])[0].split() else: iuse_split = [] + iuse_expand_split = [] except SystemExit, e: raise # Needed else can't exit except: portage.writemsg("!!! Error getting IUSE (report this to bugs.gentoo.org)\n") portage.writemsg("!!! %s\n" % x) iuse_split = [] + iuse_expand_split = [] + + iuse_split = portage.unique_array(iuse_split) iuse_split.sort() - old_use=None + iuse_expand_split = portage.unique_array(iuse_expand_split) + iuse_expand_split.sort() + + cur_use = self.applied_useflags[x[2]] + + old_use = [] if myoldbest: pkg=myoldbest else: @@ -1581,24 +1617,25 @@ 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+" " + + verboseadd += create_use_string(iuse_split, cur_use, old_use, portage.settings.usemask) + + for expvar in use_expand: + expiuse = [] + expcur = [] + expold = [] + expmask = [] + for flag in iuse_expand_split: + if flag.startswith(expvar+"_"): + expiuse.append(flag[len(expvar)+1:]) + if flag in cur_use: + expcur.append(expiuse[-1]) + if flag in old_use: + expold.append(expiuse[-1]) + if flag in portage.settings.usemask: + expmask.append(expiuse[-1]) + if expiuse: + verboseadd += expvar.upper()+'="'+create_use_string(expiuse,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-26 11:48:15.000000000 +0900 +++ 2.0/pym/portage.py 2005-09-28 12:06:36.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. @@ -5112,8 +5112,8 @@ 'RESTRICT', 'HOMEPAGE', 'LICENSE', 'DESCRIPTION', 'KEYWORDS', 'INHERITED', 'IUSE', 'CDEPEND', 'PDEPEND', 'PROVIDE', 'EAPI', - 'UNUSED_01', 'UNUSED_02', 'UNUSED_03', 'UNUSED_04', - 'UNUSED_05', 'UNUSED_06', 'UNUSED_07', + 'IUSE_EXPAND', 'UNUSED_01', 'UNUSED_02', 'UNUSED_03', + 'UNUSED_04', 'UNUSED_05', 'UNUSED_06', ] auxdbkeylen=len(auxdbkeys) --Boundary-00=_xpgODiumDaGDjnx-- -- gentoo-dev@gentoo.org mailing list