From e015391b4311152b3932838b89bbe7585758239d Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Wed, 28 Mar 2007 19:17:18 +0000 Subject: [PATCH] Merged from trunk 6262:6277 +------------------------------------------------------------------------+ | 6263 | default --help should be usable, so make the extended | | SpankMan | output require --verbose | |----------+-------------------------------------------------------------| | 6264 | Add --verbose to the "for more help" message. | | zmedico | | |----------+-------------------------------------------------------------| | 6265 | Ignore non-existent directories for bug #171809. This is | | zmedico | required for readonly mode. | |----------+-------------------------------------------------------------| | 6267 | For bug #171840, consider all choices for slot intersection | | zmedico | and promote those that have upgrades relative to other | | | choices. | |----------+-------------------------------------------------------------| | 6269 | Clean up and simplify preference selection logic for bug | | zmedico | #171840. | |----------+-------------------------------------------------------------| | 6271 | For bug #172033, remove the obsolete QA Notice for man | | zmedico | pages that are already compressed. | |----------+-------------------------------------------------------------| | 6273 | Allow the merge task to continue despite conflicts when | | zmedico | --fetch-all-uri is specified. | |----------+-------------------------------------------------------------| | 6275 | return from the merge task instead of calling sys.exit | | zmedico | directly. | |----------+-------------------------------------------------------------| | 6277 | Verify all ebuild manifests before building anything now so | | zmedico | that the user is notified of failure as soon as possible. | +------------------------------------------------------------------------+ svn path=/main/branches/prefix/; revision=6311 --- bin/doman | 4 +- pym/emerge/__init__.py | 37 ++++++++++++--- pym/emerge/help.py | 11 ++--- pym/portage/__init__.py | 83 ++++++++++++++-------------------- pym/portage/cache/flat_hash.py | 10 +++- 5 files changed, 79 insertions(+), 66 deletions(-) diff --git a/bin/doman b/bin/doman index c39d897b3..9eb759782 100755 --- a/bin/doman +++ b/bin/doman @@ -23,10 +23,10 @@ for x in "$@" ; do suffix=${x##*.} - if [[ ${suffix} == "gz" ]] ; then + # These will be automatically decompressed by ecompressdir. + if hasq ${suffix} Z gz bz2 ; then realname=${x%.*} suffix=${realname##*.} - eqawarn "QA Notice: File is already compressed: '${realname}'" fi mandir=${i18n}man${suffix:0:1} diff --git a/pym/emerge/__init__.py b/pym/emerge/__init__.py index f2b49f461..7b58c116e 100644 --- a/pym/emerge/__init__.py +++ b/pym/emerge/__init__.py @@ -2923,6 +2923,7 @@ class MergeTask(object): #check for blocking dependencies if "--fetchonly" not in self.myopts and \ + "--fetch-all-uri" not in self.myopts and \ "--buildpkgonly" not in self.myopts: for x in mylist: if x[0]=="blocks": @@ -2931,12 +2932,36 @@ class MergeTask(object): print "!!! Please use 'emerge --pretend' to determine blockers." if "--quiet" not in self.myopts: show_blocker_docs_link() - if "--pretend" not in self.myopts: - try: - del mtimedb["resume"] - except KeyError: - pass - sys.exit(1) + return 1 + + # Verify all the manifests now so that the user is notified of failure + # as soon as possible. + if "--fetchonly" not in self.myopts and \ + "--fetch-all-uri" not in self.myopts and \ + len(mylist) > 1 and \ + "strict" in self.settings.features: + shown_verifying_msg = False + quiet_settings = {} + for myroot, pkgsettings in self.pkgsettings.iteritems(): + quiet_config = portage.config(clone=pkgsettings) + quiet_config["PORTAGE_QUIET"] = "1" + quiet_config.backup_changes("PORTAGE_QUIET") + quiet_settings[myroot] = quiet_config + del quiet_config + for x in mylist: + if x[0] != "ebuild" or x[-1] == "nomerge": + continue + if not shown_verifying_msg: + shown_verifying_msg = True + print ">>> Verifying ebuild Manifests..." + mytype, myroot, mycpv, mystatus = x + portdb = self.trees[myroot]["porttree"].dbapi + quiet_config = quiet_settings[myroot] + quiet_config["O"] = os.path.dirname(portdb.findname(mycpv)) + if not portage.digestcheck([], quiet_config, strict=True): + return 1 + del x, mytype, myroot, mycpv, mystatus, quiet_config + del shown_verifying_msg, quiet_settings #buildsyspkg: I need mysysdict also on resume (moved from the else block) mysysdict = genericdict(getlist(self.settings, "system")) diff --git a/pym/emerge/help.py b/pym/emerge/help.py index 60ae52c2d..7df9ee760 100644 --- a/pym/emerge/help.py +++ b/pym/emerge/help.py @@ -1,4 +1,4 @@ -# Copyright 1999-2006 Gentoo Foundation +# Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id$ @@ -7,8 +7,7 @@ import os,sys from portage.output import bold, turquoise, green def shorthelp(): - print - print + print bold("emerge:")+" the other white meat (command-line interface to the Portage system)" print bold("Usage:") print " "+turquoise("emerge")+" [ "+green("options")+" ] [ "+green("action")+" ] [ "+turquoise("ebuildfile")+" | "+turquoise("tbz2file")+" | "+turquoise("dependency")+" ] [ ... ]" print " "+turquoise("emerge")+" [ "+green("options")+" ] [ "+green("action")+" ] < "+turquoise("system")+" | "+turquoise("world")+" >" @@ -20,14 +19,12 @@ def shorthelp(): print " ["+green("--nospinner")+"]" print " [ "+green("--deep")+" ] [" + green("--with-bdeps")+" < " + turquoise("y") + " | "+ turquoise("n")+" > ]" print bold("Actions:")+" [ "+green("--clean")+" | "+green("--depclean")+" | "+green("--prune")+" | "+green("--regen")+" | "+green("--search")+" | "+green("--unmerge")+" ]" - print def help(myaction,myopts,havecolor=1): - if not myaction and ("--help" not in myopts): + if not myaction and ("--verbose" not in myopts): shorthelp() print - print " For more help try 'emerge --help' or consult the man page." - print + print " For more help try 'emerge --help --verbose' or consult the man page." elif not myaction: shorthelp() print diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 8b95b6854..13a335c49 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -4235,65 +4235,44 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None): else: atoms = [dep] + if not vardb: + # called by repoman + other.append((atoms, None, False)) + continue + all_available = True + versions = {} for atom in atoms: - if not mydbapi.match(atom): + avail_pkg = best(mydbapi.match(atom)) + if not avail_pkg and use_binaries: # With --usepkgonly, count installed packages as "available". # Note that --usepkgonly currently has no package.mask support. # See bug #149816. - if use_binaries and vardb and vardb.match(atom): - continue + avail_pkg = best(vardb.match(atom)) + if not avail_pkg: all_available = False break - - if not vardb: - # called by repoman - preferred.append((atoms, None, all_available)) - continue - - """ The package names rather than the exact atoms are used for an - initial rough match against installed packages. More specific - preference selection is handled later via slot and version comparison.""" - all_installed = True - for atom in set([dep_getkey(atom) for atom in atoms]): - # New-style virtuals have zero cost to install. - if not vardb.match(atom) and not atom.startswith("virtual/"): - all_installed = False - break - - # Check if the set of atoms will result in a downgrade of - # an installed package. If they will then don't prefer them - # over other atoms. - has_downgrade = False - versions = {} - if all_installed or all_available: - for atom in atoms: - mykey = dep_getkey(atom) - avail_pkg = best(mydbapi.match(atom)) - if not avail_pkg: - continue - avail_slot = "%s:%s" % (mykey, - mydbapi.aux_get(avail_pkg, ["SLOT"])[0]) - versions[avail_slot] = avail_pkg - inst_pkg = vardb.match(avail_slot) - if not inst_pkg: - continue - # emerge guarantees 1 package per slot here (highest counter) - inst_pkg = inst_pkg[0] - if avail_pkg != inst_pkg and \ - avail_pkg != best([avail_pkg, inst_pkg]): - has_downgrade = True - break + avail_slot = "%s:%s" % (dep_getkey(atom), + mydbapi.aux_get(avail_pkg, ["SLOT"])[0]) + versions[avail_slot] = avail_pkg this_choice = (atoms, versions, all_available) - if not has_downgrade: + if all_available: + # The "all installed" criterion is not version or slot specific. + # If any version of a package is installed then we assume that it + # is preferred over other possible packages choices. + all_installed = True + for atom in set([dep_getkey(atom) for atom in atoms]): + # New-style virtuals have zero cost to install. + if not vardb.match(atom) and not atom.startswith("virtual/"): + all_installed = False + break if all_installed: preferred.append(this_choice) - continue - elif all_available: + else: possible_upgrades.append(this_choice) - continue - other.append(this_choice) + else: + 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 @@ -4301,10 +4280,15 @@ 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. - for possible_upgrade in list(possible_upgrades): + preferred.extend(possible_upgrades) + possible_upgrades = preferred[1:] + for possible_upgrade in possible_upgrades: atoms, versions, all_available = possible_upgrade myslots = set(versions) for other_choice in preferred: + if possible_upgrade is other_choice: + # possible_upgrade will not be promoted, so move on + break o_atoms, o_versions, o_all_available = other_choice intersecting_slots = myslots.intersection(o_versions) if not intersecting_slots: @@ -4321,11 +4305,10 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None): has_downgrade = True break if has_upgrade and not has_downgrade: + preferred.remove(possible_upgrade) 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) diff --git a/pym/portage/cache/flat_hash.py b/pym/portage/cache/flat_hash.py index a0bdde430..f9c575811 100644 --- a/pym/portage/cache/flat_hash.py +++ b/pym/portage/cache/flat_hash.py @@ -107,7 +107,15 @@ class database(fs_template.FsBased): dirs = [self.location] len_base = len(self.location) while len(dirs): - for l in os.listdir(dirs[0]): + try: + dir_list = os.listdir(dirs[0]) + except OSError, e: + if e.errno != errno.ENOENT: + raise + del e + dirs.pop(0) + continue + for l in dir_list: if l.endswith(".cpickle"): continue p = os.path.join(dirs[0],l) -- 2.26.2