aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Vigier <boklm@mageia.org>2013-05-23 15:06:43 +0000
committerNicolas Vigier <boklm@mageia.org>2013-05-23 15:06:43 +0000
commitd0430fa7a7a032d92ed00634f321ca0f0322bf8d (patch)
treeada0f0f9dafe0ae3f406f9ea64e1fe626c585976
parent4ff7fabb70a0b83e343ce444931e645bac22c7c1 (diff)
downloadpuppet-d0430fa7a7a032d92ed00634f321ca0f0322bf8d.tar
puppet-d0430fa7a7a032d92ed00634f321ca0f0322bf8d.tar.gz
puppet-d0430fa7a7a032d92ed00634f321ca0f0322bf8d.tar.bz2
puppet-d0430fa7a7a032d92ed00634f321ca0f0322bf8d.tar.xz
puppet-d0430fa7a7a032d92ed00634f321ca0f0322bf8d.zip
buildsystem: Change youri submit configuration
The youri submit configuration has been changed. The following two template files : - youri/submit-todo.conf - youri/submit-upload.conf have been replaced by a common template file for youri submit-todo and youri submit-upload : - youri/submit.conf This new template file does not contain any specific configuration. Instead the youri configuration is now created using informations from the following hash variables : - the $youri_conf_default hash from buildsystem::var::youri, containing default configuration for the repository, the checks, actions and posts. - the $youri_conf parameter from buildsystem::var::youri, overriding infos from the default configuration defined in $youri_conf_default. - the distros specific configuration is defined in the $distros parameter from buildsystem::var::distros. All those variables contain configuration for both youri submit-todo and youri submit-upload. This change allows moving all Mageia specific configuration outside the buildsystem module to the class mga_buildsystem::config, while still keeping common configuration in the buildsystem module. The following checks definitions have also been removed from youri submit-todo configuration, because they are not used in the current configuration : - history - precedence - section - svn The 'version' check options for infra_1 and infra_2 have been moved from youri submit-upload to submit-todo configuration.
-rw-r--r--deployment/mga_buildsystem/manifests/config.pp360
-rw-r--r--modules/buildsystem/manifests/var/distros.pp32
-rw-r--r--modules/buildsystem/manifests/var/scheduler.pp3
-rw-r--r--modules/buildsystem/manifests/var/youri.pp289
-rw-r--r--modules/buildsystem/manifests/youri_submit.pp11
-rw-r--r--modules/buildsystem/manifests/youri_submit_conf.pp6
-rw-r--r--modules/buildsystem/templates/youri/submit-todo.conf249
-rw-r--r--modules/buildsystem/templates/youri/submit-upload.conf448
-rw-r--r--modules/buildsystem/templates/youri/submit.conf140
9 files changed, 829 insertions, 709 deletions
diff --git a/deployment/mga_buildsystem/manifests/config.pp b/deployment/mga_buildsystem/manifests/config.pp
index 31cbe195..de81bb2c 100644
--- a/deployment/mga_buildsystem/manifests/config.pp
+++ b/deployment/mga_buildsystem/manifests/config.pp
@@ -18,10 +18,6 @@ class mga_buildsystem::config {
},
}
include buildsystem::var::repository
- class { 'buildsystem::var::youri':
- packages_archivedir => "${buildsystem::var::scheduler::homedir}/old",
- }
-
class { 'buildsystem::var::binrepo':
uploadmail_from => "root@${::domain}",
uploadmail_to => "packages-commits@ml.${::domain}",
@@ -118,6 +114,219 @@ class mga_buildsystem::config {
'10.42.0',
'212.85.158.152', #rabbit
]
+
+ # the list of checks, actions, posts for cauldron in youri-upload
+ $cauldron_youri_upload_targets = {
+ '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',
+ 'archive',
+ 'mail',
+ 'maintdb',
+ ],
+ 'posts' => [
+ 'genhdlist2',
+ 'clean_rpmsrate',
+ 'mirror',
+ ],
+ }
+
+ # the list of checks, actions, posts for stable distros in youri-upload
+ $std_youri_upload_targets = {
+ 'checks' => [
+ 'version',
+ 'tag',
+ 'acl',
+ 'rpmlint',
+ 'recency',
+ ],
+ 'actions' => [
+ 'sign',
+ 'install',
+ 'link',
+ 'archive',
+ 'mail',
+ ],
+ 'posts' => [
+ 'genhdlist2',
+ 'clean_rpmsrate',
+ 'mirror',
+ ],
+ }
+
+ # the list of checks, actions, posts for infra distros in youri-upload
+ $infra_youri_upload_targets = {
+ 'checks' => [
+ 'version',
+ 'tag',
+ 'acl',
+ 'rpmlint',
+ 'recency',
+ ],
+ 'actions' => [
+ 'sign',
+ 'install',
+ 'link',
+ 'archive',
+ ],
+ 'posts' => [
+ 'genhdlist2',
+ ],
+ }
+
+ # the list of checks, actions, posts for cauldron in youri-todo
+ $cauldron_youri_todo_targets = {
+ 'checks' => [
+ 'source',
+ 'deps',
+ 'version',
+ 'tag',
+ 'acl',
+ 'host',
+ 'rpmlint',
+ 'recency',
+ 'queue_recency',
+ ],
+ 'actions' => [
+ 'send',
+ 'rpminfo',
+ ],
+ }
+
+ # the list of checks, actions, posts for stable distros in youri-todo
+ $std_youri_todo_targets = {
+ 'checks' => [
+ 'source',
+ 'version',
+ 'tag',
+ 'acl',
+ 'host',
+ 'rpmlint',
+ 'recency',
+ 'queue_recency',
+ ],
+ 'actions' => [
+ 'send',
+ 'rpminfo',
+ 'ulri',
+ ],
+ }
+
+ # the list of checks, actions, posts for infra distros in youri-todo
+ $infra_youri_todo_targets = {
+ 'checks' => [
+ 'source',
+ 'version',
+ 'tag',
+ 'acl',
+ 'rpmlint',
+ 'recency',
+ 'queue_recency',
+ ],
+ 'actions' => [
+ 'send',
+ 'rpminfo',
+ 'ulri',
+ ],
+ }
+
+ # rpmlint check options for mageia <= 2
+ $mga2_rpmlint = {
+ 'config' => '/usr/share/rpmlint/config.mga2',
+ 'path' => '/usr/bin/mga2-rpmlint',
+ }
+
+ # rpmlint check options for cauldron
+ $cauldron_rpmlint = {
+ 'config' => '/usr/share/rpmlint/config',
+ 'path' => '/usr/bin/rpmlint',
+ 'results' => [
+ 'buildprereq-use',
+ 'no-description-tag',
+ 'no-summary-tag',
+ 'non-standard-group',
+ 'non-xdg-migrated-menu',
+ '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',
+ 'tmpfiles-conf-in-etc',
+ 'non-ghost-in-run',
+ 'non-ghost-in-var-run',
+ 'non-ghost-in-var-lock',
+ 'systemd-unit-in-etc',
+ 'udev-rule-in-etc',
+ ],
+ }
+
+ # list of users allowed to submit packages when cauldron is frozen
+ $cauldron_authorized_users = str_join(group_members('mga-release_managers'), '|')
+ $cauldron_version_check = {
+ 'authorized_sections' => '^[a-z]+/updates_testing$',
+ 'authorized_packages' => '^$',
+ 'authorized_arches' => 'none',
+ 'authorized_users' => "^${cauldron_authorized_users}\$",
+ #'mode' => 'normal',
+ 'mode' => 'version_freeze',
+ #'mode' => 'freeze',
+ }
+
+ # for EOL distributions
+ $frozen_version_check = {
+ 'authorized_packages' => 'none_package_authorized',
+ 'authorized_sections' => 'none_section_authorized',
+ 'authorized_arches' => 'none',
+ 'mode' => 'freeze',
+ }
+
+ # for supported stable distributions
+ $std_version_check = {
+ 'authorized_packages' => 'none_package_authorized',
+ 'authorized_sections' => '^(core|nonfree|tainted)/(updates_testing|backports_testing)$',
+ 'authorized_arches' => 'none',
+ 'mode' => 'freeze',
+ }
+
+ $infra_authorized_users = str_join(group_members('mga-sysadmin'), '|')
+ $infra_version_check = {
+ 'authorized_users' => "^${infra_authorized_users}\$",
+ 'mode' => 'freeze',
+ }
+
class { 'buildsystem::var::distros':
default_distro => 'cauldron',
distros => {
@@ -130,6 +339,21 @@ class mga_buildsystem::config {
'submit_allowed' => "${svn_root_packages}/cauldron",
'macros' => $std_macros,
'repo_allow_from' => $repo_allow_from,
+ 'youri' => {
+ 'upload' => {
+ 'targets' => $cauldron_youri_upload_targets,
+ 'checks' => {
+ 'rpmlint' => $cauldron_rpmlint,
+ },
+ },
+ 'todo' => {
+ 'targets' => $cauldron_youri_todo_targets,
+ 'checks' => {
+ 'rpmlint' => $cauldron_rpmlint,
+ 'version' => $cauldron_version_check,
+ },
+ },
+ },
},
'1' => {
@@ -141,6 +365,21 @@ class mga_buildsystem::config {
'submit_allowed' => "${svn_root_packages}/updates/1",
'macros' => $std_macros,
'repo_allow_from' => $repo_allow_from,
+ 'youri' => {
+ 'upload' => {
+ 'targets' => $std_youri_upload_targets,
+ 'checks' => {
+ 'rpmlint' => $mga2_rpmlint,
+ },
+ },
+ 'todo' => {
+ 'targets' => $std_youri_todo_targets,
+ 'checks' => {
+ 'rpmlint' => $mga2_rpmlint,
+ 'version' => $frozen_version_check,
+ },
+ },
+ },
},
'2' => {
@@ -152,6 +391,21 @@ class mga_buildsystem::config {
'submit_allowed' => "${svn_root_packages}/updates/2",
'macros' => $std_macros,
'repo_allow_from' => $repo_allow_from,
+ 'youri' => {
+ 'upload' => {
+ 'targets' => $std_youri_upload_targets,
+ 'checks' => {
+ 'rpmlint' => $mga2_rpmlint,
+ },
+ },
+ 'todo' => {
+ 'targets' => $std_youri_todo_targets,
+ 'checks' => {
+ 'rpmlint' => $mga2_rpmlint,
+ 'version' => $std_version_check,
+ },
+ },
+ },
},
'infra_1' => {
@@ -167,6 +421,21 @@ class mga_buildsystem::config {
'core' => [ 'release', 'updates' ],
},
},
+ 'youri' => {
+ 'upload' => {
+ 'targets' => $infra_youri_upload_targets,
+ 'checks' => {
+ 'rpmlint' => $mga2_rpmlint,
+ },
+ },
+ 'todo' => {
+ 'targets' => $infra_youri_todo_targets,
+ 'checks' => {
+ 'rpmlint' => $mga2_rpmlint,
+ 'version' => $infra_version_check,
+ },
+ },
+ },
},
'infra_2' => {
@@ -182,8 +451,89 @@ class mga_buildsystem::config {
'core' => [ 'release', 'updates' ],
},
},
+ 'youri' => {
+ 'upload' => {
+ 'targets' => $infra_youri_upload_targets,
+ 'checks' => {
+ 'rpmlint' => $mga2_rpmlint,
+ },
+ },
+ 'todo' => {
+ 'targets' => $infra_youri_todo_targets,
+ 'checks' => {
+ 'rpmlint' => $mga2_rpmlint,
+ 'version' => $infra_version_check,
+ },
+ },
+ },
+ },
+ }
+ }
+ $checks_tag_options = {
+ 'tags' => {
+ 'release' => inline_template("<%= std_macros['distsuffix'] %>\\d+"),
+ 'distribution' => inline_template("^<%= std_macros['distribution'] %>"),
+ 'vendor' => inline_template("^<%= std_macros['vendor'] %>$"),
+ },
+ }
+ class { 'buildsystem::var::youri':
+ packages_archivedir => "${buildsystem::var::scheduler::homedir}/old",
+ youri_conf => {
+ 'upload' => {
+ 'checks' => {
+ 'tag' => {
+ 'options' => $checks_tag_options,
+ },
+ 'rpmlint' => {
+ 'options' => {
+ 'results' => [
+ 'buildprereq-use',
+ 'no-description-tag',
+ 'no-summary-tag',
+ 'non-standard-group',
+ 'non-xdg-migrated-menu',
+ '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',
+ ],
+ },
+ },
+ },
+ 'actions' => {
+ 'mail' => {
+ 'options' => {
+ 'to' => "changelog@ml.${::domain}",
+ 'reply_to' => "mageia-dev@${::domain}",
+ 'from' => "buildsystem-daemon@${::domain}",
+ 'prefix' => 'RPM',
+ },
+ },
+ },
+ },
+ 'todo' => {
+ 'checks' => {
+ 'tag' => {
+ 'options' => $checks_tag_options,
+ },
+ },
},
}
}
-
}
diff --git a/modules/buildsystem/manifests/var/distros.pp b/modules/buildsystem/manifests/var/distros.pp
index 7aed19ac..79cbb239 100644
--- a/modules/buildsystem/manifests/var/distros.pp
+++ b/modules/buildsystem/manifests/var/distros.pp
@@ -68,6 +68,38 @@
# 'core' => [ 'release', 'updates' ],
# },
# },
+# 'youri' => {
+# # Configuration for youri-upload
+# 'upload' => {
+# # list of enabled checks, actions and posts
+# 'targets' => {
+# 'checks' => [
+# ...
+# ],
+# 'actions' => [
+# ...
+# ],
+# 'posts' => [
+# ...
+# ],
+# },
+# 'checks' => {
+# # rpmlint checks options
+# 'rpmlint' => {
+# 'config' => '/usr/share/rpmlint/config',
+# 'path' => ''/usr/bin/rpmlint',
+# },
+# },
+# # options for actions
+# 'actions' => {
+# ...
+# },
+# },
+# # Configuration for youri-todo
+# 'todo' => {
+# ...
+# },
+# },
# },
# }
class buildsystem::var::distros(
diff --git a/modules/buildsystem/manifests/var/scheduler.pp b/modules/buildsystem/manifests/var/scheduler.pp
index d69c66fc..087020bf 100644
--- a/modules/buildsystem/manifests/var/scheduler.pp
+++ b/modules/buildsystem/manifests/var/scheduler.pp
@@ -1,10 +1,13 @@
# $admin_mail:
# the email address from which the build failure notifications
# will be sent
+# $pkg_uphost:
+# hostname of the server where submitted packages are uploaded
# $build_nodes:
# a hash containing available build nodes indexed by architecture
class buildsystem::var::scheduler(
$admin_mail = "root@${::domain}",
+ $pkg_uphost = "pkgsubmit.${::domain}",
$build_nodes
){
$login = 'schedbot'
diff --git a/modules/buildsystem/manifests/var/youri.pp b/modules/buildsystem/manifests/var/youri.pp
index 7732c8f5..b9406369 100644
--- a/modules/buildsystem/manifests/var/youri.pp
+++ b/modules/buildsystem/manifests/var/youri.pp
@@ -1,3 +1,21 @@
+# The youri configuration files are created using informations from 3
+# different hash variables :
+# - the $youri_conf_default variable defined in this class, containing
+# the default configuration for youri. It contais the repository
+# configuration, and the definitions of the checks, actions and posts.
+# - the $youri_conf parameter passed to this class. The values defined
+# in this hash override the values defined in the default configuration.
+# - for each distribution defined in the hash variable $distros from
+# var::buildsystem::distros the hash defined in index 'youri' contains
+# some distro specific options for youri checks, actions or posts. It
+# also contains for each distribution the list of active checks,
+# actions and posts.
+#
+# Each of those variables contain the configuration for youri submit-todo
+# (in index 'todo') and youri submit-upload (in index 'upload')
+#
+#
+# Parameters :
# $tmpl_youri_upload_conf:
# template file for youri submi-upload.conf
# $tmpl_youri_todo_conf:
@@ -5,9 +23,274 @@
# $packages_archivedir:
# the directory where youri will archive old packages when they are
# replaced by a new version
+# $youri_conf:
+# a hash containing the youri configuration
class buildsystem::var::youri(
- $tmpl_youri_upload_conf = 'buildsystem/youri/submit-upload.conf',
- $tmpl_youri_todo_conf = 'buildsystem/youri/submit-todo.conf',
- $packages_archivedir
+ $tmpl_youri_upload_conf = 'buildsystem/youri/submit.conf',
+ $tmpl_youri_todo_conf = 'buildsystem/youri/submit.conf',
+ $packages_archivedir,
+ $youri_conf = {}
) {
+ include buildsystem::var::repository
+ include buildsystem::var::mgarepo
+ include buildsystem::var::distros
+ include buildsystem::var::signbot
+ include buildsystem::var::scheduler
+
+ $check_tag = { 'class' => 'Youri::Submit::Check::Tag', }
+ $check_recency = { 'class' => 'Youri::Submit::Check::Recency', }
+ $check_queue_recency = { 'class' => 'Youri::Submit::Check::Queue_recency', }
+ $check_host = {
+ 'class' => 'Youri::Submit::Check::Host',
+ 'options' => {
+ 'host_file' => '/etc/youri/host.conf',
+ },
+ }
+ $check_rpmlint = { 'class' => 'Youri::Submit::Check::Rpmlint', }
+ $check_acl = {
+ 'class' => 'Youri::Submit::Check::ACL',
+ 'options' => {
+ 'acl_file' => '/etc/youri/acl.conf',
+ },
+ }
+ $check_source = { 'class' => 'Youri::Submit::Check::Source', }
+ $check_version = {
+ 'class' => 'Youri::Submit::Check::Version',
+ 'options' => {},
+ }
+
+ $youri_conf_default = {
+ 'upload' => {
+ 'repository' => {
+ 'class' => 'Youri::Repository::Mageia',
+ 'options' => {
+ 'install_root' => $buildsystem::var::repository::bootstrap_reporoot,
+ 'upload_root' => '${home}/uploads/',
+ 'archive_root' => $packages_archivedir,
+ 'upload_state' => 'queue',
+ 'queue' => 'queue',
+ 'noarch' => 'i586',
+ 'svn' => "${buildsystem::var::mgarepo::svn_root_packages_ssh}/${buildsystem::var::distros::default_distro}",
+ },
+ },
+ 'checks' => {
+ 'tag' => $check_tag,
+ 'recency' => $check_recency,
+ 'queue_recency' => $check_queue_recency,
+ 'host' => $check_host,
+ 'section' => {
+ 'class' => 'Youri::Submit::Check::Section',
+ },
+ 'rpmlint' => $check_rpmlint,
+ 'svn' => {
+ 'class' => 'Youri::Submit::Check::SVN',
+ },
+ 'acl' => $check_acl,
+ 'history' => {
+ 'class' => 'Youri::Submit::Check::History',
+ },
+ 'source' => $check_source,
+ 'precedence' => {
+ 'class' => 'Youri::Submit::Check::Precedence',
+ 'options' => {
+ 'target' => $buildsystem::var::distros::default_distro,
+ },
+ },
+ 'version' => $check_version,
+ },
+ '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' => $buildsystem::var::signbot::login,
+ 'path' => $buildsystem::var::signbot::sign_keydir,
+ 'name' => $buildsystem::var::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',
+ },
+ },
+ 'maintdb' => {
+ 'class' => 'Youri::Submit::Action::UpdateMaintDb',
+ },
+ },
+ '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' => $buildsystem::var::repository::mirror_reporoot,
+ },
+ },
+ },
+ },
+ 'todo' => {
+ 'repository' => {
+ 'class' => 'Youri::Repository::Mageia',
+ 'options' => {
+ 'install_root' => $buildsystem::var::repository::bootstrap_reporoot,
+ 'upload_root' => '${home}/uploads/',
+ 'upload_state' => 'todo done queue',
+ 'queue' => 'todo',
+ 'noarch' => 'i586',
+ 'svn' => "${buildsystem::var::mgarepo::svn_root_packages_ssh}/${buildsystem::var::distros::default_distro}",
+ },
+ },
+ 'checks' => {
+ 'tag' => $check_tag,
+ 'recency' => $check_recency,
+ 'queue_recency' => $check_queue_recency,
+ 'host' => $check_host,
+ 'rpmlint' => $check_rpmlint,
+ 'acl' => $check_acl,
+ 'source' => $check_source,
+ 'version' => $check_version,
+ 'deps' => {
+ 'class' => 'Youri::Submit::Check::Deps',
+ },
+ },
+ 'actions' => {
+ 'send' => {
+ 'class' => 'Youri::Submit::Action::Send',
+ 'options' => {
+ 'user' => $buildsystem::var::scheduler::login,
+ 'keep_svn_release' => 'yes',
+ 'uphost' => $buildsystem::var::scheduler::pkg_uphost,
+ 'root' => '${home}/uploads',
+ 'ssh_key' => '${home}/.ssh/id_rsa',
+ },
+ },
+ 'rpminfo' => {
+ 'class' => 'Youri::Submit::Action::Rpminfo',
+ 'options' => {
+ 'user' => $buildsystem::var::scheduler::login,
+ 'uphost' => $buildsystem::var::scheduler::pkg_uphost,
+ 'root' => '${home}/uploads',
+ 'ssh_key' => '${home}/.ssh/id_rsa',
+ },
+ },
+ 'ulri' => {
+ 'class' => 'Youri::Submit::Action::Ulri',
+ 'options' => {
+ 'user' => $buildsystem::var::scheduler::login,
+ 'uphost' => $buildsystem::var::scheduler::pkg_uphost,
+ 'ssh_key' => '${home}/.ssh/id_rsa',
+ },
+ },
+ },
+ 'posts' => {
+ },
+ },
+ }
}
diff --git a/modules/buildsystem/manifests/youri_submit.pp b/modules/buildsystem/manifests/youri_submit.pp
index f55402d8..f4e49412 100644
--- a/modules/buildsystem/manifests/youri_submit.pp
+++ b/modules/buildsystem/manifests/youri_submit.pp
@@ -24,14 +24,17 @@ class buildsystem::youri_submit {
file {
'/etc/youri/':
ensure => 'directory';
- '/etc/youri/submit-todo.conf':
- content => template($buildsystem::var::youri::tmpl_youri_todo_conf);
- '/etc/youri/submit-upload.conf':
- content => template($buildsystem::var::youri::tmpl_youri_upload_conf);
'/etc/youri/acl.conf':
content => template('buildsystem/youri/acl.conf');
}
+ buildsystem::youri_submit_conf{ 'upload':
+ tmpl_file => $buildsystem::var::youri::tmpl_youri_upload_conf,
+ }
+ buildsystem::youri_submit_conf{ 'todo':
+ tmpl_file => $buildsystem::var::youri::tmpl_youri_todo_conf,
+ }
+
file { $buildsystem::var::youri::packages_archivedir:
ensure => 'directory',
owner => $buildsystem::var::scheduler::login,
diff --git a/modules/buildsystem/manifests/youri_submit_conf.pp b/modules/buildsystem/manifests/youri_submit_conf.pp
new file mode 100644
index 00000000..9281713e
--- /dev/null
+++ b/modules/buildsystem/manifests/youri_submit_conf.pp
@@ -0,0 +1,6 @@
+define buildsystem::youri_submit_conf($tmpl_file) {
+ $conf_name = $name
+ file { "/etc/youri/submit-${conf_name}.conf":
+ content => template($tmpl_file),
+ }
+}
diff --git a/modules/buildsystem/templates/youri/submit-todo.conf b/modules/buildsystem/templates/youri/submit-todo.conf
deleted file mode 100644
index a575602e..00000000
--- a/modules/buildsystem/templates/youri/submit-todo.conf
+++ /dev/null
@@ -1,249 +0,0 @@
-<%
-escaped_domain = domain.gsub('.','\.')
-repository_root = scope.lookupvar('buildsystem::var::repository::bootstrap_root')
-sched_home_dir = scope.lookupvar('buildsystem::var::scheduler::homedir')
-sched_login = scope.lookupvar('buildsystem::var::scheduler::login')
-%>
-
-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: <%= scope.lookupvar('buildsystem::var::mgarepo::svn_root_packages_ssh') %>/<%= scope.lookupvar('buildsystem::var::distros::default_distro') %>/
- 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: ^none$
- authorized_arches: none
- mode: freeze
-
- cauldron:
-# authorized_sections: ^[a-z]+/updates_testing$
- authorized_sections: ^$
- 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 305de6cd..00000000
--- a/modules/buildsystem/templates/youri/submit-upload.conf
+++ /dev/null
@@ -1,448 +0,0 @@
-<%
-Puppet::Parser::Functions.autoloader.loadall
-escaped_domain = domain.gsub('.','\.')
-repository_root = scope.lookupvar('buildsystem::var::repository::bootstrap_root')
-sched_home_dir = scope.lookupvar('buildsystem::var::scheduler::homedir')
-sched_login = scope.lookupvar('buildsystem::var::scheduler::login')
-%>
-
-home: <%= sched_home_dir %>
-
-# repository declaration
-repository:
- class: Youri::Repository::Mageia
- options:
- install_root: <%= repository_root %>/distrib
- upload_root: ${home}/uploads/
- archive_root: <%= scope.lookupvar('buildsystem::var::youri::packages_archivedir') %>
- upload_state: queue
- queue: queue
- noarch: i586
- svn: <%= scope.lookupvar('buildsystem::var::mgarepo::svn_root_packages_ssh') %>/<%= scope.lookupvar('buildsystem::var::distros::default_distro') %>/
- 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_product_id
- - 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
- results:
- - buildprereq-use
- - no-description-tag
- - no-summary-tag
- - non-standard-group
- - non-xdg-migrated-menu
- - 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
- - tmpfiles-conf-in-etc
- - non-ghost-in-run
- - non-ghost-in-var-run
- - non-ghost-in-var-lock
- - systemd-unit-in-etc
- - udev-rule-in-etc
- 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::var::signbot::login') %>
- path: <%= scope.lookupvar('buildsystem::var::signbot::sign_keydir') %>
- name: <%= scope.lookupvar('buildsystem::var::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_product_id:
- class: Youri::Submit::Action::Unpack
- options:
- name: mageia-release-Default
- source_subdir: /etc
- grep_files: product.id
- 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..233020ba
--- /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