Mailinglist Archive: opensuse-buildservice (250 mails)

< Previous Next >
[opensuse-buildservice] OSC upstream integration
  • From: "Marek Stopka (M4r3k)" <marekstopka@xxxxxxxxx>
  • Date: Mon, 25 Aug 2008 15:59:01 +0200
  • Message-id: <ab6ee74d0808250659v7063a64an455456043fc6e669@xxxxxxxxxxxxxx>
Hi, currently I am working on upstream integration in BuildService. I
have first patch for OSC. If you want to, you can take a look. If you
have any related ideas, feel free to reply.

For make this totally work, we also need to extend server backend of
buildservice... I am thinking about some special "upstream scheduler"
which have information about all _upstream files and trying "svn co"
(or offcourse similar command for other supported SCM) which are
compared with previous release numbers (stored "somewhere" :-) ) and
if they are different new tarball are created and changes are
commited. Do you have better idea how solve this problem?

Yaloki:
This can be also used for our following OBS migration, because
upstream integration support http downloads too... :-)

--
S pozdravem / Best regards
Marek Stopka
Official openSUSE community member
Kontakty / Contacts
Mobil/Cell phone: 774 59 79 40
E-mail: mstopka@xxxxxxxxxxxx
WEB: www.m4r3k.org
Index: osc/core.py
===================================================================
--- osc/core.py (revision 4764)
+++ osc/core.py (working copy)
@@ -138,6 +138,29 @@
</package>
"""

+new_upstream_template = """\
+<!-- this feature is under heavy development and BuildService servers do not
support this feature yet, in this time you need to use import.rb from
https://forgesvn1.novell.com/svn/opensuse/trunk/buildservice/src/tools/upstream
-->
+<upstream>
+ <source>
+ <file archive='method of making archive - tar/nil supported'
compress='method of compressing - gzip/bzip2/nil supported'>name of archive
file to produce </file>
+<!-- remove this comment and select used type of upstream integration
+ <svn>
+ <url>Svn repository URL</url>
+ <destdir>destination dir for svn checkout</destdir>
+ </svn>
+ <cvs>
+ <cvsroot>passed as -d to cvs command</cvsroot>
+ <path>path on cvs server</path>
+ </cvs>
+ <download>
+ <url>http or ftp url for file to download</url>
+ <destdir>name of output file</destdir>
+ </download>
+-->
+ </source>
+</upstream>
+"""
+
new_user_template = """\
<person>
<login>%(user)s</login>
@@ -1613,6 +1636,14 @@
e.osc_msg = 'Error getting meta for project \'%s\' package \'%s\'' %
(prj, pac)
raise

+def show_upstream_meta(apiurl, prj, pac):
+ url = makeurl(apiurl, ['source', prj, pac, '_upstream'])
+ try:
+ f = http_GET(url)
+ return f.readlines()
+ except urllib2.HTTPError, e:
+ e.osc_msg = 'Error getting meta for project \'%s\' package \'%s\'' %
(prj, pac)
+ raise

def show_develproject(apiurl, prj, pac):
m = show_package_meta(apiurl, prj, pac)
@@ -1698,6 +1729,10 @@
'template': new_pattern_template,
'file_ext': '.xml'
},
+ 'upstream':{ 'path': 'source/%s/%s/_upstream',
+ 'template': new_upstream_template,
+ 'file_ext': '.xml'
+ }
}

def meta_exists(metatype,
@@ -2873,7 +2908,6 @@
def get_osc_version():
return __version__

-
def abortbuild(apiurl, project, package=None, arch=None, repo=None):
query = { 'cmd': 'abortbuild' }
if package:
Index: osc/commandline.py
===================================================================
--- osc/commandline.py (revision 4764)
+++ osc/commandline.py (working copy)
@@ -228,7 +228,7 @@
def do_meta(self, subcmd, opts, *args):
"""${cmd_name}: Show meta information, or edit it

- Show or edit build service metadata of type
<prj|pkg|prjconf|user|pattern>.
+ Show or edit build service metadata of type
<prj|pkg|upstream|prjconf|user|pattern>.

This command displays metadata on buildservice objects like projects,
packages, or users. The type of metadata is specified by the word after
@@ -237,6 +237,7 @@
prj denotes metadata of a buildservice project.
prjconf denotes the (build) configuration of a project.
pkg denotes metadata of a buildservice package.
+ upstream denotes metadata of buildservice upstream intergation
user denotes the metadata of a user.
pattern denotes installation patterns defined for a project.

@@ -258,9 +259,9 @@
osc meta pkg PRJ PKG -e

Usage:
- osc meta <prj|pkg|prjconf|user|pattern> ARGS...
- osc meta <prj|pkg|prjconf|user|pattern> -e|--edit ARGS...
- osc meta <prj|pkg|prjconf|user|pattern> -F|--file ARGS...
+ osc meta <prj|pkg|upstream|prjconf|user|pattern> ARGS...
+ osc meta <prj|pkg|upstream|prjconf|user|pattern> -e|--edit ARGS...
+ osc meta <prj|pkg|upstream|prjconf|user|pattern> -F|--file ARGS...
osc meta pattern --delete PRJ PATTERN
${cmd_option_list}
"""
@@ -276,6 +277,8 @@

if cmd in ['pkg']:
min_args, max_args = 2, 2
+ elif cmd in ['upstream']:
+ min_args, max_args = 2, 2
elif cmd in ['pattern']:
min_args, max_args = 1, 2
else:
@@ -290,6 +293,8 @@
project = args[0]
elif cmd == 'pkg':
project, package = args[0:2]
+ elif cmd == 'upstream':
+ project, package = args[0:2]
elif cmd == 'prjconf':
project = args[0]
elif cmd == 'user':
@@ -310,6 +315,8 @@

sys.stdout.write(''.join(show_project_meta(conf.config['apiurl'], project)))
elif cmd == 'pkg':

sys.stdout.write(''.join(show_package_meta(conf.config['apiurl'], project,
package)))
+ elif cmd == 'upstream':
+
sys.stdout.write(''.join(show_upstream_meta(conf.config['apiurl'], project,
package)))
elif cmd == 'prjconf':

sys.stdout.write(''.join(show_project_conf(conf.config['apiurl'], project)))
elif cmd == 'user':
@@ -342,6 +349,11 @@
template_args=({
'name': package,
'user': conf.config['user']}))
+ elif cmd == 'upstream':
+ edit_meta(metatype='upstream',
+ edit=True,
+ path_args=(quote_plus(project), quote_plus(package)),
+ template_args=None)
elif cmd == 'prjconf':
edit_meta(metatype='prjconf',
edit=True,
@@ -379,6 +391,11 @@
data=f,
edit=opts.edit,
path_args=(quote_plus(project), quote_plus(package)))
+ elif cmd == 'upstream':
+ edit_meta(metatype='upstream',
+ data=f,
+ edit=opts.edit,
+ path_args=(quote_plus(project), quote_plus(package)))
elif cmd == 'prjconf':
edit_meta(metatype='prjconf',
data=f,
@@ -403,6 +420,10 @@
path = path % (project, pattern)
u = makeurl(conf.config['apiurl'], [path])
http_DELETE(u)
+ elif cmd == 'upstream':
+ path = path % (project, package)
+ u = makeurl(conf.config['apiurl'], [path])
+ http_DELETE(u)
else:
sys.exit('The --delete switch is only for pattern metadata.')

< Previous Next >