From: Fabian Groffen Date: Sat, 30 Dec 2006 16:23:53 +0000 (-0000) Subject: Merged from trunk 5414:5425 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=110b0277b81db438bf712caadf1e476b9374a5bd;p=portage.git Merged from trunk 5414:5425 keep things quiet when uninstalling (SoLudd) Send stuff that's not a warning or error to stdout rather than stderr. fixup style (SpankMan) detect incorrect absolute symlinks in libdirs (SpankMan) For bug #159360, make sure that the highest available new-style virtual is selected even if it has depes that aren't already installed. Sort the --info USE flags for bug #159161. Be slightly more defensive when loading the vdb/blockers caches. Improve the logic for bug #159360 to ensure that an actual upgrade is selected without any downgrades. Do some small fixes to prevent slot collision nodes from interfering with the depgraph. Fix 'TypeError: unpack non-sequence' that occurs if myparent is None. Punt the abort_unpack() handler since it's pointless anyway. svn path=/main/branches/prefix/; revision=5427 --- diff --git a/bin/ebuild.sh b/bin/ebuild.sh index bde203001..097aac35a 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -839,7 +839,6 @@ dyn_setup() { } dyn_unpack() { - trap "abort_unpack" SIGINT SIGQUIT [ "$(type -t pre_src_unpack)" == "function" ] && pre_src_unpack local newstuff="no" if [ -e "${WORKDIR}" ]; then @@ -890,8 +889,6 @@ dyn_unpack() { cd "${PORTAGE_BUILDDIR}" [ "$(type -t post_src_unpack)" == "function" ] && post_src_unpack - - trap SIGINT SIGQUIT } dyn_clean() { @@ -1029,13 +1026,6 @@ abort_compile() { exit 1 } -abort_unpack() { - abort_handler "src_unpack" $1 - rm -f "${PORTAGE_BUILDDIR}/.unpacked" - rm -rf "${PORTAGE_BUILDDIR}/work" - exit 1 -} - abort_test() { abort_handler "dyn_test" $1 rm -f "${PORTAGE_BUILDDIR}/.tested" diff --git a/bin/emerge b/bin/emerge index 47d895731..511da0a98 100755 --- a/bin/emerge +++ b/bin/emerge @@ -845,8 +845,8 @@ class BlockerCache(DictMixin): cache_valid = self._cache_data and \ isinstance(self._cache_data, dict) and \ self._cache_data.get("version") == self._cache_version and \ - self._cache_data["virtuals"] == self._virtuals and \ - set(self._cache_data["blockers"]) == self._installed_pkgs + self._cache_data.get("virtuals") == self._virtuals and \ + set(self._cache_data.get("blockers", [])) == self._installed_pkgs if cache_valid: for pkg in self._installed_pkgs: if long(self._vardb.aux_get(pkg, ["COUNTER"])[0]) != \ @@ -1190,8 +1190,14 @@ class depgraph: ((jbigkey, myparents), (existing_node, e_parents))) # Now add this node to the graph so that self.display() - # can work with it show use flags and --tree output. - self.useFlags[myroot][mykey] = myuse + # can show use flags and --tree output. This node is + # only being partially added to the graph. It must not be + # allowed to interfere with the other nodes that have been + # added. Do not overwrite data for existing nodes in + # self.pkg_node_map and self.mydbapi since that data will + # be used for blocker validation. + self.pkg_node_map[myroot].setdefault(mykey, jbigkey) + self.useFlags[myroot].setdefault(mykey, myuse) self._parent_child_digraph.add(jbigkey, myparent) if rev_dep and myparent: self.digraph.add(myparent, jbigkey, @@ -1526,7 +1532,10 @@ class depgraph: portage_dep._dep_check_strict = True if not mycheck[0]: - show_invalid_depstring_notice(myparent, depstring, mycheck[1]) + if myparent: + show_invalid_depstring_notice(myparent, depstring, mycheck[1]) + else: + sys.stderr.write("\n%s\n%s\n" % (depstring, mycheck[1])) return 0 mymerge = mycheck[1] @@ -3317,8 +3326,9 @@ def unmerge(settings, myopts, vartree, unmerge_action, unmerge_files, return 0 if not numselected: - print "\n>>> No packages selected for removal by", \ - unmerge_action+".\n" + portage.writemsg_stdout( + "\n>>> No packages selected for removal by " + \ + unmerge_action + "\n") return 0 finally: if vdb_lock: @@ -4258,6 +4268,8 @@ def action_info(settings, trees, myopts, myfiles): for f in list(use): if f.startswith(flag_prefix): use.remove(f) + use = list(use) + use.sort() print 'USE="%s"' % " ".join(use), for varname in use_expand: myval = settings.get(varname) diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh index 0378ee504..6044ad433 100644 --- a/bin/misc-functions.sh +++ b/bin/misc-functions.sh @@ -222,12 +222,14 @@ install_qa_check() { rm -f "${ED}/usr/share/info/dir.gz" fi - if hasq multilib-strict ${FEATURES} && [ -x file -a -x find -a \ - -n "${MULTILIB_STRICT_DIRS}" -a -n "${MULTILIB_STRICT_DENY}" ]; then - local abort=no firstrun=yes + if hasq multilib-strict ${FEATURES} && \ + [[ -x ${EPREFIX}/usr/bin/file && -x ${EPREFIX}/usr/bin/find ]] && \ + [[ -n ${MULTILIB_STRICT_DIRS} && -n ${MULTILIB_STRICT_DENY} ]] + then + local abort=no firstrun=yes MULTILIB_STRICT_EXEMPT=$(echo ${MULTILIB_STRICT_EXEMPT} | sed -e 's:\([(|)]\):\\\1:g') - for dir in ${MULTILIB_STRICT_DIRS}; do - [ -d "${ED}/${dir}" ] || continue + for dir in ${MULTILIB_STRICT_DIRS} ; do + [[ -d ${ED}/${dir} ]] || continue for file in $(find ${ED}/${dir} -type f | grep -v "^${ED}/${dir}/${MULTILIB_STRICT_EXEMPT}"); do if file ${file} | egrep -q "${MULTILIB_STRICT_DENY}" ; then if [[ ${firstrun} == yes ]] ; then diff --git a/bin/prepall b/bin/prepall index 3821e55e9..9cb84a5cc 100755 --- a/bin/prepall +++ b/bin/prepall @@ -25,9 +25,19 @@ for i in "${ED}"/opt/*/lib{,32,64} \ for j in "${i}"/*.so.* "${i}"/*.so ; do [[ ! -e ${j} ]] && continue - [[ -L ${j} ]] && continue + if [[ -L ${j} ]] ; then + linkdest=$(readlink "${j}") + if [[ ${linkdest} == /* ]] ; then + vecho -e "\a" + vecho "QA Notice: Found an absolute symlink in a library directory:" + vecho " ${j#${D}} -> ${linkdest}" + vecho " It should be a relative symlink if in the same directory" + vecho " or a linker script if it crosses the /usr boundary." + fi + continue + fi [[ -x ${j} ]] && continue - echo "making executable: /${j/${D}/}" + vecho "making executable: ${j#${D}}" chmod +x "${j}" done @@ -35,7 +45,7 @@ for i in "${ED}"/opt/*/lib{,32,64} \ [[ ! -e ${j} ]] && continue [[ -L ${j} ]] && continue [[ ! -x ${j} ]] && continue - echo "removing executable bit: /${j/${D}/}" + vecho "removing executable bit: ${j#${D}}" chmod -x "${j}" done done @@ -49,7 +59,7 @@ for a in "${ED}"/usr/lib*/*.a ; do if [[ ! -e ${s} ]] ; then s=${s%usr/*}${s##*/usr/} if [[ -e ${s} ]] ; then - echo -e "\aQA Notice: missing gen_usr_ldscript for ${s##*/}\a" + vecho -e "\aQA Notice: missing gen_usr_ldscript for ${s##*/}\a" sleep 1 fi fi @@ -58,8 +68,8 @@ done # Make sure people don't store libtool files or static libs in /lib f=$(ls "${ED}"/lib*/*.{a,la} 2>/dev/null) if [[ -n ${f} ]] ; then - echo -e "\n\aQA Notice: excessive files found in the / partition\a" - echo "${f}" + vecho -e "\n\aQA Notice: excessive files found in the / partition\a" + vecho "${f}" sleep 1 fi @@ -67,7 +77,7 @@ fi for a in "${ED}"/usr/lib*/*.la ; do s=${a##*/} if grep -qs "${ED}" "${a}" ; then - echo -e "\n\aQA Notice: ${s} appears to contain PORTAGE_TMPDIR paths\a" + vecho -e "\n\aQA Notice: ${s} appears to contain PORTAGE_TMPDIR paths\a" sleep 1 fi done @@ -78,17 +88,17 @@ if type -p scanelf > /dev/null ; then for d in "${ED}"/lib* "${ED}"/usr/lib* ; do f=$(scanelf -ByF '%S %p' "${d}"/lib*.so* | gawk '$2 == "" { print }') if [[ -n ${f} ]] ; then - echo -e "\n\aQA Notice: the following shared libraries lack a SONAME\a" - echo "${f}" - echo + vecho -e "\n\aQA Notice: the following shared libraries lack a SONAME\a" + vecho "${f}" + vecho sleep 1 fi f=$(scanelf -ByF '%n %p' "${d}"/lib*.so* | gawk '$2 == "" { print }') if [[ -n ${f} ]] ; then - echo -e "\n\aQA Notice: the following shared libraries lack NEEDED entries\a" - echo "${f}" - echo + vecho -e "\n\aQA Notice: the following shared libraries lack NEEDED entries\a" + vecho "${f}" + vecho sleep 1 fi done diff --git a/pym/portage.py b/pym/portage.py index 7c50daf2b..5d0054b0c 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -3952,6 +3952,7 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None): # d) is the first item preferred = [] + possible_upgrades = [] other = [] # Alias the trees we'll be checking availability against @@ -3990,17 +3991,19 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None): # an installed package. If they will then don't prefer them # over other atoms. is_downgrade = False - if all_installed and all_available: + versions = {} + if all_installed or all_available: for atom in atoms: mykey = dep_getkey(atom) - inst_pkgs = vardb.match(mykey) - if not inst_pkgs: - # This must be a new-style virtual that isn't really - # installed yet (they have zero cost to install). - continue avail_pkg = best(mydbapi.match(atom)) + if not avail_pkg: + continue avail_slot = mydbapi.aux_get(avail_pkg, ["SLOT"])[0] + versions["%s:%s" % (mykey, avail_slot)] = avail_pkg avail_split = catpkgsplit(avail_pkg)[1:] + inst_pkgs = vardb.match(mykey) + if not inst_pkgs: + continue for pkg in inst_pkgs: if avail_slot != vardb.aux_get(pkg, ["SLOT"])[0]: continue @@ -4010,10 +4013,47 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None): if is_downgrade: break - if all_installed and not is_downgrade: - preferred.append((atoms, all_available)) - else: - other.append((atoms, all_available)) + this_choice = (atoms, versions, all_available) + if not is_downgrade: + if all_installed: + preferred.append(this_choice) + continue + elif all_available: + possible_upgrades.append(this_choice) + continue + other.append(this_choice) + + # Compare the "all_installed" choices against the "all_available" choices + # for possible missed upgrades. The main purpose of this code is to find + # upgrades of new-style virtuals since _expand_new_virtuals() expands them + # into || ( highest version ... lowest version ). We want to prefer the + # highest all_available version of the new-style virtual when there is a + # lower all_installed version. + for possible_upgrade in list(possible_upgrades): + atoms, versions, all_available = possible_upgrade + myslots = set(versions) + for other_choice in preferred: + o_atoms, o_versions, o_all_available = other_choice + intersecting_slots = myslots.intersection(o_versions) + if not intersecting_slots: + continue + has_upgrade = False + has_downgrade = False + for myslot in intersecting_slots: + myversion = versions[myslot] + o_version = o_versions[myslot] + if myversion != o_version: + if myversion == best([myversion, o_version]): + has_upgrade = True + else: + has_downgrade = True + break + if has_upgrade and not has_downgrade: + o_index = preferred.index(other_choice) + preferred.insert(o_index, possible_upgrade) + possible_upgrades.remove(possible_upgrade) + break + preferred.extend(possible_upgrades) # preferred now contains a) and c) from the order above with # the masked flag differentiating the two. other contains b) @@ -4022,7 +4062,7 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None): preferred.extend(other) for allow_masked in (False, True): - for atoms, all_available in preferred: + for atoms, versions, all_available in preferred: if all_available or allow_masked: return atoms @@ -5040,7 +5080,8 @@ class vardbapi(dbapi): pass if not self._aux_cache or \ not isinstance(self._aux_cache, dict) or \ - self._aux_cache.get("version") != self._aux_cache_version: + self._aux_cache.get("version") != self._aux_cache_version or \ + not self._aux_cache.get("packages"): self._aux_cache = {"version":self._aux_cache_version} self._aux_cache["packages"] = {} self._aux_cache["modified"] = False