Merged from trunk 5732:5737
authorFabian Groffen <grobian@gentoo.org>
Sat, 20 Jan 2007 20:36:23 +0000 (20:36 -0000)
committerFabian Groffen <grobian@gentoo.org>
Sat, 20 Jan 2007 20:36:23 +0000 (20:36 -0000)
forgot to document strict alias warnings (SpankMan)

fix programlisting output to match the sections they are in (SpankMan)

Some minor fixes for manifest code (genone)

For bug #161356, fix the SLOT match code to handle a KeyError thrown due
to a corrupt ebuild.

For bug #161356, prevent an AttributeError if the exception has no
__module__ attribute.

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

bin/emerge
doc/qa.docbook
pym/portage.py
pym/portage_const.py
pym/portage_manifest.py

index 14dbd6ef0fe7aa1bef3fbf187457c705d2d7f6f3..b3a55276279ad1e5b7291fafbb5fb8a810800bdf 100755 (executable)
@@ -1463,7 +1463,7 @@ class depgraph:
                                        raise # Needed else can't exit
                                except Exception, e:
                                        print >> sys.stderr, "\n\n!!! Problem in '%s' dependencies." % mykey
-                                       print >> sys.stderr, "!!!", str(e), e.__module__
+                                       print >> sys.stderr, "!!!", str(e), getattr(e, "__module__", None)
                                        raise
 
                                if not self.mysd:
index d4c92086780f298dd3fdf7e2e32bb590c2f7f50c..a8178d5b72842adfcb41f9f1d5da161363526432 100644 (file)
    </programlisting>
   </para>
   <para>
+   This warning crops up when code starts casting distinct pointer types and
+   then dereferencing them.  Generally, this is a violation of aliasing rules
+   which are part of the C standard.  Historically, these warnings did not show
+   up as the optimization was not turned on by default.  With gcc-4.1.x and
+   newer though, the -O2 optimization level enables strict aliasing support.
+   For information, please review these links:
+   <ulink url="http://mail-index.netbsd.org/tech-kern/2003/08/11/0001.html">NetBSD Explanation</ulink>,
+   <ulink url="http://thread.gmane.org/gmane.linux.gentoo.devel/39495">Gentoo Dev Thread</ulink>,
+   <ulink url="http://gcc.gnu.org/bugs.html#nonbugs_c">GCC Docs</ulink>
+  </para>
+  <para>
+   To fix this issue, use the methods proposed in the links mentioned earlier.
+   If you're unable to do so, then a work around would be to append the gcc
+   -fno-strict-aliasing flag to CFLAGS in the ebuild.
   </para>
  </sect1>
 
     QA Notice: Package has poor programming practices which may compile
                fine but exhibit random runtime failures.
     ...: warning: implicit declaration of function ...
+    ...: warning: incompatible implicit declaration of built-in function ...
    </programlisting>
   </para>
   <para>
    <programlisting>
     QA Notice: Package has poor programming practices which may compile
                fine but exhibit random runtime failures.
-    ...: warning: incompatible implicit declaration of built-in function ...
+    ...: warning: is used uninitialized in this function
    </programlisting>
   </para>
   <para>
    <programlisting>
     QA Notice: Package has poor programming practices which may compile
                fine but exhibit random runtime failures.
-    ...: warning: is used uninitialized in this function
+    ...: warning: comparisons like X&lt;=Y&lt;=Z do not have their mathematical meaning
    </programlisting>
   </para>
   <para>
    <programlisting>
     QA Notice: Package has poor programming practices which may compile
                fine but exhibit random runtime failures.
-    ...: warning: comparisons like X&lt;=Y&lt;=Z do not have their mathematical meaning
+    ...: warning: null argument where non-null required
    </programlisting>
   </para>
   <para>
index 80218cb32b6bfe8fa6f28579544de59766871b95..8d2135ade5342301c1e6cb34b4bbda59ac6f2dfd 100644 (file)
@@ -6109,8 +6109,14 @@ class portdbapi(dbapi):
                        raise KeyError
                myslot = portage_dep.dep_getslot(mydep)
                if myslot is not None:
-                       myval = [cpv for cpv in myval \
-                               if self.aux_get(cpv, ["SLOT"])[0] == myslot]
+                       slotmatches = []
+                       for cpv in myval:
+                               try:
+                                       if self.aux_get(cpv, ["SLOT"])[0] == myslot:
+                                               slotmatches.append(cpv)
+                               except KeyError:
+                                       pass # ebuild masked by corruption
+                       myval = slotmatches
                if self.frozen and (level not in ["match-list","bestmatch-list"]):
                        self.xcache[level][mydep]=myval
                        if origdep and origdep != mydep:
index 6051def413ccfef21c4a48a8a4eeb3515ebee4fa..0978ec98a1768a735d743a724f811684d9fb757d 100644 (file)
@@ -60,6 +60,7 @@ EAPI = "prefix"
 HASHING_BLOCKSIZE        = 32768
 MANIFEST1_HASH_FUNCTIONS = ["MD5","SHA256","RMD160"]
 MANIFEST2_HASH_FUNCTIONS = ["SHA1","SHA256","RMD160"]
+MANIFEST2_REQUIRED_HASH = "SHA1"
 
 MANIFEST2_IDENTIFIERS = ["AUX","MISC","DIST","EBUILD"]
 # ===========================================================================
index 1266e33df435b7a6b0ee0e8ef342627f154663db..e621606c1ec1b251844e4536decc4c85143f5170 100644 (file)
@@ -120,7 +120,10 @@ class Manifest(object):
                if not from_scratch:
                        self._read()
                self.compat = manifest1_compat
-               self.fetchlist_dict = fetchlist_dict
+               if fetchlist_dict != None:
+                       self.fetchlist_dict = fetchlist_dict
+               else:
+                       self.fetchlist_dict = {}
                self.distdir = distdir
                self.guessType = guessManifestFileType
 
@@ -381,17 +384,21 @@ class Manifest(object):
                """ Validate signature on Manifest """
                raise NotImplementedError()
        
-       def addFile(self, ftype, fname, hashdict=None):
+       def addFile(self, ftype, fname, hashdict=None, ignoreMissing=False):
                """ Add entry to Manifest optionally using hashdict to avoid recalculation of hashes """
-               if not os.path.exists(self.pkgdir+fname):
+               if ftype == "AUX" and not fname.startswith("files/"):
+                       fname = os.path.join("files", fname)
+               if not os.path.exists(self.pkgdir+fname) and not ignoreMissing:
                        raise FileNotFound(fname)
                if not ftype in portage_const.MANIFEST2_IDENTIFIERS:
                        raise InvalidDataType(ftype)
+               if ftype == "AUX" and fname.startswith("files"):
+                       fname = fname[6:]
                self.fhashdict[ftype][fname] = {}
                if hashdict != None:
                        self.fhashdict[ftype][fname].update(hashdict)
                if not portage_const.MANIFEST2_REQUIRED_HASH in self.fhashdict[ftype][fname]:
-                       self.updateFileHashes(ftype, fname)
+                       self.updateFileHashes(ftype, fname, checkExisting=False, ignoreMissing=ignoreMissing)
        
        def removeFile(self, ftype, fname):
                """ Remove given entry from Manifest """
@@ -521,10 +528,9 @@ class Manifest(object):
                                self.checkTypeHashes("MISC", ignoreMissingFiles=False)
                        ebuildname = "%s.ebuild" % self._catsplit(cpv)[1]
                        self.checkFileHashes("EBUILD", ebuildname, ignoreMissing=False)
-               if checkDistfiles:
-                       if onlyDistfiles:
-                               for f in self._getCpvDistfiles(cpv):
-                                       self.checkFileHashes("DIST", f, ignoreMissing=False)
+               if checkDistfiles or onlyDistfiles:
+                       for f in self._getCpvDistfiles(cpv):
+                               self.checkFileHashes("DIST", f, ignoreMissing=False)
        
        def _getCpvDistfiles(self, cpv):
                """ Get a list of all DIST files associated to the given cpv """