From: Fabian Groffen Date: Sun, 29 Oct 2006 13:43:34 +0000 (-0000) Subject: Merged from trunk 4866:4869 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=f943a89a9311b9b4c109a5e4dbe9ffdcb2f68254;p=portage.git Merged from trunk 4866:4869 Prevent an attribute error AttributeError for invalid binary packages for which there is no CATEGORY data. Don't forget to continue for invalid binpkgs. svn path=/main/branches/prefix/; revision=4871 --- diff --git a/pym/portage.py b/pym/portage.py index 50e42cc3b..99420474b 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -5715,8 +5715,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().""" @@ -5783,7 +5785,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 @@ -5793,6 +5796,8 @@ class binarytree(packagetree): "recoverable and should be deleted.\n", noiselevel=-1) self.invalids.append(mypkg) + continue + mycat = mycat.strip() if mycat != mydir and mydir != "All": continue if mypkg != mytbz2.getfile("PF").strip():