From 2040b172163bea277be6ffe712bfd8a04dcbdb86 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 4 Jun 2020 21:43:03 +0200 Subject: Behave better with symlinks; replace them with the actual path at the earliest opportunity. --- cdist | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/cdist b/cdist index 6829244..2474307 100755 --- a/cdist +++ b/cdist @@ -446,7 +446,7 @@ class Target(object): self.set('CCACHE_BASEDIR', os.path.realpath(self.directory)) self.set('CCACHE_NOHASHDIR', '') else: - self.directory = directory + self.directory = os.path.realpath(directory) self.rmdir = False @@ -542,14 +542,17 @@ class DockerTarget(Target): return '' return '-u %s' % getpass.getuser() + def _mount_option(self, d): + return '-v %s:%s ' % (os.path.realpath(d), os.path.realpath(d)) + def setup(self): - opts = '-v %s:%s ' % (self.directory, self.directory) + opts = self._mount_option(self.directory) for m in self.mounts: - opts += '-v %s:%s ' % (m, m) + opts += self._mount_option(m) + if config.has('git_reference'): + opts += self._mount_option(config.get('git_reference')) if self.privileged: opts += '--privileged=true ' - if config.has('git_reference'): - opts += '-v %s:%s ' % (config.get('git_reference'), config.get('git_reference')) if self.ccache: opts += "-e CCACHE_DIR=/ccache/%s --mount source=ccache,target=/ccache" % self.image -- cgit v1.2.3