1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-10 14:56:14 +01:00

fix offline build mode

The offline mode does not really work offline since
parse_repoarchdescr() uses get_buildconfig to store the
buildconfig in a temporary file.

Solution:

Use the same logic as in build.py. If in offline mode(noinit = True)
try to use the local _buildconfig file. If not in offline mode just
download the buildconfig from the server via get_buildconfig
This commit is contained in:
lethliel 2019-05-21 14:28:55 +02:00
parent 6fe6dbc724
commit 178dfd16c3

View File

@ -6092,16 +6092,26 @@ Please submit there instead, or use --nodevelproject to force direct submission.
raise oscerr.WrongArgs("Repository is missing. Cannot guess build description without repository")
apiurl = self.get_api_url()
project = store_read_project('.')
bc = get_buildconfig(apiurl, project, arg_repository)
with tempfile.NamedTemporaryFile() as f:
f.write(bc)
f.flush()
# some distros like Debian rename and move build to obs-build
if not os.path.isfile('/usr/lib/build/queryconfig') and os.path.isfile('/usr/lib/obs-build/queryconfig'):
queryconfig = '/usr/lib/obs-build/queryconfig'
# some distros like Debian rename and move build to obs-build
if not os.path.isfile('/usr/lib/build/queryconfig') and os.path.isfile('/usr/lib/obs-build/queryconfig'):
queryconfig = '/usr/lib/obs-build/queryconfig'
else:
queryconfig = '/usr/lib/build/queryconfig'
if noinit:
bc_filename = '_buildconfig-%s-%s' % (arg_repository, arg_arch)
if is_package_dir('.'):
bc_filename = os.path.join(os.getcwd(), osc.core.store, bc_filename)
else:
queryconfig = '/usr/lib/build/queryconfig'
recipe = return_external(queryconfig, '--dist', f.name, 'type')
bc_filename = os.path.abspath(bc_filename)
if not os.path.isfile(bc_filename):
raise oscerr.WrongOptions('--offline is not possible, no local buildconfig file')
recipe = return_external(queryconfig, '--dist', bc_filename, 'type')
else:
bc = get_buildconfig(apiurl, project, arg_repository)
with tempfile.NamedTemporaryFile() as f:
f.write(bc)
f.flush()
recipe = return_external(queryconfig, '--dist', f.name, 'type')
recipe = recipe.strip()
if recipe == 'arch':
recipe = 'PKGBUILD'