|
|
d2717eb |
From 178dfd16c316e8483a61100464d369bee33fbd02 Mon Sep 17 00:00:00 2001
|
|
|
d2717eb |
From: lethliel <mstrigl@suse.com>
|
|
|
d2717eb |
Date: Tue, 21 May 2019 14:28:55 +0200
|
|
|
d2717eb |
Subject: [PATCH 3/9] fix offline build mode
|
|
|
d2717eb |
|
|
|
d2717eb |
The offline mode does not really work offline since
|
|
|
d2717eb |
parse_repoarchdescr() uses get_buildconfig to store the
|
|
|
d2717eb |
buildconfig in a temporary file.
|
|
|
d2717eb |
|
|
|
d2717eb |
Solution:
|
|
|
d2717eb |
|
|
|
d2717eb |
Use the same logic as in build.py. If in offline mode(noinit = True)
|
|
|
d2717eb |
try to use the local _buildconfig file. If not in offline mode just
|
|
|
d2717eb |
download the buildconfig from the server via get_buildconfig
|
|
|
d2717eb |
---
|
|
|
d2717eb |
osc/commandline.py | 28 +++++++++++++++++++---------
|
|
|
d2717eb |
1 file changed, 19 insertions(+), 9 deletions(-)
|
|
|
d2717eb |
|
|
|
d2717eb |
diff --git a/osc/commandline.py b/osc/commandline.py
|
|
|
d2717eb |
index 05faaac..98a8f10 100644
|
|
|
d2717eb |
--- a/osc/commandline.py
|
|
|
d2717eb |
+++ b/osc/commandline.py
|
|
|
d2717eb |
@@ -6092,16 +6092,26 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|
|
d2717eb |
raise oscerr.WrongArgs("Repository is missing. Cannot guess build description without repository")
|
|
|
d2717eb |
apiurl = self.get_api_url()
|
|
|
d2717eb |
project = store_read_project('.')
|
|
|
d2717eb |
- bc = get_buildconfig(apiurl, project, arg_repository)
|
|
|
d2717eb |
- with tempfile.NamedTemporaryFile() as f:
|
|
|
d2717eb |
- f.write(bc)
|
|
|
d2717eb |
- f.flush()
|
|
|
d2717eb |
- # some distros like Debian rename and move build to obs-build
|
|
|
d2717eb |
- if not os.path.isfile('/usr/lib/build/queryconfig') and os.path.isfile('/usr/lib/obs-build/queryconfig'):
|
|
|
d2717eb |
- queryconfig = '/usr/lib/obs-build/queryconfig'
|
|
|
d2717eb |
+ # some distros like Debian rename and move build to obs-build
|
|
|
d2717eb |
+ if not os.path.isfile('/usr/lib/build/queryconfig') and os.path.isfile('/usr/lib/obs-build/queryconfig'):
|
|
|
d2717eb |
+ queryconfig = '/usr/lib/obs-build/queryconfig'
|
|
|
d2717eb |
+ else:
|
|
|
d2717eb |
+ queryconfig = '/usr/lib/build/queryconfig'
|
|
|
d2717eb |
+ if noinit:
|
|
|
d2717eb |
+ bc_filename = '_buildconfig-%s-%s' % (arg_repository, arg_arch)
|
|
|
d2717eb |
+ if is_package_dir('.'):
|
|
|
d2717eb |
+ bc_filename = os.path.join(os.getcwd(), osc.core.store, bc_filename)
|
|
|
d2717eb |
else:
|
|
|
d2717eb |
- queryconfig = '/usr/lib/build/queryconfig'
|
|
|
d2717eb |
- recipe = return_external(queryconfig, '--dist', f.name, 'type')
|
|
|
d2717eb |
+ bc_filename = os.path.abspath(bc_filename)
|
|
|
d2717eb |
+ if not os.path.isfile(bc_filename):
|
|
|
d2717eb |
+ raise oscerr.WrongOptions('--offline is not possible, no local buildconfig file')
|
|
|
d2717eb |
+ recipe = return_external(queryconfig, '--dist', bc_filename, 'type')
|
|
|
d2717eb |
+ else:
|
|
|
d2717eb |
+ bc = get_buildconfig(apiurl, project, arg_repository)
|
|
|
d2717eb |
+ with tempfile.NamedTemporaryFile() as f:
|
|
|
d2717eb |
+ f.write(bc)
|
|
|
d2717eb |
+ f.flush()
|
|
|
d2717eb |
+ recipe = return_external(queryconfig, '--dist', f.name, 'type')
|
|
|
d2717eb |
recipe = recipe.strip()
|
|
|
d2717eb |
if recipe == 'arch':
|
|
|
d2717eb |
recipe = 'PKGBUILD'
|
|
|
d2717eb |
--
|
|
|
d2717eb |
2.21.0
|
|
|
d2717eb |
|