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 279131382C5 for ; Fri, 15 May 2020 06:37:45 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 3C4AFE0BFC; Fri, 15 May 2020 06:37:44 +0000 (UTC) Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) (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 35F3AE0BFC for ; Fri, 15 May 2020 06:37:44 +0000 (UTC) Received: by mail-pg1-f194.google.com with SMTP id u5so534365pgn.5 for ; Thu, 14 May 2020 23:37:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BGs90GsLk17l9OalRFQmk+w1yp2ZWN4xhFCOFMJcab4=; b=Wu8bTP0TkD8Vs5JR9mRF5sDYTnC4lUwoJ8n4DzrWT2FFDdiIOq2DI63biNT6qeMrHx +GPtyIwwyacfMr0/Rv2H9XYW9krYgXiLdcphGRu5IZSLVkoE0sbZtNiMz/gM5CyVeRr8 nh+zdvq70p/yq1SCk4W8xHLfQxRbe3JUJ+SSTuuv7oUTy9EfzdFdO25Qlfafx8o+MElO PoMflobqfHd2zQAy0WwlBeazA2ujQtvn0lNmiUeR0Wfb7Lg59ZNRS+lIH/hVdmCSggeR YlGDiZW1PY9DvmKYBuN764FrsDDT6S2Xf7K4pyB2HaP/ysb4i68LF37MOfGw/m9VHMEw ncIg== X-Gm-Message-State: AOAM530CFFrW0GHvApGXjxS0PFQAlAV+5q3HGyW9UBnmOSoSofgVpA50 5bmlzoSrPPiQ51S6V7SQDf+VHqz8 X-Google-Smtp-Source: ABdhPJx4CgPnZhC6JuMlC4trRFxeGde7ZSFh7TOJ7A3bhwoE7IKyXNnxZXFOU7lGto2+kwFfFxuTsw== X-Received: by 2002:a65:4683:: with SMTP id h3mr849875pgr.165.1589524662699; Thu, 14 May 2020 23:37:42 -0700 (PDT) Received: from localhost ([134.134.139.83]) by smtp.gmail.com with ESMTPSA id u5sm923283pgi.70.2020.05.14.23.37.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 23:37:41 -0700 (PDT) From: Matt Turner To: gentoo-catalyst@lists.gentoo.org Cc: Matt Turner Subject: [gentoo-catalyst] [PATCH 2/3] catalyst: Factor out mount/source/target in bind() Date: Thu, 14 May 2020 23:37:29 -0700 Message-Id: <20200515063730.2582596-2-mattst88@gentoo.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200515063730.2582596-1-mattst88@gentoo.org> References: <20200515063730.2582596-1-mattst88@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-catalyst@lists.gentoo.org Reply-to: gentoo-catalyst@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Archives-Salt: a61615aa-70a5-4eba-870a-578e82838801 X-Archives-Hash: 121f0fd3ae9774689f5a40379db48273 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 --- 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 -- 2.26.2