From: Fabian Groffen Date: Fri, 23 Nov 2007 19:26:48 +0000 (-0000) Subject: Merged from trunk 8592:8623 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=315a59dcbb9f065ae43f713072a2b684e9836731;p=portage.git Merged from trunk 8592:8623 | 8593 | In depgraph.altlist(), measure the bias of circular RDEPEND | | zmedico | PDEPEND relationships and use it to optimize merge order. | | 8595 | Filter HOSTTYPE, MACHTYPE, and OSTYPE vars that are set by | | zmedico | bash. | | 8597 | Make dyn_package() create a /var/db/pkg/*/*/BINPKGMD5 | | zmedico | entries so that packages installed via --buildpkg have a | | | BINPKGMD5 entry matching the package built. | | 8599 | Document dohtml -p. Thanks to robbat2 for reporting. | | zmedico | | | 8601 | When portage reinstalls itself, during inst/rm phases, the | | zmedico | environment may have been saved by a different version of | | | ebuild.sh, so it can't trusted that it's been properly | | | filtered. Therefore, always preprocess the environment when | | | ${PN} == portage. | | 8603 | Don't call preprocess_ebuild_env() unless EBUILD_SH_ARGS is | | zmedico | set since otherwise it can interfere with the environment | | | for things like the "package" phase. | | 8605 | Generalize the sed expression in filter_readonly_variables() | | zmedico | so that it will work with things like 'declare -xr' as well | | | as 'declare -rx'. | | 8607 | Allow any errors from save_ebuild_env() to go to stderr | | zmedico | instead of directing them to /dev/null. | | 8609 | When filtering the backupenv in create_trees(), be more | | zmedico | selective and ensure that special variables that come from | | | the config constructor are preserved. | | 8611 | Make the sed expression in filter_readonly_variables() | | zmedico | handle '^declare -r ' by simply removing it. | | 8613 | Use %% instead of % parameter expansion where appropriate | | zmedico | for md5sum output. | | 8615 | Sort hashes for predictable output from | | zmedico | Manifest._createManifestEntries(). | | 8617 | For compatibility with previous behavior, so the bashrc | | zmedico | sourcing after the ebuild environment is fully loaded. | | 8619 | unset x to avoid global env pollution. | | zmedico | | | 8621 | Try again to make bashrc sourcing compatible with previous | | zmedico | behavior. The bashrcs get an opportunity to set aliases that | | | will be expanded during sourcing of ebuilds and eclasses. | | 8623 | Make save_ebuild_env() filter the new source_all_bashrcs() | | zmedico | function from the environment. | svn path=/main/branches/prefix/; revision=8625 --- diff --git a/bin/dohtml b/bin/dohtml index f49e754c7..def135d67 100755 --- a/bin/dohtml +++ b/bin/dohtml @@ -100,6 +100,7 @@ def print_help(): print " -f Set list of allowed extensionless file names." print " -x Set directories to be excluded from recursion." print " Default:", ",".join(opts.disallowed_dirs) + print " -p Set a document prefix for installed files (empty by default)." print " -r Install files and directories recursively." print " -V Be verbose." print diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 7e0293134..ed96a4ac6 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -60,9 +60,6 @@ export PATH="${DEFAULT_PATH}:${PORTAGE_BIN_PATH}:${ROOTPATH}" 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} @@ -101,36 +98,6 @@ lchgrp() { chgrp -h "$@" } -# source the existing profile.bashrc's. -save_IFS -IFS=$'\n' -for dir in ${PROFILE_PATHS}; do - # Must unset it so that it doesn't mess up assumptions in the RCs. - unset IFS - if [ -f "${dir}/profile.bashrc" ]; then - qa_source "${dir}/profile.bashrc" - fi -done -restore_IFS - -# We assume if people are changing shopts in their bashrc they do so at their -# own peril. This is the ONLY non-portage bit of code that can change shopts -# without a QA violation. -if [ -f "${PORTAGE_BASHRC}" ]; then - # If $- contains x, then tracing has already enabled elsewhere for some - # reason. We preserve it's state so as not to interfere. - if [ "$PORTAGE_DEBUG" != "1" ] || [ "${-/x/}" != "$-" ]; then - source "${PORTAGE_BASHRC}" - else - set -x - source "${PORTAGE_BASHRC}" - set +x - fi -fi - -[ ! -z "$OCC" ] && export CC="$OCC" -[ ! -z "$OCXX" ] && export CXX="$OCXX" - esyslog() { # Custom version of esyslog() to take care of the "Red Star" bug. # MUST follow functions.sh to override the "" parameter problem. @@ -1380,6 +1347,37 @@ remove_path_entry() { PATH="${stripped_path}" } +source_all_bashrcs() { + 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 + [ -f "${x}/profile.bashrc" ] && qa_source "${x}/profile.bashrc" + done + restore_IFS + + # We assume if people are changing shopts in their bashrc they do so at their + # own peril. This is the ONLY non-portage bit of code that can change shopts + # without a QA violation. + if [ -f "${PORTAGE_BASHRC}" ]; then + # If $- contains x, then tracing has already enabled elsewhere for some + # reason. We preserve it's state so as not to interfere. + if [ "$PORTAGE_DEBUG" != "1" ] || [ "${-/x/}" != "$-" ]; then + source "${PORTAGE_BASHRC}" + else + set -x + source "${PORTAGE_BASHRC}" + set +x + fi + fi + [ ! -z "${OCC}" ] && export CC="${OCC}" + [ ! -z "${OCXX}" ] && export CXX="${OCXX}" +} + READONLY_EBUILD_METADATA="DEPEND DESCRIPTION EAPI HOMEPAGE INHERITED IUSE KEYWORDS LICENSE PDEPEND PROVIDE RDEPEND RESTRICT SLOT SRC_URI" @@ -1411,7 +1409,9 @@ filter_readonly_variables() { # listed in READONLY_EBUILD_METADATA, since having any readonly attributes # persisting in the saved environment can be inconvenient when it # eventually needs to be reloaded. - egrep -v -e "${var_grep}" | sed 's:^declare -rx:declare -x:' + egrep -v -e "${var_grep}" | sed \ + -e 's:^declare[[:space:]]\+-r[[:space:]]\+::' \ + -e 's:^declare[[:space:]]\+-\([[:alnum:]]*\)r\([[:alnum:]]*\)[[:space:]]\+:declare -\1\2 :' } # @FUNCTION: preprocess_ebuild_env @@ -1439,7 +1439,8 @@ save_ebuild_env() { ( # misc variables set by bash - unset BASH IFS OLDPWD OPTERR OPTIND PS4 PWD SHELL + unset BASH HOSTTYPE IFS MACHTYPE OLDPWD \ + OPTERR OPTIND OSTYPE PS4 PWD SHELL # misc variables inherited from the calling environment unset COLORTERM DISPLAY EDITOR LESS LESSOPEN LOGNAME LS_COLORS PAGER \ @@ -1461,7 +1462,8 @@ save_ebuild_env() { dyn_preinst dyn_help debug-print debug-print-function \ debug-print-section inherit EXPORT_FUNCTIONS newdepend newrdepend \ newpdepend do_newdepend remove_path_entry killparent \ - save_ebuild_env filter_readonly_variables preprocess_ebuild_env + save_ebuild_env filter_readonly_variables preprocess_ebuild_env \ + source_all_bashrcs # portage config variables and variables set directly by portage unset ACCEPT_KEYWORDS AUTOCLEAN BAD BRACKET BUILD_PREFIX CLEAN_DELAY \ @@ -1626,8 +1628,21 @@ fi if hasq ${EBUILD_SH_ARGS} clean ; then true elif ! hasq ${EBUILD_PHASE} depend && [ -f "${T}"/environment ] ; then + if [ "${PN}" == "portage" ] && [ -n "${EBUILD_SH_ARGS}" ] ; then + # When portage reinstalls itself, during inst/rm phases, the + # environment may have been saved by a different version of ebuild.sh, + # so it can't trusted that it's been properly filtered. Therefore, + # always preprocess the environment when ${PN} == portage. + preprocess_ebuild_env + fi source "${T}"/environment + source_all_bashrcs else + + # 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 @@ -1816,7 +1831,7 @@ 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 + save_ebuild_env > "${T}/environment" chown ${PORTAGE_USER:-portage}:${PORTAGE_GROUP:-portage} "${T}/environment" &>/dev/null chmod g+w "${T}/environment" &>/dev/null fi diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh index aa1a6d37c..0c1eb7c66 100644 --- a/bin/misc-functions.sh +++ b/bin/misc-functions.sh @@ -613,6 +613,8 @@ dyn_package() { rm -f "${PORTAGE_BINPKG_TMPFILE}" die "Failed to append metadata to the tbz2 file" fi + local md5sum_output=$(md5sum "${PORTAGE_BINPKG_TMPFILE}") + echo ${md5sum_output%% *} > "${PORTAGE_BUILDDIR}"/build-info/BINPKGMD5 vecho ">>> Done." cd "${PORTAGE_BUILDDIR}" touch .packaged || die "Failed to 'touch .packaged' in ${PORTAGE_BUILDDIR}" diff --git a/man/ebuild.5 b/man/ebuild.5 index dd879a59f..c52145bbb 100644 --- a/man/ebuild.5 +++ b/man/ebuild.5 @@ -805,7 +805,7 @@ Installs the files in the list of files (space\-separated list) into /usr/share/doc/${PF}/html provided the file ends in .htm, .html, .css, .js, .gif, .jpeg, .jpg, or .png. Setting \fI\-a\fR limits what types of files will be included, \fI\-A\fR appends to the default list, setting \fI\-x\fR sets which dirs to -exclude (CVS excluded by default), \fI\-r\fR sets recursive. +exclude (CVS excluded by default), \fI\-p\fR sets a document prefix, \fI\-r\fR sets recursive. .TP \fBdoinfo\fR \fI [list of more info\-files]\fR Installs info\-pages into \fIDESTDIR\fR/info. Files are automatically diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index 35cee55d2..0d089dea4 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -2846,6 +2846,21 @@ class depgraph(object): if not removed_something: break self._merge_order_bias(mygraph) + def cmp_circular_bias(n1, n2): + """ + RDEPEND is stronger than PDEPEND and this function + measures such a strength bias within a circular + dependency relationship. + """ + n1_n2_medium = n2 in mygraph.child_nodes(n1, + ignore_priority=DepPriority.MEDIUM_SOFT) + n2_n1_medium = n1 in mygraph.child_nodes(n2, + ignore_priority=DepPriority.MEDIUM_SOFT) + if n1_n2_medium == n2_n1_medium: + return 0 + elif n1_n2_medium: + return 1 + return -1 myblockers = self.blocker_digraph.copy() retlist=[] circular_blocks = False @@ -3013,6 +3028,11 @@ class depgraph(object): continue asap_nodes.append(child) + if selected_nodes and len(selected_nodes) > 1: + if not isinstance(selected_nodes, list): + selected_nodes = list(selected_nodes) + selected_nodes.sort(cmp_circular_bias) + if not selected_nodes: if not myblockers.is_empty(): """A blocker couldn't be circumnavigated while keeping all diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index a2018c9ba..1a56afab2 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -5845,7 +5845,21 @@ def create_trees(config_root=None, target_root=None, trees=None): # with ROOT != "/", so we wipe out the "backupenv" for the # config that is associated with ROOT == "/" and regenerate # it's incrementals. - settings.configdict["backupenv"].clear() + + # Preserve backupenv values that are initialized in the config + # constructor. Also, preserve XARGS since it is set by the + # portage.data module. + backupenv_whitelist = set(["FEATURES", "PORTAGE_BIN_PATH", + "PORTAGE_CONFIGROOT", "PORTAGE_DEPCACHEDIR", + "PORTAGE_GID", "PORTAGE_INST_GID", "PORTAGE_INST_UID", + "PORTAGE_PYM_PATH", "PORTDIR_OVERLAY", "ROOT", "USE_ORDER", + "XARGS"]) + backupenv = settings.configdict["backupenv"] + for k, v in os.environ.iteritems(): + if k in backupenv_whitelist: + continue + if v == backupenv.get(k): + del backupenv[k] settings.regenerate() settings.lock() settings.validate() diff --git a/pym/portage/manifest.py b/pym/portage/manifest.py index 82ca37efb..7f7be0fdd 100644 --- a/pym/portage/manifest.py +++ b/pym/portage/manifest.py @@ -316,6 +316,7 @@ class Manifest(object): myentry = Manifest2Entry( type=t, name=f, hashes=self.fhashdict[t][f].copy()) myhashkeys = myentry.hashes.keys() + myhashkeys.sort() for h in myhashkeys: if h not in ["size"] + portage.const.MANIFEST2_HASH_FUNCTIONS: del myentry.hashes[h]