Mailinglist Archive: opensuse-buildservice (251 mails)

< Previous Next >
[opensuse-buildservice] Re: [PATCH] git_pull service osc support
  • From: Adrian Schröter <adrian@xxxxxxx>
  • Date: Mon, 20 Sep 2010 11:46:12 +0200
  • Message-id: <201009201146.12584.adrian@xxxxxxx>

Please adapt this to use "tar_scm" service instead.

I do not want to have two services by default for the same thing.
(Please see my other mail).

bye
adrian

Am Montag, 20. September 2010, 11:06:47 schrieb OBS osc:
From: brook hong <hzgmaxwell@xxxxxxxxxxx>

---
osc/commandline.py | 5 ++++-
osc/core.py | 27 +++++++++++++++++++++++++++
2 files changed, 31 insertions(+), 1 deletions(-)

diff --git a/osc/commandline.py b/osc/commandline.py
index 0e11913..d5432b3 100644
--- a/osc/commandline.py
+++ b/osc/commandline.py
@@ -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])

diff --git a/osc/core.py b/osc/core.py
index 1bead66..47124ea 100644
--- a/osc/core.py
+++ b/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



--
Adrian Schroeter
SUSE Linux Products GmbH
email: adrian@xxxxxxx
--
To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-buildservice+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups