From: Zac Medico Date: Sat, 5 Apr 2008 19:27:13 +0000 (-0000) Subject: In dbapi.move_ent(), never assume that any of the expected metadata X-Git-Tag: v2.1.5~243 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=801d551e35934bbd8c48f7ef6680960cf3572741;p=portage.git In dbapi.move_ent(), never assume that any of the expected metadata entries exist (PF, CATEGORY, or *.ebuild). (trunk r9712) svn path=/main/branches/2.1.2/; revision=9722 --- diff --git a/pym/portage.py b/pym/portage.py index 8cf24bd7a..fecfec3dd 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -6461,8 +6461,7 @@ class vardbapi(dbapi): if e.errno != errno.ENOENT: raise del e - write_atomic(os.path.join(newpath, "PF"), new_pf+"\n") - + write_atomic(os.path.join(newpath, "PF"), new_pf+"\n") write_atomic(os.path.join(newpath, "CATEGORY"), mynewcat+"\n") fixdbentries([mylist], newpath) return moves @@ -7747,11 +7746,13 @@ class binarytree(object): mydata = mytbz2.get_data() updated_items = update_dbentries([mylist], mydata) mydata.update(updated_items) + mydata["PF"] = mynewpkg + "\n" mydata["CATEGORY"] = mynewcat+"\n" if mynewpkg != myoldpkg: - mydata[mynewpkg+".ebuild"] = mydata[myoldpkg+".ebuild"] - del mydata[myoldpkg+".ebuild"] - mydata["PF"] = mynewpkg + "\n" + ebuild_data = mydata.get(myoldpkg+".ebuild") + if ebuild_data is not None: + mydata[mynewpkg+".ebuild"] = ebuild_data + del mydata[myoldpkg+".ebuild"] mytbz2.recompose_mem(xpak.xpak_mem(mydata)) self.dbapi.cpv_remove(mycpv)