Merged from trunk -r5896 -r5904
authorFabian Groffen <grobian@gentoo.org>
Tue, 6 Feb 2007 21:30:50 +0000 (21:30 -0000)
committerFabian Groffen <grobian@gentoo.org>
Tue, 6 Feb 2007 21:30:50 +0000 (21:30 -0000)
For bug #165382, show a helpful message if an exception is raised from
cpv_expand().

Check if entries contain the required hashes before writing the Manifest
(genone)

Make sure to fetch files if MANIFEST2_REQUIRED_HASH is missing.

Document PORTAGE_WORKDIR_MODE for bug #8688.  Thanks to Peter
Hjalmarsson in bug #164617.

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

bin/emerge
man/make.conf.5
pym/portage/__init__.py
pym/portage/manifest.py

index 1e5b7fe61a0bf64969e374dc099b2a5f9e280822..bcbdb93238011def9e598e805d30eee29cb2a2bd 100755 (executable)
@@ -1805,9 +1805,22 @@ class depgraph:
                                                # dep_wordreduce and dep_eval calls.
                                                try:
                                                        portage.dep._dep_check_strict = False
-                                                       success, atoms = portage.dep_check(depstr,
-                                                               final_db, pkgsettings, myuse=myuse,
-                                                               trees=dep_check_trees, myroot=myroot)
+                                                       try:
+                                                               success, atoms = portage.dep_check(depstr,
+                                                                       final_db, pkgsettings, myuse=myuse,
+                                                                       trees=dep_check_trees, myroot=myroot)
+                                                       except Exception, e:
+                                                               if isinstance(e, SystemExit):
+                                                                       raise
+                                                               # This is helpful, for example, if a ValueError
+                                                               # is thrown from cpv_expand due to multiple
+                                                               # matches (this can happen if an atom lacks a
+                                                               # category).
+                                                               show_invalid_depstring_notice(
+                                                                       ("installed", myroot, pkg, "nomerge"),
+                                                                       depstr, str(e))
+                                                               del e
+                                                               raise
                                                finally:
                                                        portage.dep._dep_check_strict = True
                                                if not success:
index 8e89cca7504d38086babec0902b6b727ae310e0b..168523efa3955238c6ea607e4c668bcf1795d1e9 100644 (file)
@@ -377,6 +377,9 @@ Defines the location of the temporary build directories.
 .br
 Defaults to /var/tmp.
 .TP
+\fBPORTAGE_WORKDIR_MODE\fR = \fI"0700"\fR
+This variable controls permissions for \fIWORKDIR\fR (see \fBebuild\fR(5)).
+.TP
 \fBPORTDIR\fR = \fI[path]\fR
 Defines the location of your Portage tree.
 .br
index f8e65cb8498beb9443c5ca8baf8a1036b265de88..b7fa6ae47e58535632fbc3e72e97ecde95aaf4da 100644 (file)
@@ -2713,6 +2713,7 @@ def digestgen(myarchives, mysettings, overwrite=1, manifestonly=0, myportdb=None
                # exist before and after the transition.
                required_hash_types = set(portage.const.MANIFEST1_HASH_FUNCTIONS
                        ).intersection(portage.const.MANIFEST2_HASH_FUNCTIONS)
+               required_hash_types.add(portage.const.MANIFEST2_REQUIRED_HASH)
                required_hash_types.add("size")
                dist_hashes = mf.fhashdict.get("DIST", {})
                missing_hashes = set()
index 92b5b8e85ab284b144476d9f69d3b75bfbab74a5..08ac13932b25ebb53f89ac1e28de6d63a6124315 100644 (file)
@@ -6,7 +6,7 @@ import errno, os, sets
 if not hasattr(__builtins__, "set"):
        from sets import Set as set
 
-import portage.exception, portage.versions, portage.const
+import portage.versions, portage.const
 from portage.checksum import *
 from portage.exception import *
 from portage.util import write_atomic
@@ -341,8 +341,15 @@ class Manifest(object):
                                except FileNotFound:
                                        pass
 
+       def checkIntegrity(self):
+               for t in self.fhashdict.keys():
+                       for f in self.fhashdict[t]:
+                               if not portage.const.MANIFEST2_REQUIRED_HASH in self.fhashdict[t][f].keys():
+                                       raise MissingParameter("Missing %s checksum: %s %s" % (portage.const.MANIFEST2_REQUIRED_HASH, t, f))
+
        def write(self, sign=False, force=False):
                """ Write Manifest instance to disk, optionally signing it """
+               self.checkIntegrity()
                try:
                        if self.compat:
                                self._writeDigests()
@@ -478,7 +485,8 @@ class Manifest(object):
                                (assumeDistHashesAlways and mystat is None) or \
                                (assumeDistHashesAlways and mystat is not None and \
                                len(distfilehashes[f]) == len(self.hashes) and \
-                               distfilehashes[f]["size"] == mystat.st_size)):
+                               distfilehashes[f]["size"] == mystat.st_size)) and \
+                               portage.const.MANIFEST2_REQUIRED_HASH in distfilehashes[f].keys():
                                self.fhashdict["DIST"][f] = distfilehashes[f]
                        else:
                                try: