From 5063ec9b5497e7083f2bb351d75be436db15761a Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Sat, 28 Apr 2007 10:34:13 +0000 Subject: [PATCH] Merged from trunk 6415:6446 +------------------------------------------------------------------------+ | 6416 | strip .comment by default, add a comment as to what we | | SpankMan | need before we can do .note, and add safe stripping of | | | relocatable objects | |-----------+------------------------------------------------------------| | 6417 | For bug #175344, use cp_list instead of xmatch in order to | | zmedico | avoid dep_expand calls. | |-----------+------------------------------------------------------------| | 6419 | For bug #175344, handle a potential InvalidDependString | | zmedico | exception when parsing PROVIDE. | |-----------+------------------------------------------------------------| | 6421 | For bug #175344, handle a potential InvalidDependString | | zmedico | exception when parsing PROVIDE. | |-----------+------------------------------------------------------------| | 6423 | For bug #175344, validate LICENSE and PROVIDE inside | | zmedico | doebuild(). | |-----------+------------------------------------------------------------| | 6425 | Also validate SRC_URI inside doebuild(). | | zmedico | | |-----------+------------------------------------------------------------| | 6427 | Also validate RESTRICT inside doebuild(). | | zmedico | | |-----------+------------------------------------------------------------| | 6429 | Use portable sh syntax rather than bash syntax. Thanks to | | zmedico | drizzt. | |-----------+------------------------------------------------------------| | 6431 | Pretty up the repoman imports, use cPickle over pickle for | | WarnerBro | performance | |-----------+------------------------------------------------------------| | 6432 | For bug #175781, add a higher preference priority for | | zmedico | choices where all matching slots are installed (not just | | | any slot). | |-----------+------------------------------------------------------------| | 6435 | fix typo | | WarnerBro | | |-----------+------------------------------------------------------------| | 6438 | For bug #176139, only symlink the distfiles that are | | zmedico | required according the current USE settings. | |-----------+------------------------------------------------------------| | 6440 | Always ensure permissions in DISTCC_DIR in order to try to | | zmedico | prevent potential permission problems for non-root users | | | who are in the portage group (userpriv, etc.). | |-----------+------------------------------------------------------------| | 6442 | In the installsources docs, note that CFLAGS needs to be | | zmedico | set to include debug information. Thanks to tigger^ for | | | reporting. | |-----------+------------------------------------------------------------| | 6444 | For bug #176305, validate the resume merge list before | | zmedico | attempting to verify the ebuild manifests. | |-----------+------------------------------------------------------------| | 6446 | Fix up missing mymergelist variable from the previous | | zmedico | commit. | +------------------------------------------------------------------------+ svn path=/main/branches/prefix/; revision=6449 --- bin/ecompressdir | 2 +- bin/prepstrip | 14 ++++++++++---- bin/repoman | 27 ++++++++++++++++++++++----- man/make.conf.5 | 3 ++- pym/emerge/__init__.py | 36 ++++++++++++++++++++++-------------- pym/portage/__init__.py | 37 ++++++++++++++++++++++++++++++++----- 6 files changed, 89 insertions(+), 30 deletions(-) diff --git a/bin/ecompressdir b/bin/ecompressdir index 9befd84b0..a4b166f54 100755 --- a/bin/ecompressdir +++ b/bin/ecompressdir @@ -121,7 +121,7 @@ for dir in "$@" ; do # forcibly break all hard links as some compressors whine about it find "${dir}" -type f -links +1 -exec env file="{}" sh -c \ - 'cp -p "${file}"{,.ecompress.break} ; mv -f "${file}"{.ecompress.break,}' \; + 'cp -p "${file}" "${file}.ecompress.break" ; mv -f "${file}.ecompress.break" "${file}"' \; # now lets do our work [[ -z ${suffix} ]] && continue diff --git a/bin/prepstrip b/bin/prepstrip index 2aeda2161..3b68cdd05 100755 --- a/bin/prepstrip +++ b/bin/prepstrip @@ -18,7 +18,10 @@ type -P -- ${STRIP} > /dev/null || STRIP=strip OBJCOPY=${OBJCOPY:-${CHOST}-objcopy} type -P -- ${OBJCOPY} > /dev/null || OBJCOPY=objcopy -export PORTAGE_STRIP_FLAGS=${PORTAGE_STRIP_FLAGS:---strip-unneeded} +# We'll leave out -R .note for now until we can check out the relevance +# of the section when it has the ALLOC flag set on it ... +export SAFE_STRIP_FLAGS="--strip-unneeded" +export PORTAGE_STRIP_FLAGS=${PORTAGE_STRIP_FLAGS-${SAFE_STRIP_FLAGS} -R .comment} banner=1 @@ -86,11 +89,14 @@ for x in $(scanelf -yqRBF '#k%F' -k '.symtab' "$@") $(for y in "$@"; do find "${ vecho " ${x:${#ED}}" [[ -n ${NOSTRIP} ]] && continue [[ ${stripitbaby} -eq 1 ]] && ${STRIP} -g "${x}" - fi - if [[ ${f} == *"SB executable"* || ${f} == *"SB shared object"* ]] ; then + elif [[ ${f} == *"SB executable"* || ${f} == *"SB shared object"* || ${f} == *"SB relocatable"* ]] ; then vecho " ${x:${#ED}}" save_elf_debug "${x}" [[ -n ${NOSTRIP} ]] && continue - [[ ${stripitbaby} -eq 1 ]] && ${STRIP} ${PORTAGE_STRIP_FLAGS} "${x}" + if [[ ${stripitbaby} -eq 1 ]] ; then + [[ ${f} == *"SB relocatable"* ]] \ + && ${STRIP} ${SAFE_STRIP_FLAGS} "${x}" \ + || ${STRIP} ${PORTAGE_STRIP_FLAGS} "${x}" + fi fi done diff --git a/bin/repoman b/bin/repoman index 926963b12..14c23062e 100755 --- a/bin/repoman +++ b/bin/repoman @@ -7,9 +7,22 @@ # Then, check to make sure deps are satisfiable (to avoid "can't find match for" problems) # that last one is tricky because multiple profiles need to be checked. -import errno, os, shutil, sys +import errno +import os +import shutil +import sys +import signal +import re +import tempfile + +try: + import cPickle as pickle +except ImportError: + import pickle + if not hasattr(__builtins__, "set"): from sets import Set as set + exename=os.path.basename(sys.argv[0]) version="1.2" @@ -20,8 +33,6 @@ map(allowed_filename_chars_set.setdefault, map(chr, range(ord('A'), ord('Z')+1)) map(allowed_filename_chars_set.setdefault, map(chr, range(ord('0'), ord('9')+1))) map(allowed_filename_chars_set.setdefault, map(chr, map(ord, [".", "-", "_", "+", ":"]))) -import signal,re,pickle,tempfile - os.environ["PORTAGE_LEGACY_GLOBALS"] = "false" try: import portage @@ -1118,8 +1129,14 @@ for x in scanlist: #for x in myaux[allvars.index("RESTRICT")].split(): # if x.startswith("no"): # print "Bad RESTRICT value: %s" % x - - myaux["PROVIDE"] = portage.dep.use_reduce(portage.dep.paren_reduce(myaux["PROVIDE"]), matchall=1) + try: + myaux["PROVIDE"] = portage.dep.use_reduce( + portage.dep.paren_reduce(myaux["PROVIDE"]), matchall=1) + except portage.exception.InvalidDependString, e: + stats["PROVIDE.syntax"] = stats["PROVIDE.syntax"] + 1 + fails["PROVIDE.syntax"].append(mykey+".ebuild PROVIDE: "+str(e)) + del e + continue myaux["PROVIDE"] = " ".join(portage.flatten(myaux["PROVIDE"])) for myprovide in myaux["PROVIDE"].split(): prov_cp = portage.dep_getkey(myprovide) diff --git a/man/make.conf.5 b/man/make.conf.5 index 4f6a24c74..632c7f1ec 100644 --- a/man/make.conf.5 +++ b/man/make.conf.5 @@ -177,7 +177,8 @@ Check the signatures of Manifests and make sure they are correct. .TP .B installsources Install source code into /usr/src/debug/${CATEGORY}/${PF} (also see -\fBsplitdebug\fR). This feature works only if debugedit is installed. +\fBsplitdebug\fR). This feature works only if debugedit is installed and CFLAGS +is set to include debug information (such as with the \-ggdb flag). .TP .B keeptemp Do not delete the ${T} directory after the merge process. diff --git a/pym/emerge/__init__.py b/pym/emerge/__init__.py index 39ad03778..f004f8d93 100644 --- a/pym/emerge/__init__.py +++ b/pym/emerge/__init__.py @@ -1543,8 +1543,14 @@ class depgraph: if p_status == "merge": # Update old-style virtuals if this package provides any. # These are needed for dep_virtual calls inside dep_check. - self.pkgsettings[p_root].setinst(p_key, - self.trees[p_root][self.pkg_tree_map[p_type]].dbapi) + p_db = self.trees[p_root][self.pkg_tree_map[p_type]].dbapi + try: + self.pkgsettings[p_root].setinst(p_key, p_db) + except portage.exception.InvalidDependString, e: + provide = p_db.aux_get(p_key, ["PROVIDE"])[0] + show_invalid_depstring_notice(myparent, provide, str(e)) + del e + return 0 if "--debug" in self.myopts: print "Candidates:",mymerge @@ -2912,6 +2918,18 @@ class MergeTask(object): show_blocker_docs_link() return 1 + if "--resume" in self.myopts: + # We're resuming. + print colorize("GOOD", "*** Resuming merge...") + emergelog(xterm_titles, " *** Resuming merge...") + mylist = mtimedb["resume"]["mergelist"][:] + if "--skipfirst" in self.myopts and mylist: + del mtimedb["resume"]["mergelist"][0] + del mylist[0] + mtimedb.commit() + validate_merge_list(self.trees, mylist) + mymergelist = mylist + # Verify all the manifests now so that the user is notified of failure # as soon as possible. if "--fetchonly" not in self.myopts and \ @@ -2942,17 +2960,7 @@ class MergeTask(object): #buildsyspkg: I need mysysdict also on resume (moved from the else block) mysysdict = genericdict(getlist(self.settings, "system")) - if "--resume" in self.myopts: - # We're resuming. - print colorize("GOOD", "*** Resuming merge...") - emergelog(xterm_titles, " *** Resuming merge...") - mymergelist=mtimedb["resume"]["mergelist"][:] - if "--skipfirst" in self.myopts and mymergelist: - del mtimedb["resume"]["mergelist"][0] - del mymergelist[0] - mtimedb.commit() - validate_merge_list(self.trees, mymergelist) - else: + if "--resume" not in self.myopts: myfavs = portage.grabfile( os.path.join(self.target_root, portage.WORLD_FILE)) myfavdict=genericdict(myfavs) @@ -4422,7 +4430,7 @@ def action_regen(settings, portdb): dead_nodes = None break for x in mynodes: - mymatches = portdb.xmatch("match-all",x) + mymatches = portdb.cp_list(x) portage.writemsg_stdout("processing %s\n" % x) for y in mymatches: try: diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index fe615442a..172c28931 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -3238,7 +3238,7 @@ def prepare_build_dirs(myroot, mysettings, cleanup): "basedir_var":"DISTCC_DIR", "default_dir":os.path.join(mysettings["BUILD_PREFIX"], ".distcc"), "subdirs":("lock", "state"), - "always_recurse":False} + "always_recurse":True} } dirmode = 02070 filemode = 060 @@ -3541,7 +3541,9 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0, set(["clean", "cleanrm", "help", "prerm", "postrm"]) mycpv = mysettings["CATEGORY"] + "/" + mysettings["PF"] dep_keys = ["DEPEND", "RDEPEND", "PDEPEND"] - metadata = dict(izip(dep_keys, mydbapi.aux_get(mycpv, dep_keys))) + misc_keys = ["LICENSE", "PROVIDE", "RESTRICT", "SRC_URI"] + all_keys = dep_keys + misc_keys + metadata = dict(izip(all_keys, mydbapi.aux_get(mycpv, all_keys))) class FakeTree(object): def __init__(self, mydb): self.dbapi = mydb @@ -3557,7 +3559,18 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0, if mydo not in invalid_dep_exempt_phases: return 1 del dep_type, mycheck - del mycpv, dep_keys, metadata, FakeTree, dep_check_trees + for k in misc_keys: + try: + portage.dep.use_reduce( + portage.dep.paren_reduce(metadata[k]), matchall=True) + except portage.exception.InvalidDependString, e: + writemsg("%s: %s\n%s\n" % ( + k, metadata[k], str(e)), noiselevel=-1) + del e + if mydo not in invalid_dep_exempt_phases: + return 1 + del k + del mycpv, dep_keys, metadata, misc_keys, FakeTree, dep_check_trees if "PORTAGE_TMPDIR" not in mysettings or \ not os.path.isdir(mysettings["PORTAGE_TMPDIR"]): @@ -3734,7 +3747,7 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0, os.mkdir(edpath) apply_secpass_permissions(edpath, uid=portage_uid, mode=0755) try: - for file in aalist: + for file in alist: os.symlink(os.path.join(orig_distdir, file), os.path.join(edpath, file)) except OSError: @@ -4208,6 +4221,7 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None): # d) is the first item preferred = [] + preferred_any_slot = [] possible_upgrades = [] other = [] @@ -4261,8 +4275,20 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None): if not vardb.match(atom) and not atom.startswith("virtual/"): all_installed = False break + all_installed_slots = False + if all_installed: + all_installed_slots = True + for slot_atom in versions: + # New-style virtuals have zero cost to install. + if not vardb.match(slot_atom) and \ + not slot_atom.startswith("virtual/"): + all_installed_slots = False + break if all_installed: - preferred.append(this_choice) + if all_installed_slots: + preferred.append(this_choice) + else: + preferred_any_slot.append(this_choice) else: possible_upgrades.append(this_choice) else: @@ -4274,6 +4300,7 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None): # 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. + preferred.extend(preferred_any_slot) preferred.extend(possible_upgrades) possible_upgrades = preferred[1:] for possible_upgrade in possible_upgrades: -- 2.26.2