Change conditional USE deps syntax and expermental EAPI from 2_pre0 to 2_pre1.
authorZac Medico <zmedico@gentoo.org>
Wed, 30 Jul 2008 02:27:53 +0000 (02:27 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 30 Jul 2008 02:27:53 +0000 (02:27 -0000)
Conditional syntax examples:

Compact Form        Equivalent Expanded Form

foo[bar?]           bar? ( foo[bar]  ) !bar? ( foo       )
foo[!bar?]          bar? ( foo       ) !bar? ( foo[-bar] )
foo[bar=]           bar? ( foo[bar]  ) !bar? ( foo[-bar] )
foo[!bar=]          bar? ( foo[-bar] ) !bar? ( foo[bar]  )

svn path=/main/trunk/; revision=11274

doc/package/ebuild/eapi/2.docbook
pym/portage/__init__.py
pym/portage/dep.py
pym/portage/tests/__init__.py
pym/portage/tests/dep/test_isvalidatom.py

index 08386cc2f25f275716a34c33290fc9ed1a13c3e8..b8827f8b83091975f2a9d31de202560e0c526734 100644 (file)
@@ -1,5 +1,5 @@
 <sect1 id='package-ebuild-eapi-2'>
-       <title>EAPI 2_pre0</title>
+       <title>EAPI 2_pre1</title>
        <sect2 id='package-ebuild-eapi-2-helpers'>
        <title>Helpers</title>
        <sect3 id='package-ebuild-eapi-2-helpers-doman'>
@@ -80,7 +80,7 @@
        <entry>bar? ( foo[bar]  ) !bar? ( foo       )</entry>
        </row>
        <row>
-       <entry>foo[-bar?]</entry>
+       <entry>foo[!bar?]</entry>
        <entry>bar? ( foo       ) !bar? ( foo[-bar] )</entry>
        </row>
        <row>
@@ -89,7 +89,7 @@
        </row>
        <row>
        <entry>foo[bar!=]</entry>
-       <entry>bar? ( foo[-bar] ) !bar? ( foo[bar] )</entry>
+       <entry>bar? ( foo[-bar] ) !bar? ( foo[bar]  )</entry>
        </row>
        </tbody>
        </tgroup>
index cd065d25dfac9b781c842f569d031e754dfb7caa..d489891ee12d665c2a86f2571b775be3a4030ea9 100644 (file)
@@ -4478,7 +4478,7 @@ def _spawn_misc_sh(mysettings, commands, **kwargs):
 
 def eapi_is_supported(eapi):
        eapi = str(eapi).strip()
-       if eapi == "2_pre0":
+       if eapi == "2_pre1":
                return True
        try:
                eapi = int(eapi)
index 8528da4f8f5b27665eb7a626e4266e02ead15dcf..704a3060bcf5921db5e608a60a892234c672a4b2 100644 (file)
@@ -356,20 +356,23 @@ class _use_dep(object):
 
                for x in use:
                        last_char = x[-1:]
+                       first_char = x[:1]
                        if "?" == last_char:
-                               if "-" == x[:1]:
+                               if "-" == first_char:
                                        conditional.disabled.append(x[1:-1])
                                else:
                                        conditional.enabled.append(x[:-1])
                        elif "=" == last_char:
-                               if "-" == x[:1]:
+                               if "-" == first_char:
                                        raise InvalidAtom("Invalid use dep: '%s'" % (x,))
                                if "!" == x[-2:-1]:
-                                       conditional.not_equal.append(x[:-2])
+                                       raise InvalidAtom("Invalid use dep: '%s'" % (x,))
+                               if "!" == first_char:
+                                       conditional.not_equal.append(x[1:-1])
                                else:
                                        conditional.equal.append(x[:-1])
                        else:
-                               if "-" == x[:1]:
+                               if "-" == first_char:
                                        disabled_flags.append(x[1:])
                                else:
                                        enabled_flags.append(x)
@@ -413,22 +416,22 @@ class _use_dep(object):
 
                         x              x?            x
                        -x              x?
-                        x             -x?
-                       -x             -x?           -x
+                        x             !x?
+                       -x             !x?           -x
 
                         x              x=            x
                        -x              x=           -x
-                        x              x!=          -x
-                       -x              x!=           x
+                        x             !x=           -x
+                       -x             !x=            x
 
                Conditional syntax examples:
 
-                       compact form         equivalent expanded form
+                       Compact Form        Equivalent Expanded Form
 
                        foo[bar?]           bar? ( foo[bar]  ) !bar? ( foo       )
-                       foo[-bar?]          bar? ( foo       ) !bar? ( foo[-bar] )
+                       foo[!bar?]          bar? ( foo       ) !bar? ( foo[-bar] )
                        foo[bar=]           bar? ( foo[bar]  ) !bar? ( foo[-bar] )
-                       foo[bar!=]          bar? ( foo[-bar] ) !bar? ( foo[bar]  )
+                       foo[!bar=]          bar? ( foo[-bar] ) !bar? ( foo[bar]  )
 
                """
                tokens = []
index 7ca048b9ac6b0f974374b37447d3080338b56dfb..927af49c74804e338746c539326c4945a883977a 100644 (file)
@@ -178,4 +178,4 @@ test_cps = ['sys-apps/portage','virtual/portage']
 test_versions = ['1.0', '1.0-r1','2.3_p4','1.0_alpha57']
 test_slots = [ None, '1','gentoo-sources-2.6.17','spankywashere']
 test_usedeps = ['foo','-bar', ('foo','bar'),
-       ('foo','-bar'), ('foo?', '-bar?') ]
+       ('foo','-bar'), ('foo?', '!bar?') ]
index f7cc3b844e8533751372a328c3fd7a1f1c39813a..e21f54afcdbed2d828476ebd91506fbc2a6ce290 100644 (file)
@@ -25,16 +25,19 @@ class IsValidAtom(TestCase):
                          ( "sys-apps/portage:foo", True ),
                          ( "sys-apps/portage-2.1:foo", False ),
                          ( "sys-apps/portage-2.1:", False ),
-                         ( "=sys-apps/portage-2.2*:foo[bar?,-baz?,doc!=,build=]", True ),
-                         ( "=sys-apps/portage-2.2*:foo[build=]", True ),
-                         ( "=sys-apps/portage-2.2*:foo[doc!=]", True ),
+                         ( "=sys-apps/portage-2.2*:foo[bar?,!baz?,!doc=,build=]", True ),
+                         ( "=sys-apps/portage-2.2*:foo[doc?]", True ),
+                         ( "=sys-apps/portage-2.2*:foo[!doc?]", True ),
+                         ( "=sys-apps/portage-2.2*:foo[doc=]", True ),
+                         ( "=sys-apps/portage-2.2*:foo[!doc=]", True ),
+                         ( "=sys-apps/portage-2.2*:foo[-doc=]", False ),
                          ( "=sys-apps/portage-2.2*:foo[-doc!=]", False ),
                          ( "=sys-apps/portage-2.2*:foo[-doc=]", False ),
                          ( "=sys-apps/portage-2.2*:foo[bar][-baz][doc?][-build?]", False ),
                          ( "=sys-apps/portage-2.2*:foo[bar,-baz,doc?,-build?]", True ),
-                         ( "=sys-apps/portage-2.2*:foo[bar,-baz,doc?,-build?,]", False ),
-                         ( "=sys-apps/portage-2.2*:foo[,bar,-baz,doc?,-build?]", False ),
-                         ( "=sys-apps/portage-2.2*:foo[bar,-baz][doc?,-build?]", False ),
+                         ( "=sys-apps/portage-2.2*:foo[bar,-baz,doc?,!build?,]", False ),
+                         ( "=sys-apps/portage-2.2*:foo[,bar,-baz,doc?,!build?]", False ),
+                         ( "=sys-apps/portage-2.2*:foo[bar,-baz][doc?,!build?]", False ),
                          ( "=sys-apps/portage-2.2*:foo[bar][doc,build]", False ),
                          ( ">~cate-gory/foo-1.0", False ),
                          ( ">~category/foo-1.0", False ),