Merged from trunk -r15032:15043
authorFabian Groffen <grobian@gentoo.org>
Fri, 18 Dec 2009 08:19:05 +0000 (08:19 -0000)
committerFabian Groffen <grobian@gentoo.org>
Fri, 18 Dec 2009 08:19:05 +0000 (08:19 -0000)
   | 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
bin/ebuild-helpers/newins
bin/ebuild.sh
bin/isolated-functions.sh
doc/package/ebuild/eapi/3.docbook
man/ebuild.5
pym/portage/__init__.py
pym/repoman/checks.py

index fc5642421cb86304573a0a9353d6e22b41d92d57..d4a277aa63e900dd2b5f19ad4125e138f30c3560 100755 (executable)
@@ -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
                ;;
        *)
index af5166c7a9147f3bcf8f6987fa8c77a8753824f4..d1756df959275093380f8a3deadcfc1813aab232 100755 (executable)
@@ -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 $?
                ;;
        *)
index 7b33dda8a80cb42b06b05351d3963cacb3ba3032..97fb2e20de842af705412328525ce881a7f26a8c 100755 (executable)
@@ -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"
index ff0a198df87675c92f1b587b417994fd95e7eae5..6063d9e1de696f988ac8a3e5b616592f297c1146 100755 (executable)
@@ -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
index 7be24f29cd3cee869e7e8263f66942fa24e08efc..7bab213bb28fa55b4bac7f9fa4ac27c0b9d98763 100644 (file)
-<section id='package-ebuild-eapi-3_pre1'>
-<title>EAPI 3_pre1</title>
-<section id='package-ebuild-eapi-3_pre1-helpers'>
+<section id='package-ebuild-eapi-3_pre2'>
+<title>EAPI 3_pre2</title>
+<section id='package-ebuild-eapi-3_pre2-helpers'>
 <title>Helpers</title>
-<section id='package-ebuild-eapi-3_pre1-helpers-unpack'>
+<section id='package-ebuild-eapi-3_pre2-helpers-unpack'>
 <title>unpack</title>
-<section id='package-ebuild-eapi-3_pre1-helpers-unpack-xz'>
+<section id='package-ebuild-eapi-3_pre2-helpers-unpack-xz'>
 <title>Support for the xz file extension</title>
 <para>
-The xz file extension is now supported.
+The unpack helper now supports the xz file extension.
 </para>
 </section>
 </section>
 </section>
+<section id='package-ebuild-eapi-3_pre2-prefix'>
+<title>Support for installation prefix</title>
+<section id='package-ebuild-eapi-3_pre2-prefix-helpers'>
+<title>Helpers</title>
+<para>
+Beginning with EAPI 3, all helpers use ${ED} instead of ${D}
+when appropriate. For example, see econf and einstall below.
+</para>
+<section id='package-ebuild-eapi-3_pre2-prefix-helpers-econf'>
+<title>econf</title>
+<programlisting>
+${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"
+</programlisting>
+</section>
+<section id='package-ebuild-eapi-3_pre2-prefix-helpers-einstall'>
+<title>einstall</title>
+<para>
+Note that, for make-based packages, 'emake install DESTDIR=${D}' (with
+DESTDIR=${D} rather than ${ED}) is still preferred over einstall.
+</para>
+<programlisting>
+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
+</programlisting>
+</section>
+</section>
+<section id='package-ebuild-eapi-3_pre2-prefix-variables'>
+<title>Variables</title>
+<table><title>Installation Prefix Variables</title>
+       <tgroup cols='2' align='left' >
+       <colspec colname='name'/>
+       <colspec colname='description'/>
+       <thead>
+       <row>
+               <entry>Variable Name</entry>
+               <entry>Description</entry>
+       </row>
+       </thead>
+       <tbody>
+       <row>
+               <entry>ED</entry>
+               <entry>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.
+               </entry>
+       </row>
+       <row>
+               <entry>EPREFIX</entry>
+               <entry>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. </entry>
+       </row>
+       <row>
+               <entry>EROOT</entry>
+               <entry>Contains
+               "${ROOT%/}${EPREFIX}/" for convenience purposes.
+               Do not modify this variable. </entry>
+       </row>
+       </tbody>
+       </tgroup>
+</table>
+</section>
+</section>
 </section>
index a229bf90ae9cb2ca836db0bd00612fc43a4d0c56..44279e3d4e7439aef24b45d355055d8cbff627b6 100644 (file)
@@ -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}
index 8562da917a741237299aa3bbeca242f3e30a71bd..ace5d53d353c1437550f35a0d77a55b7815f07f3 100644 (file)
@@ -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]
index ce72e36eaca529c7c2782af40c2e88417a817904..3156894f6feb18995c0f35271f7457df38082f57 100644 (file)
@@ -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)