From: Fabian Groffen Date: Wed, 7 Nov 2007 21:54:01 +0000 (-0000) Subject: PYTHON_EPREFIX -> get rid of retarded name X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=22544ee45b6d7c6101277ed882cc1b113fdd66c4;p=portage.git PYTHON_EPREFIX -> get rid of retarded name 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 --- diff --git a/configure.in b/configure.in index d927225da..7162caad3 100644 --- a/configure.in +++ b/configure.in @@ -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) diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 405847b25..9a7638a11 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -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 ':' tokens, where is a + # string, and a number. If ':' is omitted, it would be + # assumed to be the EAPI version as used in the main tree, if + # ':' 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 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() diff --git a/pym/portage/const.py b/pym/portage/const.py index 306d47122..571e18932 100644 --- a/pym/portage/const.py +++ b/pym/portage/const.py @@ -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"] diff --git a/pym/portage/const_autotool.py b/pym/portage/const_autotool.py index 6362468af..c1b1e124f 100644 --- a/pym/portage/const_autotool.py +++ b/pym/portage/const_autotool.py @@ -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@