mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-25 17:36:13 +01:00
support for new source service modes: disabled, trylocal and localonly
This commit is contained in:
parent
8a488d3b6d
commit
146a2d4f72
1
NEWS
1
NEWS
@ -13,6 +13,7 @@
|
||||
#
|
||||
- "my requests" is doing faster and complete server side lookup now if available
|
||||
- "review" command has been extended to handle reviews by project or by package maintainers
|
||||
- support for new source service modes: disabled, trylocal and localonly
|
||||
|
||||
0.130
|
||||
- new "revert" command to restore the original working copy file (without
|
||||
|
24
osc/core.py
24
osc/core.py
@ -245,7 +245,7 @@ class Serviceinfo:
|
||||
"""
|
||||
def __init__(self):
|
||||
"""creates an empty serviceinfo instance"""
|
||||
self.commands = None
|
||||
self.services = None
|
||||
|
||||
def read(self, serviceinfo_node):
|
||||
"""read in the source services <services> element passed as
|
||||
@ -253,17 +253,22 @@ class Serviceinfo:
|
||||
"""
|
||||
if serviceinfo_node == None:
|
||||
return
|
||||
self.commands = []
|
||||
self.services = []
|
||||
services = serviceinfo_node.findall('service')
|
||||
|
||||
for service in services:
|
||||
name = service.get('name')
|
||||
mode = service.get('mode', None)
|
||||
data = { 'name' : name, 'mode' : '' }
|
||||
if mode:
|
||||
data['mode'] = mode
|
||||
try:
|
||||
for param in service.findall('param'):
|
||||
option = param.get('name', None)
|
||||
value = param.text
|
||||
name += " --" + option + " '" + value + "'"
|
||||
self.commands.append(name)
|
||||
data['command'] = name
|
||||
self.services.append(data)
|
||||
except:
|
||||
msg = 'invalid service format:\n%s' % ET.tostring(serviceinfo_node)
|
||||
raise oscerr.APIError(msg)
|
||||
@ -317,7 +322,10 @@ class Serviceinfo:
|
||||
os.unlink(os.path.join(dir, filename))
|
||||
|
||||
# recreate files
|
||||
for call in self.commands:
|
||||
for service in self.services:
|
||||
if service['mode'] == "disabled":
|
||||
next
|
||||
call = service['command']
|
||||
temp_dir = tempfile.mkdtemp()
|
||||
name = call.split(None, 1)[0]
|
||||
if not os.path.exists("/usr/lib/obs/service/"+name):
|
||||
@ -334,8 +342,12 @@ class Serviceinfo:
|
||||
# updating _services.
|
||||
print " (your _services file may be corrupt now)"
|
||||
|
||||
for filename in os.listdir(temp_dir):
|
||||
shutil.move( os.path.join(temp_dir, filename), os.path.join(dir, "_service:"+name+":"+filename) )
|
||||
if service['mode'] == "trylocal" or service['mode'] == "localonly":
|
||||
for filename in os.listdir(temp_dir):
|
||||
shutil.move( os.path.join(temp_dir, filename), os.path.join(dir, filename) )
|
||||
else:
|
||||
for filename in os.listdir(temp_dir):
|
||||
shutil.move( os.path.join(temp_dir, filename), os.path.join(dir, "_service:"+name+":"+filename) )
|
||||
os.rmdir(temp_dir)
|
||||
|
||||
class Linkinfo:
|
||||
|
Loading…
Reference in New Issue
Block a user