summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-11-24 04:50:40 +0000
committerZac Medico <zmedico@gentoo.org>2007-11-24 04:50:40 +0000
commitd1f031621d8058ad470ad3e7329f550b568eb6e2 (patch)
treeb530fe6e006bbb6441005720bcfb4d5689c62462
parentfb5fd2d5277952f138ec5e1a3101583598b2fad0 (diff)
downloadportage-d1f031621d8058ad470ad3e7329f550b568eb6e2.tar.gz
portage-d1f031621d8058ad470ad3e7329f550b568eb6e2.tar.bz2
portage-d1f031621d8058ad470ad3e7329f550b568eb6e2.zip
When binarytree.populate() finds missing metadata, specify which keys
are missing so that the user has a clue about what is wrong. (trunk r8638). svn path=/main/branches/2.1.2/; revision=8639
-rw-r--r--pym/portage.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/pym/portage.py b/pym/portage.py
index 1dce3a1d0..3d5515148 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -7211,11 +7211,23 @@ class binarytree(object):
mypkg = myfile[:-5]
if not mycat or not mypf:
#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")
+ 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()