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 ]),
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)
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:
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()
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"
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"]
# 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@