Merged from trunk 8542:8585
authorFabian Groffen <grobian@gentoo.org>
Wed, 21 Nov 2007 19:15:44 +0000 (19:15 -0000)
committerFabian Groffen <grobian@gentoo.org>
Wed, 21 Nov 2007 19:15:44 +0000 (19:15 -0000)
   | 8543    | Don't unset ${S} inside save_ebuild_env().                   |
   | zmedico |                                                              |

   | 8559    | * Remove bogus "ci" mode. * Sync "scan" mode description     |
   | zmedico | with 2.1.2 branch.                                           |

   | 8569    | Move preinst IMAGE initialzation before bashrc handling.     |
   | zmedico |                                                              |

   | 8573    | Clean up some local variables that are needlessly saved in   |
   | zmedico | the environment.                                             |

   | 8575    | Move environment saving from dyn_compile() to dyn_install()  |
   | zmedico | so that state from src_install() is saved.                   |

   | 8577    | Generate an eerror elog message when an ebuild prerm or      |
   | zmedico | postrm phase fails.                                          |

   | 8578    | Fix the diefunc overlay message so that it doesn't trigger   |
   | zmedico | falsely in prerm or postrm.                                  |

   | 8581    | * Make save_ebuild_env() filter some more variables. * Make  |
   | zmedico | dyn_install() filter S when it's no longer needed.           |

   | 8583    | In dyn_install(), don't cleanse S from the global            |
   | zmedico | environment, in case the user wants to repeat the phase      |
   |         | (like with FEATURES=noauto and the ebuild command). Only     |
   |         | cleanse it from environment.bz2.                             |

   | 8585    | Replace usage of the "myarg" global variable with the        |
   | zmedico | equivalent readonly EBUILD_SH_ARGS variable.                 |

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

bin/ebuild.sh
bin/isolated-functions.sh
bin/repoman
man/repoman.1
pym/_emerge/__init__.py
pym/portage/dbapi/vartree.py

index c5206e5ba4d82b09fc930d6bf6980f904944c30a..209029cc72ee67f2a016d656ce1bbed9b69d485b 100755 (executable)
@@ -63,6 +63,10 @@ source "${PORTAGE_BIN_PATH}/isolated-functions.sh"  &>/dev/null
 OCC="$CC"
 OCXX="$CXX"
 
+# Set IMAGE for minimal backward compatibility with
+# overlays or user's bashrc, but don't export it.
+[ "${EBUILD_PHASE}" == "preinst" ] && IMAGE=${D}
+
 [[ $PORTAGE_QUIET != "" ]] && export PORTAGE_QUIET
 
 # the sandbox is disabled by default except when overridden in the relevant stages
@@ -303,15 +307,19 @@ keepdir() {
        local x
        if [ "$1" == "-R" ] || [ "$1" == "-r" ]; then
                shift
-               find "$@" -type d -printf "${ED}%p/.keep_${CATEGORY}_${PN}-${SLOT}\n" | tr "\n" "\0" | $XARGS -0 -n100 touch || die "Failed to recursively create .keep files"
+               find "$@" -type d -printf "${ED}%p/.keep_${CATEGORY}_${PN}-${SLOT}\n" \
+                       | tr "\n" "\0" | ${XARGS} -0 -n100 touch || \
+                       die "Failed to recursively create .keep files"
        else
                for x in "$@"; do
-                       touch "${ED}${x}/.keep_${CATEGORY}_${PN}-${SLOT}" || die "Failed to create .keep in ${ED}${x}"
+                       touch "${ED}${x}/.keep_${CATEGORY}_${PN}-${SLOT}" || \
+                               die "Failed to create .keep in ${ED}${x}"
                done
        fi
 }
 
 unpack() {
+       local srcdir
        local x
        local y
        local myfail
@@ -377,6 +385,9 @@ unpack() {
                        LHa|LHA|lha|lzh)
                                lha xfq "${srcdir}${x}" || die "$myfail"
                                ;;
+                       a)
+                               ar x "${srcdir}${x}" || die "$myfail"
+                               ;;
                        deb)
                                # Unpacking .deb archives can not always be done with
                                # `ar`.  For instance on AIX this doesn't work out.  If
@@ -390,9 +401,6 @@ unpack() {
                                        ar x "${srcdir}/${x}" || die "$myfail"
                                fi
                                ;;
-                       a)
-                               ar x "${srcdir}${x}" || die "$myfail"
-                               ;;
                        lzma)
                                if [ "${y}" == "tar" ]; then
                                        lzma -dc "${srcdir}${x}" | tar xof - ${tar_opts}
@@ -919,10 +927,10 @@ dyn_compile() {
        fi
        if [ -d "${S}" ]; then
                srcdir=${S}
-               cd "${S}"
        else
-               cd "${WORKDIR}"
+               srcdir=${WORKDIR}
        fi
+       cd "${srcdir}"
        #our custom version of libtool uses $S and $ED to fix
        #invalid paths in .la files
        export S ED
@@ -935,30 +943,6 @@ dyn_compile() {
        #|| abort_compile "fail"
        cd "${PORTAGE_BUILDDIR}"
        touch .compiled
-       cd build-info
-
-       set -f
-       for f in ASFLAGS CATEGORY CBUILD CC CFLAGS CHOST CTARGET CXX \
-               CXXFLAGS DEPEND EXTRA_ECONF EXTRA_EINSTALL EXTRA_MAKE \
-               FEATURES INHERITED IUSE LDFLAGS LIBCFLAGS LIBCXXFLAGS \
-               LICENSE PDEPEND PF PKGUSE PROVIDE RDEPEND RESTRICT SLOT \
-               KEYWORDS HOMEPAGE SRC_URI DESCRIPTION EPREFIX ; do
-               [ -n "${!f}" ] && echo $(echo "${!f}" | tr '\n,\r,\t' ' , , ' | sed s/'  \+'/' '/g) > ${f}
-       done
-       echo "${USE}"           > USE
-       echo "${EAPI:-0}"       > EAPI
-       set +f
-
-       save_ebuild_env > environment
-       bzip2 -f9 environment
-
-       cp "${EBUILD}" "${PF}.ebuild"
-       [ -n "${PORTAGE_REPO_NAME}" ]  && echo "${PORTAGE_REPO_NAME}" > repository
-       if hasq nostrip ${FEATURES} ${RESTRICT} || hasq strip ${RESTRICT}
-       then
-               touch DEBUGBUILD
-       fi
-
        [ "$(type -t post_src_compile)" == "function" ] && qa_call post_src_compile
 
        trap SIGINT SIGQUIT
@@ -1035,6 +1019,42 @@ dyn_install() {
        vecho
        cd ${PORTAGE_BUILDDIR}
        [ "$(type -t post_src_install)" == "function" ] && qa_call post_src_install
+
+       cd "${PORTAGE_BUILDDIR}"/build-info
+       set -f
+       local f
+       for f in ASFLAGS CATEGORY CBUILD CC CFLAGS CHOST CTARGET CXX \
+               CXXFLAGS DEPEND EXTRA_ECONF EXTRA_EINSTALL EXTRA_MAKE \
+               FEATURES INHERITED IUSE LDFLAGS LIBCFLAGS LIBCXXFLAGS \
+               LICENSE PDEPEND PF PKGUSE PROVIDE RDEPEND RESTRICT SLOT \
+               KEYWORDS HOMEPAGE SRC_URI DESCRIPTION; do
+               [ -n "${!f}" ] && echo $(echo "${!f}" | \
+                       tr '\n,\r,\t' ' , , ' | sed s/'  \+'/' '/g) > ${f}
+       done
+       echo "${USE}"       > USE
+       echo "${EAPI:-0}"   > EAPI
+       set +f
+
+       # local variables can leak into the saved environment.
+       unset f
+
+       (
+               # To avoid environment.bz2 bloat, cleanse variables that are
+               # are no longer needed after src_install(). Don't cleanse from
+               # the global environment though, in case the user wants to repeat
+               # this phase (like with FEATURES=noauto and the ebuild command).
+               unset S
+       
+               save_ebuild_env > environment
+       )
+       bzip2 -f9 environment
+
+       cp "${EBUILD}" "${PF}.ebuild"
+       [ -n "${PORTAGE_REPO_NAME}" ]  && echo "${PORTAGE_REPO_NAME}" > repository
+       if hasq nostrip ${FEATURES} ${RESTRICT} || hasq strip ${RESTRICT}
+       then
+               touch DEBUGBUILD
+       fi
        trap SIGINT SIGQUIT
 }
 
@@ -1454,8 +1474,9 @@ save_ebuild_env() {
                        KV LAST_E_CMD LAST_E_LEN LD_PRELOAD MOPREFIX \
                        NORMAL O PATH PKGDIR PKGUSE PKG_LOGDIR PKG_TMPDIR \
                        PORTAGE_ACTUAL_DISTDIR PORTAGE_ARCHLIST PORTAGE_BASHRC \
-                       PORTAGE_BINHOST_CHUNKSIZE PORTAGE_BUILDDIR PORTAGE_CALLER \
-                       PORTAGE_COLORMAP PORTAGE_CONFIGROOT \
+                       PORTAGE_BINHOST_CHUNKSIZE PORTAGE_BINPKG_TMPFILE \
+                       PORTAGE_BUILDDIR PORTAGE_CALLER \
+                       PORTAGE_COLORMAP PORTAGE_CONFIGROOT PORTAGE_DEBUG \
                        PORTAGE_DEPCACHEDIR PORTAGE_ELOG_CLASSES PORTAGE_ELOG_MAILFROM \
                        PORTAGE_ELOG_MAILSUBJECT PORTAGE_ELOG_MAILURI PORTAGE_ELOG_SYSTEM \
                        PORTAGE_GID PORTAGE_GPG_DIR PORTAGE_GPG_KEY PORTAGE_INST_GID \
@@ -1469,7 +1490,7 @@ save_ebuild_env() {
                        RC_INDENTATION READONLY_EBUILD_METADATA READONLY_PORTAGE_VARS \
                        RESUMECOMMAND RESUMECOMMAND_HTTP \
                        RESUMECOMMAND_HTTP RESUMECOMMAND_SFTP ROOT ROOTPATH RPMDIR \
-                       S STARTDIR SYNC TMP TMPDIR USE_EXPAND \
+                       STARTDIR SYNC TMP TMPDIR USE_EXPAND \
                        USE_EXPAND_HIDDEN USE_ORDER WARN XARGS
 
                set
@@ -1591,11 +1612,7 @@ if hasq ${EBUILD_PHASE} setup prerm && [ ! -f "${T}/environment" ]; then
        fi
 fi
 
-# Set IMAGE for minimal backward compatibility with
-# overlays or user's bashrc, but don't export it.
-[ "${EBUILD_PHASE}" == "preinst" ] && IMAGE=${D}
-
-if hasq ${EBUILD_PHASE} clean ; then
+if hasq ${EBUILD_SH_ARGS} clean ; then
        true
 elif ! hasq ${EBUILD_PHASE} depend && [ -f "${T}"/environment ] ; then
        source "${T}"/environment
@@ -1681,30 +1698,32 @@ if [ "${EBUILD_PHASE}" != "depend" ] ; then
        unset x
 fi
 
-for myarg in ${EBUILD_SH_ARGS} ; do
-       case $myarg in
+if [ -n "${EBUILD_SH_ARGS}" ] ; then
+       case ${EBUILD_SH_ARGS} in
        nofetch)
                qa_call pkg_nofetch
                exit 1
                ;;
        prerm|postrm|postinst|config|info)
-               if [ "${myarg}" == "info" ] && \
-                       [ "$(type -t pkg_${myarg})" != "function" ]; then
-                       ewarn  "pkg_${myarg}() is not defined: '${EBUILD##*/}'"
+               if [ "${EBUILD_SH_ARGS}" == "info" ] && \
+                       [ "$(type -t pkg_${EBUILD_SH_ARGS})" != "function" ]; then
+                       ewarn  "pkg_${EBUILD_SH_ARGS}() is not defined: '${EBUILD##*/}'"
                        continue
                fi
                export SANDBOX_ON="0"
-               if [ "$PORTAGE_DEBUG" != "1" ]; then
-                       [ "$(type -t pre_pkg_${myarg})" == "function" ] && qa_call pre_pkg_${myarg}
-                       qa_call pkg_${myarg}
-                       [ "$(type -t post_pkg_${myarg})" == "function" ] && qa_call post_pkg_${myarg}
-                       #Allow non-zero return codes since they can be caused by &&
+               if [ "${PORTAGE_DEBUG}" != "1" ] || [ "${-/x/}" != "$-" ]; then
+                       [ "$(type -t pre_pkg_${EBUILD_SH_ARGS})" == "function" ] && \
+                               qa_call pre_pkg_${EBUILD_SH_ARGS}
+                       qa_call pkg_${EBUILD_SH_ARGS}
+                       [ "$(type -t post_pkg_${EBUILD_SH_ARGS})" == "function" ] && \
+                               qa_call post_pkg_${EBUILD_SH_ARGS}
                else
                        set -x
-                       [ "$(type -t pre_pkg_${myarg})" == "function" ] && qa_call pre_pkg_${myarg}
-                       qa_call pkg_${myarg}
-                       [ "$(type -t post_pkg_${myarg})" == "function" ] && qa_call post_pkg_${myarg}
-                       #Allow non-zero return codes since they can be caused by &&
+                       [ "$(type -t pre_pkg_${EBUILD_SH_ARGS})" == "function" ] && \
+                               qa_call pre_pkg_${EBUILD_SH_ARGS}
+                       qa_call pkg_${EBUILD_SH_ARGS}
+                       [ "$(type -t post_pkg_${EBUILD_SH_ARGS})" == "function" ] && \
+                               qa_call post_pkg_${EBUILD_SH_ARGS}
                        set +x
                fi
                ;;
@@ -1714,13 +1733,11 @@ for myarg in ${EBUILD_SH_ARGS} ; do
                else
                        export SANDBOX_ON="0"
                fi
-               if [ "$PORTAGE_DEBUG" != "1" ]; then
-                       dyn_${myarg}
-                       #Allow non-zero return codes since they can be caused by &&
+               if [ "${PORTAGE_DEBUG}" != "1" ] || [ "${-/x/}" != "$-" ]; then
+                       dyn_${EBUILD_SH_ARGS}
                else
                        set -x
-                       dyn_${myarg}
-                       #Allow non-zero return codes since they can be caused by &&
+                       dyn_${EBUILD_SH_ARGS}
                        set +x
                fi
                export SANDBOX_ON="0"
@@ -1730,11 +1747,11 @@ for myarg in ${EBUILD_SH_ARGS} ; do
                #for example, awking and piping a file in /tmp requires a temp file to be created
                #in /etc.  If pkg_setup is in the sandbox, both our lilo and apache ebuilds break.
                export SANDBOX_ON="0"
-               if [ "$PORTAGE_DEBUG" != "1" ]; then
-                       dyn_${myarg}
+               if [ "${PORTAGE_DEBUG}" != "1" ] || [ "${-/x/}" != "$-" ]; then
+                       dyn_${EBUILD_SH_ARGS}
                else
                        set -x
-                       dyn_${myarg}
+                       dyn_${EBUILD_SH_ARGS}
                        set +x
                fi
                ;;
@@ -1775,24 +1792,17 @@ for myarg in ${EBUILD_SH_ARGS} ; do
                ;;
        *)
                export SANDBOX_ON="1"
-               echo "Please specify a valid command."
+               echo "Unrecognized EBUILD_SH_ARGS: '${EBUILD_SH_ARGS}'"
                echo
                dyn_help
                exit 1
                ;;
        esac
-
-       #if [ $? -ne 0 ]; then
-       #       exit 1
-       #fi
-done
+fi
 
 # Save the env only for relevant phases.
-if [ -n "${myarg}" ] && \
-       ! hasq ${myarg} clean help info ; then
-       # Do not save myarg in the env, or else the above [ -n "$myarg" ] test will
-       # give a false positive when ebuild.sh is sourced.
-       unset myarg
+if [ -n "${EBUILD_SH_ARGS}" ] && \
+       ! hasq ${EBUILD_SH_ARGS} clean help info; then
        # Save current environment and touch a success file. (echo for success)
        umask 002
        save_ebuild_env > "${T}/environment" 2>/dev/null
index 1449528cd14a7e751cdf2ad4a15f1b7a1f121e38..743a1187fce05f0c3fdc3b6d6593229215d23917 100755 (executable)
@@ -96,6 +96,7 @@ diefunc() {
                done
        fi
        if [ "${EMERGE_FROM}" != "binary" ] && \
+               ! hasq ${EBUILD_PHASE} prerm postrm && \
                [ "${EBUILD#${PORTDIR}/}" == "${EBUILD}" ] ; then
                local overlay=${EBUILD%/*}
                overlay=${overlay%/*}
index bd4048a614122c3244a4c7586a5751ba4cc92de3..6fd5e9b321db5fb505fe0ce7eb2a590d4d1d89e4 100755 (executable)
@@ -128,7 +128,6 @@ def ParseArgs(args, qahelp):
 
        modes = {
                'commit' : 'Run a scan then commit changes',
-               'ci' : 'Run a scan then commit changes',
                'fix' : 'Fix simple QA issues (stray digests, missing digests)',
                'full' : 'Scan directory tree and print all issues (not a summary)',
                'help' : 'Show this screen',
index 5b12962b78416f7afca810a03ea3d5c3519425b9..f213b9adf99e49772cf3efbe97405831017f08c7 100644 (file)
@@ -60,7 +60,7 @@ Remember report from last run
 Show this screen
 .TP
 .B scan
-Scan directory tree for QA issues
+Scan directory tree for QA issues (short listing)
 .TP
 .B fix
 Fix simple QA issues (stray digests, missing digests)
index 45065cb2c9f17d51d466838f698b12d5784c976b..6bc1bddb81f91cfee9a0541f6a923564f9be97ef 100644 (file)
@@ -4832,33 +4832,12 @@ def unmerge(root_config, myopts, unmerge_action,
                                vartree=vartree, ldpath_mtimes=ldpath_mtimes)
                        if retval != os.EX_OK:
                                emergelog(xterm_titles, " !!! unmerge FAILURE: "+y)
-                               ebuild = vartree.dbapi.findname(y)
-                               show_unmerge_failure_message(y, ebuild, retval)
                                sys.exit(retval)
                        else:
                                sets["world"].cleanPackage(vartree.dbapi, y)
                                emergelog(xterm_titles, " >>> unmerge success: "+y)
        return 1
 
-def show_unmerge_failure_message(pkg, ebuild, retval):
-
-       from formatter import AbstractFormatter, DumbWriter
-       f = AbstractFormatter(DumbWriter(sys.stderr, maxcol=72))
-
-       msg = []
-       msg.append("A removal phase of the '%s' package " % pkg)
-       msg.append("has failed with exit value %s.  " % retval)
-       msg.append("The problem occurred while executing ")
-       msg.append("the ebuild located at '%s'.  " % ebuild)
-       msg.append("If necessary, manually remove the ebuild " )
-       msg.append("in order to skip the execution of removal phases.")
-
-       f.end_paragraph(1)
-       for x in msg:
-               f.add_flowing_data(x)
-       f.end_paragraph(1)
-       f.writer.flush()
-
 def chk_updated_info_files(root, infodirs, prev_mtimes, retval):
 
        if os.path.exists(EPREFIX+"/usr/bin/install-info"):
index 7f90a8e33b4b24d2b377113a21fed4d279daf929..d6e14311020f20b336d8bc2622a1e8b8cc598548 100644 (file)
@@ -1071,6 +1071,7 @@ class dblink(object):
                # Now, don't assume that the name of the ebuild is the same as the
                # name of the dir; the package may have been moved.
                myebuildpath = None
+               ebuild_phase = "prerm"
                mystuff = listdir(self.dbdir, EmptyOnError=1)
                for x in mystuff:
                        if x.endswith(".ebuild"):
@@ -1127,6 +1128,7 @@ class dblink(object):
                        self.vartree.dbapi.plib_registry.unregister(self.mycpv, self.settings["SLOT"], self.settings["COUNTER"])
 
                        if myebuildpath:
+                               ebuild_phase = "postrm"
                                retval = doebuild(myebuildpath, "postrm", self.myroot,
                                         self.settings, use_cache=0, tree="vartree",
                                         mydbapi=self.vartree.dbapi, vartree=self.vartree)
@@ -1143,6 +1145,19 @@ class dblink(object):
                        if builddir_lock:
                                try:
                                        if myebuildpath:
+                                               if retval != os.EX_OK:
+                                                       msg = ("The '%s' " % ebuild_phase) + \
+                                                       ("phase of the '%s' package " % self.mycpv) + \
+                                                       ("has failed with exit value %s. " % retval) + \
+                                                       "The problem occurred while executing " + \
+                                                       ("the ebuild located at '%s'. " % myebuildpath) + \
+                                                       "If necessary, manually remove the ebuild " + \
+                                                       "in order to skip the execution of removal phases."
+                                                       from portage.elog.messages import eerror
+                                                       from textwrap import wrap
+                                                       for l in wrap(msg, 72):
+                                                               eerror(l, phase=ebuild_phase, key=self.mycpv)
+
                                                # process logs created during pre/postrm
                                                elog_process(self.mycpv, self.settings, phasefilter=filter_unmergephases)
                                                if retval == os.EX_OK: