aboutsummaryrefslogtreecommitdiffstats
path: root/modules/buildsystem/templates
diff options
context:
space:
mode:
Diffstat (limited to 'modules/buildsystem/templates')
-rw-r--r--modules/buildsystem/templates/binrepo/sudoers.binrepo1
-rwxr-xr-xmodules/buildsystem/templates/binrepo/upload-bin32
-rw-r--r--modules/buildsystem/templates/binrepo/vhost_binrepo.conf3
-rw-r--r--modules/buildsystem/templates/binrepo/wrapper.upload-bin26
-rw-r--r--modules/buildsystem/templates/bs-webstatus.conf32
-rwxr-xr-xmodules/buildsystem/templates/cleaner.rb235
-rw-r--r--modules/buildsystem/templates/cleaner_test.rb83
-rw-r--r--modules/buildsystem/templates/iurt.cauldron.conf30
-rw-r--r--modules/buildsystem/templates/iurt.conf37
-rwxr-xr-xmodules/buildsystem/templates/maintdb/maintdb.bin98
-rw-r--r--modules/buildsystem/templates/maintdb/sudoers.maintdb4
-rw-r--r--modules/buildsystem/templates/maintdb/vhost_maintdb.conf3
-rw-r--r--modules/buildsystem/templates/maintdb/wrapper.maintdb25
-rw-r--r--modules/buildsystem/templates/media.cfg142
-rwxr-xr-xmodules/buildsystem/templates/mga-youri-submit2
-rwxr-xr-xmodules/buildsystem/templates/mga-youri-submit.wrapper36
-rw-r--r--modules/buildsystem/templates/mgarepo.conf88
-rw-r--r--modules/buildsystem/templates/repoctl.conf40
-rw-r--r--modules/buildsystem/templates/rpmlint.conf7
-rw-r--r--modules/buildsystem/templates/signbot/sudoers.signpackage2
-rwxr-xr-xmodules/buildsystem/templates/submit_package.pl18
-rw-r--r--modules/buildsystem/templates/sudoers.iurt2
-rw-r--r--modules/buildsystem/templates/sudoers.youri6
-rw-r--r--modules/buildsystem/templates/upload.conf131
-rw-r--r--modules/buildsystem/templates/vhost_repository.conf73
-rw-r--r--modules/buildsystem/templates/vhost_webstatus.conf13
-rw-r--r--modules/buildsystem/templates/youri/acl.conf1
-rw-r--r--modules/buildsystem/templates/youri/host.conf23
-rw-r--r--modules/buildsystem/templates/youri/submit.conf140
29 files changed, 1302 insertions, 31 deletions
diff --git a/modules/buildsystem/templates/binrepo/sudoers.binrepo b/modules/buildsystem/templates/binrepo/sudoers.binrepo
new file mode 100644
index 00000000..c20810cf
--- /dev/null
+++ b/modules/buildsystem/templates/binrepo/sudoers.binrepo
@@ -0,0 +1 @@
+%<%= scope.lookupvar('buildsystem::var::groups::packagers_committers') %> ALL =(<%= scope.lookupvar('buildsystem::var::binrepo::login') %>) NOPASSWD: <%= scope.lookupvar('buildsystem::var::binrepo::uploadbinpath') %>
diff --git a/modules/buildsystem/templates/binrepo/upload-bin b/modules/buildsystem/templates/binrepo/upload-bin
new file mode 100755
index 00000000..7cad5838
--- /dev/null
+++ b/modules/buildsystem/templates/binrepo/upload-bin
@@ -0,0 +1,32 @@
+#!/bin/sh
+set -e
+
+binrepodir=<%= scope.lookupvar('buildsystem::var::binrepo::repodir') %>
+uploadinfosdir=<%= scope.lookupvar('buildsystem::var::binrepo::uploadinfosdir') %>
+tmpfile=$(mktemp)
+mail_from="<%= scope.lookupvar('buildsystem::var::binrepo::uploadmail_from') %>"
+mail_dest="<%= scope.lookupvar('buildsystem::var::binrepo::uploadmail_to') %>"
+
+test $# = 2 || exit 3
+username="$1"
+comment="$2"
+
+/bin/cat > "$tmpfile"
+sha1sum=$(/usr/bin/sha1sum "$tmpfile" | sed 's/ .*$//')
+test -n "$sha1sum"
+if [ -f "$binrepodir/$sha1sum" ]
+then
+ echo "File $sha1sum already exists." >&2
+ /bin/rm -f "$tmpfile"
+ exit 2
+fi
+/bin/mv "$tmpfile" "$binrepodir/$sha1sum"
+/bin/chmod 644 "$binrepodir/$sha1sum"
+echo "$username:$comment" > "$uploadinfosdir/$sha1sum"
+echo "User $username uploaded file $sha1sum: $comment"
+
+echo "User $username uploaded file $sha1sum: $comment" | \
+ /usr/bin/mailx -s "New file uploaded: $sha1sum - $comment" -S "from=$username <$mail_from>" "$mail_dest"
+
+exit 0
+
diff --git a/modules/buildsystem/templates/binrepo/vhost_binrepo.conf b/modules/buildsystem/templates/binrepo/vhost_binrepo.conf
new file mode 100644
index 00000000..f411c07a
--- /dev/null
+++ b/modules/buildsystem/templates/binrepo/vhost_binrepo.conf
@@ -0,0 +1,3 @@
+<Directory <%= scope.lookupvar('buildsystem::var::binrepo::repodir') %>>
+ Options None
+</Directory>
diff --git a/modules/buildsystem/templates/binrepo/wrapper.upload-bin b/modules/buildsystem/templates/binrepo/wrapper.upload-bin
new file mode 100644
index 00000000..3def84a0
--- /dev/null
+++ b/modules/buildsystem/templates/binrepo/wrapper.upload-bin
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+binrepouser="<%= scope.lookupvar('buildsystem::var::binrepo::login') %>"
+uploadbinpath="<%= scope.lookupvar('buildsystem::var::binrepo::uploadbinpath') %>"
+packagerscommittersgroup="<%= scope.lookupvar('buildsystem::var::groups::packagers_committers') %>"
+
+function isingroup()
+{
+ grp="$1"
+ for group in `groups`
+ do if [ "$grp" = "$group" ]
+ then
+ return 0
+ fi
+ done
+ return 1
+}
+
+if ! isingroup "$packagerscommittersgroup"
+then
+ echo "You are not in $packagerscommittersgroup group."
+ exit 1
+fi
+
+sudo -u "$binrepouser" "$uploadbinpath" $(whoami) $@
+
diff --git a/modules/buildsystem/templates/bs-webstatus.conf b/modules/buildsystem/templates/bs-webstatus.conf
new file mode 100644
index 00000000..9f37a990
--- /dev/null
+++ b/modules/buildsystem/templates/bs-webstatus.conf
@@ -0,0 +1,32 @@
+<?php
+
+/** Where is the current app located. */
+$g_webapp_dir = '<%= scope.lookupvar('buildsystem::var::webstatus::location') %>';
+
+/** Full system path where packages are uploaded. */
+$upload_dir = '<%= scope.lookupvar('buildsystem::var::scheduler::homedir') %>/uploads';
+
+/** How long a history should we keep, in days. */
+$max_modified = <%= scope.lookupvar('buildsystem::var::webstatus::max_modified') %>;
+
+/** How many nodes are available. */
+$g_nodes_count = 2;
+
+/** html > body > h1 title */
+$title = 'Build system status';
+
+/** Should crawlers index this page or not? meta[robots] tag.*/
+$robots = 'index,nofollow,nosnippet,noarchive';
+
+/** */
+$g_root_url = 'https://<%= scope.lookupvar('buildsystem::var::webstatus::hostname') %>/';
+
+/** URL to view a package svn revision. %d is replaced by the revision */
+$package_commit_url = '<%= scope.lookupvar('buildsystem::var::webstatus::package_commit_url') %>';
+
+/** name of the theme */
+$theme_name = '<%= scope.lookupvar('buildsystem::var::webstatus::theme_name') %>';
+
+/** themes directory */
+$themes_dir = '<%= scope.lookupvar('buildsystem::var::webstatus::themes_dir') %>';
+
diff --git a/modules/buildsystem/templates/cleaner.rb b/modules/buildsystem/templates/cleaner.rb
new file mode 100755
index 00000000..fa0d08ca
--- /dev/null
+++ b/modules/buildsystem/templates/cleaner.rb
@@ -0,0 +1,235 @@
+#!/usr/bin/ruby
+
+def usage
+ puts "Usage: #{$0} [options]"
+ puts "Moves obsolete packages"
+ puts
+ puts "-h, --help show this help"
+ puts "-a, --archs <arch1>,<arch2>,... list of architectures to clean"
+ puts "-a, --auto do not ask confirmation"
+ puts "-p, --base <path> base path to the repository"
+ puts "-m, --media <media1>,<media2>,... list of media to clean (default: core/release,tainted/release,nonfree/release)"
+ puts "-d, --destination <path> path to the old packages storage"
+ puts "-v, --version <version> version to clean (default: cauldron)"
+end
+
+require 'fileutils'
+require 'getoptlong'
+require 'readline'
+
+def process
+ opts = GetoptLong.new(
+ [ '--help', '-h', GetoptLong::NO_ARGUMENT ],
+ [ '--archs', '-a', GetoptLong::REQUIRED_ARGUMENT ],
+ [ '--auto', '-A', GetoptLong::NO_ARGUMENT ],
+ [ '--base', '-p', GetoptLong::REQUIRED_ARGUMENT ],
+ [ '--media', '-m', GetoptLong::REQUIRED_ARGUMENT ],
+ [ '--destination', '-d', GetoptLong::REQUIRED_ARGUMENT ],
+ [ '--version', '-v', GetoptLong::REQUIRED_ARGUMENT ],
+ [ '--lockfile', '-l', GetoptLong::REQUIRED_ARGUMENT ],
+ )
+
+ base_path = "<%= scope.lookupvar('buildsystem::var::repository::bootstrap_root') %>/distrib"
+ archs = [ "x86_64", "i686", "aarch64", "armv7hl" ]
+ medias = ["core/release", "tainted/release", "nonfree/release"]
+ old_path = "<%= scope.lookupvar('buildsystem::var::youri::packages_archivedir') %>"
+ version = "cauldron"
+ auto = false
+ lockfile = nil
+
+ opts.each do |opt, arg|
+ case opt
+ when '--help'
+ usage
+ exit 0
+ when '--destination'
+ old_path = arg
+ when '--media'
+ medias = arg.split(",")
+ when '--archs'
+ archs = arg.split(",")
+ when '--auto'
+ auto = true
+ when '--base'
+ base_path = arg
+ when '--version'
+ version = arg
+ when '--lockfile'
+ lockfile = arg
+ end
+ end
+
+ take_upload_lock(lockfile) if lockfile
+
+ medias.each{|media|
+ src_path = "#{base_path}/#{version}/SRPMS/#{media}"
+
+ $used_srcs = {}
+ $old_srcs = {}
+ $srcs = {}
+ $srcages = {}
+ $noarch = {}
+
+ # Get a list of all src.rpm and their build time
+ `urpmf --synthesis "#{src_path}/media_info/synthesis.hdlist.cz" --qf '%filename:%buildtime:%buildarchs' "."`.each_line{|l|
+ l2 = l.split(':')
+ filename = l2[0]
+ buildtime = l2[1].to_i
+ buildarch = l2[2].rstrip
+ name = name_from_filename(filename)
+ if $srcages[name] then
+ if buildtime < $srcages[name][1] then
+ # This src.rpm is older, ignore it and store it in the list to be deleted
+ $old_srcs[filename] = true
+ next
+ else
+ # This src.rpm has an older version, ignore that version and store it in the list to be deleted
+ old_filename = $srcages[name][0]
+ $old_srcs[old_filename] = true
+ $srcs.delete(old_filename)
+ end
+ end
+ $srcages[name] = [ filename, buildtime ]
+ $srcs[filename] = true
+ $noarch[name] = true if buildarch == 'noarch'
+ }
+ archs.each{|arch|
+ bin_path = "#{base_path}/#{version}/#{arch}/media/#{media}"
+ debug_path = bin_path.sub("/media/", "/media/debug/")
+ old_packages = check_binaries(arch, $srcs, $srcages, src_path, bin_path, $used_srcs)
+ old_debug_packages = check_binaries(arch, $srcs, {}, src_path, debug_path, nil)
+ move_packages(bin_path, old_path, old_packages, auto)
+ move_packages(debug_path, old_path, old_debug_packages, auto)
+ }
+ $used_srcs.keys.each{|s| $srcs.delete(s)}
+
+ move_packages(src_path, old_path, $srcs.keys + $old_srcs.keys, auto)
+ }
+end
+
+def take_upload_lock(path)
+ start_time = Time.new
+ has_lock = false
+ at_exit {
+ if File.exists?(path)
+ if File.readlines(path)[0].to_i == Process.pid
+ File.delete(path)
+ end
+ end
+ }
+ until has_lock
+ while File.exists?(path)
+ if Time.new - start_time > 2*3600.0
+ puts "Could not acquire upload lock for more than 2h, giving up"
+ end
+ sleep(5)
+ end
+ File.write(path, Process.pid)
+ if File.readlines(path)[0].to_i == Process.pid
+ has_lock = true
+ end
+ end
+end
+
+def move_packages(src, dst, list, auto)
+ list.reject!{|f| !File.exist?(src + "/" + f)}
+ return if list.empty?
+ list.each{|b|
+ puts b
+ }
+ puts "The #{list.length} listed packages will be moved from #{src} to #{dst}."
+ line = Readline::readline('Are you sure [Yn]? ') unless auto
+ if auto || line =~ /^y?$/i
+ list.each{|s|
+ oldfile = src + "/" + s
+ newfile = dst + "/" + s
+ next unless File.exist?(oldfile)
+ if (File.exist?(newfile))
+ File.unlink(oldfile)
+ else
+ FileUtils.mv(oldfile, newfile)
+ end
+ }
+ end
+end
+
+# For each binary media:
+# - Check if we have the src.rpm (else the binary package is obsolete)
+# * If we don't have the src.rpm, check if we have a newer version
+# - If there is a new version:
+# * check if this architecture has packages from it to avoid deleting armv7hl packages before the new one get rebuilt
+# * check if the new version is old enough to allow rebuilding everything (7d?)
+# - Mark used src.rpm (if one is never marked, the src.rpm is obsolete)
+
+def packages(path)
+ `urpmf --synthesis "#{path}/media_info/synthesis.hdlist.cz" --qf '%sourcerpm:%filename:%buildtime' ":"`.each_line{|l|
+ l2 = l.split(':')
+ sourcerpm = l2[0]
+ filename = l2[1]
+ buildtime = l2[2].to_i
+ yield(sourcerpm, filename, buildtime)
+ }
+end
+
+def name_from_filename(filename)
+ filename.sub(/-[^-]*-[^-]*$/, '')
+end
+
+def arch_wanted(src, arch)
+ exclusive_arch = `rpmquery -p #{src} --qf '[%{EXCLUSIVEARCH} ]'`.rstrip
+ if exclusive_arch != "" then
+ if !exclusive_arch.split(/ /).include?(arch) then
+ return false
+ end
+ end
+ exclude_arch = `rpmquery -p #{src} --qf '[%{EXCLUDEARCH} ]'`.rstrip
+ if exclude_arch != "" then
+ if exclude_arch.split(/ /).include?(arch) then
+ return false
+ end
+ end
+
+ return true
+end
+
+def check_binaries(arch, srcs, srcages, src_path, path, used_srcs)
+ used_here_srcs = {}
+ all_versions = {}
+ packages(path) {|src, filename, buildtime|
+ used_srcs[src] = true if used_srcs != nil
+ if filename =~ /noarch.rpm$/ then
+ # We need to mark the src.rpm present on this arch only for full noarch packages
+ used_here_srcs[src] = true if $noarch[name_from_filename(src)]
+ else
+ used_here_srcs[src] = true
+ end
+ name = name_from_filename(filename)
+ if all_versions[name] then
+ all_versions[name] << src
+ else
+ all_versions[name] = [src]
+ end
+ }
+ old_binaries = []
+ packages(path) {|src, filename, buildtime|
+ if ! srcs[src] then
+ srcname = name_from_filename(src)
+ if srcages[srcname] then
+ # The src.rpm is gone but there is a different version of it
+ latestsrc = srcages[srcname][0]
+ # Only delete old binaries after 7d or if there is a new version
+ name = name_from_filename(filename)
+ next unless (srcages[srcname][1] < Time.now.to_i - 24*60*60*7 || all_versions[name].include?(latestsrc))
+ # Do not delete if the new version of the package hasn't been built for this arch yet
+ # but still delete it if it is no longer expected to be built.
+ next unless (used_here_srcs[latestsrc] || !arch_wanted("#{src_path}/#{latestsrc}", arch))
+ end
+ old_binaries << filename
+ end
+ }
+ old_binaries
+end
+
+if __FILE__ == $0 then
+ process
+end
diff --git a/modules/buildsystem/templates/cleaner_test.rb b/modules/buildsystem/templates/cleaner_test.rb
new file mode 100644
index 00000000..804bd1b5
--- /dev/null
+++ b/modules/buildsystem/templates/cleaner_test.rb
@@ -0,0 +1,83 @@
+require 'cleaner'
+require "test/unit"
+
+class TestCleaner < Test::Unit::TestCase
+
+ @pkgs = []
+
+ def setpackages(pkgs)
+ @pkgs = pkgs
+ end
+
+ def packages(path)
+ @pkgs.map{|p|
+ l2 = p.split(':')
+ sourcerpm = l2[0]
+ filename = l2[1]
+ buildtime = l2[2].to_i
+ yield(sourcerpm, filename, buildtime)
+ }
+ end
+
+ def test_old
+ # Package was built on this arch and src.rpm for new version is 15d old
+ setpackages(['foo-43-1.src.rpm:libfoo2-43-1.armv7hl.rpm:43', 'foo-42-1.src.rpm:libfoo1-42-1.armv7hl.rpm:42'])
+ srcages = {}
+ srcages['foo'] = [ 'foo-43-1.src.rpm', Time.now.to_i - 15*24*3600 ]
+ srcs = {}
+ srcs['foo-43-1.src.rpm'] = true
+ assert_equal(['libfoo1-42-1.armv7hl.rpm'], check_binaries('armv7hl', srcs, srcages, '', '', nil))
+ end
+
+ def test_recent
+ # Package was built on this arch but src.rpm for new version is only 1d old
+ setpackages(['foo-43-1.src.rpm:foo-43-1.armv7hl.rpm:43', 'foo-42-1.src.rpm:foo-42-1.armv7hl.rpm:42'])
+ srcages = {}
+ srcages['foo'] = [ 'foo-43.src.rpm', Time.now.to_i - 24*3600 ]
+ srcs = {}
+ srcs['foo-43-1.src.rpm'] = true
+ assert_equal([], check_binaries('armv7hl', srcs, srcages, '', '', nil))
+ end
+
+ def test_arm_late
+ # Package was not yet built on this arch
+ setpackages(['foo-42-1.src.rpm:foo-42-1.armv7hl.rpm:42'])
+ srcages = {}
+ srcages['foo'] = [ 'foo-43.src.rpm', Time.now.to_i - 24*3600 ]
+ srcs = {}
+ srcs['foo-43-1.src.rpm'] = true
+ assert_equal([], check_binaries('armv7hl', srcs, srcages, '', '', nil))
+ end
+
+ def test_multiple_versions
+ # Old package remains (usually happens to noarch due to youri bug)
+ $noarch = { 'foo' => true }
+ setpackages(['foo-42-1.src.rpm:foo-42-1.noarch.rpm:42', 'foo-42-2.src.rpm:foo-42-2.noarch.rpm:43'])
+ srcages = {}
+ srcages['foo'] = [ 'foo-42-2.src.rpm', Time.now.to_i - 24*3600 ]
+ srcs = {}
+ srcs['foo-42-2.src.rpm'] = true
+ assert_equal(['foo-42-1.noarch.rpm'], check_binaries('i586', srcs, srcages, '', '', nil))
+ end
+
+ def test_icu
+ $noarch = {}
+ now = Time.now.to_i
+ srctime = now - 3600
+ oldbintime = now - 10*24*3600
+ newbintime = now - 3200
+ setpackages([
+ "icu-71.1-2.mga9.src.rpm:icu71-data-71.1-2.mga9.noarch.rpm:#{oldbintime}",
+ "icu-71.1-2.mga9.src.rpm:lib64icu71-71.1-2.mga9.aarch64.rpm:#{oldbintime}",
+ "icu-72.1-1.mga9.src.rpm:icu72-data-72.1-1.mga9.noarch.rpm:#{newbintime}",
+ "icu-72.1-1.mga9.src.rpm:lib64icu-devel-72.1-1.mga9.aarch64.rpm:#{newbintime}",
+ "icu-72.1-1.mga9.src.rpm:lib64icu72-72.1-1.mga9.aarch64.rpm:#{newbintime}"
+ ])
+ srcages = {}
+ srcages['icu'] = [ 'icu-71.1-2.mga9.src.rpm', srctime ]
+ srcs = {}
+ srcs['icu-71.1-2.mga9.src.rpm'] = true
+ assert_equal([], check_binaries('aarch64', srcs, srcages, '', '', nil))
+ end
+
+end
diff --git a/modules/buildsystem/templates/iurt.cauldron.conf b/modules/buildsystem/templates/iurt.cauldron.conf
deleted file mode 100644
index 5a7f047e..00000000
--- a/modules/buildsystem/templates/iurt.cauldron.conf
+++ /dev/null
@@ -1,30 +0,0 @@
-{
- supported_arch => [ 'i586', 'x86_64' ],
- all_media => { 'main' => [ 'release' ], 'contrib' => [ 'release' ] },
- upload => 'schedbot@pkgsubmit:~/uploads/',
- upload_queue => 'schedbot@pkgsubmit:~/uploads/queue/',
- unwanted_packages => '^monotone-',
- repository => '/mnt/BIG/dis/',
- rsync_to => 'schedbot@pkgsubmit:/mnt/BIG/dis/uploads/build/',
- log_url => 'http://pkgsubmit.mageia.org/queue/build/',
- admin => 'mageia-sysadm@mageia.org',
- iurt_root_command => '/home/buildbot/iurt-trunk/iurt_root_command',
- packager => 'Iurt the rebuild bot <mageia-sysadm@mageia.org>',
- sendmail => 0,
- build_timeout => {
- 'default' => 18000,
- 'gcc' => 57600,
- 'paraview' => 115200,
- 'salome' => 57600,
- 'itk' => 115200,
- 'wrapitk' => 115200,
- 'kernel-rt' => 57600,
- 'kernel-xen' => 57600,
- 'kernel-tmb' => 57600,
- 'openoffice.org' => 345600,
- 'openoffice.org64' => 345600,
- 'openoffice.org-go-ooo' => 345600,
- 'openoffice.org64-go-ooo' => 345600
- },
-}
-
diff --git a/modules/buildsystem/templates/iurt.conf b/modules/buildsystem/templates/iurt.conf
new file mode 100644
index 00000000..2dd8bf0e
--- /dev/null
+++ b/modules/buildsystem/templates/iurt.conf
@@ -0,0 +1,37 @@
+<%- distro = scope.lookupvar('buildsystem::var::distros::distros')[@distribution] -%>
+{
+ supported_arch => [ '<%= distro['arch'].join("', '") %>' ],
+ all_media =>{
+<%- distro['medias'].keys.sort.each{|media| -%>
+ '<%= media %>' => [ '<%=
+ distro['medias'][media]['repos'].keys.sort.join("', '") %>' ],
+<%-
+} -%>
+ },
+ distribution => '<%= distro['macros']['distribution'] %>',
+ vendor => '<%= distro['macros']['vendor'] %>',
+ base_media => [ '<%= distro['base_media'].join("', '") %>' ],
+ upload => '<%= build_login %>@pkgsubmit:~/uploads/',
+ upload_queue => '<%= build_login %>@pkgsubmit:~/uploads/queue/',
+ unwanted_packages => '^monotone-',
+ repository => 'http://<%= scope.lookupvar('buildsystem::var::repository::hostname') %>/<%= scope.lookupvar('buildsystem::var::repository::distribdir') %>/',
+ log_url => 'https://<%= scope.lookupvar('buildsystem::var::webstatus::hostname') %>/queue/build/',
+ admin => 'mageia-sysadm@mageia.org',
+ packager => 'Iurt the rebuild bot <mageia-sysadm@mageia.org>',
+ sendmail => 0,
+ log_size_limit => '600M',
+ build_timeout => {
+<%- build_timeout.keys.sort.each{|package| -%>
+ '<%= package %>' => <%= (build_timeout[package].to_f * scope.lookupvar('buildsystem::var::iurt::timeout_multiplier').to_f).to_i %>,
+<%-
+} -%>
+ },
+ use_netns => {
+ 'default' => 1,
+<%- allow_network_access.sort.each{|package| -%>
+ '<%= package %>' => 0,
+<%-
+} -%>
+ },
+}
+
diff --git a/modules/buildsystem/templates/maintdb/maintdb.bin b/modules/buildsystem/templates/maintdb/maintdb.bin
new file mode 100755
index 00000000..903ee009
--- /dev/null
+++ b/modules/buildsystem/templates/maintdb/maintdb.bin
@@ -0,0 +1,98 @@
+#!/bin/bash
+
+MAINTDBDIR="<%= scope.lookupvar('buildsystem::var::maintdb::dbdir') %>"
+
+function checkname()
+{
+ if [ -z "$1" ] ||
+ echo "$1" | grep -q '[/*{}%]' ||
+ echo "$1" | fgrep -q '..'
+ then
+ echo "Error: invalid package name." >&2
+ exit 1
+ fi
+}
+
+function maintnew()
+{
+ if [ "$user" != "root" ]; then
+ echo "Error: new is only allowed to root." >&2
+ exit 1
+ fi
+ checkname "$1"
+ maintfile="$MAINTDBDIR/$1"
+ if [ -f "$maintfile" ]; then
+ exit 0
+ fi
+ echo "$2" > "$maintfile"
+}
+
+function maintset()
+{
+ checkname "$1"
+ maintfile="$MAINTDBDIR/$1"
+ newmaint="$2"
+ if [ ! -f "$maintfile" ]; then
+ echo "Error: package $1 does not exist in maintdb." >&2
+ exit 1
+ fi
+ curmaint=$(cat "$maintfile")
+ if [ "$newmaint" = "nobody" ] || [[ "$newmaint" = *-team ]]; then
+ if [ "$curmaint" = "$user" ]; then
+ echo "$newmaint" > "$maintfile"
+ exit 0
+ else
+ echo "Error: cannot set maintainer for $1." >&2
+ exit 1
+ fi
+ elif [ "$newmaint" = "$user" ]; then
+ if [ "$curmaint" = "nobody" ] || [[ "$curmaint" = *-team ]]; then
+ echo "$newmaint" > "$maintfile"
+ exit 0
+ else
+ echo "Error: cannot set maintainer for $1." >&2
+ exit 1
+ fi
+ else
+ echo "Error: cannot set someone else as maintainer." >&2
+ exit 1
+ fi
+}
+
+function maintgetall()
+{
+ cd "$MAINTDBDIR"
+ for file in *; do
+ echo "$file $(cat $file)"
+ done
+ exit 0
+}
+
+function maintget()
+{
+ if [ -z "$1" ]; then
+ maintgetall
+ fi
+ checkname "$1"
+ maintfile="$MAINTDBDIR/$1"
+ if [ -f "$maintfile" ]; then
+ cat "$maintfile"
+ else
+ echo "Error: package $1 does not exist in maintdb." >&2
+ exit 1
+ fi
+}
+
+user="$1"
+action="$2"
+
+if [ "$action" = "new" ]; then
+ maintnew "$3" "$4"
+elif [ "$action" = "set" ]; then
+ maintset "$3" "$4"
+elif [ "$action" = "get" ]; then
+ maintget "$3"
+else
+ echo "Error: unknown command." >&2
+ exit 2
+fi
diff --git a/modules/buildsystem/templates/maintdb/sudoers.maintdb b/modules/buildsystem/templates/maintdb/sudoers.maintdb
new file mode 100644
index 00000000..91c88e47
--- /dev/null
+++ b/modules/buildsystem/templates/maintdb/sudoers.maintdb
@@ -0,0 +1,4 @@
+%<%= scope.lookupvar('buildsystem::var::groups::packagers') %> ALL =(<%= scope.lookupvar('buildsystem::var::maintdb::login') %>) NOPASSWD: <%= scope.lookupvar('buildsystem::var::maintdb::binpath') %> [a-z]* get
+%<%= scope.lookupvar('buildsystem::var::groups::packagers') %> ALL =(<%= scope.lookupvar('buildsystem::var::maintdb::login') %>) NOPASSWD: <%= scope.lookupvar('buildsystem::var::maintdb::binpath') %> [a-z]* [gs]et [a-zA-Z0-9]*
+%<%= scope.lookupvar('buildsystem::var::groups::packagers') %> ALL =(<%= scope.lookupvar('buildsystem::var::maintdb::login') %>) NOPASSWD: <%= scope.lookupvar('buildsystem::var::maintdb::binpath') %> [a-z]* set [a-zA-Z0-9]* [a-z]*
+<%= scope.lookupvar('buildsystem::var::scheduler::login') %> ALL =(<%= scope.lookupvar('buildsystem::var::maintdb::login') %>) NOPASSWD: <%= scope.lookupvar('buildsystem::var::maintdb::binpath') %> [a-z]* new [a-zA-Z0-9]* [a-z]*
diff --git a/modules/buildsystem/templates/maintdb/vhost_maintdb.conf b/modules/buildsystem/templates/maintdb/vhost_maintdb.conf
new file mode 100644
index 00000000..146413a7
--- /dev/null
+++ b/modules/buildsystem/templates/maintdb/vhost_maintdb.conf
@@ -0,0 +1,3 @@
+<Directory <%= scope.lookupvar('buildsystem::var::maintdb::dbdir') %>>
+ Options None
+</Directory>
diff --git a/modules/buildsystem/templates/maintdb/wrapper.maintdb b/modules/buildsystem/templates/maintdb/wrapper.maintdb
new file mode 100644
index 00000000..fcf69dab
--- /dev/null
+++ b/modules/buildsystem/templates/maintdb/wrapper.maintdb
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+maintdbuser="<%= scope.lookupvar('buildsystem::var::maintdb::login') %>"
+maintdbpath="<%= scope.lookupvar('buildsystem::var::maintdb::binpath') %>"
+packagersgroup="<%= scope.lookupvar('buildsystem::var::groups::packagers') %>"
+
+function isingroup()
+{
+ grp="$1"
+ for group in `groups`
+ do if [ "$grp" = "$group" ]
+ then
+ return 0
+ fi
+ done
+ return 1
+}
+
+if ! isingroup "$packagersgroup"
+then
+ echo "You are not in $packagersgroup group."
+ exit 1
+fi
+
+sudo -u "$maintdbuser" "$maintdbpath" $(whoami) "$@"
diff --git a/modules/buildsystem/templates/media.cfg b/modules/buildsystem/templates/media.cfg
new file mode 100644
index 00000000..64757a2b
--- /dev/null
+++ b/modules/buildsystem/templates/media.cfg
@@ -0,0 +1,142 @@
+<%-
+def media_name(media, repo, type, archname)
+ name = [ media.capitalize ]
+ if archname != nil
+ name += [ archname ]
+ end
+ for r in repo.split('_') do
+ name += [ r.capitalize ]
+ end
+ if type != nil
+ name += [ type.capitalize ]
+ end
+ return name.join(' ')
+end
+
+def media_out(name, media_hash)
+ media_out = "[%s]\n" % name
+ media_hash.keys.sort.each{|key|
+ value = media_hash[key]
+ if value != nil
+ media_out += "%s=%s\n" % [ key, value ]
+ end
+ }
+ return media_out
+end
+distro = scope.lookupvar('buildsystem::var::distros::distros')[@distro_name]
+-%>
+[media_info]
+version=<%= distro['version'] %>
+mediacfg_version=2
+branch=<%= distro['branch'] %>
+<%-
+if @arch != 'armv7hl'
+-%>
+arch=<%= @arch %>
+<%-
+end
+-%>
+xml-info=1
+
+<%-
+distro['medias'].keys.sort { |x,y| distro['medias'][x]['order'] <=> distro['medias'][y]['order'] }.each{|medianame|
+ media = distro['medias'][medianame]
+ media['repos'].keys.sort { |x,y| media['repos'][x]['order'] <=> media['repos'][y]['order'] }.each{|reponame|
+ repo = media['repos'][reponame]
+ media_type = []
+ if media['media_type'] != nil
+ media_type += media['media_type']
+ end
+ if repo['media_type'] != nil
+ media_type += repo['media_type']
+ end
+ noauto=nil
+ if (media['noauto'] == '1') or (repo['noauto'] == '1')
+ noauto='1'
+ end
+ updates_for = nil
+ if repo['updates_for'] != nil
+ updates_for = [ medianame, repo['updates_for'] ].join('/')
+ end
+ -%><%=
+ media_out [ medianame, reponame ].join('/'),
+ :hdlist => [ 'hdlist', medianame, reponame ].join('_') + '.cz',
+ :name => media_name(medianame, reponame, nil, nil),
+ :srpms => [ '../../SRPMS', medianame, reponame ].join('/'),
+ :media_type => media_type.join(':'),
+ :updates_for => updates_for,
+ :noauto => noauto
+
+ %>
+ <%-# debug -%>
+ <%-
+ debug_media_type = media_type + [ 'debug' ]
+ -%><%=
+ media_out [ 'debug', medianame, reponame ].join('/'),
+ :hdlist => [ 'hdlist_debug', medianame, reponame ].join('_') + '.cz',
+ :name => media_name(medianame, reponame, 'debug', nil),
+ :srpms => [ '../../SRPMS', medianame, reponame ].join('/'),
+ :media_type => debug_media_type.join(':'),
+ :noauto => '1'
+
+ %>
+ <%-# source -%>
+ <%-
+ source_media_type = media_type + [ 'source' ]
+ -%><%=
+ media_out [ '../../SRPMS', medianame, reponame ].join('/'),
+ :hdlist => [ 'hdlist', medianame, reponame ].join('_') + '.src.cz',
+ :name => media_name(medianame, reponame, 'sources', nil),
+ :rpms => [ medianame, reponame ].join('/'),
+ :media_type => source_media_type.join(':'),
+ :noauto => '1'
+
+ %>
+ <%-# we add 32bit media if arch is x86_64 -%>
+ <%-
+ if @arch == 'x86_64' and distro['arch'].include?('i586')
+ medianame32 = [ medianame, '32' ].join('')
+ -%><%=
+ media_out [ '../../i586/media', medianame, reponame ].join('/'),
+ :hdlist => [ 'hdlist', medianame32, reponame ].join('_') + '.src.cz',
+ :name => media_name(medianame, reponame, nil, '32bit'),
+ :media_type => media_type.join(':'),
+ :noauto => noauto
+
+ %>
+ <%-
+ end
+ if @arch == 'x86_64' and distro['arch'].include?('i686')
+ medianame32 = [ medianame, '32' ].join('')
+ -%><%=
+ media_out [ '../../i686/media', medianame, reponame ].join('/'),
+ :hdlist => [ 'hdlist', medianame32, reponame ].join('_') + '.src.cz',
+ :name => media_name(medianame, reponame, nil, '32bit'),
+ :media_type => media_type.join(':'),
+ :noauto => noauto
+
+ %>
+ <%-
+ end
+ }
+}
+if distro['based_on'] != nil
+ distro['based_on'].keys.sort.each{|bdistroname|
+ bdistro = distro['based_on'][bdistroname]
+ bdistro.keys.sort.each{|medianame|
+ media = bdistro[medianame]
+ for reponame in media
+ -%><%=
+ media_out [ bdistroname, medianame, reponame ].join('/'),
+ :hdlist => [ 'hdlist', bdistroname, medianame,
+ reponame ].join('_'),
+ :name => media_name([ medianame, bdistroname].join(''), reponame, nil, nil),
+ :media_type => 'base_distro',
+ :noauto => 1
+ %>
+ <%-
+ end
+ }
+ }
+end
+-%>
diff --git a/modules/buildsystem/templates/mga-youri-submit b/modules/buildsystem/templates/mga-youri-submit
new file mode 100755
index 00000000..0d29d462
--- /dev/null
+++ b/modules/buildsystem/templates/mga-youri-submit
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec sudo /usr/local/bin/mga-youri-submit.wrapper "$@"
diff --git a/modules/buildsystem/templates/mga-youri-submit.wrapper b/modules/buildsystem/templates/mga-youri-submit.wrapper
new file mode 100755
index 00000000..66fc59bc
--- /dev/null
+++ b/modules/buildsystem/templates/mga-youri-submit.wrapper
@@ -0,0 +1,36 @@
+#!/usr/bin/perl
+# youri-submit wrapper
+
+use strict;
+use warnings;
+use Fcntl ':mode';
+use File::Basename;
+use MDK::Common;
+
+my $log_dir = "$ENV{HOME}/submit-logs";
+
+my $sudo_user = $ENV{SUDO_USER} or die "should be run through sudo";
+my @prog = ('perl', '-I/usr/share/mga-youri-submit/lib', '/usr/share/mga-youri-submit/bin/youri-submit');
+
+my @options;
+foreach my $arg (@ARGV) {
+ if ($arg =~ /^-?-(\S+)/) {
+ # drop prohibited options
+ if ($arg =~ /-c/ || $arg =~ /-s/) {
+ print STDERR "prohibited option $arg, skipping\n";
+ next;
+ }
+ }
+ push(@options, $arg);
+}
+
+# logging for bug #30315 -spuk, 2007-05-29
+mkdir_p($log_dir);
+open(STDERR, "| tee -a $log_dir/$sudo_user.err >&2");
+open(STDOUT, "| tee -a $log_dir/$sudo_user.out");
+
+# call wrapped program
+print "Executing @prog --config /etc/youri/submit-todo.conf --define user=$sudo_user @options (sudo_user $sudo_user)\n";
+my $err = system(@prog, "--config", "/etc/youri/submit-todo.conf", "--define", "user=$sudo_user", @options) && ($? >> 8 || 1);
+
+exit $err
diff --git a/modules/buildsystem/templates/mgarepo.conf b/modules/buildsystem/templates/mgarepo.conf
new file mode 100644
index 00000000..fbe5109c
--- /dev/null
+++ b/modules/buildsystem/templates/mgarepo.conf
@@ -0,0 +1,88 @@
+<%-
+ default_distro = scope.lookupvar('buildsystem::var::distros::default_distro')
+ distros = scope.lookupvar('buildsystem::var::distros::distros')
+-%>
+[global]
+verbose = no
+default_parent = <%= scope.lookupvar('buildsystem::var::mgarepo::svn_root_packages') %>/<%= default_distro %>
+#url-map = svn\+ssh://svn\.mageia\.org/(.*) file:///\1
+tempdir = <%= sched_home_dir %>/repsys/tmp
+trunk-dir = <%= default_distro %>
+<%-
+conf = scope.lookupvar('buildsystem::var::mgarepo::conf')
+if conf['global'] != nil
+ conf['global'].keys.sort.each{|key|
+ value = conf['global'][key]
+ -%><%= key %> = <%= value %>
+<%-
+ }
+end
+-%>
+
+
+[log]
+oldurl = <%= scope.lookupvar('buildsystem::var::mgarepo::oldurl') %>
+# controls up to which revision the rpm changelog
+# will be constructed (default zero, i.e., oldest
+# commit)
+# revision-offset = 0
+# commit lines containing this string won't be shown in the changelog:
+ignore-string = SILENT
+
+[template]
+path = /usr/share/mgarepo/default.chlog
+
+[users]
+iurt = Mageia build bot <mageia-sysadm@<%= domain %>>
+
+[submit]
+default = <%= default_distro %>
+host = <%= scope.lookupvar('buildsystem::var::mgarepo::submit_host') %>
+
+<%-
+ distros.keys.sort.each{|d|
+ distro = distros[d]
+-%>
+[submit <%= d %>]
+target = <%= sched_home_dir %>/repsys/srpms
+allowed = <%= distro['submit_allowed'] %> <%= distro['backports_allowed'] %>
+rpm-macros = global <%= d %>
+
+<%-
+ }
+-%>
+
+[macros global]
+# mkrel definition to be removed when rpm-setup is updated on main build node
+mkrel(c:) = %{-c: 0.%{-c*}.}%{1}%{?subrel:.%subrel}%{?distsuffix:%distsuffix}%{?!distsuffix:.mga}%{?distro_release:%distro_release}
+dist = %{?distsuffix:%distsuffix}%{?!distsuffix:.mga}%{?distro_release:%distro_release}
+
+<%-
+ distros.keys.sort.each{|d|
+ distro = distros[d]
+-%>
+[macros <%= d %>]
+distro_release = <%= distro['version'] %>
+<%-
+ distro['macros'].keys.sort.each{|macro|
+ value = distro['macros'][macro]
+ -%><%= macro %> = <%= value %>
+ <%- } %>
+<%- }
+%>
+
+[helper]
+create-srpm = /usr/share/repsys/create-srpm
+upload-srpm = /usr/local/bin/mga-youri-submit
+# needed by mdvsys 2.0
+install-buildrequires = sudo rurpmi --auto --no-suggests
+upload-bin = /usr/local/bin/wrapper.upload-bin
+
+[srpm]
+run-prep = yes
+
+[binrepo]
+<%- binrepo_hostname = scope.lookupvar('buildsystem::var::binrepo::hostname') -%>
+download_url = http://<%= binrepo_hostname %>/
+upload_host = <%= binrepo_hostname %>
+
diff --git a/modules/buildsystem/templates/repoctl.conf b/modules/buildsystem/templates/repoctl.conf
new file mode 100644
index 00000000..14506a25
--- /dev/null
+++ b/modules/buildsystem/templates/repoctl.conf
@@ -0,0 +1,40 @@
+<%-
+distribdir = scope.lookupvar('buildsystem::var::repository::distribdir')
+distros = scope.lookupvar('buildsystem::var::distros::distros')
+arches = {}
+distrosections = {}
+sectionsrepos = {}
+distros.each{|distroname, distro|
+ distro['medias'].each{|medianame, media|
+ distrosections[medianame] = 1
+ media['repos'].each{|reponame, repo|
+ sectionsrepos[reponame] = 1
+ }
+ }
+ distro['arch'].each{|arch|
+ arches[arch] = 1
+ }
+}
+-%>
+dryrun=echo
+if [ -z $SUDO_USER ]
+then
+ requestuser="$USER"
+else
+ requestuser="$SUDO_USER"
+fi
+lockdir=/var/lib/repoctl/locks
+hdlistsdir=/var/lib/repoctl/hdlists
+rootdir=<%= scope.lookupvar('buildsystem::var::repository::bootstrap_root') %>
+finalrootdir=<%= scope.lookupvar('buildsystem::var::repository::mirror_root') %>
+distribdir=$rootdir/<%= distribdir %>
+finaldistribdir=$finalrootdir/<%= distribdir %>
+distroreleases='<%= distros.keys.sort.join(' ') -%>'
+distrosections='<%= distrosections.keys.sort.join(' ') -%>'
+sectionsrepos='<%= sectionsrepos.keys.sort.join(' ') -%>'
+arches='<%= arches.keys.sort.join(' ') -%>'
+mirror_rsync_options="-v --delete -alH"
+timestampfile="mageia_timestamp"
+sha1sumfile="mageia_sha1sum"
+sha1sumsigfile="mageia_sha1sum.gpg"
+sign_mirror_sha1sum=/bin/true
diff --git a/modules/buildsystem/templates/rpmlint.conf b/modules/buildsystem/templates/rpmlint.conf
new file mode 100644
index 00000000..b81f169b
--- /dev/null
+++ b/modules/buildsystem/templates/rpmlint.conf
@@ -0,0 +1,7 @@
+from Config import *
+execfile('/etc/rpmlint/extracted.d/distribution.exceptions.conf')
+
+for i in open('/etc/rpmlint/extracted.d/distribution.error.list').readlines():
+ setBadness(i, 10)
+
+
diff --git a/modules/buildsystem/templates/signbot/sudoers.signpackage b/modules/buildsystem/templates/signbot/sudoers.signpackage
new file mode 100644
index 00000000..4ea30238
--- /dev/null
+++ b/modules/buildsystem/templates/signbot/sudoers.signpackage
@@ -0,0 +1,2 @@
+<%= sched_login %> ALL =(<%= scope.lookupvar('buildsystem::var::signbot::login') %>) NOPASSWD: /usr/local/bin/mga-signpackage
+<%= sched_login %> ALL =(<%= scope.lookupvar('buildsystem::var::signbot::login') %>) NOPASSWD: /usr/local/bin/sign-check-package
diff --git a/modules/buildsystem/templates/submit_package.pl b/modules/buildsystem/templates/submit_package.pl
new file mode 100755
index 00000000..1fdf7749
--- /dev/null
+++ b/modules/buildsystem/templates/submit_package.pl
@@ -0,0 +1,18 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+my $svn_server = '<%= scope.lookupvar('buildsystem::var::mgarepo::svn_hostname') %>';
+my $packagersgroup="<%= scope.lookupvar('buildsystem::var::groups::packagers') %>";
+
+my $login = getpwuid($<);
+my (undef, undef, undef, $members) = getgrnam $packagersgroup;
+if (not $members =~ /\b$login\b/) {
+ print "You are not in $packagersgroup group\n";
+ exit 1;
+}
+
+# for bug 914
+# https://bugs.mageia.org/show_bug.cgi?id=914
+map { $_ =~ s|^svn\+ssh://$svn_server/|svn://$svn_server/| } @ARGV;
+exec "/usr/share/mgarepo/create-srpm", @ARGV;
diff --git a/modules/buildsystem/templates/sudoers.iurt b/modules/buildsystem/templates/sudoers.iurt
index 266f301c..21e81e87 100644
--- a/modules/buildsystem/templates/sudoers.iurt
+++ b/modules/buildsystem/templates/sudoers.iurt
@@ -1 +1 @@
-<%= build_login %> ALL = NOPASSWD: /usr/sbin/iurt_root_command
+<%= scope.lookupvar('buildsystem::var::iurt::login') %> ALL = NOPASSWD: /usr/sbin/iurt_root_command
diff --git a/modules/buildsystem/templates/sudoers.youri b/modules/buildsystem/templates/sudoers.youri
new file mode 100644
index 00000000..3bc7cc2d
--- /dev/null
+++ b/modules/buildsystem/templates/sudoers.youri
@@ -0,0 +1,6 @@
+<%- sched_login = scope.lookupvar('buildsystem::var::scheduler::login') -%>
+Cmnd_Alias YOURI = /usr/local/bin/mga-youri-submit.wrapper
+Defaults!YOURI always_set_home
+Defaults!YOURI runas_default = <%= sched_login %>
+Defaults!YOURI !requiretty
+%<%= scope.lookupvar('buildsystem::var::groups::packagers') -%> ALL = (<%= sched_login %>) NOPASSWD: YOURI
diff --git a/modules/buildsystem/templates/upload.conf b/modules/buildsystem/templates/upload.conf
new file mode 100644
index 00000000..af610c92
--- /dev/null
+++ b/modules/buildsystem/templates/upload.conf
@@ -0,0 +1,131 @@
+###
+#
+# Do not disable the host without appropriate warning
+# to somebody able to fix the machine
+#
+# Please run 'perl -cw .upload.conf' in order to check the file is OK.
+#
+###
+
+<%-
+ build_nodes = scope.lookupvar('buildsystem::var::scheduler::build_nodes')
+-%>
+my %nodes = (
+<%-
+ build_nodes.keys.sort.each{|arch|
+-%>
+ <%= arch -%> => [ '<%= build_nodes[arch].join("', '") -%>' ],
+<%-
+ }
+-%>
+);
+my $repository = "http://<%= scope.lookupvar('buildsystem::var::repository::hostname') %>/<%= scope.lookupvar('buildsystem::var::repository::distribdir') %>/";
+my $homedir = "<%= scope.lookupvar('buildsystem::var::iurt::homedir') %>";
+
+{
+ bot => {
+ (map {
+ my $arch = $_;
+ $arch => {
+ map {
+ my $node = $_;
+ ($node => {
+ iurt => {
+ user => '<%= scope.lookupvar('buildsystem::var::iurt::login') %>',
+# (spuk, 2007-08-16) disabled iurt_cache additional media, locks trying to mount -o bind
+# command => "iurt --copy-srpm --group -v 6 --config local_spool $homedir/iurt/__DIR__ --no_rsync --chrooted-urpmi -m __MEDIA__ -- $repository --additional-media -m __MEDIA__ -- file://$homedir/cache/ -p \"__PACKAGER__\" -r __TARGET__ __ARCH__",
+ command => "iurt --copy_srpm --group --rpmmacros \"%distro_section __SECTION__\" --config local_spool $homedir/iurt/__DIR__ --no_rsync --chrooted-urpmi -m __MEDIA__ -- $repository -p \"__PACKAGER__\" -r __TARGET__ __ARCH__",
+ packages => "$homedir/iurt/",
+ },
+ });
+ } @{$nodes{$arch}},
+ };
+ } keys %nodes),
+ },
+ media => {
+ <%-
+ def repo_deps(distros, dname, mname, rname)
+ deps = {}
+ distro = distros[dname]
+ if distro['based_on'] != nil
+ distro['based_on'].each{|bdistro, bmedias|
+ if bmedias[mname] != nil and \
+ bmedias[mname].include?(rname) then
+ deps[ [ bdistro, mname, rname ].join('/') ] = 1
+ end
+ }
+ end
+ if distro['medias'][mname] != nil \
+ and distro['medias'][mname]['repos'][rname] != nil
+ then
+ deps[ [ mname, rname ].join('/') ] = 1
+ else
+ return deps
+ end
+ mlist = distro['medias'][mname]['requires']
+ mlist = mlist == nil ? [ mname ] : [ mname ] + mlist
+ mlist.each{|mreq|
+ rlist = distro['medias'][mname]['repos'][rname]['requires']
+ rlist = [] if rlist == nil
+ rlist += [ rname ] if mreq != mname
+ rlist.each{|rreq|
+ deps.merge!(repo_deps(distros, dname, mreq, rreq))
+ }
+ }
+ return deps
+ end
+ distros = scope.lookupvar('buildsystem::var::distros::distros')
+ distros.keys.sort.each{|distroname|
+ -%>
+ '<%= distroname -%>' => {
+ <%-
+ distro = distros[distroname]
+ distro['medias'].keys.sort.each{|medianame|
+ media = distro['medias'][medianame]
+ media['repos'].keys.sort.each{|reponame|
+ deps = repo_deps(distros, distroname, medianame, reponame)
+ -%>
+ "<%= [ medianame, reponame ].join('/') %>" => [ "<%=
+ deps.keys.sort.join('", "')
+ %>" ],
+ <%-
+ }
+ }
+ -%>
+ },
+ <%-
+ }
+ -%>
+ },
+ admin => '<%= scope.lookupvar('buildsystem::var::scheduler::admin_mail') %>',
+ http_queue => 'https://<%= scope.lookupvar('buildsystem::var::webstatus::hostname') %>/uploads',
+ upload_user => '<%= scope.lookupvar('buildsystem::var::scheduler::login') %>',
+ email_domain => '<%= domain %>',
+ arch => {
+ <%-
+ distros.keys.sort.each{|distroname|
+ -%>
+ <%= distroname -%> => [ '<%= distros[distroname]['arch'].join("', '") %>' ],
+ <%-
+ }
+ -%>
+ default => [ 'i586', 'x86_64' ],
+ },
+ mandatory_arch => {
+ <%-
+ distros.keys.sort.each{|distroname|
+ if distros[distroname]['mandatory_arch'] != nil
+ march = distros[distroname]['mandatory_arch']
+ else
+ march = distros[distroname]['arch']
+ end
+ -%>
+ <%= distroname -%> => [ '<%= march.join("', '") %>' ],
+ <%-
+ }
+ -%>
+ default => [ 'i586', 'x86_64' ],
+ },
+ ssh_options => "-o ServerAliveInterval=10 -o ConnectTimeout=20 -o BatchMode=yes",
+ faildelay => 360000,
+}
diff --git a/modules/buildsystem/templates/vhost_repository.conf b/modules/buildsystem/templates/vhost_repository.conf
new file mode 100644
index 00000000..e082ffca
--- /dev/null
+++ b/modules/buildsystem/templates/vhost_repository.conf
@@ -0,0 +1,73 @@
+<%-
+mirror_root = scope.lookupvar('buildsystem::var::repository::mirror_root')
+mirror_reporoot = scope.lookupvar('buildsystem::var::repository::mirror_reporoot')
+bootstrap_reporoot = scope.lookupvar('buildsystem::var::repository::bootstrap_reporoot')
+distribdir = scope.lookupvar('buildsystem::var::repository::distribdir')
+repo_allow_from_ips = scope.lookupvar('buildsystem::var::distros::repo_allow_from_ips')
+repo_allow_from_domains = scope.lookupvar('buildsystem::var::distros::repo_allow_from_ips')
+distros = scope.lookupvar('buildsystem::var::distros::distros')
+-%>
+<VirtualHost *:80>
+ ServerName <%= scope.lookupvar('buildsystem::var::repository::hostname') %>
+ DocumentRoot <%= mirror_root %>
+
+ # Some simple API to check existence of SRPMs for QA
+ RewriteEngine On
+
+ RewriteCond /distrib/bootstrap/distrib/$2/SRPMS/$3/$1s_testing/$4.src.rpm -f
+ RewriteRule ^/qa/checksrpm/(update|backport)/([1-9][0-9]*)/([a-z_]+)/([^/]+)$ http://repository.mageia.org/qa/checksrpm/found [L,R=302]
+
+ RewriteRule ^/qa/checksrpm/ - [L,G]
+
+<%-
+ if repo_allow_from_ips != nil || repo_allow_from_domains != nil then
+ access_requires = [ 'all denied' ]
+ if repo_allow_from_ips != nil then
+ for allow in repo_allow_from_ips do
+ access_requires << 'ip ' + allow
+ end
+ end
+ if repo_allow_from_domains != nil then
+ for allow in repo_allow_from_domains do
+ access_requires << 'host ' + allow
+ end
+ end
+ else
+ access_requires = [ 'all granted' ]
+ end
+%>
+ Alias /bootstrap/ "<%= bootstrap_reporoot %>/"
+<%-
+ distros.keys.sort.each{|distroname|
+ distro = distros[distroname]
+ if distro['no_mirror'] -%>
+ Alias /<%= distribdir %>/<%= distroname %>/ "<%= bootstrap_reporoot %>/<%= distroname %>/"
+<%-
+ end
+ }
+-%>
+
+ <Directory <%= bootstrap_reporoot %>>
+ Header append Cache-Control "public, must-revalidate"
+<%-
+ for req in access_requires do
+-%>
+ Require <%= req %>
+<%-
+ end
+-%>
+ Options Indexes FollowSymLinks
+ </Directory>
+
+ <Directory <%= mirror_root %>>
+ Header append Cache-Control "public, must-revalidate"
+<%-
+ for req in access_requires do
+-%>
+ Require <%= req %>
+<%-
+ end
+-%>
+ Options Indexes FollowSymLinks
+ </Directory>
+</VirtualHost>
diff --git a/modules/buildsystem/templates/vhost_webstatus.conf b/modules/buildsystem/templates/vhost_webstatus.conf
new file mode 100644
index 00000000..3b0e6246
--- /dev/null
+++ b/modules/buildsystem/templates/vhost_webstatus.conf
@@ -0,0 +1,13 @@
+<Location /uploads>
+ Require all granted
+ Options Indexes
+ IndexOptions NameWidth=*
+</Location>
+<Location /autobuild>
+ Require all granted
+ Options Indexes
+ IndexOptions NameWidth=*
+</Location>
+<Directory /var/www/bs/autobuild>
+ Options FollowSymlinks FollowSymLinks
+</Directory>
diff --git a/modules/buildsystem/templates/youri/acl.conf b/modules/buildsystem/templates/youri/acl.conf
new file mode 100644
index 00000000..f0949f8a
--- /dev/null
+++ b/modules/buildsystem/templates/youri/acl.conf
@@ -0,0 +1 @@
+.* .* .* ^glib$ ^blacklisted$
diff --git a/modules/buildsystem/templates/youri/host.conf b/modules/buildsystem/templates/youri/host.conf
new file mode 100644
index 00000000..bf4fa086
--- /dev/null
+++ b/modules/buildsystem/templates/youri/host.conf
@@ -0,0 +1,23 @@
+<%-
+ aliases = scope.lookupvar('buildsystem::var::scheduler::build_nodes_aliases')
+ nodes = {}
+ nodes['src'] = [ scope.lookupvar('buildsystem::var::scheduler::build_src_node') ]
+ scope.lookupvar('buildsystem::var::scheduler::build_nodes').each{|arch,n|
+ a = arch + '|noarch|src'
+ nodes[a] = []
+ n.each{|node|
+ if aliases[node] != nil
+ nodes[a] += [ aliases[node] ]
+ else
+ nodes[a] += [ node ]
+ end
+ }
+ }
+ str = ''
+ nodes.keys.sort.each{|arch|
+ nodes[arch].sort.uniq.each{|node|
+ str += node + ' ' + arch + "\n"
+ }
+ }
+-%>
+<%= str -%>
diff --git a/modules/buildsystem/templates/youri/submit.conf b/modules/buildsystem/templates/youri/submit.conf
new file mode 100644
index 00000000..0d7cf927
--- /dev/null
+++ b/modules/buildsystem/templates/youri/submit.conf
@@ -0,0 +1,140 @@
+<%
+Puppet::Parser::Functions.autoloader.loadall
+sched_home_dir = scope.lookupvar('buildsystem::var::scheduler::homedir')
+
+conf = scope.lookupvar('buildsystem::var::youri::youri_conf')
+conf_default = scope.lookupvar('buildsystem::var::youri::youri_conf_default')
+distros = scope.lookupvar('buildsystem::var::distros::distros')
+
+def line(text, indent)
+ res = ''
+ i = 0
+ while i < indent
+ res += ' '
+ i += 1
+ end
+ res += text + "\n"
+end
+
+def array_text(array, indent)
+ res = ''
+ array.each{|a|
+ res += line('- ' + a, indent)
+ }
+ return res
+end
+
+def hash_text(hash, indent)
+ res = ''
+ curindent = indent
+ hash.keys.sort.each{|key|
+ if hash[key].instance_of? Hash
+ res += line(key + ':', indent)
+ res += hash_text(hash[key], indent + 4)
+ elsif hash[key].instance_of? Array
+ res += line(key + ':', indent)
+ res += array_text(hash[key], indent + 4)
+ elsif hash[key].instance_of? String
+ res += line(key + ': ' + hash[key], indent)
+ end
+ }
+ return res
+end
+
+def class_hash(conf, conf_default)
+ res = {}
+ res['class'] = get_conf(conf, ['class']) == nil ?
+ conf_default['class'] : conf['class']
+ res['options'] = get_conf(conf_default, ['options']) == nil ? {} :
+ conf_default['options'].dup
+ if get_conf(conf, ['options']) != nil
+ res['options'].merge!(conf['options'])
+ end
+ return res
+end
+
+def get_conf(conf, path)
+ res = conf
+ path.each{|p|
+ if res == nil
+ return nil
+ end
+ res = res[p]
+ }
+ return res
+end
+
+def get_distros_conf(distros, conf_name, path)
+ res = {}
+ distros.keys.each{|distro|
+ t = get_conf(distros[distro], [ 'youri', conf_name ] + path)
+ if t != nil
+ res[distro] = t.dup
+ end
+ }
+ return res
+end
+
+def get_definitions(def_name, conf_name, conf, conf_default, distros)
+ res = {}
+ res[def_name] = {}
+ def_list = conf_default[conf_name][def_name].keys
+ def_list += get_conf(conf, [ conf_name, def_name ]) != nil ? \
+ conf[conf_name][def_name].keys : []
+ def_list.uniq.each{|d|
+ res[def_name][d] = class_hash(
+ get_conf(conf, [ conf_name, def_name, d ]),
+ get_conf(conf_default, [ conf_name, def_name, d ])
+ )
+ res[def_name][d]['options'].merge!(get_distros_conf(distros,
+ conf_name, [ def_name, d ]))
+ }
+ return res
+end
+
+%>
+home: <%= sched_home_dir %>
+
+<%-
+ repository = {
+ 'repository' => class_hash(get_conf(conf[conf_name],
+ ['repository']),
+ conf_default[conf_name]['repository']),
+ }
+ distros.keys.each{|distro|
+ repository['repository']['options'][distro] = {
+ 'arch' => distros[distro]['arch'].join(' '),
+ }
+ }
+-%>
+# repository declaration
+<%= hash_text(repository, 0) %>
+
+<%-
+ targets = {
+ 'targets' => get_distros_conf(distros, conf_name, [ 'targets' ]),
+ }
+-%>
+# targets definition
+<%= hash_text(targets, 0) %>
+
+<%-
+ checks = get_definitions('checks', conf_name, conf, conf_default, distros)
+-%>
+# checks definition
+<%= hash_text(checks, 0) -%>
+
+<%-
+ actions = get_definitions('actions', conf_name, conf, conf_default, distros)
+-%>
+# actions definitions
+<%= hash_text(actions, 0) -%>
+
+<%-
+ posts = get_definitions('posts', conf_name, conf, conf_default, distros)
+-%>
+
+# posts definitions
+<%= hash_text(posts, 0) -%>
+
+# vim:ft=yaml:et:sw=4