Print this page
5189 validate_pkg should support mediated links
Reviewed by: Richard Lowe <richlowe@richlowe.net>
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
*** 58,67 ****
--- 58,68 ----
("mode", "mode="),
("owner", "owner="),
("path", "path=")
],
"link": [
+ ("mediator", "mediator="),
("path", "path="),
("target", "target=")
],
"hardlink": [
("path", "path="),
*** 194,206 ****
if typelhs != typerhs:
return True
#
# For symlinks, all that's left is the link target.
#
if typelhs == "link":
! return 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.
--- 195,208 ----
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.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,313 ****
--- 306,316 ----
if "preserve" in action.attrs:
self.editable = True
elif action.name == "link":
target = action.attrs["target"]
self.target = os.path.normpath(target)
+ self.mediator = action.attrs.get("mediator")
elif action.name == "dir":
self.owner = action.attrs["owner"]
self.group = action.attrs["group"]
self.mode = action.attrs["mode"]
self.isdir = True
*** 364,373 ****
--- 367,377 ----
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)