[gentoo-portage-dev] default USE flags in IUSE

2006-01-02 Thread Alec Warner
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Disclaimer:  This is nowhere near done, mostly looking to start a
conversation with people about stuff it's missing, and ways to improve,
mostly it was a proof of concept.  However please try it out and play
with it a bit, find issues, etc..

included is a patch against 2.1_pre3-r1.
Also included is the ebuild I used to test fun things with.  The ebuild
doesn't pass QA, I know :P

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iQIVAwUBQ7mWq2zglR5RwbyYAQIXEg/+Mk70jBVZzdgEUhuOTh3MxWUB+ELk72J3
ZW6h2FBp+q7vBs0T350ZWQh+HbBNFStf1eBH1FxXdb84QcMnWxiERWfqfQ0zDv2F
Ov3URqwtdiyrLcCsBWUWwH4KCJToX6ujBWpWHrnZTfEp8yJJl844qMX4VZPryboR
KeRJKaTf1K1xTtJ9FY6hOuID5guBhMW6prd7Boa9spK8HK+VNaZks+jzAUMl3gK1
7/4nSakFBAFwr/PXFT+CiA4D5O5ONDhS+7axXgdr8I52FYKpV40QdMfltnbbKTrY
Gw8m6pwwDq15Zlj9x6cRV1f49V5b86NE+KK78gPAJCSeL7Ta5V42VWp4gOYjjaFz
oLJz+SVRhbzacvqxuHzjZc4+ydSr5F240UDZ9k8wfhYJ2FxO+LFIz9cnoSHAGHNS
Fk2y9BjBMmHNjVc6j1JLa+akcUwDwxVY4h6LRFZ2H13vHAlqenyqDfkzTuGlvutt
yfrD/Gf9a8ItuyfwWwSeessQ++ajjyzglXwhMRj4EuwTKduH0uW9x39sleAmlq87
jBDfr6qIG0EXDoVwuvQQB0VDHjtBz9e6XOtCvde89Q6o0vgT9Db3b0Q4vUZdV4uv
zuIYeMGB6swPDOxxiA3ejFpHqRc9PfcU4/mrW1S47F08uONL8HVoWlTdUY6AOMSQ
PKmwerHX/wk=
=2Y/q
-END PGP SIGNATURE-
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

DESCRIPTION=This is a sample skeleton ebuild file

# Homepage, not used by Portage directly but handy for developer reference
HOMEPAGE=http://foo.bar.com/;

# Point to any required sources; these will be automatically downloaded by
# Portage.
SRC_URI=
# License of the package.  This must match the name of file(s) in
# /usr/portage/licenses/.  For complex license combination see the developer
# docs on gentoo.org for details.
LICENSE=
SLOT=0
KEYWORDS=x86
IUSE=+python -debug +doc +bar foo -nocxx
DEPEND=python? dev-python/twisted
doc? sys-apps/portage
RDEPEND=
--- emerge.orig 2006-01-02 14:43:57.624036128 -0500
+++ emerge  2006-01-02 15:57:50.190183648 -0500
@@ -964,8 +964,26 @@
if myuse == None:
self.pkgsettings.setcpv(mykey)
myuse = self.pkgsettings[USE].split()
-   self.applied_useflags[mykey] = myuse
 
+   self.applied_useflags[mykey] = myuse
+   # Add the code here.
+   if mytype == binary:
+   iuses = portage.db[/][bintree].dbapi.aux_get(mykey, 
[IUSE])[0].split()
+   else:
+   iuses = 
portage.db[/][porttree].dbapi.aux_get(mykey, [IUSE])[0].split()
+   
+   conf_use = self.pkgsettings.configdict[conf][USE]
+   
+   for flag in iuses:
+   if flag.startswith(+):
+   if '-' + flag[1:] not in conf_use:
+   if flag[1:] not in 
self.applied_useflags[mykey]:
+   
self.applied_useflags[mykey].append(flag[1:])   
+   elif flag.startswith(-):
+   if flag[1:] not in conf_use:
+   if flag[1:] in 
self.applied_useflags[mykey]:
+   
self.applied_useflags[mykey].remove(flag[1:])
+   
merging=1
if addme:
# this is where we add the node to the list of packages to merge
@@ -1625,10 +1643,18 @@
 
cur_iuse = 
portage.unique_array(cur_iuse)
cur_iuse = [flag for flag in cur_iuse 
if flag not in portage.settings.usemask]
+   result = []
+   # Strip the +- default USE flag in IUSE 
stuff out of IUSE   
+   for flag in cur_iuse:
+   if flag.startswith(+) or 
flag.startswith(-):
+   result.append(flag[1:])
+   else:
+   result.append(flag)
+   cur_iuse = result
cur_iuse.sort()
+   
cur_use = self.applied_useflags[x[2]]
cur_use = [flag for flag in cur_use if 
flag in cur_iuse]
-
if myoldbest:
pkg = myoldbest
else:
@@ -1636,6 +1662,14 @@
if 
portage.db[/][vartree].dbapi.cpv_exists(pkg):
   

Re: [gentoo-portage-dev] default USE flags in IUSE

2006-01-02 Thread Lares Moreau
On Mon, 2006-01-02 at 16:10 -0500, Alec Warner wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 Disclaimer:  This is nowhere near done, mostly looking to start a
 conversation with people about stuff it's missing, and ways to improve,
 mostly it was a proof of concept.  However please try it out and play
 with it a bit, find issues, etc..
 
 included is a patch against 2.1_pre3-r1.
 Also included is the ebuild I used to test fun things with.  The ebuild
 doesn't pass QA, I know :P

I would like to have the option to opt-out of having these flags
enabled. This way, the average user would not need to worry about
enabling flags, and the advanced user (opting out) doesn't have 'magic'
happen behind their back.

The IUSE as you have in the sample.ebuild can be thought as the
recommended default use-flags. 

-Lares

-- 
Lares Moreau [EMAIL PROTECTED]  | LRU: 400755 http://counter.li.org
lares/irc.freenode.net |
Gentoo x86 Arch Tester |   ::0 Alberta, Canada
Public Key: 0D46BB6E @ subkeys.pgp.net |  Encrypted Mail Preferred
Key fingerprint = 0CA3 E40D F897 7709 3628  C5D4 7D94 483E 0D46 BB6E


signature.asc
Description: This is a digitally signed message part


Re: [gentoo-portage-dev] default USE flags in IUSE

2006-01-02 Thread Mike Frysinger
On Monday 02 January 2006 18:58, Lares Moreau wrote:
 I would like to have the option to opt-out of having these flags
 enabled. This way, the average user would not need to worry about
 enabling flags, and the advanced user (opting out) doesn't have 'magic'
 happen behind their back.

said 'advanced user' will probably already be using USE=-* and as such, wont 
need to opt-out of this feature
-mike
-- 
gentoo-portage-dev@gentoo.org mailing list