Skip to content

Commit

Permalink
Add '--just-print-buildroot' option to print build root path and exit…
Browse files Browse the repository at this point in the history
… to 'build' command
  • Loading branch information
dmach committed Sep 4, 2023
1 parent 1dd06ca commit 465edfb
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions osc/commandline.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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

Check warning on line 7267 in osc/commandline.py

View check run for this annotation

Codecov / codecov/patch

osc/commandline.py#L7265-L7267

Added lines #L7265 - L7267 were not covered by tests
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

Check warning on line 7275 in osc/commandline.py

View check run for this annotation

Codecov / codecov/patch

osc/commandline.py#L7269-L7275

Added lines #L7269 - L7275 were not covered by tests

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:
Expand Down

0 comments on commit 465edfb

Please sign in to comment.