summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-04-13 21:59:18 +0000
committerZac Medico <zmedico@gentoo.org>2006-04-13 21:59:18 +0000
commit0241a10d9fd597ff534446d82619fc42b2880a36 (patch)
tree6e0de5b1c9312338c1abd99dfbecf19e763b6b2c
parente5ffe576e032738060f0c9b5ced5e9dc9b065f32 (diff)
downloadportage-0241a10d9fd597ff534446d82619fc42b2880a36.tar.gz
portage-0241a10d9fd597ff534446d82619fc42b2880a36.tar.bz2
portage-0241a10d9fd597ff534446d82619fc42b2880a36.zip
Fix digestcheck logic for bug #129839.
svn path=/main/trunk/; revision=3142
-rw-r--r--pym/portage.py42
-rw-r--r--pym/portage_manifest.py15
2 files changed, 30 insertions, 27 deletions
diff --git a/pym/portage.py b/pym/portage.py
index 413bd4cd9..4f8c9423c 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -2163,33 +2163,31 @@ def digestcheck(myfiles, mysettings, strict=0, justmanifest=0):
"""Verifies checksums. Assumes all files have been downloaded.
DEPRECATED: this is now only a compability wrapper for
portage_manifest.Manifest()."""
-
+ if not strict:
+ return 1
pkgdir = mysettings["O"]
+ manifest_path = os.path.join(pkgdir, "Manifest")
+ if not os.path.exists(manifest_path):
+ writemsg("!!! Manifest file not found: '%s'\n" % manifest_path)
+ if strict:
+ return 0
mf = Manifest(pkgdir, FetchlistDict(pkgdir, mysettings), mysettings["DISTDIR"])
try:
- if strict:
- print ">>> checking ebuild checksums",
- mf.checkTypeHashes("EBUILD")
- print ":-)"
- print ">>> checking auxfile checksums",
- mf.checkTypeHashes("AUX")
- print ":-)"
- print ">>> checking miscfile checksums",
- mf.checkTypeHashes("MISC", ignoreMissingFiles=True)
- print ":-)"
+ writemsg_stdout(">>> checking ebuild checksums\n")
+ mf.checkTypeHashes("EBUILD")
+ writemsg_stdout(">>> checking auxfile checksums\n")
+ mf.checkTypeHashes("AUX")
+ writemsg_stdout(">>> checking miscfile checksums\n")
+ mf.checkTypeHashes("MISC", ignoreMissingFiles=True)
+ writemsg_stdout(">>> checking distfiles checksums\n")
for f in myfiles:
- if f.startswith("files/"):
- f = f[5:]
- print ">>> checking %s checksums" % f,
- mf.checkFileHashes(mf.findFile(f), f)
- print ":-)"
+ mf.checkFileHashes(mf.findFile(f), f)
except portage_exception.DigestException, e:
- print e.value
- print red("!!! ")+"Digest verification failed:"
- print red("!!! ")+" "+e.value[0]
- print red("!!! ")+"Reason: "+e.value[1]
- print red("!!! ")+"Got: "+str(e.value[2])
- print red("!!! ")+"Expected: "+str(e.value[3])
+ writemsg("!!! Digest verification failed:\n")
+ writemsg("!!! %s\n" % e.value[0])
+ writemsg("!!! Reason: %s\n" % e.value[1])
+ writemsg("!!! Got: %s\n" % e.value[2])
+ writemsg("!!! Expected: %s\n" % e.value[3])
return 0
return 1
diff --git a/pym/portage_manifest.py b/pym/portage_manifest.py
index 491074da9..50d061ecc 100644
--- a/pym/portage_manifest.py
+++ b/pym/portage_manifest.py
@@ -86,11 +86,16 @@ class Manifest(object):
def _read(self):
""" Parse Manifest file for this instance """
- if not os.path.exists(self.getFullname()):
- return
- fd = open(self.getFullname(), "r")
- mylines = fd.readlines()
- fd.close()
+ mylines = []
+ try:
+ fd = open(self.getFullname(), "r")
+ mylines.extend(fd.readlines())
+ fd.close()
+ except (OSError, IOError), e:
+ if e.errno == errno.ENOENT:
+ pass
+ else:
+ raise
mylines.extend(self._readDigests().split("\n"))
self._parseDigests(mylines, myhashdict=self.fhashdict)