Merged from trunk 6048:6070
authorFabian Groffen <grobian@gentoo.org>
Mon, 26 Feb 2007 21:56:01 +0000 (21:56 -0000)
committerFabian Groffen <grobian@gentoo.org>
Mon, 26 Feb 2007 21:56:01 +0000 (21:56 -0000)
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 <david@watzke.cz> for this patch from bug #168169.

Filter paths matching '/<built-in>$' 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 <ulm@kph.uni-mainz.de>
for the suggestion.

svn path=/main/branches/prefix/; revision=6084

bin/prepstrip
cnf/make.globals
pym/emerge/__init__.py
pym/portage/__init__.py
pym/portage/checksum.py

index 4997a4953264b73e597613df73c9067c10e117a2..6666d32023f59a61c38508827d876912575d0eb4 100755 (executable)
@@ -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 '/<built-in>$' "${T}"/debug.sources | \
+                               (cd "${WORKDIR}"; LANG=C sort -z -u | \
                                rsync -rtL0 --files-from=- "${WORKDIR}/" "${ED}${sources_dir}/" )
                fi
        fi
index e88550de92de9d09a3663bf8a63cbb2fd8e12313..b8aed34132eab8fbf485a04bc6c8941d1877e494 100644 (file)
@@ -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"
index 42412730e45653543f732259a7a0b3dd4759ed86..6cab8ab9d96c7aecc7ca8226367b02f0082bfa1a 100644 (file)
@@ -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"])
index 48ae2f4370643b9a193f1ba42a47cc3c502ab698..2c820bd4dd2c0f1f67d19acadb9f06656ce0dce4 100644 (file)
@@ -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
index 8d4fea4a0e31462e846ce835934cbbd6115898f2..2ae873ca5da6ea5229da31d2e57eaf9ebd7f7ac7 100644 (file)
@@ -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