From b76aa38c71b90592ffb8cdb0db59024306ed3097 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Sat, 20 Jan 2007 20:36:23 +0000 Subject: [PATCH] Merged from trunk 5732:5737 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 | 2 +- doc/qa.docbook | 21 ++++++++++++++++++--- pym/portage.py | 10 ++++++++-- pym/portage_const.py | 1 + pym/portage_manifest.py | 22 ++++++++++++++-------- 5 files changed, 42 insertions(+), 14 deletions(-) diff --git a/bin/emerge b/bin/emerge index 14dbd6ef0..b3a552762 100755 --- a/bin/emerge +++ b/bin/emerge @@ -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: diff --git a/doc/qa.docbook b/doc/qa.docbook index d4c920867..a8178d5b7 100644 --- a/doc/qa.docbook +++ b/doc/qa.docbook @@ -214,6 +214,20 @@ + 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: + NetBSD Explanation, + Gentoo Dev Thread, + GCC Docs + + + 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. @@ -224,6 +238,7 @@ 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 ... @@ -252,7 +267,7 @@ 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 @@ -271,7 +286,7 @@ 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<=Y<=Z do not have their mathematical meaning @@ -298,7 +313,7 @@ QA Notice: Package has poor programming practices which may compile fine but exhibit random runtime failures. - ...: warning: comparisons like X<=Y<=Z do not have their mathematical meaning + ...: warning: null argument where non-null required diff --git a/pym/portage.py b/pym/portage.py index 80218cb32..8d2135ade 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -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: diff --git a/pym/portage_const.py b/pym/portage_const.py index 6051def41..0978ec98a 100644 --- a/pym/portage_const.py +++ b/pym/portage_const.py @@ -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"] # =========================================================================== diff --git a/pym/portage_manifest.py b/pym/portage_manifest.py index 1266e33df..e621606c1 100644 --- a/pym/portage_manifest.py +++ b/pym/portage_manifest.py @@ -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 """ -- 2.26.2