aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Harring <ferringb@gentoo.org>2005-08-09 08:04:56 +0000
committerBrian Harring <ferringb@gentoo.org>2005-08-09 08:04:56 +0000
commit64c1b0bfcbe677e56d96d3fedfb8f8ee95ba203b (patch)
treef552a67d4b33a7432f43d51acea3c0e57f6b6f4f
parentbye bye cvs_id attrib... (diff)
downloadportage-cvs-64c1b0bfcbe677e56d96d3fedfb8f8ee95ba203b.tar.gz
portage-cvs-64c1b0bfcbe677e56d96d3fedfb8f8ee95ba203b.tar.bz2
portage-cvs-64c1b0bfcbe677e56d96d3fedfb8f8ee95ba203b.zip
initial digest parsing code
-rw-r--r--portage/ebuild/digest.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/portage/ebuild/digest.py b/portage/ebuild/digest.py
new file mode 100644
index 0000000..b75ddd3
--- /dev/null
+++ b/portage/ebuild/digest.py
@@ -0,0 +1,20 @@
+# Copyright: 2005 Gentoo Foundation
+# Author(s): Brian Harring (ferringb@gentoo.org)
+# License: GPL2
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/portage/ebuild/digest.py,v 1.1 2005/08/09 08:04:56 ferringb Exp $
+
+from portage.fetch import ChecksumUnavailable
+def parse_digest(path):
+ d = {}
+ try:
+ f = open(path)
+ for line in f:
+ l = line.split()
+ if len(l) != 4:
+ raise ChecksumUnavailable("failed parsing " + path, l.strip())
+ #MD5 c08f3a71a51fff523d2cfa00f14fa939 diffball-0.6.2.tar.bz2 305567
+ d[l[2]] = {l[0].lower():l[1], "size":l[3]}
+ f.close()
+ except (OSError, IOError), e:
+ raise ChecksumUnavailable("failed parsing " + path, e)
+ return d