mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-26 01:46:13 +01:00
git_pull service osc support
This commit is contained in:
parent
530d67102f
commit
02980dfdb0
@ -2880,7 +2880,10 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
# Do some magic here, when adding a url. We want that the server to download the tar ball and to verify it
|
||||
for arg in parseargs(args):
|
||||
if arg.startswith('http://') or arg.startswith('https://') or arg.startswith('ftp://'):
|
||||
addDownloadUrlService(arg)
|
||||
if arg.endswith('.git'):
|
||||
addGitSource(arg)
|
||||
else:
|
||||
addDownloadUrlService(arg)
|
||||
else:
|
||||
addFiles([arg])
|
||||
|
||||
|
27
osc/core.py
27
osc/core.py
@ -301,6 +301,12 @@ class Serviceinfo:
|
||||
r.append( s )
|
||||
return r
|
||||
|
||||
def addGitUrl(self, serviceinfo_node, url_string):
|
||||
r = serviceinfo_node
|
||||
s = ET.Element( "service", name="git_pull" )
|
||||
ET.SubElement(s, "param", name="url").text = url_string
|
||||
r.append( s )
|
||||
return r
|
||||
|
||||
def execute(self, dir):
|
||||
import tempfile
|
||||
@ -5169,6 +5175,27 @@ def stripETxml(node):
|
||||
for child in node.getchildren():
|
||||
stripETxml(child)
|
||||
|
||||
def addGitSource(url):
|
||||
service_file = os.path.join(os.getcwd(), '_service')
|
||||
addfile = False
|
||||
if os.path.exists( service_file ):
|
||||
services = ET.parse(os.path.join(os.getcwd(), '_service')).getroot()
|
||||
else:
|
||||
services = ET.fromstring("<services />")
|
||||
addfile = True
|
||||
stripETxml( services )
|
||||
si = Serviceinfo()
|
||||
s = si.addGitUrl(services, url)
|
||||
si.read(s)
|
||||
|
||||
# for pretty output
|
||||
reparsed = minidom.parseString(ET.tostring(s))
|
||||
f = open(service_file, 'wb')
|
||||
f.write(reparsed.toprettyxml(indent=" "))
|
||||
f.close()
|
||||
if addfile:
|
||||
addFiles( ['_service'] )
|
||||
|
||||
def addDownloadUrlService(url):
|
||||
service_file = os.path.join(os.getcwd(), '_service')
|
||||
addfile = False
|
||||
|
Loading…
Reference in New Issue
Block a user