Merged from trunk 8592:8623
authorFabian Groffen <grobian@gentoo.org>
Fri, 23 Nov 2007 19:26:48 +0000 (19:26 -0000)
committerFabian Groffen <grobian@gentoo.org>
Fri, 23 Nov 2007 19:26:48 +0000 (19:26 -0000)
   | 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

bin/dohtml
bin/ebuild.sh
bin/misc-functions.sh
man/ebuild.5
pym/_emerge/__init__.py
pym/portage/__init__.py
pym/portage/manifest.py

index f49e754c7b85462c4898e4e080027a36c139c16a..def135d67978f0b65a50e90320037c49796f2751 100755 (executable)
@@ -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
index 7e029313479ee7fd3f85c062aba9ba01d054ed90..ed96a4ac675298bb8fcc8b05ced57a4a2ba89760 100755 (executable)
@@ -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
index aa1a6d37c5abe51d53835df8801cfc10fda9b710..0c1eb7c666deab5a14a49d7bb96930c81de2b472 100644 (file)
@@ -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}"
index dd879a59fae4375ddb887d9776d3e95e1a99dcb4..c52145bbbf7ca4f6936091e9e60624bdb8479c04 100644 (file)
@@ -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<info\-file> [list of more info\-files]\fR
 Installs info\-pages into \fIDESTDIR\fR/info.  Files are automatically
index 35cee55d2770ae0fe6d232bca2f9e938e780a649..0d089dea42daef42bc95d1dd716e4260c6520b39 100644 (file)
@@ -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
index a2018c9ba34e125cc6a617c3d7ca2096baa4d629..1a56afab29b4de0ca904721f1bdf59ecb7e598a3 100644 (file)
@@ -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()
index 82ca37efbe75d344e6bdee8c235cc996511b190f..7f7be0fdddb6d5d601fd7d0632581f2ff348ad4a 100644 (file)
@@ -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]