summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-11-24 04:47:12 +0000
committerZac Medico <zmedico@gentoo.org>2007-11-24 04:47:12 +0000
commitec62257fabc320237b42f7f74a4b73b75e9db972 (patch)
treebde754c565baa4b104bc358e5b5f606842e74946 /pym
parent748af6ce22dae92ca0e18f2d24fab6f19763e32a (diff)
downloadportage-ec62257fabc320237b42f7f74a4b73b75e9db972.tar.gz
portage-ec62257fabc320237b42f7f74a4b73b75e9db972.tar.bz2
portage-ec62257fabc320237b42f7f74a4b73b75e9db972.zip
When binarytree.populate() finds missing metadata, specify which keys
are missing so that the user has a clue about what is wrong. svn path=/main/trunk/; revision=8638
Diffstat (limited to 'pym')
-rw-r--r--pym/portage/dbapi/bintree.py22
1 files changed, 18 insertions, 4 deletions
diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py
index 45cd80463..b354f9aee 100644
--- a/pym/portage/dbapi/bintree.py
+++ b/pym/portage/dbapi/bintree.py
@@ -465,11 +465,25 @@ class binarytree(object):
mypkg = myfile[:-5]
if not mycat or not mypf or not slot:
#old-style or corrupt package
- writemsg("!!! Invalid binary package: '%s'\n" % full_path,
- noiselevel=-1)
- writemsg("!!! This binary package is not " + \
- "recoverable and should be deleted.\n",
+ writemsg("\n!!! Invalid binary package: '%s'\n" % full_path,
noiselevel=-1)
+ missing_keys = []
+ if not mycat:
+ missing_keys.append("CATEGORY")
+ if not mypf:
+ missing_keys.append("PF")
+ if not slot:
+ missing_keys.append("SLOT")
+ msg = []
+ if missing_keys:
+ missing_keys.sort()
+ msg.append("Missing metadata key(s): %s." % \
+ ", ".join(missing_keys))
+ msg.append(" This binary package is not " + \
+ "recoverable and should be deleted.")
+ from textwrap import wrap
+ for line in wrap("".join(msg), 72):
+ writemsg("!!! %s\n" % line, noiselevel=-1)
self.invalids.append(mypkg)
continue
mycat = mycat.strip()