Print this page
5166 sendmail package should be replaceable

@@ -58,10 +58,11 @@
         ("mode", "mode="),
         ("owner", "owner="),
         ("path", "path=")
     ],
     "link": [
+        ("mediator", "mediator="),
         ("path", "path="),
         ("target", "target=")
     ],
     "hardlink": [
         ("path", "path="),

@@ -194,13 +195,14 @@
             if typelhs != typerhs:
                 return True
 
         #
         # For symlinks, all that's left is the link target.
+        # For mediated symlinks targets can differ.
         #
         if typelhs == "link":
-            return lhs.target != rhs.target
+            return (lhs.mediator is None) and (lhs.target != rhs.target)
 
         #
         # For a directory, it's important that both be directories,
         # the modes be identical, and the paths are identical.  We already
         # checked all but the modes above.

@@ -304,10 +306,14 @@
             if "preserve" in action.attrs:
                 self.editable = True
         elif action.name == "link":
             target = action.attrs["target"]
             self.target = os.path.normpath(target)
+            if "mediator" in action.attrs:
+                self.mediator = action.attrs["mediator"]
+            else:
+                self.mediator = None
         elif action.name == "dir":
             self.owner = action.attrs["owner"]
             self.group = action.attrs["group"]
             self.mode = action.attrs["mode"]
             self.isdir = True

@@ -364,10 +370,11 @@
             self.hash = self.path
         elif stat.S_ISDIR(mode):
             self.isdir = True
         elif stat.S_ISLNK(mode):
             self.target = os.path.normpath(os.readlink(path))
+            self.mediator = None
         else:
             raise UnsupportedFileFormatError(path, mode)
 
         if not stat.S_ISLNK(mode):
             self.mode = "%04o" % stat.S_IMODE(mode)