From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id A48501382C5 for ; Fri, 15 May 2020 06:32:05 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id CD3ADE083B; Fri, 15 May 2020 06:32:04 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id A9AA9E083B for ; Fri, 15 May 2020 06:32:04 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id BCB4C350F51 for ; Fri, 15 May 2020 06:32:02 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 5E78318F for ; Fri, 15 May 2020 06:32:00 +0000 (UTC) From: "Matt Turner" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Matt Turner" Message-ID: <1589524294.dc0abc9160b4f85659a1d5db39201febb184e8df.mattst88@gentoo> Subject: [gentoo-commits] proj/catalyst:pending/mattst88 commit in: catalyst/base/ X-VCS-Repository: proj/catalyst X-VCS-Files: catalyst/base/stagebase.py X-VCS-Directories: catalyst/base/ X-VCS-Committer: mattst88 X-VCS-Committer-Name: Matt Turner X-VCS-Revision: dc0abc9160b4f85659a1d5db39201febb184e8df X-VCS-Branch: pending/mattst88 Date: Fri, 15 May 2020 06:32:00 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 0d05b915-c1b1-4de3-990b-fb60d8b3e3e6 X-Archives-Hash: 91adb1689cd7aa2b4b3da290e66c0be2 commit: dc0abc9160b4f85659a1d5db39201febb184e8df Author: Matt Turner gentoo org> AuthorDate: Fri May 15 06:24:52 2020 +0000 Commit: Matt Turner gentoo 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 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 880761382C5 for ; Sat, 16 May 2020 06:43:42 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0B0EAE09A8; Sat, 16 May 2020 06:43:40 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id D91BEE09A8 for ; Sat, 16 May 2020 06:43:39 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id EDA0D34F0FE for ; Sat, 16 May 2020 06:43:38 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id DE7CE256 for ; Sat, 16 May 2020 06:43:34 +0000 (UTC) From: "Matt Turner" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Matt Turner" Message-ID: <1589524294.dc0abc9160b4f85659a1d5db39201febb184e8df.mattst88@gentoo> Subject: [gentoo-commits] proj/catalyst:master commit in: catalyst/base/ X-VCS-Repository: proj/catalyst X-VCS-Files: catalyst/base/stagebase.py X-VCS-Directories: catalyst/base/ X-VCS-Committer: mattst88 X-VCS-Committer-Name: Matt Turner X-VCS-Revision: dc0abc9160b4f85659a1d5db39201febb184e8df X-VCS-Branch: master Date: Sat, 16 May 2020 06:43:34 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 442ec4b1-b662-4a34-8eeb-2df06b2b594c X-Archives-Hash: 64c43e1bf13fdca8fcfd54121e8bddce Message-ID: <20200516064334.zpQdYn9BJrYKvJRBA8yaDgrnMhVIeeS_0pZ4LOoudy4@z> commit: dc0abc9160b4f85659a1d5db39201febb184e8df Author: Matt Turner gentoo org> AuthorDate: Fri May 15 06:24:52 2020 +0000 Commit: Matt Turner gentoo 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 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