Merged from trunk -r14635:14667
authorFabian Groffen <grobian@gentoo.org>
Sun, 18 Oct 2009 13:29:15 +0000 (13:29 -0000)
committerFabian Groffen <grobian@gentoo.org>
Sun, 18 Oct 2009 13:29:15 +0000 (13:29 -0000)
   | 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
bin/isolated-functions.sh
man/emerge.1
pym/_emerge/depgraph.py
pym/_emerge/help.py
pym/_emerge/main.py
pym/portage/sets/__init__.py

index 57f25b2f570a162c136f996f34ab3a8246798f19..4d843d1edea6bd4eee5567be0a87489b1b979fbf 100755 (executable)
@@ -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
 
index 0198552422190cbebedc7b8f01ceb0965da2cbb3..5987a522ba18f60733ef7204156beb06de894fbb 100755 (executable)
@@ -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
        )
 }
 
index 934f6905a87eb5b095f3468ee1e283dc28003710..a04a06b2829feea46fd8de5bd7705a0285992413 100644 (file)
@@ -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 
index e6a60a6ca06983c3ba83860df4ad4438de83b107..607f0255dcf738d4b67fd7eb094db7015b22ce79 100644 (file)
@@ -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):
index bbeb2fb365dffe584a950984e51b245de0adba02..346d77712a387ce19921aea36dad000ab4eb9a98 100644 (file)
@@ -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.")
index f79d4e1da56a2cde7b1dbfd3a1a20f170b7d2668..3a693f145ca47243aac12974c3083d385c26d28b 100644 (file)
@@ -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)
 
index 01ce6605592151e1329ed11c02b20d061270e839..ab67642b87fe13912cf8c23f03b19775ff8d74c6 100644 (file)
@@ -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"):