From 9a881d190b9ccb8a4e5549fac5ceca3cfa23aebd Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Fri, 18 Dec 2009 08:19:05 +0000 Subject: [PATCH] Merged from trunk -r15032:15043 | 15033 | Add support for EAPI 3_pre2. | | zmedico | | | 15034 | Enable xz unpack for EAPI 3_pre2. | | zmedico | | | 15035 | Add EAPI 3_pre2 to conditinals so the EAPI 4 stuff is | | zmedico | disabled. | | 15036 | Add EAPI to the whitelist to ensure it's always available as | | zmedico | early as possible. | | 15037 | In movefile() timestamp preservation code, use another loop | | zmedico | to search for another digit of precision. | | 15038 | Add missing line from previous commit. | | zmedico | | | 15039 | Tweak movefile() timestamp preservation code to maximize | | zmedico | precision for old timestamps that are closer to the epoch. | | 15040 | Just use integer mtime if no fractional seconds are found in | | zmedico | the search. | | 15041 | Add EAPI 3 conditionals for prefix variables. | | zmedico | | | 15042 | Add more EAPI 3 conditionals for prefix variables. | | zmedico | | | 15043 | Update for EAPI 3_pre2. | | zmedico | | svn path=/main/branches/prefix/; revision=15112 --- bin/ebuild-helpers/doins | 2 +- bin/ebuild-helpers/newins | 2 +- bin/ebuild.sh | 22 +++---- bin/isolated-functions.sh | 2 +- doc/package/ebuild/eapi/3.docbook | 99 +++++++++++++++++++++++++++++-- man/ebuild.5 | 24 +++++--- pym/portage/__init__.py | 45 +++++++++----- pym/repoman/checks.py | 4 +- 8 files changed, 155 insertions(+), 45 deletions(-) diff --git a/bin/ebuild-helpers/doins b/bin/ebuild-helpers/doins index fc5642421..d4a277aa6 100755 --- a/bin/ebuild-helpers/doins +++ b/bin/ebuild-helpers/doins @@ -26,7 +26,7 @@ if [[ ${INSDESTTREE#${D}} != "${INSDESTTREE}" ]]; then fi case "$EAPI" in - 0|1|2|3) + 0|1|2|3|3_pre2) PRESERVE_SYMLINKS=n ;; *) diff --git a/bin/ebuild-helpers/newins b/bin/ebuild-helpers/newins index af5166c7a..d1756df95 100755 --- a/bin/ebuild-helpers/newins +++ b/bin/ebuild-helpers/newins @@ -15,7 +15,7 @@ fi rm -rf "${T}/${2}" || exit $? case "$EAPI" in - 0|1|2|3) + 0|1|2|3|3_pre2) cp "$1" "$T/$2" || exit $? ;; *) diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 7b33dda8a..97fb2e20d 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -150,7 +150,7 @@ useq() { # Skip this for older EAPIs since lots of ebuilds/eclasses # have stuff in global scope that really belongs somewhere # like pkg_setup or src_configure. - if [[ -n $EAPI ]] && ! hasq "$EAPI" 0 1 2 3 ; then + if [[ -n $EAPI ]] && ! hasq "$EAPI" 0 1 2 3 3_pre2 ; then die "use() called during invalid phase: $EBUILD_PHASE" fi @@ -445,7 +445,7 @@ unpack() { _unpack_tar lzma ;; xz) - if hasq $eapi 0 1 2 3 ; then + if hasq $eapi 0 1 2 ; then vecho "unpack ${x}: file format not recognized. Ignoring." else _unpack_tar xz @@ -507,7 +507,7 @@ econf() { fi # EAPI=3 adds --disable-dependency-tracking to econf - if ! hasq "$EAPI" 0 1 2 3 ; then + if ! hasq "$EAPI" 0 1 2 3 3_pre2 ; then set -- --disable-dependency-tracking "$@" fi @@ -918,7 +918,7 @@ dyn_prepare() { if [[ -d $S ]] ; then cd "${S}" - elif hasq $EAPI 0 1 2 3; then + elif hasq $EAPI 0 1 2 3 3_pre2 ; then cd "${WORKDIR}" elif [[ -z ${A} ]] && ! has_phase_defined_up_to prepare; then cd "${WORKDIR}" @@ -949,7 +949,7 @@ dyn_configure() { if [[ -d $S ]] ; then cd "${S}" - elif hasq $EAPI 0 1 2 3; then + elif hasq $EAPI 0 1 2 3 3_pre2 ; then cd "${WORKDIR}" elif [[ -z ${A} ]] && ! has_phase_defined_up_to configure; then cd "${WORKDIR}" @@ -982,7 +982,7 @@ dyn_compile() { if [[ -d $S ]] ; then cd "${S}" - elif hasq $EAPI 0 1 2 3; then + elif hasq $EAPI 0 1 2 3 3_pre2 ; then cd "${WORKDIR}" elif [[ -z ${A} ]] && ! has_phase_defined_up_to compile; then cd "${WORKDIR}" @@ -1059,7 +1059,7 @@ dyn_install() { mkdir "${PORTAGE_BUILDDIR}/image" if [[ -d $S ]] ; then cd "${S}" - elif hasq $EAPI 0 1 2 3; then + elif hasq $EAPI 0 1 2 3 3_pre2 ; then cd "${WORKDIR}" elif [[ -z ${A} ]] && ! has_phase_defined_up_to install; then cd "${WORKDIR}" @@ -1416,7 +1416,7 @@ _ebuild_arg_to_phase() { case "$arg" in pretend) - ! hasq $eapi 0 1 2 3 && \ + ! hasq $eapi 0 1 2 3 3_pre2 && \ phase_func=pkg_pretend ;; setup) @@ -1512,7 +1512,7 @@ _ebuild_phase_funcs() { declare -F src_compile >/dev/null || \ src_compile() { _eapi2_src_compile "$@" ; } - has $eapi 2 3 || declare -F src_install >/dev/null || \ + has $eapi 2 3 3_pre2 || declare -F src_install >/dev/null || \ src_install() { _eapi4_src_install "$@" ; } if hasq $phase_func $default_phases ; then @@ -1868,7 +1868,7 @@ if ! hasq "$EBUILD_PHASE" clean cleanrm ; then [[ -n $EAPI ]] || EAPI=0 - if has "$EAPI" 0 1 2 3 ; then + if has "$EAPI" 0 1 2 3 3_pre2 ; then export RDEPEND=${RDEPEND-${DEPEND}} debug-print "RDEPEND: not set... Setting to: ${DEPEND}" fi @@ -1888,7 +1888,7 @@ if ! hasq "$EBUILD_PHASE" clean cleanrm ; then pkg_nofetch pkg_postinst pkg_postrm pkg_preinst pkg_prerm pkg_setup src_test src_unpack" ;; - 2|3) + 2|3|3_pre2) _valid_phases="src_compile pkg_config src_configure pkg_info src_install pkg_nofetch pkg_postinst pkg_postrm pkg_preinst src_prepare pkg_prerm pkg_setup src_test src_unpack" diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh index ff0a198df..6063d9e1d 100755 --- a/bin/isolated-functions.sh +++ b/bin/isolated-functions.sh @@ -54,7 +54,7 @@ dump_trace() { } nonfatal() { - if has "${EAPI:-0}" 0 1 2 3; then + if has "${EAPI:-0}" 0 1 2 3 3_pre2 ; then die "$FUNCNAME() not supported in this EAPI" fi if [[ $# -lt 1 ]]; then diff --git a/doc/package/ebuild/eapi/3.docbook b/doc/package/ebuild/eapi/3.docbook index 7be24f29c..7bab213bb 100644 --- a/doc/package/ebuild/eapi/3.docbook +++ b/doc/package/ebuild/eapi/3.docbook @@ -1,15 +1,102 @@ -
-EAPI 3_pre1 -
+
+EAPI 3_pre2 +
Helpers -
+
unpack -
+
Support for the xz file extension -The xz file extension is now supported. +The unpack helper now supports the xz file extension.
+
+Support for installation prefix +
+Helpers + +Beginning with EAPI 3, all helpers use ${ED} instead of ${D} +when appropriate. For example, see econf and einstall below. + +
+econf + +${ECONF_SOURCE:-.}/configure \ + --prefix="${EPREFIX}"/usr \ + --host="${EPREFIX}${CHOST} \ + --mandir="${EPREFIX}"/usr/share/man \ + --infodir="${EPREFIX}"/usr/share/info \ + --datadir="${EPREFIX}"/usr/share \ + --sysconfdir="${EPREFIX}"/etc \ + --localstatedir="${EPREFIX}"/var/lib \ + ${EXTRA_ECONF} \ + configure options || die "econf failed" + +
+
+einstall + +Note that, for make-based packages, 'emake install DESTDIR=${D}' (with +DESTDIR=${D} rather than ${ED}) is still preferred over einstall. + + +make \ + prefix=${ED}/usr \ + datadir=${ED}/usr/share \ + infodir=${ED}/usr/share/info \ + localstatedir=${ED}/var/lib \ + mandir=${ED}/usr/share/man \ + sysconfdir=${ED}/etc \ + ${EXTRA_EINSTALL} \ + make options \ + install + +
+
+
+Variables +Installation Prefix Variables + + + + + + Variable Name + Description + + + + + ED + Contains the path + "${D%/}${EPREFIX}/" for convenience purposes. + For EAPI values prior to EAPI 3 which do not + support ${ED}, helpers use ${D} where they would + otherwise use ${ED}. Do not modify this variable. + + + + EPREFIX + Contains the offset + that this Portage was configured for during + installation. The offset is sometimes necessary + in an ebuild or eclass, and is available in such + cases as ${EPREFIX}. EPREFIX does not contain a + trailing slash, therefore an absent offset is + represented by the empty string. Do not modify + this variable. + + + EROOT + Contains + "${ROOT%/}${EPREFIX}/" for convenience purposes. + Do not modify this variable. + + + +
+
+
diff --git a/man/ebuild.5 b/man/ebuild.5 index a229bf90a..44279e3d4 100644 --- a/man/ebuild.5 +++ b/man/ebuild.5 @@ -103,7 +103,8 @@ Contains the path to the 'files' sub folder in the package specific location in the portage tree. Do not modify this variable. .TP .B EPREFIX -Contains the offset that this Portage was configured for during +Beginning with \fBEAPI 3\fR, contains the offset +that this Portage was configured for during installation. The offset is sometimes necessary in an ebuild or eclass, and is available in such cases as ${EPREFIX}. EPREFIX does not contain a trailing slash, therefore an absent offset is represented by the empty @@ -122,13 +123,19 @@ whatever you like. \fBD\fR = \fI"${PORTAGE_TMPDIR}/portage/${CATEGORY}/${PF}/image/"\fR Contains the path to the temporary \fIinstall directory\fR. Every write operation that does not involve the helper tools and functions (found below) -should be prefixed with ${D}. Often the offset prefix needs to be taken -into account here, for which the variable ${ED} is provided (see below). +should be prefixed with ${D}. +Beginning with \fBEAPI 3\fR, the offset prefix often needs +to be taken into account here, for which the variable +${ED} is provided (see below). Do not modify this variable. .TP \fBED\fT = \fI"${PORTAGE_TMPDIR}/portage/${CATEGORY}/${PF}/image/${EPREFIX}/"\fR -Contains the path "${D%/}${EPREFIX}/" for convenience purposes. Do not -modify this variable. +Beginning with \fBEAPI 3\fR, contains the path +"${D%/}${EPREFIX}/" for convenience purposes. +For \fBEAPI\fR values prior to \fBEAPI 3\fR which do +not support \fB${ED}\fR, helpers use \fB${D}\fR where +they would otherwise use \fB${ED}\fR. +Do not modify this variable. .TP .B PORTAGE_LOG_FILE Contains the path of the build log. If \fBPORT_LOGDIR\fR variable is unset then @@ -142,8 +149,9 @@ into account here, for which the variable ${EROOT} is provided (see below). Do not modify this variable. .TP \fBEROOT\fR = \fI"${ROOT%/}${EPREFIX}/"\fR -Contains "${ROOT%/}${EPREFIX}/" for convenience purposes. Do not modify -this variable. +Beginning with \fBEAPI 3\fR, contains +"${ROOT%/}${EPREFIX}/" for convenience +purposes. Do not modify this variable. .TP \fBDESCRIPTION\fR = \fI"A happy little package"\fR Should contain a short description of the package. @@ -789,6 +797,8 @@ Note that the \fIEXTRA_ECONF\fR is for users only, not for ebuild writers. If you wish to pass more options to configure, just pass the extra arguments to \fBeconf\fR. Also note that \fBeconf\fR automatically calls \fBdie\fR if the configure script fails. +Beginning with \fBEAPI 3\fR, \fBeconf\fR uses the \fB${EPREFIX}\fR +variable which is disregared for prior \fBEAPI\fR values. .TP \fBemake\fR \fI[make options]\fR This is used as a replacement for make. Performs 'make ${MAKEOPTS} diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 8562da917..ace5d53d3 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -1413,7 +1413,7 @@ class config(object): # in it's bashrc (causing major leakage). _environ_whitelist += [ "ACCEPT_LICENSE", "BASH_ENV", "BUILD_PREFIX", "D", - "DISTDIR", "DOC_SYMLINKS_DIR", "EBUILD", + "DISTDIR", "DOC_SYMLINKS_DIR", "EAPI", "EBUILD", "EBUILD_EXIT_STATUS_FILE", "EBUILD_FORCE_TEST", "EBUILD_PHASE", "ECLASSDIR", "ECLASS_DEPTH", "ED", "EMERGE_FROM", "EPREFIX", "EROOT", @@ -3796,7 +3796,7 @@ class config(object): mydict["USE"] = self.get("PORTAGE_USE", "") # Don't export AA to the ebuild environment in EAPIs that forbid it - if eapi not in ("0", "1", "2", "3"): + if eapi not in ("0", "1", "2", "3", "3_pre2"): mydict.pop("AA", None) # sandbox's bashrc sources /etc/profile which unsets ROOTPATH, @@ -5662,7 +5662,7 @@ def spawnebuild(mydo, actionmap, mysettings, debug, alwaysdep=0, if mydo == "prepare" and eapi in ("0", "1"): return os.EX_OK - if mydo == "pretend" and eapi in ("0", "1", "2", "3"): + if mydo == "pretend" and eapi in ("0", "1", "2", "3", "3_pre2"): return os.EX_OK kwargs = actionmap[mydo]["args"] @@ -6092,7 +6092,7 @@ def _spawn_misc_sh(mysettings, commands, phase=None, **kwargs): return rval -_testing_eapis = frozenset() +_testing_eapis = frozenset(["3_pre2"]) _deprecated_eapis = frozenset(["3_pre1", "2_pre3", "2_pre2", "2_pre1"]) def _eapi_is_deprecated(eapi): @@ -6315,7 +6315,7 @@ def doebuild_environment(myebuild, mydo, myroot, mysettings, debug, use_cache, m mysettings["PORTAGE_BUILDDIR"], ".exit_status") #set up KV variable -- DEP SPEEDUP :: Don't waste time. Keep var persistent. - if eapi not in ('0', '1', '2', '3'): + if eapi not in ('0', '1', '2', '3', '3_pre2'): # Discard KV for EAPIs that don't support it. Cache KV is restored # from the backupenv whenever config.reset() is called. mysettings.pop('KV', None) @@ -7687,18 +7687,31 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None, else: # Prevent mtime from rounding up to the next second. int_mtime = sstat[stat.ST_MTIME] - mtime_str = "%i.9999999" % int_mtime - min_len = len(str(int_mtime)) + 2 - while True: - mtime_str = mtime_str[:-1] - newmtime = float(mtime_str) - if int_mtime == long(newmtime): - break - elif len(mtime_str) <= min_len: - # This shouldn't happen, but let's make sure - # we can never have an infinite loop. - newmtime = int_mtime + mtime_str = "%i." % int_mtime + digits = 0 + max_digits = 9 + while digits < max_digits: + if int_mtime == long(float(mtime_str + "9")): + mtime_str += "9" + digits += 1 + else: + if digits < max_digits: + another_digit = None + for i in range(1, 9): + i_str = str(i) + if int_mtime != \ + long(float(mtime_str + i_str)): + break + else: + another_digit = i_str + if another_digit is not None: + mtime_str += another_digit + digits += 1 break + if digits > 0: + newmtime = float(mtime_str) + else: + newmtime = int_mtime os.utime(dest, (newmtime, newmtime)) newmtime = sstat[stat.ST_MTIME] diff --git a/pym/repoman/checks.py b/pym/repoman/checks.py index ce72e36ea..3156894f6 100644 --- a/pym/repoman/checks.py +++ b/pym/repoman/checks.py @@ -436,7 +436,7 @@ class Eapi4IncompatibleFuncs(LineCheck): self.eapi = pkg.metadata['EAPI'] def check_eapi(self, eapi): - return self.eapi not in ('0', '1', '2', '3') + return self.eapi not in ('0', '1', '2', '3', '3_pre2') def check(self, num, line): m = self.banned_commands_re.match(line) @@ -453,7 +453,7 @@ class Eapi4GoneVars(LineCheck): self.eapi = pkg.metadata['EAPI'] def check_eapi(self, eapi): - return self.eapi not in ('0', '1', '2', '3') + return self.eapi not in ('0', '1', '2', '3', '3_pre2') def check(self, num, line): m = self.undefined_vars_re.match(line) -- 2.26.2