From 0afa27887f55668d47d1e57587432dfc4829c1c6 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Sun, 18 Oct 2009 13:29:15 +0000 Subject: [PATCH] Merged from trunk -r14635:14667 | 14660 | Ind SetConfig.getSetAtoms(), don't assume the set has a | | zmedico | 'creator' attribute, since if sets.conf is corrupt then | | | emerge generates fallback sets without the 'creator' | | | attribute. | | 14662 | Preserve variables which have been set in global scope | | arfrever | using 'declare'. | | 14663 | Remove reference to non-existent _source_ebuild function. | | zmedico | | | 14664 | Fix breakage in DEFINED_PHASES code. | | zmedico | | | 14665 | Add a --use-ebuild-visibility option, for using unbuilt | | zmedico | ebuild metadata in visibility checks for built ebuilds. | | | Thanks to Sebastian Mingramm (few) for reporting the | | | problem and testing the patch. | | 14666 | Warn aabout default world and system set configuration | | zmedico | being used when sets.conf is corrupt. Thanks to Thanks to | | | Sebastian Mingramm (few) for the suggestion. | | 14667 | Convert --select to boolean True when enabled, so --resume | | zmedico | code handles it like other boolean options. | svn path=/main/branches/prefix/; revision=14671 --- bin/ebuild.sh | 127 +++++++++++++++++------------------ bin/isolated-functions.sh | 5 +- man/emerge.1 | 4 ++ pym/_emerge/depgraph.py | 4 +- pym/_emerge/help.py | 6 ++ pym/_emerge/main.py | 14 ++++ pym/portage/sets/__init__.py | 5 +- 7 files changed, 95 insertions(+), 70 deletions(-) diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 57f25b2f5..4d843d1ed 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -1654,8 +1654,8 @@ PORTAGE_MUTABLE_FILTERED_VARS="AA HOSTNAME" # variables out and discards them. See bug #190128. filter_readonly_variables() { local x filtered_vars - local readonly_bash_vars="DIRSTACK EUID FUNCNAME GROUPS - PIPESTATUS PPID SHELLOPTS UID" + local readonly_bash_vars="BASHPID DIRSTACK EUID FUNCNAME + GROUPS PIPESTATUS PPID SHELLOPTS UID" local filtered_sandbox_vars="SANDBOX_ACTIVE SANDBOX_BASHRC SANDBOX_DEBUG_LOG SANDBOX_DISABLED SANDBOX_LIB SANDBOX_LOG SANDBOX_ON" @@ -1838,78 +1838,75 @@ if ! hasq "$EBUILD_PHASE" clean cleanrm depend && \ [[ -n $EAPI ]] || EAPI=0 fi -_source_ebuild() { - # The bashrcs get an opportunity here to set aliases that will be expanded - # during sourcing of ebuilds and eclasses. - source_all_bashrcs - - # *DEPEND and IUSE will be set during the sourcing of the ebuild. - # In order to ensure correct interaction between ebuilds and - # eclasses, they need to be unset before this process of - # interaction begins. - unset DEPEND RDEPEND PDEPEND IUSE - source "${EBUILD}" || die "error sourcing ebuild" - - if [ "${EBUILD_PHASE}" != "depend" ] ; then - RESTRICT=${PORTAGE_RESTRICT} - [[ -e $PORTAGE_BUILDDIR/.ebuild_changed ]] && \ +if ! hasq "$EBUILD_PHASE" clean cleanrm ; then + if [[ $EBUILD_PHASE = depend || ! -f $T/environment || \ + -f $PORTAGE_BUILDDIR/.ebuild_changed ]] || \ + hasq noauto $FEATURES ; then + # The bashrcs get an opportunity here to set aliases that will be expanded + # during sourcing of ebuilds and eclasses. + source_all_bashrcs + + # *DEPEND and IUSE will be set during the sourcing of the ebuild. + # In order to ensure correct interaction between ebuilds and + # eclasses, they need to be unset before this process of + # interaction begins. + unset DEPEND RDEPEND PDEPEND IUSE + source "${EBUILD}" || die "error sourcing ebuild" + + if [[ "${EBUILD_PHASE}" != "depend" ]] ; then + RESTRICT=${PORTAGE_RESTRICT} + [[ -e $PORTAGE_BUILDDIR/.ebuild_changed ]] && \ rm "$PORTAGE_BUILDDIR/.ebuild_changed" - fi + fi - [[ -n $EAPI ]] || EAPI=0 + [[ -n $EAPI ]] || EAPI=0 - if has "$EAPI" 0 1 2 ; then - export RDEPEND=${RDEPEND-${DEPEND}} - debug-print "RDEPEND: not set... Setting to: ${DEPEND}" - fi + if has "$EAPI" 0 1 2 ; then + export RDEPEND=${RDEPEND-${DEPEND}} + debug-print "RDEPEND: not set... Setting to: ${DEPEND}" + fi - # add in dependency info from eclasses - IUSE="${IUSE} ${E_IUSE}" - DEPEND="${DEPEND} ${E_DEPEND}" - RDEPEND="${RDEPEND} ${E_RDEPEND}" - PDEPEND="${PDEPEND} ${E_PDEPEND}" + # add in dependency info from eclasses + IUSE="${IUSE} ${E_IUSE}" + DEPEND="${DEPEND} ${E_DEPEND}" + RDEPEND="${RDEPEND} ${E_RDEPEND}" + PDEPEND="${PDEPEND} ${E_PDEPEND}" - unset ECLASS E_IUSE E_DEPEND E_RDEPEND E_PDEPEND + unset ECLASS E_IUSE E_DEPEND E_RDEPEND E_PDEPEND - # alphabetically ordered by $EBUILD_PHASE value - local f valid_phases - case "$EAPI" in - 0|1) - valid_phases="src_compile pkg_config pkg_info src_install - pkg_nofetch pkg_postinst pkg_postrm pkg_preinst pkg_prerm - pkg_setup src_test src_unpack" - ;; - 2) - 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" - ;; - *) - 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_pretend pkg_setup src_test src_unpack" - ;; - esac + # alphabetically ordered by $EBUILD_PHASE value + case "$EAPI" in + 0|1) + _valid_phases="src_compile pkg_config pkg_info src_install + pkg_nofetch pkg_postinst pkg_postrm pkg_preinst pkg_prerm + pkg_setup src_test src_unpack" + ;; + 2) + _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" + ;; + *) + _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_pretend pkg_setup src_test src_unpack" + ;; + esac - DEFINED_PHASES= - for f in $valid_phases ; do - if declare -F $f >/dev/null ; then - f=${f#pkg_} - DEFINED_PHASES+=" ${f#src_}" - fi - done - [[ -n $DEFINED_PHASES ]] || DEFINED_PHASES=- + DEFINED_PHASES= + for _f in $_valid_phases ; do + if declare -F $_f >/dev/null ; then + _f=${_f#pkg_} + DEFINED_PHASES+=" ${_f#src_}" + fi + done + [[ -n $DEFINED_PHASES ]] || DEFINED_PHASES=- - # This needs to be exported since prepstrip is a separate shell script. - [[ -n $QA_PRESTRIPPED ]] && export QA_PRESTRIPPED - eval "[[ -n \$QA_PRESTRIPPED_${ARCH/-/_} ]] && export QA_PRESTRIPPED_${ARCH/-/_}" -} + unset _f _valid_phases -if ! hasq "$EBUILD_PHASE" clean cleanrm ; then - if [[ $EBUILD_PHASE = depend || ! -f $T/environment || \ - -f $PORTAGE_BUILDDIR/.ebuild_changed ]] || \ - hasq noauto $FEATURES ; then - _source_ebuild + # This needs to be exported since prepstrip is a separate shell script. + [[ -n $QA_PRESTRIPPED ]] && export QA_PRESTRIPPED + eval "[[ -n \$QA_PRESTRIPPED_${ARCH/-/_} ]] && export QA_PRESTRIPPED_${ARCH/-/_}" fi fi diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh index 019855242..5987a522b 100755 --- a/bin/isolated-functions.sh +++ b/bin/isolated-functions.sh @@ -551,7 +551,6 @@ save_ebuild_env() { source_all_bashrcs ebuild_main \ ebuild_phase ebuild_phase_with_hooks \ _ebuild_arg_to_phase _ebuild_phase_funcs default \ - _source_ebuild \ ${QA_INTERCEPTORS} # portage config variables and variables set directly by portage @@ -584,8 +583,8 @@ save_ebuild_env() { # user config variables unset DOC_SYMLINKS_DIR INSTALL_MASK PKG_INSTALL_MASK - set - export + declare -p + declare -fp ) } diff --git a/man/emerge.1 b/man/emerge.1 index 934f6905a..a04a06b28 100644 --- a/man/emerge.1 +++ b/man/emerge.1 @@ -501,6 +501,10 @@ Shows the dependency tree for the given target by indenting dependencies. This is only really useful in combination with \fB\-\-emptytree\fR or \fB\-\-update\fR and \fB\-\-deep\fR. .TP +.BR "\-\-use\-ebuild\-visibility[=n]" +Use unbuilt ebuild metadata for visibility +checks on built packages. +.TP .BR "\-\-usepkg[=n] " (\fB\-k\fR) Tells emerge to use binary packages (from $PKGDIR) if they are available, thus possibly avoiding some time\-consuming compiles. This option is useful for CD diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index e6a60a6ca..607f0255d 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -2319,6 +2319,8 @@ class depgraph(object): reinstall = False noreplace = "--noreplace" in self._frozen_config.myopts avoid_update = "--update" not in self._frozen_config.myopts + use_ebuild_visibility = self._frozen_config.myopts.get( + '--use-ebuild-visibility', 'n') != 'n' # Behavior of the "selective" parameter depends on # whether or not a package matches an argument atom. # If an installed package provides an old-style @@ -2392,7 +2394,7 @@ class depgraph(object): # instances (installed or binary). # If --usepkgonly is enabled, assume that # the ebuild status should be ignored. - if usepkgonly: + if not use_ebuild_visibility and usepkgonly: if installed and \ pkgsettings._getMissingKeywords( pkg.cpv, pkg.metadata): diff --git a/pym/_emerge/help.py b/pym/_emerge/help.py index bbeb2fb36..346d77712 100644 --- a/pym/_emerge/help.py +++ b/pym/_emerge/help.py @@ -538,6 +538,12 @@ def help(myopts, havecolor=1): print(" a package's dependencies follow the package. Only really useful") print(" in combination with --emptytree, --update or --deep.") print() + print(" " + green("--use-ebuild-visibility") + "[=%s]" % turquoise("n")) + desc = "Use unbuilt ebuild metadata for visibility " + \ + "checks on built packages." + for line in wrap(desc, desc_width): + print(desc_indent + line) + print() print(" "+green("--usepkg")+ "[=%s]" % turquoise("n") + " ("+green("-k")+" short option)") print(" Tell emerge to use binary packages (from $PKGDIR) if they are") print(" available, thus possibly avoiding some time-consuming compiles.") diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py index f79d4e1da..3a693f145 100644 --- a/pym/_emerge/main.py +++ b/pym/_emerge/main.py @@ -392,6 +392,7 @@ def insert_optional_args(args): '--root-deps' : ('rdeps',), '--select' : ('n',), '--selective' : ('n',), + "--use-ebuild-visibility": ('n',), '--usepkg' : ('n',), '--usepkgonly' : ('n',), } @@ -629,6 +630,12 @@ def parse_opts(tmpcmdline, silent=False): "choices" : ("True", "n") }, + "--use-ebuild-visibility": { + "help" : "use unbuilt ebuild metadata for visibility checks on built packages", + "type" : "choice", + "choices" : ("True", "n") + }, + "--usepkg": { "shortopt" : "-k", "help" : "use binary packages", @@ -714,6 +721,7 @@ def parse_opts(tmpcmdline, silent=False): myoptions.root_deps = True if myoptions.select == "True": + myoptions.select = True myoptions.oneshot = False elif myoptions.select == "n": myoptions.oneshot = True @@ -772,6 +780,11 @@ def parse_opts(tmpcmdline, silent=False): myoptions.load_average = load_average + if myoptions.use_ebuild_visibility in ("True",): + myoptions.use_ebuild_visibility = True + else: + myoptions.use_ebuild_visibility = None + if myoptions.usepkg in ("True",): myoptions.usepkg = True else: @@ -893,6 +906,7 @@ def missing_sets_warning(root_config, missing_sets): msg.append(" This usually means that '%s'" % \ (os.path.join(portage.const.GLOBAL_CONFIG_PATH, "sets.conf"),)) msg.append(" is missing or corrupt.") + msg.append(" Falling back to default world and system set configuration!!!") for line in msg: writemsg_level(line + "\n", level=logging.ERROR, noiselevel=-1) diff --git a/pym/portage/sets/__init__.py b/pym/portage/sets/__init__.py index 01ce66055..ab67642b8 100644 --- a/pym/portage/sets/__init__.py +++ b/pym/portage/sets/__init__.py @@ -161,7 +161,10 @@ class SetConfig(object): if ignorelist is None: ignorelist = set() - if not setname in ignorelist: + + # If sets.conf is corrupt then emerge generates + # fallback sets without the 'creator' attribute. + if setname not in ignorelist and hasattr(myset, 'creator'): if parser.has_option(myset.creator, "extend"): extend.update(parser.get(myset.creator, "extend").split()) if parser.has_option(myset.creator, "remove"): -- 2.26.2