In dbapi.move_ent(), never assume that any of the expected metadata
authorZac Medico <zmedico@gentoo.org>
Sat, 5 Apr 2008 06:25:49 +0000 (06:25 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 5 Apr 2008 06:25:49 +0000 (06:25 -0000)
entries exist (PF, CATEGORY, or *.ebuild).

svn path=/main/trunk/; revision=9712

pym/portage/dbapi/bintree.py
pym/portage/dbapi/vartree.py

index c51bfa4f901d7d15d2b9beb9e4c764f2504ad114..f920c0fab9c3662b04fcee469fe5933429058cd2 100644 (file)
@@ -204,11 +204,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(portage.xpak.xpak_mem(mydata))
 
                        self.dbapi.cpv_remove(mycpv)
index a47bbb6d9ae6b4e2870614fe8e3905036175d110..5a085f40571247c30f07523127f38838a49e1504 100644 (file)
@@ -335,8 +335,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