- s/!owned/replaced/ in merge output to clarify it (trunk r6975)
authorZac Medico <zmedico@gentoo.org>
Sun, 24 Jun 2007 18:24:34 +0000 (18:24 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 24 Jun 2007 18:24:34 +0000 (18:24 -0000)
- Fix column alignment in unmerge output. (trunk r6988)
- Fix typos. (trunk r6989 and r6996)

svn path=/main/branches/2.1.2/; revision=6997

pym/portage.py

index afc285eb50e35960db51aa3a2ed3709cb5de86af..9a5ec82f707c5f24400ec549ab8f4104f4578884 100644 (file)
@@ -7182,6 +7182,9 @@ class dblink:
                        #process symlinks second-to-last, directories last.
                        mydirs = []
                        modprotect = os.path.join(self.vartree.root, "lib/modules/")
+                       def show_unmerge(zing, desc, file_type, file_name):
+                                       writemsg_stdout("%s %s %s %s\n" % \
+                                               (zing, desc.ljust(8), file_type, obj))
                        for objkey in mykeys:
                                obj = normalize_path(objkey)
                                file_data = pkgfiles[objkey]
@@ -7198,7 +7201,7 @@ class dblink:
                                        pass
                                islink = lstatobj is not None and stat.S_ISLNK(lstatobj.st_mode)
                                if lstatobj is None:
-                                               writemsg_stdout("--- !found %s %s\n" % (file_type, obj))
+                                               show_unmerge("---", "!found", file_type, obj)
                                                continue
                                if obj.startswith(dest_root):
                                        relative_path = obj[dest_root_len:]
@@ -7210,8 +7213,7 @@ class dblink:
                                        if is_owned:
                                                # A new instance of this package claims the file, so
                                                # don't unmerge it.
-                                               writemsg_stdout("--- !owned %s %s\n" % \
-                                                       (file_type, obj))
+                                               show_unmerge("---", "replaced", file_type, obj)
                                                continue
                                # next line includes a tweak to protect modules from being unmerged,
                                # but we don't protect modules from being overwritten if they are
@@ -7219,7 +7221,7 @@ class dblink:
                                # functionality for /lib/modules. For portage-ng both capabilities
                                # should be able to be independently specified.
                                if obj.startswith(modprotect):
-                                       writemsg_stdout("--- cfgpro %s %s\n" % (pkgfiles[objkey][0], obj))
+                                       show_unmerge("---", "cfgpro", file_type, obj)
                                        continue
 
                                # Don't unlink symlinks to directories here since that can
@@ -7236,22 +7238,22 @@ class dblink:
                                                os.unlink(obj)
                                        except EnvironmentError, e:
                                                pass
-                                       writemsg_stdout("<<<        %s %s\n" % (file_type, obj))
+                                       show_unmerge("<<<", "", file_type, obj)
                                        continue
 
-                               lmtime=str(lstatobj[stat.ST_MTIME])
+                               lmtime = str(lstatobj[stat.ST_MTIME])
                                if (pkgfiles[objkey][0] not in ("dir","fif","dev")) and (lmtime != pkgfiles[objkey][1]):
-                                       writemsg_stdout("--- !mtime %s %s\n" % (pkgfiles[objkey][0], obj))
+                                       show_unmerge("---", "!mtime", file_type, obj)
                                        continue
 
-                               if pkgfiles[objkey][0]=="dir":
+                               if pkgfiles[objkey][0] == "dir":
                                        if statobj is None or not stat.S_ISDIR(statobj.st_mode):
-                                               writemsg_stdout("--- !dir   %s %s\n" % ("dir", obj))
+                                               show_unmerge("---", "!dir", file_type, obj)
                                                continue
                                        mydirs.append(obj)
-                               elif pkgfiles[objkey][0]=="sym":
+                               elif pkgfiles[objkey][0] == "sym":
                                        if not islink:
-                                               writemsg_stdout("--- !sym   %s %s\n" % ("sym", obj))
+                                               show_unmerge("---", "!sym", file_type, obj)
                                                continue
                                        # Go ahead and unlink symlinks to directories here when
                                        # they're actually recorded as symlinks in the contents.
@@ -7262,25 +7264,25 @@ class dblink:
                                        # to a symlink when it's merged to the live filesystem.
                                        try:
                                                os.unlink(obj)
-                                               writemsg_stdout("<<<        %s %s\n" % ("sym",obj))
+                                               show_unmerge("<<<", "", file_type, obj)
                                        except (OSError,IOError),e:
-                                               writemsg_stdout("!!!        %s %s\n" % ("sym",obj))
-                               elif pkgfiles[objkey][0]=="obj":
+                                               show_unmerge("!!!", "", file_type, obj)
+                               elif pkgfiles[objkey][0] == "obj":
                                        if statobj is None or not stat.S_ISREG(statobj.st_mode):
-                                               writemsg_stdout("--- !obj   %s %s\n" % ("obj", obj))
+                                               show_unmerge("---", "!obj", file_type, obj)
                                                continue
                                        mymd5 = None
                                        try:
                                                mymd5 = portage_checksum.perform_md5(obj, calc_prelink=1)
                                        except portage_exception.FileNotFound, e:
                                                # the file has disappeared between now and our stat call
-                                               writemsg_stdout("--- !obj   %s %s\n" % ("obj", obj))
+                                               show_unmerge("---", "!obj", file_type, obj)
                                                continue
 
                                        # string.lower is needed because db entries used to be in upper-case.  The
                                        # string.lower allows for backwards compatibility.
                                        if mymd5 != pkgfiles[objkey][2].lower():
-                                               writemsg_stdout("--- !md5   %s %s\n" % ("obj", obj))
+                                               show_unmerge("---", "!md5", file_type, obj)
                                                continue
                                        try:
                                                # Remove permissions to ensure that any hardlinks to
@@ -7290,14 +7292,14 @@ class dblink:
                                                os.unlink(obj)
                                        except (OSError,IOError),e:
                                                pass
-                                       writemsg_stdout("<<<        %s %s\n" % ("obj",obj))
-                               elif pkgfiles[objkey][0]=="fif":
+                                       show_unmerge("<<<", "", file_type, obj)
+                               elif pkgfiles[objkey][0] == "fif":
                                        if not stat.S_ISFIFO(lstatobj[stat.ST_MODE]):
-                                               writemsg_stdout("--- !fif   %s %s\n" % ("fif", obj))
+                                               show_unmerge("---", "!fif", file_type, obj)
                                                continue
-                                       writemsg_stdout("---        %s %s\n" % ("fif",obj))
-                               elif pkgfiles[objkey][0]=="dev":
-                                       writemsg_stdout("---        %s %s\n" % ("dev",obj))
+                                       show_unmerge("---", "", file_type, obj)
+                               elif pkgfiles[objkey][0] == "dev":
+                                       show_unmerge("---", "", file_type, obj)
 
                        mydirs.sort()
                        mydirs.reverse()
@@ -7305,9 +7307,9 @@ class dblink:
                        for obj in mydirs:
                                try:
                                        os.rmdir(obj)
-                                       writemsg_stdout("<<<        %s %s\n" % ("dir",obj))
+                                       show_unmerge("<<<", "", "dir", obj)
                                except (OSError, IOError):
-                                       writemsg_stdout("--- !empty dir %s\n" % obj)
+                                       show_unmerge("---", "!empty", "dir", obj)
 
                #remove self from vartree database so that our own virtual gets zapped if we're the last node
                self.vartree.zap(self.mycpv)