diff --git a/osc/build.py b/osc/build.py index fb19817e..5a982350 100644 --- a/osc/build.py +++ b/osc/build.py @@ -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: diff --git a/osc/commandline.py b/osc/commandline.py index 93657ad7..987e25e9 100644 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -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 '' 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: