mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-11 16:36:14 +01:00
- handle errors of source service runs
This commit is contained in:
parent
0a7492cdf8
commit
c00751f4d7
@ -4727,9 +4727,14 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
args = self.parse_repoarchdescr(args, opts.noinit or opts.offline, opts.alternative_project)
|
||||
|
||||
# check for source services
|
||||
if not opts.noservice and not opts.noinit and os.listdir('.').count("_service"):
|
||||
if not opts.noservice and not opts.noinit:
|
||||
p = Package('.')
|
||||
p.run_source_services()
|
||||
r = p.run_source_services()
|
||||
if r != 0:
|
||||
print >>sys.stderr, 'Source service run failed!'
|
||||
sys.exit(1)
|
||||
# that is currently unreadable on cli, we should not have a backtrace on standard errors:
|
||||
#raise oscerr.ServiceRuntimeError('Service run failed: \'%s\'', r)
|
||||
|
||||
if conf.config['no_verify']:
|
||||
opts.no_verify = True
|
||||
|
11
osc/core.py
11
osc/core.py
@ -317,6 +317,7 @@ class Serviceinfo:
|
||||
allservices = [data]
|
||||
|
||||
# recreate files
|
||||
ret = 0
|
||||
for service in allservices:
|
||||
if singleservice and service['name'] != singleservice:
|
||||
continue
|
||||
@ -332,12 +333,13 @@ class Serviceinfo:
|
||||
c = "/usr/lib/obs/service/" + call + " --outdir " + temp_dir
|
||||
if conf.config['verbose'] > 1:
|
||||
print "Run source service:", c
|
||||
ret = subprocess.call(c, shell=True)
|
||||
if ret != 0:
|
||||
r = subprocess.call(c, shell=True)
|
||||
if r != 0:
|
||||
print "ERROR: service call failed: " + c
|
||||
# FIXME: addDownloadUrlService calls si.execute after
|
||||
# updating _services.
|
||||
print " (your _services file may be corrupt now)"
|
||||
ret = r
|
||||
|
||||
if service['mode'] == "disabled" or service['mode'] == "trylocal" or service['mode'] == "localonly" or callmode == "local":
|
||||
for filename in os.listdir(temp_dir):
|
||||
@ -347,6 +349,8 @@ class Serviceinfo:
|
||||
shutil.move( os.path.join(temp_dir, filename), os.path.join(dir, "_service:"+name+":"+filename) )
|
||||
os.rmdir(temp_dir)
|
||||
|
||||
return ret
|
||||
|
||||
class Linkinfo:
|
||||
"""linkinfo metadata (which is part of the xml representing a directory
|
||||
"""
|
||||
@ -2045,8 +2049,9 @@ rev: %s
|
||||
service = ET.parse(os.path.join(self.absdir, '_service')).getroot()
|
||||
si.read(service)
|
||||
si.getProjectGlobalServices(self.apiurl, self.prjname, self.name)
|
||||
si.execute(self.absdir, mode, singleservice)
|
||||
r = si.execute(self.absdir, mode, singleservice)
|
||||
os.chdir(curdir)
|
||||
return r
|
||||
|
||||
def prepare_filelist(self):
|
||||
"""Prepare a list of files, which will be processed by process_filelist
|
||||
|
@ -48,6 +48,12 @@ class ExtRuntimeError(OscBaseError):
|
||||
self.msg = msg
|
||||
self.file = fname
|
||||
|
||||
class ServiceRuntimeError(OscBaseError):
|
||||
"""Exception raised when there is source service error runtime error"""
|
||||
def __init__(self, msg):
|
||||
OscBaseError.__init__(self)
|
||||
self.msg = msg
|
||||
|
||||
class WrongArgs(OscBaseError):
|
||||
"""Exception raised by the cli for wrong arguments usage"""
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user