diff options
author | Zac Medico <zmedico@gentoo.org> | 2006-10-28 21:57:27 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2006-10-28 21:57:27 +0000 |
commit | c6c602ccb0fb955376087a40b0b976c6bc169f3b (patch) | |
tree | 578336d079334bf88a8a88a4e777074fd72929de | |
parent | 9d32ae401ea25227bd8bcfe7dfaad6c06e349a6b (diff) | |
download | portage-c6c602ccb0fb955376087a40b0b976c6bc169f3b.tar.gz portage-c6c602ccb0fb955376087a40b0b976c6bc169f3b.tar.bz2 portage-c6c602ccb0fb955376087a40b0b976c6bc169f3b.zip |
Prevent an attribute error AttributeError for invalid binary packages for which there is no CATEGORY data.
svn path=/main/trunk/; revision=4867
-rw-r--r-- | pym/portage.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/pym/portage.py b/pym/portage.py index 81de2e182..6adaa56df 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -5710,8 +5710,10 @@ class binarytree(packagetree): mypath = os.path.join("All", myfile) dest_path = os.path.join(self.pkgdir, mypath) if os.path.exists(dest_path): - other_cat = xpak.tbz2(dest_path).getfile("CATEGORY").strip() + # For invalid packages, other_cat could be None. + other_cat = xpak.tbz2(dest_path).getfile("CATEGORY") if other_cat: + other_cat = other_cat.strip() self._move_from_all(other_cat + "/" + mypkg) """The file may or may not exist. Move it if necessary and update internal state for future calls to getname().""" @@ -5778,7 +5780,8 @@ class binarytree(packagetree): if os.path.islink(full_path): continue mytbz2 = xpak.tbz2(full_path) - mycat = mytbz2.getfile("CATEGORY").strip() + # For invalid packages, mycat could be None. + mycat = mytbz2.getfile("CATEGORY") mypkg = myfile[:-5] if not mycat: #old-style or corrupt package @@ -5788,6 +5791,7 @@ class binarytree(packagetree): "recoverable and should be deleted.\n", noiselevel=-1) self.invalids.append(mypkg) + mycat = mycat.strip() if mycat != mydir and mydir != "All": continue if mypkg != mytbz2.getfile("PF").strip(): |