diff options
Diffstat (limited to 'modules/buildsystem/templates')
40 files changed, 978 insertions, 1593 deletions
diff --git a/modules/buildsystem/templates/binrepo/sudoers.binrepo b/modules/buildsystem/templates/binrepo/sudoers.binrepo index 405f43a3..c20810cf 100644 --- a/modules/buildsystem/templates/binrepo/sudoers.binrepo +++ b/modules/buildsystem/templates/binrepo/sudoers.binrepo @@ -1 +1 @@ -%<%= packagers_committers_group %> ALL =(<%= login %>) NOPASSWD: <%= uploadbinpath %> +%<%= 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 index f90130f3..7cad5838 100755 --- a/modules/buildsystem/templates/binrepo/upload-bin +++ b/modules/buildsystem/templates/binrepo/upload-bin @@ -1,11 +1,11 @@ #!/bin/sh set -e -binrepodir=<%= repodir %> -uploadinfosdir=<%= uploadinfosdir %> +binrepodir=<%= scope.lookupvar('buildsystem::var::binrepo::repodir') %> +uploadinfosdir=<%= scope.lookupvar('buildsystem::var::binrepo::uploadinfosdir') %> tmpfile=$(mktemp) -mail_from="<%= uploadmail_from %>" -mail_dest="<%= uploadmail_to %>" +mail_from="<%= scope.lookupvar('buildsystem::var::binrepo::uploadmail_from') %>" +mail_dest="<%= scope.lookupvar('buildsystem::var::binrepo::uploadmail_to') %>" test $# = 2 || exit 3 username="$1" diff --git a/modules/buildsystem/templates/binrepo/vhost_binrepo.conf b/modules/buildsystem/templates/binrepo/vhost_binrepo.conf index ce29accf..f411c07a 100644 --- a/modules/buildsystem/templates/binrepo/vhost_binrepo.conf +++ b/modules/buildsystem/templates/binrepo/vhost_binrepo.conf @@ -1,3 +1,3 @@ -<Directory <%= repodir %>> +<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 index 48385a47..3def84a0 100644 --- a/modules/buildsystem/templates/binrepo/wrapper.upload-bin +++ b/modules/buildsystem/templates/binrepo/wrapper.upload-bin @@ -1,8 +1,8 @@ #!/bin/sh -binrepouser="<%= login %>" -uploadbinpath="<%= uploadbinpath %>" -packagerscommittersgroup="<%= packagers_committers_group %>" +binrepouser="<%= scope.lookupvar('buildsystem::var::binrepo::login') %>" +uploadbinpath="<%= scope.lookupvar('buildsystem::var::binrepo::uploadbinpath') %>" +packagerscommittersgroup="<%= scope.lookupvar('buildsystem::var::groups::packagers_committers') %>" function isingroup() { 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 index 338d66ba..fa0d08ca 100755 --- a/modules/buildsystem/templates/cleaner.rb +++ b/modules/buildsystem/templates/cleaner.rb @@ -1,114 +1,235 @@ #!/usr/bin/ruby def usage - puts "Usage: #{$0} [options]" - puts "Moves obsolete packages" - puts - puts "-h, --help show help" - puts "-m, --media <path> path to the binary media" - puts "-s, --src <path> path to the associated src media" - puts "-d, --destination <path> path to the old packages storage" + 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' -opts = GetoptLong.new( - [ '--help', '-h', GetoptLong::NO_ARGUMENT ], - [ '--archs', '-a', GetoptLong::REQUIRED_ARGUMENT ], - [ '--base', '-p', GetoptLong::REQUIRED_ARGUMENT ], - [ '--media', '-m', GetoptLong::REQUIRED_ARGUMENT ], - [ '--bmedia', '-b', GetoptLong::REQUIRED_ARGUMENT ], - [ '--smedia', '-s', GetoptLong::REQUIRED_ARGUMENT ], - [ '--destination', '-d', GetoptLong::REQUIRED_ARGUMENT ], - [ '--version', '-v', GetoptLong::REQUIRED_ARGUMENT ] -) - -base_path = "<%= repository_root %>/distrib" -archs = [ "i586", "x86_64" ] -media = "core/release" -old_path = "<%= packages_archivedir %>" -version = "cauldron" - -opts.each do |opt, arg| - case opt - when '--help' - usage - exit 0 - when '--bmedia' - bin_path = arg.split(",") - when '--smedia' - src_path = arg - when '--destination' - old_path = arg - when '--media' - media = arg - when '--archs' - archs = arg.split(",") - when '--base' - base_path = arg - when '--version' - version = arg - end -end +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 -bin_path ||= archs.map{|arch| "#{base_path}/#{version}/#{arch}/media/#{media}" } -src_path ||= "#{base_path}/#{version}/SRPMS/#{media}" -debug_path = bin_path.map{|path| path.sub("/media/", "/media/debug/")} + medias.each{|media| + src_path = "#{base_path}/#{version}/SRPMS/#{media}" -$used_srcs = {} -$srcs = {} + $used_srcs = {} + $old_srcs = {} + $srcs = {} + $srcages = {} + $noarch = {} -# Get a list of all src.rpm + # 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)} -`urpmf --synthesis "#{src_path}/media_info/synthesis.hdlist.cz" --qf '%filename' "."`.each_line{|l| - $srcs[l.rstrip] = true -} + 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 move_packages(src, dst, list) - 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]? ') - if (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 +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 check_binaries(path_list, old_path, mark_used) - path_list.each{|bm| - old_binaries = [] - `urpmf --synthesis "#{bm}/media_info/synthesis.hdlist.cz" --qf '%sourcerpm:%filename' ":"`.each_line{|l| - l2 = l.split(':') - src = l2[0] - filename = l2[1].rstrip - old_binaries << filename unless $srcs[src] - $used_srcs[src] = true if mark_used - } - move_packages(bm, old_path, old_binaries) - } +def name_from_filename(filename) + filename.sub(/-[^-]*-[^-]*$/, '') end -check_binaries(bin_path, old_path, true) -check_binaries(debug_path, old_path, false) +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 -$used_srcs.keys.each{|s| $srcs.delete(s)} +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 -move_packages(src_path, old_path, $srcs.keys) +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.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/iurt/1.conf b/modules/buildsystem/templates/iurt/1.conf deleted file mode 100644 index a37f336c..00000000 --- a/modules/buildsystem/templates/iurt/1.conf +++ /dev/null @@ -1,23 +0,0 @@ -{ - supported_arch => [ 'i586', 'x86_64' ], - all_media => { 'core' => [ 'release' ], 'nonfree' => [ 'release' ], 'tainted' => [ 'release' ] }, - base_media => [ 'core/release' ], - upload => '<%= build_login %>@pkgsubmit:~/uploads/', - upload_queue => '<%= build_login %>@pkgsubmit:~/uploads/queue/', - unwanted_packages => '^monotone-', - repository => 'http://repository.<%= domain %>/distrib/', - log_url => 'http://pkgsubmit.<%= domain %>/queue/build/', - admin => 'mageia-sysadm@mageia.org', - 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, - 'libreoffice' => 345600 - }, -} - diff --git a/modules/buildsystem/templates/iurt/2.conf b/modules/buildsystem/templates/iurt/2.conf deleted file mode 100644 index a37f336c..00000000 --- a/modules/buildsystem/templates/iurt/2.conf +++ /dev/null @@ -1,23 +0,0 @@ -{ - supported_arch => [ 'i586', 'x86_64' ], - all_media => { 'core' => [ 'release' ], 'nonfree' => [ 'release' ], 'tainted' => [ 'release' ] }, - base_media => [ 'core/release' ], - upload => '<%= build_login %>@pkgsubmit:~/uploads/', - upload_queue => '<%= build_login %>@pkgsubmit:~/uploads/queue/', - unwanted_packages => '^monotone-', - repository => 'http://repository.<%= domain %>/distrib/', - log_url => 'http://pkgsubmit.<%= domain %>/queue/build/', - admin => 'mageia-sysadm@mageia.org', - 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, - 'libreoffice' => 345600 - }, -} - diff --git a/modules/buildsystem/templates/iurt/cauldron.conf b/modules/buildsystem/templates/iurt/cauldron.conf deleted file mode 100644 index a37f336c..00000000 --- a/modules/buildsystem/templates/iurt/cauldron.conf +++ /dev/null @@ -1,23 +0,0 @@ -{ - supported_arch => [ 'i586', 'x86_64' ], - all_media => { 'core' => [ 'release' ], 'nonfree' => [ 'release' ], 'tainted' => [ 'release' ] }, - base_media => [ 'core/release' ], - upload => '<%= build_login %>@pkgsubmit:~/uploads/', - upload_queue => '<%= build_login %>@pkgsubmit:~/uploads/queue/', - unwanted_packages => '^monotone-', - repository => 'http://repository.<%= domain %>/distrib/', - log_url => 'http://pkgsubmit.<%= domain %>/queue/build/', - admin => 'mageia-sysadm@mageia.org', - 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, - 'libreoffice' => 345600 - }, -} - diff --git a/modules/buildsystem/templates/iurt/infra_1.conf b/modules/buildsystem/templates/iurt/infra_1.conf deleted file mode 100644 index 5f41e9f2..00000000 --- a/modules/buildsystem/templates/iurt/infra_1.conf +++ /dev/null @@ -1,13 +0,0 @@ -{ - supported_arch => [ 'i586', 'x86_64' ], - all_media => { 'infra' => [ 'release' ] }, - base_media => [ 'base/core/release' ], - upload => '<%= build_login %>@pkgsubmit:~/uploads/', - upload_queue => '<%= build_login %>@pkgsubmit:~/uploads/queue/', - repository => 'http://repository.<%= domain %>/distrib/', - log_url => 'http://pkgsubmit.<%= domain %>/queue/build/', - admin => 'mageia-sysadm@mageia.org', - packager => 'Iurt the rebuild bot <mageia-sysadm@mageia.org>', - sendmail => 0, -} - diff --git a/modules/buildsystem/templates/iurt/infra_2.conf b/modules/buildsystem/templates/iurt/infra_2.conf deleted file mode 100644 index 5f41e9f2..00000000 --- a/modules/buildsystem/templates/iurt/infra_2.conf +++ /dev/null @@ -1,13 +0,0 @@ -{ - supported_arch => [ 'i586', 'x86_64' ], - all_media => { 'infra' => [ 'release' ] }, - base_media => [ 'base/core/release' ], - upload => '<%= build_login %>@pkgsubmit:~/uploads/', - upload_queue => '<%= build_login %>@pkgsubmit:~/uploads/queue/', - repository => 'http://repository.<%= domain %>/distrib/', - log_url => 'http://pkgsubmit.<%= domain %>/queue/build/', - admin => 'mageia-sysadm@mageia.org', - packager => 'Iurt the rebuild bot <mageia-sysadm@mageia.org>', - sendmail => 0, -} - diff --git a/modules/buildsystem/templates/iurt/mandriva2010.1.conf b/modules/buildsystem/templates/iurt/mandriva2010.1.conf deleted file mode 100644 index 124625f6..00000000 --- a/modules/buildsystem/templates/iurt/mandriva2010.1.conf +++ /dev/null @@ -1,23 +0,0 @@ -{ - supported_arch => [ 'i586', 'x86_64' ], - all_media => { 'main' => [ 'release' ], 'contrib' => [ 'release' ] }, - base_media => [ 'main/release' ], - upload => '<%= build_login %>@pkgsubmit:~/uploads/', - upload_queue => '<%= build_login %>@pkgsubmit:~/uploads/queue/', - unwanted_packages => '^monotone-', - repository => 'http://repository.<%= domain %>/mandriva/', - rsync_to => '<%= build_login %>@pkgsubmit:/mnt/BIG/dis/uploads/build/', - log_url => 'http://pkgsubmit.<%= domain %>/queue/build/', - admin => 'mageia-sysadm@mageia.org', - 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 - }, -} - diff --git a/modules/buildsystem/templates/iurt/sudoers.iurt b/modules/buildsystem/templates/iurt/sudoers.iurt deleted file mode 100644 index 408aa92c..00000000 --- a/modules/buildsystem/templates/iurt/sudoers.iurt +++ /dev/null @@ -1 +0,0 @@ -<%= login %> ALL = NOPASSWD: /usr/sbin/iurt_root_command diff --git a/modules/buildsystem/templates/iurt2010.1 b/modules/buildsystem/templates/iurt2010.1 deleted file mode 100755 index 44633e9b..00000000 --- a/modules/buildsystem/templates/iurt2010.1 +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -if [ `whoami` != <%= build_login %> ] -then - echo 'this script should be run as <%= build_login %>' >&2 - exit 1 -fi -ARCH=$(rpm --eval %_target_cpu) -iurt --chrooted-urpmi -m contrib/release main/release ../../../2010.1-mgaserv/$ARCH -- http://repository.<%= domain %>/mandriva/ -r mandriva2010.1 $ARCH $@ diff --git a/modules/buildsystem/templates/maintdb/maintdb.bin b/modules/buildsystem/templates/maintdb/maintdb.bin index b0cfb1ef..903ee009 100755 --- a/modules/buildsystem/templates/maintdb/maintdb.bin +++ b/modules/buildsystem/templates/maintdb/maintdb.bin @@ -1,30 +1,28 @@ -#!/bin/sh +#!/bin/bash -MAINTDBDIR="<%= dbdir %>" +MAINTDBDIR="<%= scope.lookupvar('buildsystem::var::maintdb::dbdir') %>" function checkname() { if [ -z "$1" ] || - echo "$1" | grep -q '[/*{}%]' || - echo "$1" | fgrep -q '..' + echo "$1" | grep -q '[/*{}%]' || + echo "$1" | fgrep -q '..' then - echo "Error: invalid package name." >&2 - exit 1 + echo "Error: invalid package name." >&2 + exit 1 fi } function maintnew() { - if [ a"$user" != "aroot" ] - then - echo "Error: new is only allowed to root." >&2 - exit 1 + 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 + if [ -f "$maintfile" ]; then + exit 0 fi echo "$2" > "$maintfile" } @@ -34,79 +32,67 @@ 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 + if [ ! -f "$maintfile" ]; then + echo "Error: package $1 does not exist in maintdb." >&2 + exit 1 fi curmaint=$(cat "$maintfile") - if [ a"$newmaint" = "anobody" ] - then - if [ a"$curmaint" = a"$user" ] - then - echo "$newmaint" > "$maintfile" - exit 0 - else - echo "Error: cannot set maintainer for $1." >&2 - exit 1 - fi - elif [ a"$newmaint" = a"$user" ] - then - if [ a"$curmaint" = "anobody" ] - then - echo "$newmaint" > "$maintfile" - exit 0 - else - echo "Error: cannot set maintainer for $1." >&2 - exit 1 - fi + 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 + echo "Error: cannot set someone else as maintainer." >&2 + exit 1 fi } function maintgetall() { cd "$MAINTDBDIR" - for file in * - do - echo "$file $(cat $file)" + for file in *; do + echo "$file $(cat $file)" done exit 0 } function maintget() { - if [ -z "$1" ] - then - maintgetall + if [ -z "$1" ]; then + maintgetall fi checkname "$1" maintfile="$MAINTDBDIR/$1" - if [ -f "$maintfile" ] - then - cat "$maintfile" + if [ -f "$maintfile" ]; then + cat "$maintfile" else - echo "Error: package $1 does not exist in maintdb." >&2 - exit 1 + echo "Error: package $1 does not exist in maintdb." >&2 + exit 1 fi } user="$1" action="$2" -if [ a"$action" = "anew" ] -then +if [ "$action" = "new" ]; then maintnew "$3" "$4" -elif [ a"$action" = "aset" ] -then +elif [ "$action" = "set" ]; then maintset "$3" "$4" -elif [ a"$action" = "aget" ] -then +elif [ "$action" = "get" ]; then maintget "$3" else - echo "Error: unknow command." >&2 + echo "Error: unknown command." >&2 exit 2 fi - diff --git a/modules/buildsystem/templates/maintdb/sudoers.maintdb b/modules/buildsystem/templates/maintdb/sudoers.maintdb index 8dd19c42..91c88e47 100644 --- a/modules/buildsystem/templates/maintdb/sudoers.maintdb +++ b/modules/buildsystem/templates/maintdb/sudoers.maintdb @@ -1,2 +1,4 @@ -%<%= scope.lookupvar('buildsystem::base::packagers_group') %> ALL =(<%= login %>) NOPASSWD: <%= binpath %> -<%= scope.lookupvar('buildsystem::base::sched_login') %> ALL =(<%= login %>) NOPASSWD: <%= binpath %> +%<%= 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 index 225c7215..146413a7 100644 --- a/modules/buildsystem/templates/maintdb/vhost_maintdb.conf +++ b/modules/buildsystem/templates/maintdb/vhost_maintdb.conf @@ -1,3 +1,3 @@ -<Directory <%= dbdir %>> +<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 index 8420022d..fcf69dab 100644 --- a/modules/buildsystem/templates/maintdb/wrapper.maintdb +++ b/modules/buildsystem/templates/maintdb/wrapper.maintdb @@ -1,8 +1,8 @@ #!/bin/sh -maintdbuser="<%= login %>" -maintdbpath="<%= binpath %>" -packagersgroup="<%= scope.lookupvar('buildsystem::base::packagers_group') %>" +maintdbuser="<%= scope.lookupvar('buildsystem::var::maintdb::login') %>" +maintdbpath="<%= scope.lookupvar('buildsystem::var::maintdb::binpath') %>" +packagersgroup="<%= scope.lookupvar('buildsystem::var::groups::packagers') %>" function isingroup() { @@ -22,5 +22,4 @@ then exit 1 fi -sudo -u "$maintdbuser" "$maintdbpath" $(whoami) $@ - +sudo -u "$maintdbuser" "$maintdbpath" $(whoami) "$@" diff --git a/modules/buildsystem/templates/media.cfg b/modules/buildsystem/templates/media.cfg index e0470733..64757a2b 100644 --- a/modules/buildsystem/templates/media.cfg +++ b/modules/buildsystem/templates/media.cfg @@ -1,395 +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] -<% - if @distro == 'cauldron' -%>version=3<% - else -%>version=<%= @distro %><% end %> +version=<%= distro['version'] %> mediacfg_version=2 -<% - if @distro == 'cauldron' -%>branch=Devel<% - else -%>branch=Official<% - end -%> +branch=<%= distro['branch'] %> +<%- +if @arch != 'armv7hl' +-%> arch=<%= @arch %> +<%- +end +-%> xml-info=1 -[core/release] -hdlist=hdlist_core_release.cz -name=Core Release -srpms=../../SRPMS/core/release -media_type=official:free:release - -[debug/core/release] -hdlist=hdlist_debug_core_release.cz -name=Core Release Debug -srpms=../../SRPMS/debug/core/release -media_type=official:free:release:debug -noauto=1 - -[../../SRPMS/core/release] -hdlist=hdlist_core_release.src.cz -name=Core Release Sources -rpms=core/release -media_type=official:free:release:source -noauto=1 - -[core/updates] -hdlist=hdlist_core_updates.cz -name=Core Updates -srpms=../../SRPMS/core/updates -media_type=official:free:updates -updates_for=core/release - -[debug/core/updates] -hdlist=hdlist_debug_core_updates.cz -name=Core Updates Debug -srpms=../../SRPMS/debug/core/updates -media_type=official:free:updates:debug -noauto=1 - -[../../SRPMS/core/updates] -hdlist=hdlist_core_updates.src.cz -name=Core Updates Sources -rpms=core/updates -media_type=official:free:updates:source -noauto=1 - -[core/updates_testing] -hdlist=hdlist_core_updates_testing.cz -name=Core Updates Testing -srpms=../../SRPMS/core/updates_testing -media_type=official:free:testing -noauto=1 - -[debug/core/updates_testing] -hdlist=hdlist_debug_core_updates_testing.cz -name=Core Updates Testing Debug -srpms=../../SRPMS/debug/core/updates_testing -media_type=official:free:testing:debug -noauto=1 - -[../../SRPMS/core/updates_testing] -hdlist=hdlist_core_updates_testing.src.cz -name=Core Updates Testing Sources -rpms=core/updates_testing -media_type=official:free:testing:source -noauto=1 - -[core/backports] -hdlist=hdlist_core_backports.cz -name=Core Backports -srpms=../../SRPMS/core/backports -media_type=official:free:backports -noauto=1 - -[debug/core/backports] -hdlist=hdlist_debug_core_backports.cz -name=Core Backports Debug -srpms=../../SRPMS/debug/core/backports -media_type=official:free:backports:debug -noauto=1 - -[../../SRPMS/core/backports] -hdlist=hdlist_core_backports.src.cz -name=Core Backports Sources -rpms=core/backports -media_type=official:free:backports:source -noauto=1 - -[core/backports_testing] -hdlist=hdlist_core_backports_testing.cz -name=Core Backports Testing -srpms=../../SRPMS/core/backports_testing -media_type=official:free:backports:testing -noauto=1 - -[debug/core/backports_testing] -hdlist=hdlist_debug_core_backports_testing.cz -name=Core Backports Testing Debug -srpms=../../SRPMS/debug/core/backports_testing -media_type=official:free:backports:testing:debug -noauto=1 - -[../../SRPMS/core/backports_testing] -hdlist=hdlist_core_backports_testing.src.cz -name=Core Backports Testing Sources -rpms=core/backports_testing -media_type=official:free:backports:testing:source -noauto=1 - -[nonfree/release] -hdlist=hdlist_nonfree_release.cz -name=Nonfree Release -srpms=../../SRPMS/nonfree/release -media_type=official:release -noauto=1 - -[debug/nonfree/release] -hdlist=hdlist_debug_nonfree_release.cz -name=Nonfree Release Debug -srpms=../../SRPMS/debug/nonfree/release -media_type=official:release:debug -noauto=1 - -[../../SRPMS/nonfree/release] -hdlist=hdlist_nonfree_release.src.cz -name=Nonfree Release Sources -rpms=nonfree/release -media_type=official:release:source -noauto=1 - -[nonfree/updates] -hdlist=hdlist_nonfree_updates.cz -name=Nonfree Updates -srpms=../../SRPMS/nonfree/updates -media_type=official:updates -updates_for=nonfree/release -noauto=1 - -[debug/nonfree/updates] -hdlist=hdlist_debug_nonfree_updates.cz -name=Nonfree Updates Debug -srpms=../../SRPMS/debug/nonfree/updates -media_type=official:updates:debug -noauto=1 - -[../../SRPMS/nonfree/updates] -hdlist=hdlist_nonfree_updates.src.cz -name=Nonfree Updates Sources -rpms=nonfree/updates -media_type=official:updates:source -noauto=1 - -[nonfree/updates_testing] -hdlist=hdlist_nonfree_updates_testing.cz -name=Nonfree Updates Testing -srpms=../../SRPMS/nonfree/updates_testing -media_type=official:testing -noauto=1 - -[debug/nonfree/updates_testing] -hdlist=hdlist_debug_nonfree_updates_testing.cz -name=Nonfree Updates Testing Debug -srpms=../../SRPMS/debug/nonfree/updates_testing -media_type=official:testing:debug -noauto=1 - -[../../SRPMS/nonfree/updates_testing] -hdlist=hdlist_nonfree_updates_testing.src.cz -name=Nonfree Updates Testing Sources -rpms=nonfree/updates_testing -media_type=official:testing:source -noauto=1 - -[nonfree/backports] -hdlist=hdlist_nonfree_backports.cz -name=Nonfree Backports -srpms=../../SRPMS/nonfree/backports -media_type=official:backports -noauto=1 - -[debug/nonfree/backports] -hdlist=hdlist_debug_nonfree_backports.cz -name=Nonfree Backports Debug -srpms=../../SRPMS/debug/nonfree/backports -media_type=official:backports:debug -noauto=1 - -[../../SRPMS/nonfree/backports] -hdlist=hdlist_nonfree_backports.src.cz -name=Nonfree Backports Sources -rpms=nonfree/backports -media_type=official:backports:source -noauto=1 - -[nonfree/backports_testing] -hdlist=hdlist_nonfree_backports_testing.cz -name=Nonfree Backports Testing -srpms=../../SRPMS/nonfree/backports_testing -media_type=official:backports:testing -noauto=1 - -[debug/nonfree/backports_testing] -hdlist=hdlist_debug_nonfree_backports_testing.cz -name=Nonfree Backports Testing Debug -srpms=../../SRPMS/debug/nonfree/backports_testing -media_type=official:backports:testing:debug -noauto=1 - -[../../SRPMS/nonfree/backports_testing] -hdlist=hdlist_nonfree_backports_testing.src.cz -name=Nonfree Backports Testing Sources -rpms=nonfree/backports_testing -media_type=official:backports:testing:source -noauto=1 - -[tainted/release] -hdlist=hdlist_tainted_release.cz -name=Tainted Release -srpms=../../SRPMS/tainted/release -media_type=official:release -noauto=1 - -[debug/tainted/release] -hdlist=hdlist_debug_tainted_release.cz -name=Tainted Release Debug -srpms=../../SRPMS/debug/tainted/release -media_type=official:release:debug -noauto=1 - -[../../SRPMS/tainted/release] -hdlist=hdlist_tainted_release.src.cz -name=Tainted Release Sources -rpms=tainted/release -media_type=official:release:source -noauto=1 - -[tainted/updates] -hdlist=hdlist_tainted_updates.cz -name=Tainted Updates -srpms=../../SRPMS/tainted/updates -media_type=official:updates -updates_for=tainted/release -noauto=1 - -[debug/tainted/updates] -hdlist=hdlist_debug_tainted_updates.cz -name=Tainted Updates Debug -srpms=../../SRPMS/debug/tainted/updates -media_type=official:updates:debug -noauto=1 - -[../../SRPMS/tainted/updates] -hdlist=hdlist_tainted_updates.src.cz -name=Tainted Updates Sources -rpms=tainted/updates -media_type=official:updates:source -noauto=1 - -[tainted/updates_testing] -hdlist=hdlist_tainted_updates_testing.cz -name=Tainted Updates Testing -srpms=../../SRPMS/tainted/updates_testing -media_type=official:testing -noauto=1 - -[debug/tainted/updates_testing] -hdlist=hdlist_debug_tainted_updates_testing.cz -name=Tainted Updates Testing Debug -srpms=../../SRPMS/debug/tainted/updates_testing -media_type=official:testing:debug -noauto=1 - -[../../SRPMS/tainted/updates_testing] -hdlist=hdlist_tainted_updates_testing.src.cz -name=Tainted Updates Testing Sources -rpms=tainted/updates_testing -media_type=official:testing:source -noauto=1 - -[tainted/backports] -hdlist=hdlist_tainted_backports.cz -name=Tainted Backports -srpms=../../SRPMS/tainted/backports -media_type=official:backports -noauto=1 - -[debug/tainted/backports] -hdlist=hdlist_debug_tainted_backports.cz -name=Tainted Backports Debug -srpms=../../SRPMS/debug/tainted/backports -media_type=official:backports:debug -noauto=1 - -[../../SRPMS/tainted/backports] -hdlist=hdlist_tainted_backports.src.cz -name=Tainted Backports Sources -rpms=tainted/backports -media_type=official:backports:source -noauto=1 - -[tainted/backports_testing] -hdlist=hdlist_tainted_backports_testing.cz -name=Tainted Backports Testing -srpms=../../SRPMS/tainted/backports_testing -media_type=official:backports:testing -noauto=1 - -[debug/tainted/backports_testing] -hdlist=hdlist_debug_tainted_backports_testing.cz -name=Tainted Backports Testing Debug -srpms=../../SRPMS/debug/tainted/backports_testing -media_type=official:backports:testing:debug -noauto=1 - -[../../SRPMS/tainted/backports_testing] -hdlist=hdlist_tainted_backports_testing.src.cz -name=Tainted Backports Testing Sources -rpms=tainted/backports_testing -media_type=official:backports:testing:source -noauto=1 - -<% - if arch == 'x86_64' -%>[../../i586/media/core/release] -hdlist=hdlist_core32_release.cz -name=Core 32bit Release -media_type=official:free:release - -[../../i586/media/debug/core/release] -hdlist=hdlist_debug_core32_release.cz -name=Core 32bit Release Debug -media_type=official:free:release:debug -noauto=1 - -[../../i586/media/core/updates] -hdlist=hdlist_core32_updates.cz -name=Core 32bit Updates -media_type=official:free:updates -updates_for=../../i586/media/core/release - -[../../i586/media/debug/core/updates] -hdlist=hdlist_debug_core32_updates.cz -name=Core 32bit Updates Debug -media_type=official:free:updates:debug -noauto=1 - -[../../i586/media/core/updates_testing] -hdlist=hdlist_core32_updates_testing.cz -name=Core 32bit Updates Testing -media_type=official:free:testing -noauto=1 - -[../../i586/media/debug/core/updates_testing] -hdlist=hdlist_debug_core32_updates_testing.cz -name=Core 32bit Updates Testing Debug -media_type=official:free:testing:debug -noauto=1 - -[../../i586/media/core/backports] -hdlist=hdlist_core32_backports.cz -name=Core 32bit Backports -media_type=official:free:backports -noauto=1 - -[../../i586/media/debug/core/backports] -hdlist=hdlist_debug_core32_backports.cz -name=Core 32bit Backports Debug -media_type=official:free:backports:debug -noauto=1 - -[../../i586/media/core/backports_testing] -hdlist=hdlist_core32_backports_testing.cz -name=Core 32bit Backports Testing -media_type=official:free:backports:testing -noauto=1 - -[../../i586/media/debug/core/backports_testing] -hdlist=hdlist_debug_core32_backports_testing.cz -name=Core 32bit Backports Testing Debug -media_type=official:free:backports:testing:debug -noauto=1<% - end -%> +<%- +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/mgarepo.conf b/modules/buildsystem/templates/mgarepo.conf index 81c21d3b..fbe5109c 100644 --- a/modules/buildsystem/templates/mgarepo.conf +++ b/modules/buildsystem/templates/mgarepo.conf @@ -1,25 +1,27 @@ +<%- + default_distro = scope.lookupvar('buildsystem::var::distros::default_distro') + distros = scope.lookupvar('buildsystem::var::distros::distros') +-%> [global] verbose = no -default_parent = svn://svn.<%= domain %>/svn/packages/cauldron +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 -use-binaries-repository = yes -binaries-repository = svn://svn.<%= domain %>/svn/binrepos -# ldap settings -# ldap is searched first: if not found, then [users] is read -# if ldap search matched, then [users] is not consulted -# if ldap is down, [users] is not consulted either -# -# we should have a generic fqdn here to use round-robin DNS -# enhancement for repsys: support multiple ldap servers here -ldap-server = ldap.<%= domain %> -ldap-base = ou=People,<%= dc_suffix %> -ldap-filterformat = (&(objectClass=inetOrgPerson)(uid=$username)) -ldap-resultformat = $cn <$mail> -trunk-dir = cauldron +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 = svn+ssh://svn.<%= domain %>/svn/packages/misc +oldurl = <%= scope.lookupvar('buildsystem::var::mgarepo::oldurl') %> # controls up to which revision the rpm changelog # will be constructed (default zero, i.e., oldest # commit) @@ -28,63 +30,46 @@ oldurl = svn+ssh://svn.<%= domain %>/svn/packages/misc ignore-string = SILENT [template] -path = /usr/share/repsys/default.chlog +path = /usr/share/mgarepo/default.chlog [users] iurt = Mageia build bot <mageia-sysadm@<%= domain %>> [submit] -default = cauldron -host = pkgsubmit.<%= domain %> - -[submit cauldron] -target = <%= sched_home_dir %>/repsys/srpms -allowed = svn://svn.<%= domain %>/svn/packages/cauldron -rpm-macros = global cauldron - -[submit 1] -target = <%= sched_home_dir %>/repsys/srpms -allowed = svn://svn.<%= domain %>/svn/packages/updates/1 -rpm-macros = global 1 - -[submit 2] +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 = svn://svn.<%= domain %>/svn/packages/updates/2 -rpm-macros = global 2 +allowed = <%= distro['submit_allowed'] %> <%= distro['backports_allowed'] %> +rpm-macros = global <%= d %> -[submit infra_1] -target = <%= sched_home_dir %>/repsys/srpms -allowed = svn://svn.mageia.org/svn/packages/ -rpm-macros = global 1 - -[submit infra_2] -target = <%= sched_home_dir %>/repsys/srpms -allowed = svn://svn.mageia.org/svn/packages/ -rpm-macros = global 2 +<%- + } +-%> [macros global] -distsuffix = .mga # 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} -distribution = Mageia -vendor = Mageia.Org -_real_vendor = mageia - -[macros cauldron] -distro_release = 3 -# 100 * major + minor -mgaversion = 300 -mageia_branch = cauldron - -[macros 1] -distro_release = 1 -# 100 * major + minor -mgaversion = 100 - -[macros 2] -distro_release = 2 -# 100 * major + minor -mgaversion = 200 +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 @@ -97,6 +82,7 @@ upload-bin = /usr/local/bin/wrapper.upload-bin run-prep = yes [binrepo] -download_url = http://binrepo.<%= domain %>/ -upload_host = binrepo.<%= domain %> +<%- 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 index a538fcde..14506a25 100644 --- a/modules/buildsystem/templates/repoctl.conf +++ b/modules/buildsystem/templates/repoctl.conf @@ -1,3 +1,21 @@ +<%- +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 @@ -7,14 +25,14 @@ else fi lockdir=/var/lib/repoctl/locks hdlistsdir=/var/lib/repoctl/hdlists -rootdir=/distrib/bootstrap -finalrootdir=/distrib/mirror -distribdir=$rootdir/distrib -finaldistribdir=$finalrootdir/distrib -distroreleases='<%= distroreleases.flatten.join(' ') -%>' -distrosections='<%= distrosections.flatten.join(' ') -%>' -sectionsrepos='<%= sectionsrepos.flatten.join(' ') -%>' -arches='<%= arches.flatten.join(' ') -%>' +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" diff --git a/modules/buildsystem/templates/signbot/mga-signpackage b/modules/buildsystem/templates/signbot/mga-signpackage deleted file mode 100755 index bd88efeb..00000000 --- a/modules/buildsystem/templates/signbot/mga-signpackage +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/perl -w - -use strict; -use warnings; -use RPM4::Sign; -use File::Spec; - -sub signpackage { - my ($file, $name, $path) = @_; - - # check if parent directory is writable - my $parent = (File::Spec->splitpath($file))[1]; - die "Unsignable package, parent directory is read-only" - unless -w $parent; - - my $sign = RPM4::Sign->new( - name => $name, - path => $path, - passphrase => '', - ); - - $sign->rpmssign($file) -} - -if (@ARGV != 3) { - exit 1; -} - -signpackage(@ARGV); -exit 0 - diff --git a/modules/buildsystem/templates/signbot/sign-check-package b/modules/buildsystem/templates/signbot/sign-check-package deleted file mode 100644 index fc9704fd..00000000 --- a/modules/buildsystem/templates/signbot/sign-check-package +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh - -if [ $# != 3 ] ; then - echo "missing arguments" - echo "usage : $0 file key_number key_directory" - exit 1 -fi - -file="$1" -key="$2" -keydir="$3" - -tmpdir=`mktemp -d ${TMPDIR:-/tmp}/signbot-XXXXX` -tmpfile="$tmpdir/$(basename $file)" -cp -pf "$file" "$tmpfile" -rpm --delsign "$tmpfile" -/usr/local/bin/mga-signpackage "$tmpfile" "$key" "$keydir" -nbtry=0 -while rpmsign -Kv "$tmpfile" 2>&1 | grep BAD -do - nbtry=$(($nbtry + 1)) - if [ $nbtry -ge 30 ] - then - exit 1 - fi - - # Archive failed file for further analysis - mkdir -p "/tmp/failed-sign/" - failedfile="/tmp/failed-sign/$(basename "$file").$(date +%Y%m%d%H%M%S)" - cp -pf "$file" "$failedfile" - - cp -pf "$file" "$tmpfile" - rpm --delsign "$tmpfile" - /usr/local/bin/mga-signpackage "$tmpfile" "$key" "$keydir" -done -mv -f "$tmpfile" "$file" -rmdir "$tmpdir" diff --git a/modules/buildsystem/templates/signbot/signbot-rpmmacros b/modules/buildsystem/templates/signbot/signbot-rpmmacros deleted file mode 100644 index aab7e389..00000000 --- a/modules/buildsystem/templates/signbot/signbot-rpmmacros +++ /dev/null @@ -1,3 +0,0 @@ -%__gpg_sign_cmd %{__gpg} \ - gpg --batch --force-v3-sigs --no-verbose --no-armor --passphrase-fd 3 --no-secmem-warning \ - -u "%{_gpg_name}" -sbo %{__signature_filename} %{__plaintext_filename} diff --git a/modules/buildsystem/templates/signbot/sudoers.signpackage b/modules/buildsystem/templates/signbot/sudoers.signpackage index 05653d30..4ea30238 100644 --- a/modules/buildsystem/templates/signbot/sudoers.signpackage +++ b/modules/buildsystem/templates/signbot/sudoers.signpackage @@ -1,2 +1,2 @@ -<%= sched_login %> ALL =(<%= login %>) NOPASSWD: /usr/local/bin/mga-signpackage -<%= sched_login %> ALL =(<%= login %>) NOPASSWD: /usr/local/bin/sign-check-package +<%= 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 index 2b0e966d..1fdf7749 100755 --- a/modules/buildsystem/templates/submit_package.pl +++ b/modules/buildsystem/templates/submit_package.pl @@ -2,8 +2,8 @@ use strict; use warnings; -my $svn_server = 'svn.<%= domain %>'; -my $packagersgroup="<%= scope.lookupvar('buildsystem::base::packagers_group') %>"; +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; diff --git a/modules/buildsystem/templates/sudoers.iurt b/modules/buildsystem/templates/sudoers.iurt new file mode 100644 index 00000000..21e81e87 --- /dev/null +++ b/modules/buildsystem/templates/sudoers.iurt @@ -0,0 +1 @@ +<%= 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 index f3fa35b0..3bc7cc2d 100644 --- a/modules/buildsystem/templates/sudoers.youri +++ b/modules/buildsystem/templates/sudoers.youri @@ -1,5 +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 -%mga-packagers ALL = (<%= sched_login %>) NOPASSWD: YOURI +%<%= scope.lookupvar('buildsystem::var::groups::packagers') -%> ALL = (<%= sched_login %>) NOPASSWD: YOURI diff --git a/modules/buildsystem/templates/sync2010.1 b/modules/buildsystem/templates/sync2010.1 deleted file mode 100644 index 5f8eeebf..00000000 --- a/modules/buildsystem/templates/sync2010.1 +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -if [ `whoami` != <%= sched_login %> ] -then - echo 'this script should be run as <%= sched_login %>' >&2 - exit 1 -fi - -cd /distrib/mandriva/2010.1-mgaserv || exit 1 -rsync -avH <%= build_login %>@jonund:/home/iurt/2010.1-SRPMS/ ./SRPMS - -for i in i586 x86_64; do - mkdir -p $i - cd $i - rsync -avH <%= build_login %>@jonund:/home/iurt/iurt/mandriva2010.1/$i/*.rpm . - ssh <%= build_login %>@jonund rm -f '/home/iurt/iurt/mandriva2010.1/$i/*.rpm' - genhdlist2 . - cd .. -done - diff --git a/modules/buildsystem/templates/upload.conf b/modules/buildsystem/templates/upload.conf index 0118ca7c..af610c92 100644 --- a/modules/buildsystem/templates/upload.conf +++ b/modules/buildsystem/templates/upload.conf @@ -7,12 +7,20 @@ # ### +<%- + build_nodes = scope.lookupvar('buildsystem::var::scheduler::build_nodes') +-%> my %nodes = ( - i586 => [ qw(jonund0 ecosse0 jonund1 ecosse1 ) ], - x86_64 => [ qw(ecosse0 jonund0 ecosse1 jonund1 ) ], +<%- + build_nodes.keys.sort.each{|arch| +-%> + <%= arch -%> => [ '<%= build_nodes[arch].join("', '") -%>' ], +<%- + } +-%> ); -my $repository = "http://repository.<%= domain %>/distrib/"; -my $homedir = "<%= homedir %>"; +my $repository = "http://<%= scope.lookupvar('buildsystem::var::repository::hostname') %>/<%= scope.lookupvar('buildsystem::var::repository::distribdir') %>/"; +my $homedir = "<%= scope.lookupvar('buildsystem::var::iurt::homedir') %>"; { bot => { @@ -23,7 +31,7 @@ my $homedir = "<%= homedir %>"; my $node = $_; ($node => { iurt => { - user => '<%= login %>', + 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__", @@ -35,39 +43,89 @@ my $homedir = "<%= homedir %>"; } keys %nodes), }, media => { - default => { - "infra/release" => [ "infra/release", "base/core/updates", "base/core/release" ], - "core/release" => [ "core/updates", "core/release" ], - "core/updates" => [ "core/updates", "core/release" ], - "core/updates_testing" => [ "core/updates_testing", "core/updates", "core/release" ], - "core/backports" => [ "core/backports", "core/updates_testing", "core/updates", "core/release" ], - "core/backports_testing" => [ "core/backports_testing", "core/backports", "core/updates_testing", "core/updates", "core/release" ], - "nonfree/release" => [ "core/release", "nonfree/release" ], - "nonfree/updates" => [ "core/updates", "core/release", "nonfree/release", "nonfree/updates" ], - "nonfree/updates_testing" => [ "core/updates", "core/release", "core/updates_testing", "nonfree/release", "nonfree/updates", "nonfree/updates_testing" ], - "nonfree/backports" => [ "core/backports", "core/updates_testing", "core/updates", "core/release", - "nonfree/release", "nonfree/updates", "nonfree/updates_testing", "nonfree/backports" ], - "nonfree/backports_testing" => [ "core/backports_testing", "core/backports", "core/updates_testing", "core/updates", "core/release", - "nonfree/release", "nonfree/updates", "nonfree/updates_testing", "nonfree/backports", "nonfree/backports_testing" ], - "tainted/release" => [ "core/release", "nonfree/release", "tainted/release" ], - "tainted/updates" => [ "core/release", "nonfree/release", "tainted/release", - "core/updates", "nonfree/updates", "tainted/updates" ], - "tainted/updates_testing" => [ "core/release", "nonfree/release", "tainted/release", - "core/updates", "nonfree/updates", "tainted/updates", - "core/updates_testing", "nonfree/updates_testing", "tainted/updates_testing" ], - "tainted/backports" => [ "core/release", "nonfree/release", "tainted/release", - "core/updates", "nonfree/updates", "tainted/updates", - "core/updates_testing", "nonfree/updates_testing", "tainted/updates_testing", - "core/backports", "nonfree/backports", "tainted/backports" ], - "tainted/backports_testing" => [ "core/release", "nonfree/release", "tainted/release", - "core/updates", "nonfree/updates", "tainted/updates", - "core/updates_testing", "nonfree/updates_testing", "tainted/updates_testing", - "core/backports", "nonfree/backports", "tainted/backports", - "core/backports_testing", "nonfree/backports_testing", "tainted/backports_testing" ], - }, + <%- + 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 => 'mageia-sysadm@mageia.org', - http_queue => 'http://pkgsubmit.<%= domain %>/uploads', - upload_user => '<%= sched_login %>', + 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_pkgsubmit.conf b/modules/buildsystem/templates/vhost_pkgsubmit.conf deleted file mode 100644 index af8bb70c..00000000 --- a/modules/buildsystem/templates/vhost_pkgsubmit.conf +++ /dev/null @@ -1,4 +0,0 @@ -<Location /uploads> - Allow from all - Options Indexes -</Location> diff --git a/modules/buildsystem/templates/vhost_repository.conf b/modules/buildsystem/templates/vhost_repository.conf index 176b7f39..e082ffca 100644 --- a/modules/buildsystem/templates/vhost_repository.conf +++ b/modules/buildsystem/templates/vhost_repository.conf @@ -1,61 +1,73 @@ -<% -# FIXME: add a reverse lookup for IPv6 adresses -# allowed hosts are: valstar, ecosse, jonund -buildsystem_nodes = "2a02:2178:2:7::3/64 2a02:2178:2:7::4/64 2a02:2178:2:7::5/64" -%> - +<%- +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 repository.<%= domain %> + ServerName <%= scope.lookupvar('buildsystem::var::repository::hostname') %> DocumentRoot <%= mirror_root %> - Alias /distrib/infra_1/ "/distrib/bootstrap/distrib/infra_1/" - Alias /distrib/infra_2/ "/distrib/bootstrap/distrib/infra_2/" - Alias /mandriva/ "/distrib/mandriva/" - Alias /mageiatools/ "/distrib/mageiatools/" - <Directory <%= mirror_root %>> - Order deny,allow - Deny from all - Allow from localhost, 127.0.0.1 - Allow from <%= buildsystem_nodes %> - Allow from .<%= domain %> - Allow from 10.42.0 - # FIXME: add a reverse lookup for rabbit - Allow from 212.85.158.152 - Options Indexes FollowSymLinks - </Directory> + # Some simple API to check existence of SRPMs for QA + RewriteEngine On - <Directory /distrib/bootstrap/distrib/infra_1> - Header append Cache-Control "public, must-revalidate" - Order deny,allow - Allow from all - Options Indexes FollowSymLinks - </Directory> + 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] - <Directory /distrib/bootstrap/distrib/infra_2> - Header append Cache-Control "public, must-revalidate" - Order deny,allow - Allow from all - Options Indexes FollowSymLinks - </Directory> + RewriteRule ^/qa/checksrpm/ - [L,G] - <Directory /distrib/mandriva> - Order deny,allow - Deny from all - Allow from localhost, 127.0.0.1 - Allow from <%= buildsystem_nodes %> - Allow from .<%= domain %> - Options Indexes FollowSymLinks - </Directory> - - <Directory /distrib/mandriva/2010.1-mgaserv/> - Order deny,allow - Allow from all +<%- + 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 /distrib/mageiatools> - Order deny,allow - Allow from all + <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 index ada865f0..f0949f8a 100644 --- a/modules/buildsystem/templates/youri/acl.conf +++ b/modules/buildsystem/templates/youri/acl.conf @@ -1,5 +1 @@ .* .* .* ^glib$ ^blacklisted$ -.* .* .* ^cinnamon$ ^blacklisted$ -.* .* .* ^muffin$ ^blacklisted$ -.* .* .* ^nemo$ ^blacklisted$ -.* .* .* ^task-cinnamon$ ^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-todo.conf b/modules/buildsystem/templates/youri/submit-todo.conf deleted file mode 100644 index 2d5d18ff..00000000 --- a/modules/buildsystem/templates/youri/submit-todo.conf +++ /dev/null @@ -1,245 +0,0 @@ -<% -escaped_domain = domain.gsub('.','\.') -%> - -home: <%= sched_home_dir %> - -# repository declaration -repository: - class: Youri::Repository::Mageia - options: - install_root: <%= repository_root %>/distrib - upload_root: ${home}/uploads/ - upload_state: todo done queue - queue: todo - noarch: i586 - svn: svn+ssh://svn.<%= domain %>/svn/packages/cauldron/ - 2: - arch: i586 x86_64 - 1: - arch: i586 x86_64 - infra_1: - arch: i586 x86_64 - infra_2: - arch: i586 x86_64 - cauldron: - arch: i586 x86_64 - -# targets definition -targets: - cauldron: - checks: - - source - - deps - - version - #- svn - - tag - - acl - - host - #- section - - rpmlint - - recency - #- history - - queue_recency - actions: - - send - - rpminfo - - ulri - - 1: - checks: - - source - - version - #- svn - - tag - - acl - - host - #- section - - rpmlint - - recency - #- history - - queue_recency - actions: - - send - - rpminfo - - ulri - - 2: - checks: - - source - - version - #- svn - - tag - - acl - - host - #- section - - rpmlint - - recency - #- history - - queue_recency - actions: - - send - - rpminfo - - ulri - - infra_1: - checks: - - source - - version - - tag - - acl - - rpmlint - - recency - - queue_recency - actions: - - send - - rpminfo - - ulri - - infra_2: - checks: - - source - - version - - tag - - acl - - rpmlint - - recency - - queue_recency - actions: - - send - - rpminfo - - ulri - -# checks definition -checks: - tag: - class: Youri::Submit::Check::Tag - options: - tags: - release: 'mga\d+' - # packager: '<\S+@<%= escaped_domain %>>$' - distribution: '^Mageia' - vendor: '^Mageia.Org$' - - recency: - class: Youri::Submit::Check::Recency - - queue_recency: - class: Youri::Submit::Check::Queue_recency - - host: - class: Youri::Submit::Check::Host - options: - host_file: /etc/youri/host.conf - - section: - class: Youri::Submit::Check::Section - - rpmlint: - class: Youri::Submit::Check::Rpmlint - options: - config: /etc/rpmlint/config - results: - - buildprereq-use - - no-description-tag - - no-summary-tag - - non-standard-group - - non-xdg-migrated-menu - # it breaks dbus - #- patch-not-applied - - percent-in-conflicts - - percent-in-dependency - - percent-in-obsoletes - - percent-in-provides - - summary-ended-with-dot - - invalid-spec-name - - noarch-python-in-64bit-path - cauldron: - config: /usr/share/rpmlint/config - path: /usr/bin/rpmlint - 1: - config: /usr/share/rpmlint/config.mga2 - path: /usr/bin/mga2-rpmlint - 2: - config: /usr/share/rpmlint/config.mga2 - path: /usr/bin/mga2-rpmlint - infra_1: - config: /usr/share/rpmlint/config.mga2 - path: /usr/bin/mga2-rpmlint - infra_2: - config: /usr/share/rpmlint/config.mga2 - path: /usr/bin/mga2-rpmlint - svn: - class: Youri::Submit::Check::SVN - - acl: - class: Youri::Submit::Check::ACL - options: - acl_file: /etc/youri/acl.conf - - history: - class: Youri::Submit::Check::History - - source: - class: Youri::Submit::Check::Source - - precedence: - class: Youri::Submit::Check::Precedence - options: - target: cauldron - - version: - class: Youri::Submit::Check::Version - options: - 2: - authorized_packages: none_package_authorized - authorized_sections: ^(core|nonfree|tainted)/(updates_testing|backports_testing)$ - authorized_arches: none - mode: freeze - - 1: - authorized_packages: none_package_authorized - # authorized_sections: ^(core|nonfree|tainted)/(updates_testing|backports_testing)$ - authorized_arches: none - mode: freeze - - cauldron: - authorized_sections: ^[a-z]+/updates_testing$ - authorized_packages: ^$ - authorized_arches: none - authorized_users: ^<%= scope.function_group_members(['mga-release_managers']).join('|') %>$ - mode: normal -# mode: version_freeze -# mode: freeze - - deps: - class: Youri::Submit::Check::Deps - -# actions definitions -actions: - send: - class: Youri::Submit::Action::Send - options: - user: <%= sched_login %> - keep_svn_release: yes - uphost: pkgsubmit.<%= domain %> - root: ${home}/uploads - ssh_key: ${home}/.ssh/id_rsa - - rpminfo: - class: Youri::Submit::Action::Rpminfo - options: - user: <%= sched_login %> - uphost: pkgsubmit.<%= domain %> - root: ${home}/uploads - ssh_key: ${home}/.ssh/id_rsa - - ulri: - class: Youri::Submit::Action::Ulri - options: - user: <%= sched_login %> - uphost: pkgsubmit.<%= domain %> - ssh_key: ${home}/.ssh/id_rsa - logfile: /var/log/<%= sched_login %>/ulri.log - -# vim:ft=yaml:et:sw=4 diff --git a/modules/buildsystem/templates/youri/submit-upload.conf b/modules/buildsystem/templates/youri/submit-upload.conf deleted file mode 100644 index 879296cb..00000000 --- a/modules/buildsystem/templates/youri/submit-upload.conf +++ /dev/null @@ -1,403 +0,0 @@ -<% -Puppet::Parser::Functions.autoloader.loadall -escaped_domain = domain.gsub('.','\.') -%> - -home: <%= sched_home_dir %> - -# repository declaration -repository: - class: Youri::Repository::Mageia - options: - install_root: <%= repository_root %>/distrib - upload_root: ${home}/uploads/ - archive_root: <%= packages_archivedir %> - upload_state: queue - queue: queue - noarch: i586 - svn: svn+ssh://svn.<%= domain %>/svn/packages/cauldron/ - 2: - arch: i586 x86_64 - 1: - arch: i586 x86_64 - infra_1: - arch: i586 x86_64 - infra_2: - arch: i586 x86_64 - cauldron: - arch: i586 x86_64 - -# targets definition -targets: - cauldron: - checks: - - version - - tag - - acl - - rpmlint - - recency - actions: - - markrelease - - sign - - install - - link - - unpack_release_notes - - unpack_gfxboot_theme - - unpack_meta_task - - unpack_installer_images - - unpack_installer_images_nonfree - - unpack_installer_stage2 - - unpack_installer_advertising - - unpack_installer_rescue - - unpack_syslinux -# - dkms_module_info - - archive - - mail - - maintdb - posts: - - genhdlist2 - - clean_rpmsrate - - mirror - - 1: - checks: - - version - - tag - - acl - - rpmlint - - recency - actions: -# - markrelease - - sign - - install - - link -# - unpack_release_notes -# - unpack_gfxboot_theme -# - unpack_meta_task -# - unpack_installer_images -# - unpack_installer_stage2 -# - unpack_installer_advertising -# - unpack_installer_rescue -# - dkms_module_info - - archive - - mail -# - maintdb - posts: - - genhdlist2 - - clean_rpmsrate - - mirror - - 2: - checks: - - version - - tag - - acl - - rpmlint - - recency - actions: -# - markrelease - - sign - - install - - link -# - unpack_release_notes -# - unpack_gfxboot_theme -# - unpack_meta_task -# - unpack_installer_images -# - unpack_installer_stage2 -# - unpack_installer_advertising -# - unpack_installer_rescue -# - dkms_module_info - - archive - - mail -# - maintdb - posts: - - genhdlist2 - - clean_rpmsrate - - mirror - - infra_1: - checks: - - version - - tag - - acl - - rpmlint - - recency - actions: - - sign - - install - - link - - archive - posts: - - genhdlist2 - - infra_2: - checks: - - version - - tag - - acl - - rpmlint - - recency - actions: - - sign - - install - - link - - archive - posts: - - genhdlist2 - -# checks definition -checks: - tag: - class: Youri::Submit::Check::Tag - options: - tags: - release: 'mga\d+' - # packager: '<\S+@<%= escaped_domain %>>$' - distribution: '^Mageia' - vendor: '^Mageia.Org$' - - recency: - class: Youri::Submit::Check::Recency - - queue_recency: - class: Youri::Submit::Check::Queue_recency - - host: - class: Youri::Submit::Check::Host - options: - host_file: /etc/youri/host.conf - - section: - class: Youri::Submit::Check::Section - - rpmlint: - class: Youri::Submit::Check::Rpmlint - options: - results: - - buildprereq-use - - no-description-tag - - no-summary-tag - - non-standard-group - - non-xdg-migrated-menu - # it breaks dbus - #- patch-not-applied - - percent-in-conflicts - - percent-in-dependency - - percent-in-obsoletes - - percent-in-provides - - summary-ended-with-dot - - unexpanded-macro - - unknown-lsb-keyword - - malformed-line-in-lsb-comment-block - - empty-%postun - - empty-%post - - invalid-desktopfile - - standard-dir-owned-by-package - - use-tmp-in-%postun - - bogus-variable-use-in-%posttrans - - dir-or-file-in-usr-local - - dir-or-file-in-tmp - - dir-or-file-in-mnt - - dir-or-file-in-opt - - dir-or-file-in-home - - dir-or-file-in-var-local - cauldron: - config: /usr/share/rpmlint/config - path: /usr/bin/rpmlint - 1: - config: /usr/share/rpmlint/config.mga2 - path: /usr/bin/mga2-rpmlint - 2: - config: /usr/share/rpmlint/config.mga2 - path: /usr/bin/mga2-rpmlint - infra_1: - config: /usr/share/rpmlint/config.mga2 - path: /usr/bin/mga2-rpmlint - infra_2: - config: /usr/share/rpmlint/config.mga2 - path: /usr/bin/mga2-rpmlint - svn: - class: Youri::Submit::Check::SVN - - acl: - class: Youri::Submit::Check::ACL - options: - acl_file: /etc/youri/acl.conf - - history: - class: Youri::Submit::Check::History - - source: - class: Youri::Submit::Check::Source - - precedence: - class: Youri::Submit::Check::Precedence - options: - target: cauldron - - version: - class: Youri::Submit::Check::Version - options: - 2: - authorized_packages: none_package_authorized - authorized_sections: ^(debug/)?(core|nonfree|tainted)/(updates_testing|backports_testing)$ - authorized_arches: none - mode: freeze - - 1: - authorized_packages: none_package_authorized - # authorized_sections: ^(debug/)?(core|nonfree|tainted)/(updates_testing|backports_testing)$ - authorized_arches: none - mode: freeze - - infra_1: - authorized_users: ^<%= scope.function_group_members(['mga-sysadmin']).join('|') %>$ - mode: freeze - - infra_2: - authorized_users: ^<%= scope.function_group_members(['mga-sysadmin']).join('|') %>$ - mode: freeze - - cauldron: -# <mrl> Prior freeze - mode: normal -## <blino> Version freeze -# authorized_packages: ^$ -# authorized_sections: ^(debug/)?(core|nonfree|tainted)/updates_testing$ -# authorized_arches: ^$ -# authorized_users: ^blino|ennael|nvigier$ -# mode: version_freeze -# <mrl> Freeze config -# authorized_packages: ^mdkonline|drakxtools|urpmi|ia_ora-gnome|ldetect|ldetect-lst|rpm-mageia-setup|perl-MDK-Common$ -# authorized_packages: none_package_authorized -# authorized_sections: ^restricted/release|main/updates_testing|contrib/updates_testing$ -# authorized_arches: none -# authorized_users: ^blino|ennael|nvigier$ -# mode: freeze - -# actions definitions -actions: - install: - class: Youri::Submit::Action::Install - - markrelease: - class: Youri::Submit::Action::Markrelease - - link: - class: Youri::Submit::Action::Link - - archive: - class: Youri::Submit::Action::Archive - - clean: - class: Youri::Submit::Action::Clean - - sign: - class: Youri::Submit::Action::Sign - options: - signuser: <%= scope.lookupvar('buildsystem::signbot::login') %> - path: <%= scope.lookupvar('buildsystem::signbot::sign_keydir') %> - name: <%= scope.lookupvar('buildsystem::signbot::keyid') %> - signscript: /usr/local/bin/sign-check-package - - unpack_gfxboot_theme: - class: Youri::Submit::Action::Unpack - options: - name: mageia-gfxboot-theme - source_subdir: /usr/share/gfxboot/themes/Mageia/install/ - dest_directory: isolinux - unpack_inside_distribution_root: 1 - - unpack_meta_task: - class: Youri::Submit::Action::Unpack - options: - name: meta-task - source_subdir: /usr/share/meta-task - dest_directory: media/media_info - unpack_inside_distribution_root: 1 - - unpack_installer_images: - class: Youri::Submit::Action::Unpack - options: - name: drakx-installer-images - source_subdir: /usr/lib*/drakx-installer-images - dest_directory: . - preclean_directory: install/images/alternatives - unpack_inside_distribution_root: 1 - - unpack_installer_images_nonfree: - class: Youri::Submit::Action::Unpack - options: - name: drakx-installer-images-nonfree - source_subdir: /usr/lib*/drakx-installer-images - dest_directory: . - unpack_inside_distribution_root: 1 - - unpack_installer_stage2: - class: Youri::Submit::Action::Unpack - options: - name: drakx-installer-stage2 - source_subdir: /usr/lib*/drakx-installer-stage2 - dest_directory: . - unpack_inside_distribution_root: 1 - - unpack_installer_advertising: - class: Youri::Submit::Action::Unpack - options: - name: drakx-installer-advertising - source_subdir: /usr/share/drakx-installer-advertising - dest_directory: . - unpack_inside_distribution_root: 1 - - unpack_installer_rescue: - class: Youri::Submit::Action::Unpack - options: - name: drakx-installer-rescue - source_subdir: /usr/lib*/drakx-installer-rescue - dest_directory: install/stage2 - unpack_inside_distribution_root: 1 - - unpack_release_notes: - class: Youri::Submit::Action::Unpack - options: - name: mageia-release-common - source_subdir: /usr/share/doc/mageia-release-common - grep_files: release-notes.* - dest_directory: . - unpack_inside_distribution_root: 1 - - unpack_syslinux: - class: Youri::Submit::Action::Unpack - options: - name: syslinux - source_subdir: /usr/lib/syslinux/ - grep_files: hdt.c32 - dest_directory: isolinux - unpack_inside_distribution_root: 1 - - mail: - class: Youri::Submit::Action::Mail - options: - mta: /usr/sbin/sendmail - to: changelog@ml.<%= domain %> - reply_to: mageia-dev@<%= domain %> - from: buildsystem-daemon@<%= domain %> - prefix: RPM - - maintdb: - class: Youri::Submit::Action::UpdateMaintDb - options: - -posts: - genhdlist2: - class: Youri::Submit::Post::Genhdlist2 - options: - command: /usr/bin/genhdlist2 - clean_rpmsrate: - class: Youri::Submit::Post::CleanRpmsrate - mirror: - class: Youri::Submit::Post::Mirror - options: - destination: /distrib/mirror/distrib - -# vim:ft=yaml:et:sw=4 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 |
