From a08967bce60d50ec1d27741512dc96f6ed546594 Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Fri, 4 Nov 2022 10:13:16 +0100 Subject: [PATCH 4/6] allow to set it by user (cherry picked from commit 5dcf480a401581442ace9b17e9c2a06241885ae6) --- plugins/builder/kiwi.py | 6 +++++- plugins/cli/kiwi.py | 4 ++++ plugins/hub/kiwi.py | 4 +++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/plugins/builder/kiwi.py b/plugins/builder/kiwi.py index e220d515..b70a13a3 100644 --- a/plugins/builder/kiwi.py +++ b/plugins/builder/kiwi.py @@ -300,6 +300,10 @@ class KiwiCreateImageTask(BaseBuildTask): desc_url, desc_path, opts=None): self.opts = opts build_tag = target_info['build_tag'] + if opts.get('bind_dev'): + bind_opts = {'dirs': {'/dev': '/dev'}} + else: + bind_opts = None broot = BuildRoot(self.session, self.options, tag=build_tag, arch=arch, @@ -307,7 +311,7 @@ class KiwiCreateImageTask(BaseBuildTask): repo_id=repo_info['id'], install_group='kiwi-build', setup_dns=True, - bind_opts={'dirs': {}}) + bind_opts=bind_opts) broot.workdir = self.workdir # create the mock chroot diff --git a/plugins/cli/kiwi.py b/plugins/cli/kiwi.py index 6e965c05..61764efb 100644 --- a/plugins/cli/kiwi.py +++ b/plugins/cli/kiwi.py @@ -30,6 +30,9 @@ def handle_kiwi_build(goptions, session, args): parser.add_option("--type", help="Override default build type from description") parser.add_option("--make-prep", action="store_true", default=False, help="Run 'make prep' in checkout before starting the build") + parser.add_option("--bind-dev", action="store_true", default=False, + help="e.g. images using device-mapper needs /dev mounted in kiwi env, " + "while others can fail in such env.") parser.add_option("--can-fail", action="store", dest="optional_arches", metavar="ARCH1,ARCH2,...", default="", help="List of archs which are not blocking for build " @@ -52,6 +55,7 @@ def handle_kiwi_build(goptions, session, args): 'target': target, 'desc_url': scm, 'desc_path': path, + 'bind_dev': options.bind_dev, } if options.scratch: kwargs['scratch'] = True diff --git a/plugins/hub/kiwi.py b/plugins/hub/kiwi.py index 7b0c2f05..f83b209d 100644 --- a/plugins/hub/kiwi.py +++ b/plugins/hub/kiwi.py @@ -17,7 +17,7 @@ koji.tasks.LEGACY_SIGNATURES['createKiwiImage'] = [ @export def kiwiBuild(target, arches, desc_url, desc_path, optional_arches=None, profile=None, scratch=False, priority=None, make_prep=False, repos=None, release=None, - type=None): + type=None, bind_dev=False): context.session.assertPerm('image') for i in [desc_url, desc_path, profile, release]: if i is not None: @@ -52,6 +52,8 @@ def kiwiBuild(target, arches, desc_url, desc_path, optional_arches=None, profile opts['release'] = release if optional_arches: opts['optional_arches'] = optional_arches + if bind_dev: + opts['bind_dev'] = bind_dev if repos: opts['repos'] = repos if make_prep: -- 2.38.1