mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-27 07:06:13 +01:00
handle (properly report) HTTP errors in meta_get_filelist, get_slash_source show_project_meta, show_package_meta
This commit is contained in:
parent
5d86b595b9
commit
bac61c05ac
31
osc/core.py
31
osc/core.py
@ -724,26 +724,49 @@ def meta_get_packagelist(prj):
|
|||||||
def meta_get_filelist(prj, package):
|
def meta_get_filelist(prj, package):
|
||||||
|
|
||||||
u = makeurl(['source', prj, package])
|
u = makeurl(['source', prj, package])
|
||||||
f = urllib2.urlopen(u)
|
|
||||||
|
try:
|
||||||
|
f = urllib2.urlopen(u)
|
||||||
|
except urllib2.HTTPError, e:
|
||||||
|
print >>sys.stderr, 'error getting filelist for project \'%s\' package \'%s\'' % (prj, pac)
|
||||||
|
print >>sys.stderr, e
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
root = ET.parse(f).getroot()
|
root = ET.parse(f).getroot()
|
||||||
|
|
||||||
return [ node.get('name') for node in root ]
|
return [ node.get('name') for node in root ]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def get_slash_source():
|
def get_slash_source():
|
||||||
u = makeurl(['source'])
|
u = makeurl(['source'])
|
||||||
root = ET.parse(urllib2.urlopen(u)).getroot()
|
try:
|
||||||
|
root = ET.parse(urllib2.urlopen(u)).getroot()
|
||||||
|
except urllib2.HTTPError, e:
|
||||||
|
print >>sys.stderr, 'error getting /source'
|
||||||
|
print >>sys.stderr, e
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
return sorted([ node.get('name') for node in root ])
|
return sorted([ node.get('name') for node in root ])
|
||||||
|
|
||||||
|
|
||||||
def show_project_meta(prj):
|
def show_project_meta(prj):
|
||||||
f = urllib2.urlopen(makeurl(['source', prj, '_meta']))
|
try:
|
||||||
|
f = urllib2.urlopen(makeurl(['source', prj, '_meta']))
|
||||||
|
except urllib2.HTTPError, e:
|
||||||
|
print >>sys.stderr, 'error getting meta for project \'%s\'' % prj
|
||||||
|
print >>sys.stderr, e
|
||||||
|
sys.exit(1)
|
||||||
return f.readlines()
|
return f.readlines()
|
||||||
|
|
||||||
|
|
||||||
def show_package_meta(prj, pac):
|
def show_package_meta(prj, pac):
|
||||||
f = urllib2.urlopen(makeurl(['source', prj, pac, '_meta']))
|
try:
|
||||||
|
f = urllib2.urlopen(makeurl(['source', prj, pac, '_meta']))
|
||||||
|
except urllib2.HTTPError, e:
|
||||||
|
print >>sys.stderr, 'error getting meta for project \'%s\' package \'%s\'' % (prj, pac)
|
||||||
|
print >>sys.stderr, e
|
||||||
|
sys.exit(1)
|
||||||
return f.readlines()
|
return f.readlines()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user