For bug #158558, fix broken ebuild rename logic in vardbapi.move_ent().
authorZac Medico <zmedico@gentoo.org>
Tue, 19 Dec 2006 22:48:18 +0000 (22:48 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 19 Dec 2006 22:48:18 +0000 (22:48 -0000)
svn path=/main/trunk/; revision=5327

pym/portage.py

index 325b718cb3bde3f7e01097bb7a7700081c0e1a69..fb8690bac052266fb61fd613d37fb9ad5c1bdcab 100644 (file)
@@ -4665,13 +4665,17 @@ class vardbapi(dbapi):
                        os.rename(origpath, newpath)
 
                        # We need to rename the ebuild now.
-                       old_eb_path = newpath+"/"+mycpsplit[1]    +"-"+mycpsplit[2]
-                       new_eb_path = newpath+"/"+mycpsplit_new[1]+"-"+mycpsplit[2]
-                       if mycpsplit[3] != "r0":
-                               old_eb_path += "-"+mycpsplit[3]
-                               new_eb_path += "-"+mycpsplit[3]
-                       if os.path.exists(old_eb_path+".ebuild"):
-                               os.rename(old_eb_path+".ebuild", new_eb_path+".ebuild")
+                       old_pf = catsplit(mycpv)[1]
+                       new_pf = catsplit(mynewcpv)[1]
+                       if new_pf != old_pf:
+                               try:
+                                       os.rename(os.path.join(newpath, old_pf + ".ebuild"),
+                                               os.path.join(newpath, new_pf + ".ebuild"))
+                               except OSError, e:
+                                       if e.errno != errno.ENOENT:
+                                               raise
+                                       del e
+                               write_atomic(os.path.join(newpath, "PF"), new_pf+"\n")
 
                        write_atomic(os.path.join(newpath, "CATEGORY"), mynewcat+"\n")
                        fixdbentries([mylist], newpath)