diff --git a/osc/commandline.py b/osc/commandline.py index 5257dfcc51..57a89592f5 100644 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -7156,6 +7156,8 @@ def parse_repoarchdescr(self, args, noinit=False, alternative_project=None, igno help='trust packages from all projects') @cmdln.option('--nopreinstallimage', '--no-preinstallimage', action='store_true', help='Do not use preinstall images for creating the build root.') + @cmdln.option("--just-print-buildroot", action="store_true", + help="Print build root path and exit.") @cmdln.alias('chroot') @cmdln.alias('shell') @cmdln.alias('wipe') @@ -7260,6 +7262,18 @@ def do_build(self, subcmd, opts, *args): if not opts.vm_type: opts.vm_type = store.last_buildroot[2] + if opts.just_print_buildroot: + if opts.root: + build_root = opts.root + else: + args = self.parse_repoarchdescr(args, opts.noinit or opts.offline, opts.alternative_project, False, opts.vm_type, opts.multibuild_package) + repo, arch, build_descr = args + prj, pac = osc_build.calculate_prj_pac(store, opts, build_descr) + apihost = urlsplit(self.get_api_url())[1] + build_root = osc_build.calculate_build_root(apihost, prj, pac, repo, arch) + print(build_root) + return + vm_chroot = opts.vm_type or conf.config['build-type'] if (subcmd in ('shell', 'chroot') or opts.shell or opts.wipe) and not vm_chroot: if opts.root: