From: "Matt Turner" <mattst88@gentoo.org> To: gentoo-commits@lists.gentoo.org Subject: [gentoo-commits] proj/catalyst:pending/mattst88 commit in: catalyst/base/ Date: Fri, 15 May 2020 06:32:00 +0000 (UTC) [thread overview] Message-ID: <1589524294.dc0abc9160b4f85659a1d5db39201febb184e8df.mattst88@gentoo> (raw) commit: dc0abc9160b4f85659a1d5db39201febb184e8df Author: Matt Turner <mattst88 <AT> gentoo <DOT> org> AuthorDate: Fri May 15 06:24:52 2020 +0000 Commit: Matt Turner <mattst88 <AT> gentoo <DOT> org> CommitDate: Fri May 15 06:31:34 2020 +0000 URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=dc0abc91 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 <AT> gentoo.org> catalyst/base/stagebase.py | 23 ++++++++++------------- 1 file 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
WARNING: multiple messages have this Message-ID (diff)
From: "Matt Turner" <mattst88@gentoo.org> To: gentoo-commits@lists.gentoo.org Subject: [gentoo-commits] proj/catalyst:master commit in: catalyst/base/ Date: Sat, 16 May 2020 06:43:34 +0000 (UTC) [thread overview] Message-ID: <1589524294.dc0abc9160b4f85659a1d5db39201febb184e8df.mattst88@gentoo> (raw) Message-ID: <20200516064334.zpQdYn9BJrYKvJRBA8yaDgrnMhVIeeS_0pZ4LOoudy4@z> (raw) commit: dc0abc9160b4f85659a1d5db39201febb184e8df Author: Matt Turner <mattst88 <AT> gentoo <DOT> org> AuthorDate: Fri May 15 06:24:52 2020 +0000 Commit: Matt Turner <mattst88 <AT> gentoo <DOT> org> CommitDate: Fri May 15 06:31:34 2020 +0000 URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=dc0abc91 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 <AT> gentoo.org> catalyst/base/stagebase.py | 23 ++++++++++------------- 1 file 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
next reply other threads:[~2020-05-15 6:32 UTC|newest] Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-05-15 6:32 Matt Turner [this message] 2020-05-16 6:43 ` [gentoo-commits] proj/catalyst:master commit in: catalyst/base/ Matt Turner -- strict thread matches above, loose matches on Subject: below -- 2021-01-28 2:41 Matt Turner 2021-01-28 2:09 ` [gentoo-commits] proj/catalyst:pending/mattst88 " Matt Turner 2021-01-28 2:41 [gentoo-commits] proj/catalyst:master " Matt Turner 2021-01-28 2:09 ` [gentoo-commits] proj/catalyst:pending/mattst88 " Matt Turner 2021-01-28 2:09 Matt Turner 2021-01-28 1:54 Matt Turner 2021-01-28 1:54 Matt Turner 2021-01-18 19:53 Matt Turner 2020-10-29 19:05 Matt Turner 2020-10-29 19:05 Matt Turner 2020-10-29 19:05 Matt Turner 2020-10-29 16:34 Matt Turner 2020-10-29 16:14 Matt Turner 2020-10-29 16:14 Matt Turner 2020-10-29 16:14 Matt Turner 2020-10-29 16:04 Matt Turner 2020-10-29 16:04 Matt Turner 2020-10-29 16:04 Matt Turner 2020-10-29 15:47 Matt Turner 2020-10-29 15:47 Matt Turner 2020-10-29 15:47 Matt Turner 2020-10-29 13:08 Matt Turner 2020-10-24 22:07 [gentoo-commits] proj/catalyst:master " Matt Turner 2020-10-23 4:36 ` [gentoo-commits] proj/catalyst:pending/mattst88 " Matt Turner 2020-10-24 22:07 [gentoo-commits] proj/catalyst:master " Matt Turner 2020-10-23 4:36 ` [gentoo-commits] proj/catalyst:pending/mattst88 " Matt Turner 2020-10-22 18:59 Matt Turner 2020-05-21 20:25 [gentoo-commits] proj/catalyst:master " Matt Turner 2020-05-20 3:39 ` [gentoo-commits] proj/catalyst:pending/mattst88 " Matt Turner 2020-05-21 20:25 [gentoo-commits] proj/catalyst:master " Matt Turner 2020-05-20 3:39 ` [gentoo-commits] proj/catalyst:pending/mattst88 " Matt Turner 2020-05-21 20:25 [gentoo-commits] proj/catalyst:master " Matt Turner 2020-05-20 3:39 ` [gentoo-commits] proj/catalyst:pending/mattst88 " Matt Turner 2020-05-20 3:39 [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner 2020-05-20 3:39 ` [gentoo-commits] proj/catalyst:pending/mattst88 " Matt Turner 2020-05-15 6:32 Matt Turner
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1589524294.dc0abc9160b4f85659a1d5db39201febb184e8df.mattst88@gentoo \ --to=mattst88@gentoo.org \ --cc=gentoo-commits@lists.gentoo.org \ --cc=gentoo-dev@lists.gentoo.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox