devuan-releasebot

devuan's releasebot reimplemented (scorsh version)
git clone git://parazyd.org/devuan-releasebot.git
Log | Files | Refs | LICENSE

commit fa48a566a8bc6f35c4a11e7f07c3de9f076ed865
parent 685bb953cb55d42c1d416895f3d9f24573771747
Author: parazyd <parazyd@dyne.org>
Date:   Thu, 27 Jul 2017 13:58:42 +0200

implement support for different distributions

Diffstat:
Mbuildadd.py | 14+++++++++++---
Mconfig.def.py | 6++++++
Mfuncs.py | 8++++----
3 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/buildadd.py b/buildadd.py @@ -11,7 +11,8 @@ from os.path import basename import jenkins from config import (jenkins_user, jenkins_pass, jenkins_host, jobtypes, - arches_qemusys, arches_any, architectures, dryrun) + arches_qemusys, arches_any, architectures, dryrun, + allowed_distros) from funcs import fill_template @@ -42,8 +43,15 @@ def main(): # the -4 cuts off '.git' from the path pkgname = basename(env['SCORSH_REPO'])[:-4] + # the distro owning the job, e.g. "maemo/jessie", or "devuan/ascii-proposed" + distro = env['SCORSH_BRANCH'].split("/")[0] + if distro not in allowed_distros: + print('Error: This distribution is not supported. Exiting.') + sys.exit(1) + for jobt in jobtypes: - jobname = '-'.join([pkgname, jobt]) + # jobname = '-'.join([pkgname, jobt]) + jobname = distro+':'+pkgname+'-'+jobt print('* Trying to create %s job for %s' % (jobt, pkgname)) @@ -82,7 +90,7 @@ def main(): # which seems the gitlab issue description. did we ever pass this? # Here we use the XML template - pxml = fill_template(pkgname, jobt, arches, + pxml = fill_template(pkgname, jobt, distro, arches, git_uri=env['SCORSH_GITURL'], buildvar=add_buildvar, sequential=build_sequential, jlabels=jlabels) diff --git a/config.def.py b/config.def.py @@ -15,6 +15,12 @@ vcs_credentials = '' jobtypes = ['source', 'binaries', 'repos'] +allowed_distros = [ + 'suites', + 'devuan', + 'maemo', +] + default_suites = [ 'jessie', 'ascii', diff --git a/funcs.py b/funcs.py @@ -9,23 +9,23 @@ from os.path import isfile, join from config import templatedir, vcs_credentials -def read_template(jobtype): +def read_template(jobtype, distro): """ Reads a template file into memory """ - fpath = join(templatedir, jobtype+'-config.xml') + fpath = join(templatedir, distro, jobtype+'-config.xml') if isfile(fpath): return open(fpath).read() return None -def fill_template(pkgname, jobtype, arches=None, desc=None, +def fill_template(pkgname, jobtype, distro, arches=None, desc=None, git_uri=None, buildvar='', sequential=None, jlabels=None): """ Fills up blanks in the template """ - tmpl = read_template(jobtype) + tmpl = read_template(jobtype, distro) if tmpl: if not git_uri: