use write_atomic for move_ent CATEGORY updates
authorZac Medico <zmedico@gentoo.org>
Sun, 12 Feb 2006 23:43:40 +0000 (23:43 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 12 Feb 2006 23:43:40 +0000 (23:43 -0000)
svn path=/main/trunk/; revision=2701

pym/portage.py

index aa0d3d5c253ad3b04fbc5500f9a1cf5b4da7a3eb..650e831f50b5b565ecde12f7ea4b0de6ef07f020 100644 (file)
@@ -4357,9 +4357,7 @@ class vardbapi(dbapi):
                        if os.path.exists(old_eb_path+".ebuild"):
                                os.rename(old_eb_path+".ebuild", new_eb_path+".ebuild")
 
-                       catfile=open(newpath+"/CATEGORY", "w")
-                       catfile.write(mynewcat+"\n")
-                       catfile.close()
+                       write_atomic(os.path.join(newpath, "CATEGORY"), mynewcat+"\n")
 
                dbdir = self.root+VDB_PATH
                for catdir in listdir(dbdir):
@@ -5296,9 +5294,7 @@ class binarytree(packagetree):
 
                        fixdbentries(origcp, newcp, mytmpdir)
 
-                       catfile=open(mytmpdir+"/CATEGORY", "w")
-                       catfile.write(mynewcat+"\n")
-                       catfile.close()
+                       write_atomic(os.path.join(mytmpdir, "CATEGORY"), mynewcat+"\n")
                        try:
                                os.rename(mytmpdir+"/"+string.split(mycpv,"/")[1]+".ebuild", mytmpdir+"/"+string.split(mynewcpv, "/")[1]+".ebuild")
                        except SystemExit, e: