sort the world file before writing it and ensure that it's terminated by a newline...
authorZac Medico <zmedico@gentoo.org>
Sun, 24 Jun 2007 19:06:10 +0000 (19:06 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 24 Jun 2007 19:06:10 +0000 (19:06 -0000)
svn path=/main/branches/2.1.2/; revision=7000

bin/emaint
bin/emerge
bin/regenworld
pym/portage_update.py

index e86920a2f2c7d7b48a01bde1cae95e9f7ac29c84..0353a52ce43bc09962ad400d3f8ee7d76bc62f54 100755 (executable)
@@ -58,7 +58,8 @@ class WorldHandler(object):
        def fix(self):
                errors = []
                try:
-                       portage.write_atomic(self.world_file, "\n".join(self.okay))
+                       portage.write_atomic(self.world_file,
+                               "\n".join(sorted(self.okay)) + "\n")
                except portage_exception.PortageException:
                        errors.append(self.world_file + " could not be opened for writing")
                return errors
index 2502387d254215ea9325b0f7ba6adc7ab0e1277d..43c7efc27c01c396c9081ca86b73f4a73560b626 100755 (executable)
@@ -584,10 +584,12 @@ def clean_world(vardb, cpv):
                else:
                        #this doesn't match the package we're unmerging; keep it.
                        newworldlist.append(x)
-
+       
+       newworldlist.sort()
+       
        portage_util.ensure_dirs(os.path.join(vardb.root, portage.PRIVATE_PATH),
                gid=portage.portage_gid, mode=02770)
-       portage_util.write_atomic(world_filename, "\n".join(newworldlist))
+       portage_util.write_atomic(world_filename, "\n".join(newworldlist)+"\n")
 
 def genericdict(mylist):
        mynewdict={}
@@ -3028,7 +3030,7 @@ class MergeTask(object):
                                "--pretend" in self.myopts):
                                portage.write_atomic(
                                        os.path.join(self.target_root, portage.WORLD_FILE),
-                                       "\n".join(myfavdict.values()))
+                                               "\n".join(sorted(myfavdict.values())) + "\n")
 
                        mtimedb["resume"]["mergelist"]=mymergelist[:]
                        mtimedb.commit()
@@ -3281,7 +3283,7 @@ class MergeTask(object):
                                                        ") Updating world file ("+x[pkgindex]+")")
                                                portage.write_atomic(
                                                os.path.join(myroot, portage.WORLD_FILE),
-                                               "\n".join(myfavdict.values()))
+                                               "\n".join(sorted(myfavdict.values()))+"\n")
 
                                if "--pretend" not in self.myopts and \
                                        "--fetchonly" not in self.myopts and \
index ebac4a5916f1e29f919dc15917a0fef5c64b8376..6016534064c662840d4aad2476abba19a8408551 100755 (executable)
@@ -92,4 +92,5 @@ for mykey in biglist:
                        print "add to world:",myfavkey
                        worldlist.append(myfavkey)
 
-portage.write_atomic(os.path.join("/", portage.WORLD_FILE), "\n".join(worldlist))
+portage.write_atomic(os.path.join("/", portage.WORLD_FILE),
+       "\n".join(sorted(worldlist)) + "\n")
index c3746d34d132a34c57535b0c23a10e294aa665a8..f1cf7c6e566c2e18de22ca3c799819941be93c1a 100644 (file)
@@ -202,7 +202,8 @@ def update_config_files(config_root, protect, protect_mask, update_iter):
                                                sys.stdout.write("p")
                                                sys.stdout.flush()
 
-       write_atomic(os.path.join(config_root, WORLD_FILE), "\n".join(worldlist))
+       worldlist.sort()
+       write_atomic(os.path.join(config_root, WORLD_FILE), "\n".join(worldlist)+"\n")
 
        protect_obj = ConfigProtect(
                config_root, protect, protect_mask)