-----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):
                                                (old_iuse, old_use) = 
portage.db["/"]["vartree"].dbapi.aux_get(pkg, ["IUSE", "USE"])
                                                old_iuse = 
portage.unique_array(old_iuse.split())
+                                               # Strip the +- default USE flag 
in IUSE stuff out ofIUSE        
+                                               result = []
+                                               for flag in old_iuse:
+                                                       if flag.startswith("+") 
or flag.startswith("-"):
+                                                               
result.append(flag[1:])
+                                                       else:
+                                                               
result.append(flag)
+                                               old_iuse = result
                                                old_iuse.sort()
                                                old_use = old_use.split()
                                                is_new = False
@@ -1645,7 +1679,7 @@
                                                is_new = True
                                        old_iuse = [flag for flag in old_iuse 
if flag not in portage.settings.usemask]
                                        old_use = [flag for flag in old_use if 
flag in old_iuse]
-
+                                       
                                        use_expand = 
portage.settings["USE_EXPAND"].lower().split()
                                        use_expand.sort()
                                        use_expand.reverse()
@@ -1664,7 +1698,7 @@
                                                        if exp in ret:
                                                                del ret[exp]
                                                return ret
-
+                                       
                                        cur_iuse_map = 
map_to_use_expand(cur_iuse)
                                        cur_use_map = map_to_use_expand(cur_use)
                                        old_iuse_map = 
map_to_use_expand(old_iuse)

Reply via email to