From 02ce3978c67dd68a515e389c417c2360ec68e256 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Tue, 5 Aug 2008 20:13:21 +0000 Subject: [PATCH] Merged from trunk 11322:11332 | 11323 | Make dblink.unmerge() succeed even when ebuild phases are | | zmedico | unsuccessful because the current behavior is even worse | | | (results in orphan files). Thanks to Arfrever for this patch | | | (UnsupportedAPIException hunk by me). | | 11324 | Insert extra newline before status messages, since that's | | zmedico | how it used to be. | | 11325 | Make the status display say "Emerging" and "Emerging binary" | | zmedico | instead of "Building" and "Extracting". Thanks to Joe | | | Peterson for the suggestion (including extra newlines from | | | previous commit). | | 11326 | Remove code from bug #223447 which is now obsolete due to | | zmedico | depclean using the depgraph class. | | 11327 | Bug #233735 - Add support for src_configure and default_* | | zmedico | functions with new EAPI=2_pre2. Thanks to Arfrever Frehtes | | | Taifersar Arahesis for the initial patch which I've made a | | | few adjustments to. | | 11328 | Add some docs for EAPI 2_pre2. | | zmedico | | | 11329 | Remove the use.local.desc IUSE validation which is now | | zmedico | replaced by glep56 metadata.xml validation. This was | | | requested by Cardoe since he expects to complete the gleep56 | | | conversion process pretty soon. | | 11330 | Remove unused parse_use_local_desc() function. | | zmedico | | | 11331 | When there is no build log to display, it means that fetch | | zmedico | failed, so display the fetch log in that case. | | 11332 | Make doebuild() display manifest verification failures for | | zmedico | each corrupt ebuild rather than just the first one. | svn path=/main/branches/prefix/; revision=11334 --- bin/ebuild | 2 +- bin/ebuild.sh | 241 +++++++++++++++++++++--------- bin/isolated-functions.sh | 9 +- bin/repoman | 32 +--- doc/package/ebuild/eapi/2.docbook | 70 ++++++++- pym/_emerge/__init__.py | 89 +++++++---- pym/portage/__init__.py | 109 +++++++++----- pym/portage/const.py | 3 +- pym/portage/dbapi/vartree.py | 12 +- pym/repoman/utilities.py | 22 --- 10 files changed, 383 insertions(+), 206 deletions(-) diff --git a/bin/ebuild b/bin/ebuild index 0e48ab8e6..03fbe08a2 100755 --- a/bin/ebuild +++ b/bin/ebuild @@ -185,7 +185,7 @@ if opts.skip_manifest: tmpsettings.backup_changes("EBUILD_SKIP_MANIFEST") portage._doebuild_manifest_exempt_depend += 1 -build_dir_phases = set(["setup", "unpack", "compile", +build_dir_phases = set(["setup", "unpack", "configure", "compile", "test", "install", "package", "rpm"]) def stale_env_warning(): diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 137582316..ea3f5ac16 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -583,7 +583,7 @@ einstall() { fi } -pkg_nofetch() { +_default_pkg_nofetch() { [ -z "${SRC_URI}" ] && return echo "!!! The following are listed in SRC_URI for ${PN}:" @@ -593,22 +593,25 @@ pkg_nofetch() { done } -src_unpack() { +_default_src_unpack() { [[ -n ${A} ]] && unpack ${A} } -src_compile() { +_default_src_configure() { if [ "${EAPI:-0}" == 0 ] ; then [ -x ./configure ] && econf elif [ -x "${ECONF_SOURCE:-.}/configure" ] ; then econf fi +} + +_default_src_compile() { if [ -f Makefile ] || [ -f GNUmakefile ] || [ -f makefile ]; then emake || die "emake failed" fi } -src_test() { +_default_src_test() { if emake -j1 check -n &> /dev/null; then vecho ">>> Test phase [check]: ${CATEGORY}/${PF}" if ! emake -j1 check; then @@ -626,11 +629,32 @@ src_test() { fi } +pkg_nofetch() { + _default_pkg_nofetch +} + +src_unpack() { + _default_src_unpack +} + +src_compile() { + hasq "$EAPI" 0 1 2_pre1 && \ + _default_src_configure + + _default_src_compile +} + src_install() { - # this avoids misc errors in prefix because it doesn't exist - # by default - mkdir -p "${ED}" - return + if hasq "$EAPI" prefix; then + # this avoids misc errors in prefix because it doesn't exist + # by default + mkdir -p "${ED}" + return + fi +} + +src_test() { + _default_src_test } ebuild_phase() { @@ -829,6 +853,12 @@ abort_handler() { trap SIGINT SIGQUIT } +abort_configure() { + abort_handler src_configure $1 + rm -f "$PORTAGE_BUILDDIR/.configured" + exit 1 +} + abort_compile() { abort_handler "src_compile" $1 rm -f "${PORTAGE_BUILDDIR}/.compiled" @@ -847,72 +877,45 @@ abort_install() { exit 1 } -dyn_compile() { - trap "abort_compile" SIGINT SIGQUIT - - [ "$(type -t pre_src_compile)" == "function" ] && qa_call pre_src_compile +dyn_configure() { + hasq "$EAPI" 0 1 2_pre1 && return 0 - [ "${CFLAGS-unset}" != "unset" ] && export CFLAGS - [ "${CXXFLAGS-unset}" != "unset" ] && export CXXFLAGS - [ "${LIBCFLAGS-unset}" != "unset" ] && export LIBCFLAGS - [ "${LIBCXXFLAGS-unset}" != "unset" ] && export LIBCXXFLAGS - [ "${LDFLAGS-unset}" != "unset" ] && export LDFLAGS - [ "${ASFLAGS-unset}" != "unset" ] && export ASFLAGS + if [[ $PORTAGE_BUILDDIR/.configured -nt $WORKDIR ]] ; then + vecho ">>> It appears that '$PF' is already configured; skipping." + vecho ">>> Remove '$PORTAGE_BUILDDIR/.configured' to force configuration." + return 0 + fi - [ "${CCACHE_DIR-unset}" != "unset" ] && export CCACHE_DIR - [ "${CCACHE_SIZE-unset}" != "unset" ] && export CCACHE_SIZE + trap abort_configure SIGINT SIGQUIT - [ "${DISTCC_DIR-unset}" == "unset" ] && export DISTCC_DIR="${PORTAGE_TMPDIR}/.distcc" - [ ! -z "${DISTCC_DIR}" ] && addwrite "${DISTCC_DIR}" + [[ $(type -t pre_src_configure) = function ]] && \ + qa_call pre_src_configure - LIBDIR_VAR="LIBDIR_${ABI}" - if [ -z "${PKG_CONFIG_PATH}" -a -n "${ABI}" -a -n "${!LIBDIR_VAR}" ]; then - export PKG_CONFIG_PATH="${EPREFIX}/usr/${!LIBDIR_VAR}/pkgconfig" - fi - unset LIBDIR_VAR + vecho ">>> Configuring source in $srcdir ..." + ebuild_phase src_configure + vecho ">>> Source configured." + #|| abort_configure "fail" + cd "$PORTAGE_BUILDDIR" + touch .configured + [[ $(type -t post_src_configure) = function ]] && \ + qa_call post_src_configure - if hasq noauto $FEATURES && [ ! -f ${PORTAGE_BUILDDIR}/.unpacked ]; then - echo - echo "!!! We apparently haven't unpacked... This is probably not what you" - echo "!!! want to be doing... You are using FEATURES=noauto so I'll assume" - echo "!!! that you know what you are doing... You have 5 seconds to abort..." - echo + trap SIGINT SIGQUIT +} - local x - for x in 1 2 3 4 5 6 7 8; do - echo -ne "\a" - LC_ALL=C sleep 0.25 - done +dyn_compile() { - sleep 3 + if [[ $PORTAGE_BUILDDIR/.compiled -nt $WORKDIR ]] ; then + vecho ">>> It appears that '${PF}' is already compiled; skipping." + vecho ">>> Remove '$PORTAGE_BUILDDIR/.compiled' to force compilation." + return 0 fi - local srcdir=${PORTAGE_BUILDDIR} - cd "${PORTAGE_BUILDDIR}" - if [ ! -e "build-info" ]; then - mkdir build-info - fi - cp "${EBUILD}" "build-info/${PF}.ebuild" + trap abort_compile SIGINT SIGQUIT + + [[ $(type -t pre_src_compile) = function ]] && \ + qa_call pre_src_compile - if [[ ${PORTAGE_BUILDDIR}/.compiled -nt ${WORKDIR} ]] ; then - vecho ">>> It appears that '${PF}' is already compiled; skipping." - vecho ">>> Remove '${PORTAGE_BUILDDIR}/.compiled' to force compilation." - trap SIGINT SIGQUIT - [ "$(type -t post_src_compile)" == "function" ] && qa_call post_src_compile - return - fi - if [ -d "${S}" ]; then - srcdir=${S} - else - srcdir=${WORKDIR} - fi - cd "${srcdir}" - #our custom version of libtool uses $S and $ED to fix - #invalid paths in .la files - export S ED - #some packages use an alternative to $S to build in, cause - #our libtool to create problematic .la files - export PWORKDIR="$WORKDIR" vecho ">>> Compiling source in ${srcdir} ..." ebuild_phase src_compile vecho ">>> Source compiled." @@ -1067,8 +1070,9 @@ dyn_help() { echo " digest : create a manifest file for the package" echo " manifest : create a manifest file for the package" echo " unpack : unpack/patch sources (auto-fetch if needed)" - echo " compile : compile sources (auto-fetch/unpack if needed)" - echo " test : test package (auto-fetch/unpack/compile if needed)" + echo " configure : configure sources (auto-fetch/unpack if needed)" + echo " compile : compile sources (auto-fetch/unpack/configure if needed)" + echo " test : test package (auto-fetch/unpack/configure/compile if needed)" echo " preinst : execute pre-install instructions" echo " postinst : execute post-install instructions" echo " install : install the package to the temporary install directory" @@ -1358,13 +1362,39 @@ remove_path_entry() { PATH="${stripped_path}" } +# @FUNCTION: source_all_bashrcs +# @DESCRIPTION: +# Source a relevant bashrc files and perform other miscellaneous +# environment initialization when appropriate: +# +# * If EAPI is set, define default_* functions provided by the current EAPI. +# source_all_bashrcs() { [ -n "$EBUILD_PHASE" ] || return + local x + local default_phases="pkg_nofetch src_unpack src_configure + src_compile src_test" + + if [[ -n $EAPI ]] && ! hasq "$EAPI" 0 1 2_pre1 ; then + for x in $default_phases ; do + eval "default_$x() { _default_$x \"\$@\" ; }" + done + + [[ $(type -t src_configure) = function ]] || \ + src_configure() { _default_src_configure "$@" ; } + + else + for x in $default_phases ; do + eval "default_$x() { + die \"default_$x() is not supported with EAPI='$EAPI'\" + }" + done + fi + local OCC="${CC}" OCXX="${CXX}" # source the existing profile.bashrc's. save_IFS IFS=$'\n' - local x for x in ${PROFILE_PATHS}; do # Must unset it so that it doesn't mess up assumptions in the RCs. unset IFS @@ -1725,6 +1755,10 @@ if ! hasq ${EBUILD_PHASE} clean && \ debug-print "RDEPEND: not set... Setting to: ${DEPEND}" fi + # Set default EAPI if necessary, so that most + # code can simply assume that it's defined. + [[ -n $EAPI ]] || EAPI=0 + # add in dependency info from eclasses IUSE="${IUSE} ${E_IUSE}" DEPEND="${DEPEND} ${E_DEPEND}" @@ -1764,7 +1798,11 @@ if [ "${EBUILD_PHASE}" != "depend" ] ; then declare -r ${READONLY_EBUILD_METADATA} ${READONLY_PORTAGE_VARS} fi -if [ -n "${EBUILD_SH_ARGS}" ] ; then +ebuild_main() { + local f x + local export_vars="ASFLAGS CCACHE_DIR CCACHE_SIZE + CFLAGS CXXFLAGS LDFLAGS LIBCFLAGS LIBCXXFLAGS" + case ${EBUILD_SH_ARGS} in nofetch) ebuild_phase_with_hooks pkg_nofetch @@ -1794,12 +1832,71 @@ if [ -n "${EBUILD_SH_ARGS}" ] ; then ) fi ;; - unpack|compile|test|clean|install) - if [ "${SANDBOX_DISABLED="0"}" == "0" ]; then + unpack|configure|compile|test|clean|install) + if [[ ${SANDBOX_DISABLED:-0} = 0 ]] ; then export SANDBOX_ON="1" else export SANDBOX_ON="0" fi + + case "$EBUILD_SH_ARGS" in + configure|compile) + + for x in $export_vars ; do + [[ ${!x-unset} != unset ]] && export $x + done + + hasq distcc $FEATURES && [[ -n $DISTCC_DIR ]] && \ + [[ ${SANDBOX_WRITE/$DISTCC_DIR} = $SANDBOX_WRITE ]] && \ + addwrite "$DISTCC_DIR" + + x=LIBDIR_$ABI + [ -z "$PKG_CONFIG_PATH" -a -n "$ABI" -a -n "${!x}" ] && \ + export PKG_CONFIG_PATH=/usr/${!x}/pkgconfig + + if hasq noauto $FEATURES && \ + [[ ! -f $PORTAGE_BUILDDIR/.unpacked ]] ; then + echo + echo "!!! We apparently haven't unpacked..." \ + "This is probably not what you" + echo "!!! want to be doing... You are using" \ + "FEATURES=noauto so I'll assume" + echo "!!! that you know what you are doing..." \ + "You have 5 seconds to abort..." + echo + + local x + for x in 1 2 3 4 5 6 7 8; do + echo -ne "\a" + LC_ALL=C sleep 0.25 + done + + sleep 3 + fi + + cd "$PORTAGE_BUILDDIR" + if [ ! -d build-info ] ; then + mkdir build-info + cp "$EBUILD" "build-info/$PF.ebuild" + fi + + local srcdir + if [[ -d $S ]] ; then + srcdir=$S + else + srcdir=$WORKDIR + fi + cd "$srcdir" + #our custom version of libtool uses $S and $D to fix + #invalid paths in .la files + export S D + #some packages use an alternative to $S to build in, cause + #our libtool to create problematic .la files + export PWORKDIR=$WORKDIR + + ;; + esac + if [ "${PORTAGE_DEBUG}" != "1" ] || [ "${-/x/}" != "$-" ]; then dyn_${EBUILD_SH_ARGS} else @@ -1865,7 +1962,9 @@ if [ -n "${EBUILD_SH_ARGS}" ] ; then esac [ -n "${EBUILD_EXIT_STATUS_FILE}" ] && \ touch "${EBUILD_EXIT_STATUS_FILE}" &>/dev/null -fi +} + +[[ -n $EBUILD_SH_ARGS ]] && ebuild_main # Save the env only for relevant phases. if [ -n "${EBUILD_SH_ARGS}" ] && \ diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh index 8e43de36b..9ada80c63 100755 --- a/bin/isolated-functions.sh +++ b/bin/isolated-functions.sh @@ -514,13 +514,16 @@ save_ebuild_env() { best_version use_with use_enable register_die_hook check_KV \ keepdir unpack strip_duplicate_slashes econf einstall \ dyn_setup dyn_unpack dyn_clean into insinto exeinto docinto \ - insopts diropts exeopts libopts abort_handler abort_compile \ - abort_test abort_install dyn_compile dyn_test dyn_install \ + insopts diropts exeopts libopts \ + abort_handler abort_configure abort_compile \ + abort_test abort_install dyn_configure \ + dyn_compile dyn_test dyn_install \ dyn_preinst dyn_help debug-print debug-print-function \ debug-print-section inherit EXPORT_FUNCTIONS newdepend newrdepend \ newpdepend do_newdepend remove_path_entry \ save_ebuild_env filter_readonly_variables preprocess_ebuild_env \ - source_all_bashrcs ebuild_phase ebuild_phase_with_hooks \ + source_all_bashrcs ebuild_main \ + ebuild_phase ebuild_phase_with_hooks \ ${QA_INTERCEPTORS} # portage config variables and variables set directly by portage diff --git a/bin/repoman b/bin/repoman index 148222d4e..830948ec1 100755 --- a/bin/repoman +++ b/bin/repoman @@ -563,28 +563,6 @@ for x in range(0, repolevel - 1): def caterror(mycat): err(mycat+" is not an official category. Skipping QA checks in this directory.\nPlease ensure that you add "+catdir+" to "+repodir+"/profiles/categories\nif it is a new category.") -# retreive local USE list -luselist={} -try: - f = open(os.path.join(portdir, "profiles", "use.local.desc")) - utilities.parse_use_local_desc(f, luselist) - f.close() -except (IOError, OSError, ParseError), e: - logging.exception("Couldn't read from use.local.desc") - sys.exit(1) - -if portdir_overlay != portdir: - filename = os.path.join(portdir_overlay, "profiles", "use.local.desc") - if os.path.exists(filename): - try: - f = open(filename) - utilities.parse_use_local_desc(f, luselist) - f.close() - except (IOError, OSError, ParseError), e: - logging.exception("Couldn't read from '%s'" % (filename,)) - sys.exit(1) - del filename - # setup a uselist from portage uselist=[] try: @@ -1375,13 +1353,6 @@ for x in scanlist: if myuse[mypos] and (myuse[mypos] in muselist): del myuse[mypos] - # uselist checks - local - mykey = portage.dep_getkey(catpkg) - if mykey in luselist: - for mypos in range(len(myuse)-1,-1,-1): - if myuse[mypos] and (myuse[mypos] in luselist[mykey]): - del myuse[mypos] - if default_use and eapi == "0": for myflag in default_use: stats['EAPI.incompatible'] += 1 @@ -1433,7 +1404,8 @@ for x in scanlist: portage.dep.paren_reduce(myaux["RESTRICT"]), matchall=1) except portage.exception.InvalidDependString, e: stats["RESTRICT.syntax"] = stats["RESTRICT.syntax"] + 1 - fails["RESTRICT.syntax"].append(mykey+".ebuild RESTRICT: "+str(e)) + fails["RESTRICT.syntax"].append( + "%s: RESTRICT: %s" % (relative_path, e)) del e if myrestrict: myrestrict = set(portage.flatten(myrestrict)) diff --git a/doc/package/ebuild/eapi/2.docbook b/doc/package/ebuild/eapi/2.docbook index 2b1fa5698..dc2e0dc0a 100644 --- a/doc/package/ebuild/eapi/2.docbook +++ b/doc/package/ebuild/eapi/2.docbook @@ -1,4 +1,4 @@ - + EAPI 2_pre1 Helpers @@ -97,3 +97,71 @@ + + EAPI 2_pre2 + + Phases + + New src_configure Phase Function + + The configure portion of the src_compile function has been + split into a separate function which is named src_configure. The + src_configure function is called in between the src_unpack and + src_compile functions. + + Execution Order of Phase Functions + + + + + Phase Function Name + + + + + pkg_setup + + + src_unpack + + + src_configure + + + src_compile + + + src_test + + + src_install + + + pkg_preinst + + + pkg_postinst + + + pkg_prerm + + + pkg_postrm + + + +
+
+ + Default Phase Functions + + Each of the default src_* phase functions is now accessible + via a function having a name that begins with default_ and + ends with the respective phase function name. For example, + a call to a function with the name default_src_compile is + equivalent to a call to the default src_compile + implementation. + + +
+
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index 53193b210..fb10d0ad5 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -2614,7 +2614,7 @@ class EbuildExecuter(CompositeTask): __slots__ = ("pkg", "scheduler", "settings") + ("_tree",) - _phases = ("compile", "test", "install") + _phases = ("configure", "compile", "test", "install") _live_eclasses = frozenset([ "cvs", @@ -3471,10 +3471,10 @@ class MergeListItem(CompositeTask): world_atom = self.world_atom ldpath_mtimes = mtimedb["ldpath"] - action_desc = "Building" + action_desc = "Emerging" preposition = "for" if pkg.type_name == "binary": - action_desc = "Extracting" + action_desc += " binary" if build_opts.fetchonly: action_desc = "Fetching" @@ -5764,11 +5764,6 @@ class depgraph(object): pkgsettings = self.pkgsettings[myroot] final_db = self.mydbapi[myroot] - graph_complete_for_root = "complete" in self.myparams or \ - (myroot == self.target_root and \ - ("deep" in self.myparams or "empty" in self.myparams) and \ - not self._required_set_names.difference(self._sets)) - blocker_cache = BlockerCache(myroot, vardb) stale_cache = set(blocker_cache) for pkg in vardb: @@ -5792,18 +5787,11 @@ class depgraph(object): # # * KEYWORDS is not empty (not installed by old portage). # - # * The graph is complete and the package has not been - # pulled into the dependency graph. It's eligible for - # depclean, but depclean may fail to recognize it as - # such due to differences in visibility filtering which - # can lead to differences in || dep evaluation. - # TODO: Share visibility code to fix this inconsistency. if pkg in final_db: if pkg_in_graph and not visible(pkgsettings, pkg): self._masked_installed.add(pkg) - elif graph_complete_for_root and \ - pkgsettings._getMissingKeywords( + elif pkgsettings._getMissingKeywords( pkg.cpv, pkg.metadata) and \ pkg.metadata["KEYWORDS"].split() and \ not pkg_in_graph: @@ -8847,7 +8835,8 @@ class Scheduler(PollScheduler): emergelog(self.xterm_titles, *pargs, **kwargs) class _failed_pkg(SlotObject): - __slots__ = ("log_path", "pkg", "returncode") + __slots__ = ("build_dir", "build_log", + "fetch_log", "pkg", "returncode") def __init__(self, settings, trees, mtimedb, myopts, spinner, mergelist, favorites, digraph): @@ -9469,19 +9458,40 @@ class Scheduler(PollScheduler): # If only one package failed then just show it's # whole log for easy viewing. failed_pkg = self._failed_pkgs_all[-1] - log_path = failed_pkg.log_path - if log_path is not None: + build_dir = failed_pkg.build_dir + log_file = None + + log_paths = [failed_pkg.build_log] + + if not (build_dir and os.path.isdir(build_dir)): + log_paths.append(failed_pkg.fetch_log) + + for log_path in log_paths: + if not log_path: + continue + + try: + log_size = os.stat(log_path).st_size + except OSError: + continue + + if log_size == 0: + continue + try: log_file = open(log_path, 'rb') except IOError: - pass - else: - try: - for line in log_file: - writemsg_level(line, noiselevel=-1) - finally: - log_file.close() - failure_log_shown = True + continue + + break + + if log_file is not None: + try: + for line in log_file: + writemsg_level(line, noiselevel=-1) + finally: + log_file.close() + failure_log_shown = True if background and not failure_log_shown and \ self._failed_pkgs_all and \ @@ -9550,9 +9560,16 @@ class Scheduler(PollScheduler): def _do_merge_exit(self, merge): pkg = merge.merge.pkg if merge.returncode != os.EX_OK: - log_path = merge.merge.settings.get("PORTAGE_LOG_FILE") + settings = merge.merge.settings + build_dir = settings.get("PORTAGE_BUILDDIR") + build_log = settings.get("PORTAGE_LOG_FILE") + fetch_log = self._fetch_Log + self._failed_pkgs.append(self._failed_pkg( - log_path=log_path, pkg=pkg, returncode=merge.returncode)) + build_dir=build_dir, build_log=build_log, + fetch_log=fetch_log, pkg=pkg, + returncode=merge.returncode)) + self._status_display.failed = len(self._failed_pkgs) return @@ -9587,9 +9604,16 @@ class Scheduler(PollScheduler): self._task_queues.merge.add(merge) self._status_display.merges = len(self._task_queues.merge) else: - log_path = build.settings.get("PORTAGE_LOG_FILE") + settings = build.settings + build_dir = settings.get("PORTAGE_BUILDDIR") + fetch_log = self._fetch_log + build_log = settings.get("PORTAGE_LOG_FILE") + self._failed_pkgs.append(self._failed_pkg( - log_path=log_path, pkg=build.pkg, returncode=build.returncode)) + build_dir=build_dir, build_log=build_log, + fetch_log=fetch_log, pkg=build.pkg, + returncode=build.returncode)) + self._status_display.failed = len(self._failed_pkgs) self._deallocate_config(build.settings) self._jobs -= 1 @@ -9857,7 +9881,8 @@ class Scheduler(PollScheduler): @type msg: str @param msg: a brief status message (no newlines allowed) """ - + if not self._background: + writemsg_level("\n") self._status_display.displayMessage(msg) def _save_resume_list(self): diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index cc3fdec92..c8080200d 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -4591,7 +4591,7 @@ def eapi_is_supported(eapi): eapi.remove(prop) # now check if what's left is supported (can) - properties = [ "2_pre1" ] # another clumpsy solution + properties = [ "2_pre2", "2_pre1" ] # another clumpsy solution for i in range(portage.const.EAPI + 1): properties.append(str(i)) @@ -5027,7 +5027,8 @@ def _doebuild_exit_status_unlink(exit_status_file): os.unlink(exit_status_file) _doebuild_manifest_exempt_depend = 0 -_doebuild_manifest_checked = None +_doebuild_manifest_cache = None +_doebuild_broken_ebuilds = set() _doebuild_broken_manifests = set() def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0, @@ -5092,7 +5093,8 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0, actionmap_deps={ "setup": [], "unpack": ["setup"], - "compile":["unpack"], + "configure": ["unpack"], + "compile":["configure"], "test": ["compile"], "install":["test"], "rpm": ["install"], @@ -5113,7 +5115,8 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0, validcommands = ["help","clean","prerm","postrm","cleanrm","preinst","postinst", "config", "info", "setup", "depend", "fetch", "fetchall", "digest", - "unpack","compile","test","install","rpm","qmerge","merge", + "unpack", "configure", "compile", "test", + "install", "rpm", "qmerge", "merge", "package","unmerge", "manifest"] if mydo not in validcommands: @@ -5144,45 +5147,72 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0, mydo not in ("digest", "manifest", "help") and \ not _doebuild_manifest_exempt_depend: # Always verify the ebuild checksums before executing it. + global _doebuild_manifest_cache, _doebuild_broken_ebuilds, \ + _doebuild_broken_ebuilds + + if myebuild in _doebuild_broken_ebuilds: + return 1 + pkgdir = os.path.dirname(myebuild) manifest_path = os.path.join(pkgdir, "Manifest") - global _doebuild_manifest_checked, _doebuild_broken_manifests - if manifest_path in _doebuild_broken_manifests: - return 1 + # Avoid checking the same Manifest several times in a row during a # regen with an empty cache. - if _doebuild_manifest_checked != manifest_path: + if _doebuild_manifest_cache is None or \ + _doebuild_manifest_cache.getFullname() != manifest_path: + _doebuild_manifest_cache = None if not os.path.exists(manifest_path): - writemsg("!!! Manifest file not found: '%s'\n" % manifest_path, - noiselevel=-1) - _doebuild_broken_manifests.add(manifest_path) + out = portage.output.EOutput() + out.eerror("Manifest not found for '%s'" % (myebuild,)) + _doebuild_broken_ebuilds.add(myebuild) return 1 mf = Manifest(pkgdir, mysettings["DISTDIR"]) - try: - mf.checkTypeHashes("EBUILD") - except portage.exception.FileNotFound, e: - writemsg("!!! A file listed in the Manifest " + \ - "could not be found: %s\n" % str(e), noiselevel=-1) - _doebuild_broken_manifests.add(manifest_path) - return 1 - except portage.exception.DigestException, e: - writemsg("!!! Digest verification failed:\n", noiselevel=-1) - writemsg("!!! %s\n" % e.value[0], noiselevel=-1) - writemsg("!!! Reason: %s\n" % e.value[1], noiselevel=-1) - writemsg("!!! Got: %s\n" % e.value[2], noiselevel=-1) - writemsg("!!! Expected: %s\n" % e.value[3], noiselevel=-1) - _doebuild_broken_manifests.add(manifest_path) - return 1 - # Make sure that all of the ebuilds are actually listed in the - # Manifest. + + else: + mf = _doebuild_manifest_cache + + try: + mf.checkFileHashes("EBUILD", os.path.basename(myebuild)) + except KeyError: + out = portage.output.EOutput() + out.eerror("Missing digest for '%s'" % (myebuild,)) + _doebuild_broken_ebuilds.add(myebuild) + return 1 + except portage.exception.FileNotFound: + out = portage.output.EOutput() + out.eerror("A file listed in the Manifest " + \ + "could not be found: '%s'" % (myebuild,)) + _doebuild_broken_ebuilds.add(myebuild) + return 1 + except portage.exception.DigestException, e: + out = portage.output.EOutput() + out.eerror("Digest verification failed:") + out.eerror("%s" % e.value[0]) + out.eerror("Reason: %s" % e.value[1]) + out.eerror("Got: %s" % e.value[2]) + out.eerror("Expected: %s" % e.value[3]) + _doebuild_broken_ebuilds.add(myebuild) + return 1 + + if mf.getFullname() in _doebuild_broken_manifests: + return 1 + + if mf is not _doebuild_manifest_cache: + + # Make sure that all of the ebuilds are + # actually listed in the Manifest. for f in os.listdir(pkgdir): if f.endswith(".ebuild") and not mf.hasFile("EBUILD", f): - writemsg("!!! A file is not listed in the " + \ - "Manifest: '%s'\n" % os.path.join(pkgdir, f), - noiselevel=-1) + f = os.path.join(pkgdir, f) + if f not in _doebuild_broken_ebuilds: + out = portage.output.EOutput() + out.eerror("A file is not listed in the " + \ + "Manifest: '%s'" % (f,)) _doebuild_broken_manifests.add(manifest_path) return 1 - _doebuild_manifest_checked = manifest_path + + # Only cache it if the above stray files test succeeds. + _doebuild_manifest_cache = mf def exit_status_check(retval): if retval != os.EX_OK: @@ -5667,13 +5697,14 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0, # args are for the to spawn function actionmap = { -"setup": {"cmd":ebuild_sh, "args":{"droppriv":0, "free":1, "sesandbox":0, "fakeroot":0}}, -"unpack": {"cmd":ebuild_sh, "args":{"droppriv":droppriv, "free":0, "sesandbox":sesandbox, "fakeroot":0}}, -"compile":{"cmd":ebuild_sh, "args":{"droppriv":droppriv, "free":nosandbox, "sesandbox":sesandbox, "fakeroot":0}}, -"test": {"cmd":ebuild_sh, "args":{"droppriv":droppriv, "free":nosandbox, "sesandbox":sesandbox, "fakeroot":0}}, -"install":{"cmd":ebuild_sh, "args":{"droppriv":0, "free":0, "sesandbox":sesandbox, "fakeroot":fakeroot}}, -"rpm": {"cmd":misc_sh, "args":{"droppriv":0, "free":0, "sesandbox":0, "fakeroot":fakeroot}}, -"package":{"cmd":misc_sh, "args":{"droppriv":0, "free":0, "sesandbox":0, "fakeroot":fakeroot}}, +"setup": {"cmd":ebuild_sh, "args":{"droppriv":0, "free":1, "sesandbox":0, "fakeroot":0}}, +"unpack": {"cmd":ebuild_sh, "args":{"droppriv":droppriv, "free":0, "sesandbox":sesandbox, "fakeroot":0}}, +"configure":{"cmd":ebuild_sh, "args":{"droppriv":droppriv, "free":nosandbox, "sesandbox":sesandbox, "fakeroot":0}}, +"compile": {"cmd":ebuild_sh, "args":{"droppriv":droppriv, "free":nosandbox, "sesandbox":sesandbox, "fakeroot":0}}, +"test": {"cmd":ebuild_sh, "args":{"droppriv":droppriv, "free":nosandbox, "sesandbox":sesandbox, "fakeroot":0}}, +"install": {"cmd":ebuild_sh, "args":{"droppriv":0, "free":0, "sesandbox":sesandbox, "fakeroot":fakeroot}}, +"rpm": {"cmd":misc_sh, "args":{"droppriv":0, "free":0, "sesandbox":0, "fakeroot":fakeroot}}, +"package": {"cmd":misc_sh, "args":{"droppriv":0, "free":0, "sesandbox":0, "fakeroot":fakeroot}}, } # merge the deps in so we have again a 'full' actionmap diff --git a/pym/portage/const.py b/pym/portage/const.py index 8a80ffdbf..20bdbccbc 100644 --- a/pym/portage/const.py +++ b/pym/portage/const.py @@ -79,7 +79,8 @@ INCREMENTALS = ["USE", "USE_EXPAND", "USE_EXPAND_HIDDEN", "FEATURES", "ACCEPT_KEYWORDS", "ACCEPT_LICENSE", "CONFIG_PROTECT_MASK", "CONFIG_PROTECT", "PRELINK_PATH", "PRELINK_PATH_MASK", "PROFILE_ONLY_VARIABLES"] -EBUILD_PHASES = ["setup", "unpack", "compile", "test", "install", +EBUILD_PHASES = ["setup", "unpack", "configure", + "compile", "test", "install", "package", "preinst", "postinst","prerm", "postrm", "other"] diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 593439d52..7696bcc8b 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -1757,10 +1757,12 @@ class dblink(object): writemsg("!!! FAILED prerm: %s\n" % \ os.path.join(self.dbdir, "EAPI"), noiselevel=-1) writemsg("%s\n" % str(e), noiselevel=-1) - return 1 - catdir = os.path.dirname(self.settings["PORTAGE_BUILDDIR"]) - ensure_dirs(os.path.dirname(catdir), - uid=portage_uid, gid=portage_gid, mode=070, mask=0) + myebuildpath = None + else: + catdir = os.path.dirname(self.settings["PORTAGE_BUILDDIR"]) + ensure_dirs(os.path.dirname(catdir), uid=portage_uid, + gid=portage_gid, mode=070, mask=0) + builddir_lock = None catdir_lock = None scheduler = self._scheduler @@ -1793,7 +1795,6 @@ class dblink(object): # XXX: Decide how to handle failures here. if retval != os.EX_OK: writemsg("!!! FAILED prerm: %s\n" % retval, noiselevel=-1) - return retval self._unmerge_pkgfiles(pkgfiles, others_in_slot) @@ -1815,7 +1816,6 @@ class dblink(object): # XXX: Decide how to handle failures here. if retval != os.EX_OK: writemsg("!!! FAILED postrm: %s\n" % retval, noiselevel=-1) - return retval # regenerate reverse NEEDED map self.vartree.dbapi.linkmap.rebuild() diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py index c32f69fed..b537536bf 100644 --- a/pym/repoman/utilities.py +++ b/pym/repoman/utilities.py @@ -91,28 +91,6 @@ def have_profile_dir(path, maxdepth=3): path = normalize_path(path + "/..") maxdepth -= 1 - -def parse_use_local_desc(mylines, usedict=None): - """ - Records are of the form PACKAGE:FLAG - DESC - returns a dict of the form {cpv:set(flags)}""" - if usedict is None: - usedict = {} - for line_num, l in enumerate(mylines): - if not l or l.startswith('#'): - continue - pkg_flag = l.split(None, 1) # None implies splitting on whitespace - if not pkg_flag: - continue - try: - pkg, flag = pkg_flag[0].split(":") - except ValueError: - raise exception.ParseError("line %d: Malformed input: '%s'" % \ - (line_num + 1, l.rstrip("\n"))) - usedict.setdefault(pkg, set()) - usedict[pkg].add(flag) - return usedict - def parse_metadata_use(mylines, uselist=None): """ Records are wrapped in XML as per GLEP 56 -- 2.26.2