diff --git a/cli/koji b/cli/koji index f4ca8e01..896b6256 100755 --- a/cli/koji +++ b/cli/koji @@ -6892,6 +6892,8 @@ def handle_runroot(options, session, args): help=_("Print the ID of the runroot task")) parser.add_option("--use-shell", action="store_true", default=False, help=_("Run command through a shell, otherwise uses exec")) + parser.add_option("--new-chroot", action="store_true", default=False, + help=_("Run command with the --new-chroot (systemd-nspawn) option to mock")) parser.add_option("--repo-id", type="int", help=_("ID of the repo to use")) (opts, args) = parser.parse_args(args) @@ -6912,6 +6914,7 @@ def handle_runroot(options, session, args): packages=opts.package, mounts=opts.mount, repo_id=opts.repo_id, skip_setarch=opts.skip_setarch, + new_chroot=opts.new_chroot, weight=opts.weight) except koji.GenericError, e: if 'Invalid method' in str(e): diff --git a/plugins/builder/runroot.py b/plugins/builder/runroot.py index 7bf40e4f..83f1898c 100644 --- a/plugins/builder/runroot.py +++ b/plugins/builder/runroot.py @@ -92,7 +92,7 @@ class RunRootTask(tasks.BaseTaskHandler): if not path.startswith('/'): raise koji.GenericError("bad config: all paths (default_mounts, safe_roots, path_subs) needs to be absolute: %s" % path) - def handler(self, root, arch, command, keep=False, packages=[], mounts=[], repo_id=None, skip_setarch=False, weight=None, upload_logs=None): + def handler(self, root, arch, command, keep=False, packages=[], mounts=[], repo_id=None, skip_setarch=False, weight=None, upload_logs=None, new_chroot=False): """Create a buildroot and run a command (as root) inside of it Command may be a string or a list. @@ -188,6 +188,8 @@ class RunRootTask(tasks.BaseTaskHandler): self.do_mounts(rootdir, [self._get_path_params(x) for x in self.config['default_mounts']]) self.do_extra_mounts(rootdir, mounts) mock_cmd = ['chroot'] + if new_chroot: + mock_cmd.append('--new-chroot') if skip_setarch: #we can't really skip it, but we can set it to the current one instead of of the chroot one myarch = platform.uname()[5]