diff options
author | Angelos Evripiotis <jevripiotis@bloomberg.net> | 2019-06-11 13:36:53 +0100 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2019-06-18 09:45:00 +0000 |
commit | 415fcbd52e1387692660155f53881d0268b8c3dc (patch) | |
tree | 623b76dc6bccd0c0dfb50c6ecbc08cab29aff508 /src/buildstream/_fuse | |
parent | f1f6a5a6e09e275566bf56f4728826844b38dd47 (diff) | |
download | buildstream-415fcbd52e1387692660155f53881d0268b8c3dc.tar.gz |
_fuse: converge args for link() and symlink()
Get consistency between the Operations base class and the
SafeHardlinkOps subclass.
Use the 'target, source' convention as it appears in Operations.
This avoids the confusion of 'target' changing meaning in the
'name, target' convention introduced by SafeHardlinkOps. The naming is
also consistent with 'man ln', and more consistent with Python's
equivalent functions.
Unfortunately FUSE.link() and Operations.link() swap the order of
'target' and 'source', but the meaning is the same.
Diffstat (limited to 'src/buildstream/_fuse')
-rw-r--r-- | src/buildstream/_fuse/hardlinks.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/buildstream/_fuse/hardlinks.py b/src/buildstream/_fuse/hardlinks.py index ff2e81eea..a9756ac79 100644 --- a/src/buildstream/_fuse/hardlinks.py +++ b/src/buildstream/_fuse/hardlinks.py @@ -163,18 +163,20 @@ class SafeHardlinkOps(Operations): def unlink(self, path): return os.unlink(self._full_path(path)) - def symlink(self, name, target): - return os.symlink(target, self._full_path(name)) + def symlink(self, target, source): + 'creates a symlink `target -> source` (e.g. ln -s source target)' + return os.symlink(source, self._full_path(target)) def rename(self, old, new): return os.rename(self._full_path(old), self._full_path(new)) - def link(self, target, name): + def link(self, target, source): + 'creates a hard link `target -> source` (e.g. ln source target)' # When creating a hard link here, should we ensure the original # file is not a hardlink itself first ? # - return os.link(self._full_path(name), self._full_path(target)) + return os.link(self._full_path(source), self._full_path(target)) def utimens(self, path, times=None): return os.utime(self._full_path(path), times) |