diff --git a/osc/build.py b/osc/build.py index 9771acd8..6d991a2b 100644 --- a/osc/build.py +++ b/osc/build.py @@ -674,15 +674,42 @@ def main(apiurl, opts, argv): except: pass + # define buildinfo & config local cache + bi_file = None + bc_file = None + bi_filename = '_buildinfo-%s-%s.xml' % (repo, arch) + bc_filename = '_buildconfig-%s-%s' % (repo, arch) + if is_package_dir('.') and os.access(osc.core.store, os.W_OK): + bi_filename = os.path.join(os.getcwd(), osc.core.store, bi_filename) + bc_filename = os.path.join(os.getcwd(), osc.core.store, bc_filename) + elif not os.access('.', os.W_OK): + bi_file = NamedTemporaryFile(prefix=bi_filename) + bi_filename = bi_file.name + bc_file = NamedTemporaryFile(prefix=bc_filename) + bc_filename = bc_file.name + else: + bi_filename = os.path.abspath(bi_filename) + bc_filename = os.path.abspath(bc_filename) + if opts.shell: buildargs.append("--shell") - if os.path.exists(build_root) and not opts.clean and not opts.extra_pkgs: + if os.path.exists(build_root) and os.path.exists(bi_filename) and not opts.clean and not opts.extra_pkgs: opts.noinit = True opts.offline = True + # we should check if the service did run before and only skip it then, + # but we have no save point for this atm + opts.noservice = True if opts.noinit: buildargs.append('--noinit') + # check for source services + if not opts.offline and not opts.noservice: + p = Package('.') + r = p.run_source_services(verbose=True) + if r: + raise oscerr.ServiceRuntimeError('Source service run failed!') + cache_dir = config['packagecachedir'] % {'apihost': apihost} extra_pkgs = [] @@ -769,22 +796,6 @@ def main(apiurl, opts, argv): raise oscerr.WrongOptions('--overlay %s is no valid directory!' % opts.overlay) specialcmdopts += ['--overlay='+myoverlay] - bi_file = None - bc_file = None - bi_filename = '_buildinfo-%s-%s.xml' % (repo, arch) - bc_filename = '_buildconfig-%s-%s' % (repo, arch) - if is_package_dir('.') and os.access(osc.core.store, os.W_OK): - bi_filename = os.path.join(os.getcwd(), osc.core.store, bi_filename) - bc_filename = os.path.join(os.getcwd(), osc.core.store, bc_filename) - elif not os.access('.', os.W_OK): - bi_file = NamedTemporaryFile(prefix=bi_filename) - bi_filename = bi_file.name - bc_file = NamedTemporaryFile(prefix=bc_filename) - bc_filename = bc_file.name - else: - bi_filename = os.path.abspath(bi_filename) - bc_filename = os.path.abspath(bc_filename) - try: if opts.noinit: if not os.path.isfile(bi_filename): diff --git a/osc/commandline.py b/osc/commandline.py index 313549e1..6c38e5c1 100644 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -6441,18 +6441,6 @@ Please submit there instead, or use --nodevelproject to force direct submission. args = self.parse_repoarchdescr(args, opts.noinit or opts.offline, opts.alternative_project, False, opts.vm_type, opts.multibuild_package) - # check for source services - if not opts.offline and not opts.noservice: - p = Package('.') - r = p.run_source_services(verbose=True) - if r: - print('Source service run failed!', file=sys.stderr) - sys.exit(1) - else: - msg = ('WARNING: source services from package or project will not' - 'be executed. This may not be the same build as on server!') - print(msg) - if not opts.local_package: try: package = store_read_package(os.curdir)