1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-28 02:36:15 +01:00

avoid source service run for "osc shell"

this also drops the warning line if service disabled. It seems not
to be important enough to me.
This commit is contained in:
Adrian Schröter 2019-12-04 08:41:15 +01:00
parent f4bdd3c876
commit 47e346dde8
2 changed files with 28 additions and 29 deletions

View File

@ -674,15 +674,42 @@ def main(apiurl, opts, argv):
except: except:
pass 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: if opts.shell:
buildargs.append("--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.noinit = True
opts.offline = 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: if opts.noinit:
buildargs.append('--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} cache_dir = config['packagecachedir'] % {'apihost': apihost}
extra_pkgs = [] extra_pkgs = []
@ -769,22 +796,6 @@ def main(apiurl, opts, argv):
raise oscerr.WrongOptions('--overlay %s is no valid directory!' % opts.overlay) raise oscerr.WrongOptions('--overlay %s is no valid directory!' % opts.overlay)
specialcmdopts += ['--overlay='+myoverlay] 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: try:
if opts.noinit: if opts.noinit:
if not os.path.isfile(bi_filename): if not os.path.isfile(bi_filename):

View File

@ -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) 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: if not opts.local_package:
try: try:
package = store_read_package(os.curdir) package = store_read_package(os.curdir)