mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-14 00:06:15 +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
|
bc_file = None
|
||||||
bi_filename = '_buildinfo-%s-%s.xml' % (repo, arch)
|
bi_filename = '_buildinfo-%s-%s.xml' % (repo, arch)
|
||||||
bc_filename = '_buildconfig-%s-%s' % (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)
|
bi_filename = os.path.join(os.getcwd(), core.store, bi_filename)
|
||||||
bc_filename = os.path.join(os.getcwd(), core.store, bc_filename)
|
bc_filename = os.path.join(os.getcwd(), core.store, bc_filename)
|
||||||
elif not os.access('.', os.W_OK):
|
elif not os.access('.', os.W_OK):
|
||||||
@ -950,7 +950,7 @@ def main(apiurl, store, opts, argv):
|
|||||||
if opts.noinit:
|
if opts.noinit:
|
||||||
buildargs.append('--noinit')
|
buildargs.append('--noinit')
|
||||||
|
|
||||||
if not store.is_package:
|
if opts.local_package or not store.is_package:
|
||||||
opts.skip_local_service_run = True
|
opts.skip_local_service_run = True
|
||||||
|
|
||||||
# check for source services
|
# check for source services
|
||||||
@ -1551,7 +1551,7 @@ def main(apiurl, store, opts, argv):
|
|||||||
cmd = [change_personality[bi.buildarch]] + cmd
|
cmd = [change_personality[bi.buildarch]] + cmd
|
||||||
|
|
||||||
# record our settings for later builds
|
# 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
|
store.last_buildroot = repo, arch, vm_type
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -7388,6 +7388,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
if len(args) > 3:
|
if len(args) > 3:
|
||||||
raise oscerr.WrongArgs('Too many arguments')
|
raise oscerr.WrongArgs('Too many arguments')
|
||||||
|
|
||||||
|
if not opts.local_package:
|
||||||
store = osc_store.get_store(Path.cwd(), print_warnings=True)
|
store = osc_store.get_store(Path.cwd(), print_warnings=True)
|
||||||
store.assert_is_package()
|
store.assert_is_package()
|
||||||
|
|
||||||
@ -7397,13 +7398,18 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
# ignore the following exception: Couldn't map git branch '<BRANCH>' to a project
|
# 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
|
# HACK: avoid calling some underlying store_*() functions from parse_repoarchdescr() method
|
||||||
# We'll fix parse_repoarchdescr() later because it requires a larger change
|
# We'll fix parse_repoarchdescr() later because it requires a larger change
|
||||||
if not opts.alternative_project and isinstance(store, git_scm.GitStore):
|
if not opts.alternative_project and isinstance(store, git_scm.GitStore):
|
||||||
opts.alternative_project = store.project
|
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
|
# build env not specified, just read from last build attempt
|
||||||
args = [store.last_buildroot[0], store.last_buildroot[1]]
|
args = [store.last_buildroot[0], store.last_buildroot[1]]
|
||||||
if not opts.vm_type:
|
if not opts.vm_type:
|
||||||
|
Loading…
Reference in New Issue
Block a user