mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-13 17:16:23 +01:00
git_pull service osc support
This commit is contained in:
parent
530d67102f
commit
02980dfdb0
@ -2880,6 +2880,9 @@ 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
|
# 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):
|
for arg in parseargs(args):
|
||||||
if arg.startswith('http://') or arg.startswith('https://') or arg.startswith('ftp://'):
|
if arg.startswith('http://') or arg.startswith('https://') or arg.startswith('ftp://'):
|
||||||
|
if arg.endswith('.git'):
|
||||||
|
addGitSource(arg)
|
||||||
|
else:
|
||||||
addDownloadUrlService(arg)
|
addDownloadUrlService(arg)
|
||||||
else:
|
else:
|
||||||
addFiles([arg])
|
addFiles([arg])
|
||||||
|
27
osc/core.py
27
osc/core.py
@ -301,6 +301,12 @@ class Serviceinfo:
|
|||||||
r.append( s )
|
r.append( s )
|
||||||
return r
|
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):
|
def execute(self, dir):
|
||||||
import tempfile
|
import tempfile
|
||||||
@ -5169,6 +5175,27 @@ def stripETxml(node):
|
|||||||
for child in node.getchildren():
|
for child in node.getchildren():
|
||||||
stripETxml(child)
|
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):
|
def addDownloadUrlService(url):
|
||||||
service_file = os.path.join(os.getcwd(), '_service')
|
service_file = os.path.join(os.getcwd(), '_service')
|
||||||
addfile = False
|
addfile = False
|
||||||
|
Loading…
Reference in New Issue
Block a user