mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-08 22:06:16 +01:00
Fix osc build --local-package
Check if opts.local_package is set before attempting to read content of the local package store or access data obtained from it. This fixes issue #1612. Signed-off-by: Egbert Eich <eich@suse.com>
This commit is contained in:
parent
9d76d1d95d
commit
799b45a009
@ -925,7 +925,7 @@ def main(apiurl, store, opts, argv):
|
||||
bc_file = None
|
||||
bi_filename = '_buildinfo-%s-%s.xml' % (repo, arch)
|
||||
bc_filename = '_buildconfig-%s-%s' % (repo, arch)
|
||||
if store.is_package and os.access(core.store, os.W_OK):
|
||||
if not opts.local_package and store.is_package and os.access(core.store, os.W_OK):
|
||||
bi_filename = os.path.join(os.getcwd(), core.store, bi_filename)
|
||||
bc_filename = os.path.join(os.getcwd(), core.store, bc_filename)
|
||||
elif not os.access('.', os.W_OK):
|
||||
@ -950,7 +950,7 @@ def main(apiurl, store, opts, argv):
|
||||
if opts.noinit:
|
||||
buildargs.append('--noinit')
|
||||
|
||||
if not store.is_package:
|
||||
if opts.local_package or not store.is_package:
|
||||
opts.skip_local_service_run = True
|
||||
|
||||
# check for source services
|
||||
@ -1551,7 +1551,7 @@ def main(apiurl, store, opts, argv):
|
||||
cmd = [change_personality[bi.buildarch]] + cmd
|
||||
|
||||
# record our settings for later builds
|
||||
if store.is_package:
|
||||
if not opts.local_package and store.is_package:
|
||||
store.last_buildroot = repo, arch, vm_type
|
||||
|
||||
try:
|
||||
|
@ -7388,22 +7388,28 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
if len(args) > 3:
|
||||
raise oscerr.WrongArgs('Too many arguments')
|
||||
|
||||
store = osc_store.get_store(Path.cwd(), print_warnings=True)
|
||||
store.assert_is_package()
|
||||
if not opts.local_package:
|
||||
store = osc_store.get_store(Path.cwd(), print_warnings=True)
|
||||
store.assert_is_package()
|
||||
|
||||
try:
|
||||
if opts.alternative_project and opts.alternative_project == store.project:
|
||||
opts.alternative_project = None
|
||||
except RuntimeError:
|
||||
try:
|
||||
if opts.alternative_project and opts.alternative_project == store.project:
|
||||
opts.alternative_project = None
|
||||
except RuntimeError:
|
||||
# ignore the following exception: Couldn't map git branch '<BRANCH>' to a project
|
||||
pass
|
||||
pass
|
||||
else:
|
||||
try:
|
||||
store = osc_store.get_store(os.path.dirname(Path.cwd()), print_warnings=True)
|
||||
except oscerr.NoWorkingCopy:
|
||||
store = None
|
||||
|
||||
# HACK: avoid calling some underlying store_*() functions from parse_repoarchdescr() method
|
||||
# We'll fix parse_repoarchdescr() later because it requires a larger change
|
||||
if not opts.alternative_project and isinstance(store, git_scm.GitStore):
|
||||
opts.alternative_project = store.project
|
||||
|
||||
if len(args) == 0 and store.is_package and store.last_buildroot:
|
||||
if len(args) == 0 and store and store.is_package and store.last_buildroot:
|
||||
# build env not specified, just read from last build attempt
|
||||
args = [store.last_buildroot[0], store.last_buildroot[1]]
|
||||
if not opts.vm_type:
|
||||
|
Loading…
Reference in New Issue
Block a user