1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-02-11 13:29:19 +01:00

Merge pull request #1641 from dmach/fix-build-local-package-.osc

Fix crash in 'build' command when building with --local-package --alternative-project from a locally initialized .osc package
This commit is contained in:
Daniel Mach 2024-10-11 16:21:23 +02:00 committed by GitHub
commit 7eddadf620
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 2 deletions

View File

@ -919,7 +919,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 store is not None 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):

View File

@ -7410,10 +7410,19 @@ Please submit there instead, or use --nodevelproject to force direct submission.
pass
else:
try:
store = osc_store.get_store(os.path.dirname(Path.cwd()), print_warnings=True)
store = osc_store.get_store(Path.cwd(), print_warnings=True)
except oscerr.NoWorkingCopy:
store = None
if store is None:
try:
# if opts.local_package is set, build.main() reads project from the store and sets package to "_project"
# that's why we're ok with store from the parent directory that holds information about the project
# FIXME: the parent directory may contain a git repo that doesn't contain a project; we have no way of recognizing that!
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):