PYTHON_EPREFIX -> get rid of retarded name
authorFabian Groffen <grobian@gentoo.org>
Wed, 7 Nov 2007 21:54:01 +0000 (21:54 -0000)
committerFabian Groffen <grobian@gentoo.org>
Wed, 7 Nov 2007 21:54:01 +0000 (21:54 -0000)
First shot at some EAPI scheme which is closer towards the trunk than it
is now.  Main tree ebuilds can technically be marked EAPI=1 these days,
which is not reflected in prefix, as we use the static EAPI="prefix".
To gain the same EAPI levels here, EAPI in prefix is extended to consist
of two parts, "prefix" and the EAPI number of the main tree.  Of course
the latter can be omitted if it 0 and/or omitted in the main tree.

svn path=/main/branches/prefix/; revision=8455

configure.in
pym/portage/__init__.py
pym/portage/const.py
pym/portage/const_autotool.py

index d927225da492aac39d12ff57af12c15f69f73a44..7162caad34232ef3a6b168f4801832eb6e4b8e52 100644 (file)
@@ -217,16 +217,13 @@ AC_HELP_STRING([--with-offset-prefix],
 
 if test "x$DOMAIN_PREFIX" = "x"
 then
-       PYTHON_EPREFIX='""'
+       PORTAGE_EPREFIX='""'
+       EAPIPREFIX=''
 else
-       PYTHON_EPREFIX='path.normpath("'"$DOMAIN_PREFIX"'")'
+       PORTAGE_EPREFIX='path.normpath("'"$DOMAIN_PREFIX"'")'
+       EAPIPREFIX='"prefix"'
 fi
 
-AC_ARG_WITH(eapi,
-AC_HELP_STRING([--with-eapi], [specify what eapi to use (default 1)]),
-[SUPPORTED_EAPI=$withval],
-[SUPPORTED_EAPI=1])
-
 DEFAULT_PATH="${DOMAIN_PREFIX}/usr/bin:${DOMAIN_PREFIX}/usr/sbin:${DOMAIN_PREFIX}/bin:${DOMAIN_PREFIX}/sbin:${prefix}/bin"
 AC_ARG_WITH(default-path, 
 AC_HELP_STRING([--with-default-path], [specify additional PATHs available to the portage build environment ]),
@@ -248,8 +245,8 @@ AC_SUBST(rootuser)
 AC_SUBST(rootuid)
 AC_SUBST(rootgid)
 AC_SUBST(DOMAIN_PREFIX)
-AC_SUBST(PYTHON_EPREFIX)
-AC_SUBST(SUPPORTED_EAPI)
+AC_SUBST(PORTAGE_EPREFIX)
+AC_SUBST(EAPIPREFIX)
 AC_SUBST(DEFAULT_PATH)
 AC_SUBST(PORTAGE_BASE,['${exec_prefix}/lib/portage'])
 AM_CONDITIONAL(INSTALL_PYTHON_SOURCES, test x$enable_py_sources = xtrue)
index 405847b25a87ac6fe06c651c496dc532cdd9bd89..9a7638a11e26df01f8af31afa33001d115577f4e 100644 (file)
@@ -3574,15 +3574,33 @@ def spawnebuild(mydo,actionmap,mysettings,debug,alwaysdep=0,logfile=None):
 
 
 def eapi_is_supported(eapi):
-       # PREFIX HACK: in prefix we still use EAPI="prefix".  To avoid
-       # getting eapi = -1 here and an error by Python because
-       # portage.const.EAPI is a string, we revert to a string compare for
-       # now.  Once we use a number, we should remove this crude hack.
-       if portage.const.EAPI == "prefix":
-               return str(eapi).strip() == str(portage.const.EAPI).strip()
+       # PREFIX HACK/EXTENSION: in prefix we have "incompatible" ebuilds in
+       # an consistent manner; regardless what the EAPI of the main tree
+       # ebuild is, we always need the prefix extension which by itself can
+       # have a version too.  In EAPI we allow to have multiple components
+       # separated by spaces to cater for this.  In general we could extend
+       # it here to contain '<desc>:<ver>' tokens, where <desc> is a
+       # string, and <ver> a number.  If '<desc>:' is omitted, it would be
+       # assumed to be the EAPI version as used in the main tree, if
+       # ':<ver>' is omitted, version 0 would be assumed.  This way an
+       # unset EAPI would make main tree EAPI 0, and 'EAPI="prefix"' would
+       # mean main tree EAPI 0, prefix tree EAPI 0.
+       # However, back to reality, we just look for all <desc> we require,
+       # which because fixed to be at max 1 allows to do some optimisations
+       # and don't do version tricks other than the main tree does.
+
+       # what we implement here, better be fast, so match what we want
+       # against what we have
+       o = 0
+       eapi = str(eapi)
+       if portage.const.EAPIPREFIX:
+               o = eapi.find(portage.const.EAPIPREFIX)
+               if o == -1:
+                       return False
+               o += len(portage.const.EAPIPREFIX)
 
        try:
-               eapi = int(str(eapi).strip())
+               eapi = int(eapi[o:].strip())
        except ValueError:
                eapi = -1
        if eapi < 0:
@@ -5305,7 +5323,8 @@ def getmaskingstatus(mycpv, metadata=None, settings=None, portdb=None):
        if eapi.startswith("-"):
                eapi = eapi[1:]
        if not eapi_is_supported(eapi):
-               return ["required EAPI %s, supported EAPI %s" % (eapi, portage.const.EAPI)]
+               return ["ebuild requires EAPI %s, portage supports EAPI %s %s" %
+                               (eapi, portage.const.EAPIPREFIX, portage.const.EAPI)]
        egroups = settings.configdict["backupenv"].get(
                "ACCEPT_KEYWORDS", "").split()
        mygroups = mygroups.split()
index 306d471222703a52a9829f32267099a7f3564a02..571e1893277703cb99e5fb6d42f11dbfdd007365 100644 (file)
@@ -31,6 +31,7 @@ MODULES_FILE_PATH       = USER_CONFIG_PATH+"/modules"
 CUSTOM_PROFILE_PATH     = USER_CONFIG_PATH+"/profile"
 GLOBAL_CONFIG_PATH      = DATADIR+"/portage/config"
 
+#PORTAGE_BASE_PATH       = "/usr/lib/portage"
 PORTAGE_BASE_PATH       = PORTAGE_BASE
 PORTAGE_BIN_PATH        = PORTAGE_BASE_PATH+"/bin"
 PORTAGE_PYM_PATH        = PORTAGE_BASE_PATH+"/pym"
@@ -67,7 +68,7 @@ INCREMENTALS = ["USE", "USE_EXPAND", "USE_EXPAND_HIDDEN", "FEATURES",
 EBUILD_PHASES           = ["setup", "unpack", "compile", "test", "install",
                           "preinst", "postinst", "prerm", "postrm", "other"]
 
-EAPI = @SUPPORTED_EAPI@
+EAPI = 1
 
 HASHING_BLOCKSIZE        = 32768
 MANIFEST1_HASH_FUNCTIONS = ["MD5","SHA256","RMD160"]
index 6362468afdc2e3eeea80df6b6445acf34ab26361..c1b1e124fd78c8262d1008315008a0584036b116 100644 (file)
@@ -4,16 +4,18 @@
 
 # all vars that are to wind up in portage_const must have their name listed in __all__
 
-__all__ = ["EPREFIX", "SYSCONFDIR", "DATADIR", "PORTAGE_BASE",
+__all__ = ["EAPIPREFIX", "EPREFIX", "SYSCONFDIR", "DATADIR", "PORTAGE_BASE",
                "portageuser", "portagegroup", "rootuser", "rootuid"]
 
 from os import path
 
-EPREFIX=@PYTHON_EPREFIX@
-SYSCONFDIR=path.normpath("@sysconfdir@")
-DATADIR=path.normpath("@datadir@")
-PORTAGE_BASE=path.normpath("@PORTAGE_BASE@")
-portagegroup="@portagegroup@"
-portageuser="@portageuser@"
-rootuser="@rootuser@"
-rootuid=@rootuid@
+EAPIPREFIX   = @EAPIPREFIX@
+EPREFIX      = @PORTAGE_EPREFIX@
+SYSCONFDIR   = path.normpath("@sysconfdir@")
+DATADIR      = path.normpath("@datadir@")
+PORTAGE_BASE = path.normpath("@PORTAGE_BASE@")
+
+portagegroup = "@portagegroup@"
+portageuser  = "@portageuser@"
+rootuser     = "@rootuser@"
+rootuid      = @rootuid@