From cb05140be57d7b066b5a2a665f16aa343eac2594 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Mon, 26 Feb 2007 21:56:01 +0000 Subject: [PATCH] Merged from trunk 6048:6070 spawn rsync without a shell. Make verify_all() return an "insufficient data" error if there is not at least one supported hash type. Make fetch() bail out when an "Insufficient data for checksum verification" error occurs. Do not show the spinner and the "Calculating dependencies" message for installation actions when the --nodeps option has been specified. Thanks to David Watzke for this patch from bug #168169. Filter paths matching '/$' that come from debugedit. Thanks to Ed Catmur for this patch from bug #165342. As requested by solar, never show a merge list unless it's explicitly requested by --ask, --pretend, or --tree. As requested by solar, never show a merge list unless it's explicitly requested by --ask, --pretend, or --tree. Allow --verbose to trigger a merge list even without --pretend, --ask, or --tree. Thanks to agaffney and zlin for the suggestion. Clean up os.environ["USERLAND"] pollution from the portage.data module so that it doesn't interfere with repoman. For bug #167668, prune empty ${FILESDIR}s by adding --prune-empty-dirs to PORTAGE_RSYNC_OPTS. Thanks to Ulrich Mueller for the suggestion. svn path=/main/branches/prefix/; revision=6084 --- bin/prepstrip | 3 ++- cnf/make.globals | 2 +- pym/emerge/__init__.py | 28 ++++++++++++++++++---------- pym/portage/__init__.py | 13 ++++++++++++- pym/portage/checksum.py | 18 ++++++++++++++++++ 5 files changed, 51 insertions(+), 13 deletions(-) diff --git a/bin/prepstrip b/bin/prepstrip index 4997a4953..6666d3202 100755 --- a/bin/prepstrip +++ b/bin/prepstrip @@ -32,7 +32,8 @@ save_elf_debug() { -l "${T}"/debug.sources "${x}" if [[ -s ${T}/debug.sources ]] ; then [[ -d ${ED}${sources_dir} ]] || mkdir -p "${ED}${sources_dir}" - cat "${T}"/debug.sources | (cd "${WORKDIR}"; LANG=C sort -z -u | \ + grep -zv '/$' "${T}"/debug.sources | \ + (cd "${WORKDIR}"; LANG=C sort -z -u | \ rsync -rtL0 --files-from=- "${WORKDIR}/" "${ED}${sources_dir}/" ) fi fi diff --git a/cnf/make.globals b/cnf/make.globals index e88550de9..b8aed3413 100644 --- a/cnf/make.globals +++ b/cnf/make.globals @@ -54,7 +54,7 @@ PORTAGE_RSYNC_RETRIES="3" # Number of seconds rsync will wait before timing out. #RSYNC_TIMEOUT="180" -PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*" +PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-* --prune-empty-dirs" # Minimal CONFIG_PROTECT CONFIG_PROTECT="/etc" diff --git a/pym/emerge/__init__.py b/pym/emerge/__init__.py index 42412730e..6cab8ab9d 100644 --- a/pym/emerge/__init__.py +++ b/pym/emerge/__init__.py @@ -1094,7 +1094,8 @@ class depgraph: priority=priority) return 1 - self.spinner.update() + if "--nodeps" not in self.myopts: + self.spinner.update() if mytype == "blocks": if myparent and \ "--buildpkgonly" not in self.myopts and \ @@ -3799,7 +3800,8 @@ def action_sync(settings, trees, mtimedb, myopts, myaction): "--exclude=/distfiles", # Exclude distfiles from consideration "--exclude=/local", # Exclude local from consideration "--exclude=/packages", # Exclude packages from consideration - "--filter=H_**/files/digest-*" # Exclude manifest1 digests and delete on the receiving side + "--filter=H_**/files/digest-*", # Exclude manifest1 digests and delete on the receiving side + "--prune-empty-dirs" # Prune empty ${FILESDIR} when manifest1 digests are excluded ]) else: @@ -4031,7 +4033,9 @@ def action_sync(settings, trees, mtimedb, myopts, myaction): elif (servertimestamp == 0) or (servertimestamp > mytimestamp): # actual sync mycommand=rsynccommand+" "+dosyncuri+"/ "+myportdir - exitcode=portage.spawn(mycommand,settings,free=1) + mycommand = mycommand.split() + exitcode = portage.process.spawn(mycommand, + env=settings.environ()) if exitcode in [0,1,2,3,4,11,14,20,21]: break elif exitcode in [0,1,2,3,4,11,14,20,21]: @@ -4724,7 +4728,9 @@ def action_build(settings, trees, mtimedb, myopts, myaction, myfiles, spinner): ldpath_mtimes = mtimedb["ldpath"] favorites=[] - if "--quiet" not in myopts: + if "--quiet" not in myopts and \ + ("--pretend" in myopts or "--ask" in myopts or \ + "--tree" in myopts or "--verbose" in myopts): action = "" if "--fetchonly" in myopts or "--fetch-all-uri" in myopts: action = "fetched" @@ -4767,11 +4773,11 @@ def action_build(settings, trees, mtimedb, myresumeopts[myopt] = myarg myopts=myresumeopts myparams = create_depgraph_params(myopts, myaction) - if not "--quiet" in myopts: + if "--quiet" not in myopts and "--nodeps" not in myopts: print "Calculating dependencies ", mydepgraph = depgraph(settings, trees, myopts, myparams, spinner) - if not "--quiet" in myopts: + if "--quiet" not in myopts and "--nodeps" not in myopts: print "\b\b... done!" else: if ("--resume" in myopts): @@ -4780,17 +4786,17 @@ def action_build(settings, trees, mtimedb, myparams = create_depgraph_params(myopts, myaction) if myaction in ["system","world"]: - if not ("--quiet" in myopts): + if "--quiet" not in myopts and "--nodeps" not in myopts: print "Calculating",myaction,"dependencies ", sys.stdout.flush() mydepgraph = depgraph(settings, trees, myopts, myparams, spinner) if not mydepgraph.xcreate(myaction): print "!!! Depgraph creation failed." sys.exit(1) - if not ("--quiet" in myopts): + if "--quiet" not in myopts and "--nodeps" not in myopts: print "\b\b... done!" else: - if not ("--quiet" in myopts): + if "--quiet" not in myopts and "--nodeps" not in myopts: print "Calculating dependencies ", sys.stdout.flush() mydepgraph = depgraph(settings, trees, myopts, myparams, spinner) @@ -4801,7 +4807,7 @@ def action_build(settings, trees, mtimedb, sys.exit(1) if not retval: sys.exit(1) - if not ("--quiet" in myopts): + if "--quiet" not in myopts and "--nodeps" not in myopts: print "\b\b... done!" if ("--usepkgonly" in myopts) and mydepgraph.missingbins: @@ -4814,6 +4820,8 @@ def action_build(settings, trees, mtimedb, sys.exit(1) if "--pretend" not in myopts and \ + ("--ask" in myopts or "--tree" in myopts or \ + "--verbose" in myopts) and \ not ("--quiet" in myopts and "--ask" not in myopts): if "--resume" in myopts: validate_merge_list(trees, mtimedb["resume"]["mergelist"]) diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 48ae2f437..2c820bd4d 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -912,6 +912,10 @@ class config: # backupenv is for calculated incremental variables. self.backupenv = os.environ.copy() + if not local_config: + # Clean up pollution from portage.data so that it doesn't + # interfere with repoman. + self.backupenv.pop("USERLAND", None) def check_var_directory(varname, var): if not os.path.isdir(var): @@ -1154,7 +1158,10 @@ class config: self.configlist.append(os.environ.copy()) self.configdict["env"]=self.configlist[-1] - + if not local_config: + # Clean up pollution from portage.data so that it doesn't + # interfere with repoman. + self.configdict["env"].pop("USERLAND", None) # make lookuplist for loading package.* self.lookuplist=self.configlist[:] @@ -2411,6 +2418,8 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks", writemsg(("!!! Got: %s\n" + \ "!!! Expected: %s\n") % \ (reason[1], reason[2]), noiselevel=-1) + if reason[0] == "Insufficient data for checksum verification": + return 0 if can_fetch and not restrict_fetch: writemsg("Refetching...\n\n", noiselevel=-1) @@ -2550,6 +2559,8 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks", noiselevel=-1) writemsg("!!! Got: %s\n!!! Expected: %s\n" % \ (reason[1], reason[2]), noiselevel=-1) + if reason[0] == "Insufficient data for checksum verification": + return 0 writemsg("Removing corrupt distfile...\n", noiselevel=-1) os.unlink(mysettings["DISTDIR"]+"/"+myfile) fetched=0 diff --git a/pym/portage/checksum.py b/pym/portage/checksum.py index 8d4fea4a0..2ae873ca5 100644 --- a/pym/portage/checksum.py +++ b/pym/portage/checksum.py @@ -3,6 +3,8 @@ # Distributed under the terms of the GNU General Public License v2 # $Id: portage_checksum.py 3835 2006-07-11 00:59:10Z zmedico $ +if not hasattr(__builtins__, "set"): + from sets import Set as set from portage.const import PRIVATE_PATH,PRELINK_BINARY,HASHING_BLOCKSIZE import os @@ -113,6 +115,22 @@ def verify_all(filename, mydict, calc_prelink=0, strict=0): if e.errno == errno.ENOENT: raise portage.exception.FileNotFound(filename) return False, (str(e), None, None) + + verifiable_hash_types = set(mydict).intersection(hashfunc_map) + verifiable_hash_types.discard("size") + if not verifiable_hash_types: + expected = set(hashfunc_map) + expected.discard("size") + expected = list(expected) + expected.sort() + expected = " ".join(expected) + got = set(mydict) + got.discard("size") + got = list(got) + got.sort() + got = " ".join(got) + return False, ("Insufficient data for checksum verification", got, expected) + for x in mydict.keys(): if x == "size": continue -- 2.26.2