aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gentoo.org>2020-05-14 23:24:52 -0700
committerMatt Turner <mattst88@gentoo.org>2020-05-14 23:31:34 -0700
commitdc0abc9160b4f85659a1d5db39201febb184e8df (patch)
tree0e119962cfbe220352d2b93af6eb67f6ea671008 /catalyst/base
parentcatalyst: Rename shmfs -> shm (diff)
downloadcatalyst-dc0abc9160b4f85659a1d5db39201febb184e8df.tar.gz
catalyst-dc0abc9160b4f85659a1d5db39201febb184e8df.tar.bz2
catalyst-dc0abc9160b4f85659a1d5db39201febb184e8df.zip
catalyst: Factor out mount/source/target in bind()
This simplifies things, and lets us only append to the end of the list. It also enables us to simply add multiple args (in the next commit). Signed-off-by: Matt Turner <mattst88@gentoo.org>
Diffstat (limited to 'catalyst/base')
-rw-r--r--catalyst/base/stagebase.py23
1 files changed, 10 insertions, 13 deletions
diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 52f9cd5b..55d1032d 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -852,6 +852,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
source = str(self.mount[x]['source'])
target = self.settings['chroot_path'] + str(self.mount[x]['target'])
+ mount = ['mount']
log.debug('bind %s: "%s" -> "%s"', x, source, target)
@@ -859,29 +860,25 @@ class StageBase(TargetBase, ClearBase, GenBase):
if 'var_tmpfs_portage' not in self.settings:
continue
- _cmd = ['mount', '-t', 'tmpfs', '-o', 'size=' +
- self.settings['var_tmpfs_portage'] + 'G', source,
- target]
+ mount += ['-t', 'tmpfs', '-o', 'size=' +
+ self.settings['var_tmpfs_portage'] + 'G']
elif source == 'tmpfs':
- _cmd = ['mount', '-t', 'tmpfs', source, target]
+ mount += ['-t', 'tmpfs']
elif source == 'shm':
- _cmd = ['mount', '-t', 'tmpfs', '-o', 'noexec,nosuid,nodev',
- source, target]
+ mount += ['-t', 'tmpfs', '-o', 'noexec,nosuid,nodev']
else:
- _cmd = ['mount', source, target]
-
- source = Path(self.mount[x]['source'])
- if source.suffix != '.sqfs':
- _cmd.insert(1, '--bind')
+ source_path = Path(self.mount[x]['source'])
+ if source_path.suffix != '.sqfs':
+ mount.append('--bind')
# We may need to create the source of the bind mount. E.g., in the
# case of an empty package cache we must create the directory that
# the binary packages will be stored into.
- source.mkdir(mode=0o755, exist_ok=True)
+ source_path.mkdir(mode=0o755, exist_ok=True)
Path(target).mkdir(mode=0o755, parents=True, exist_ok=True)
- cmd(_cmd, env=self.env, fail_func=self.unbind)
+ cmd(mount + [source, target], env=self.env, fail_func=self.unbind)
def unbind(self):
ouch = 0