diff options
-rw-r--r-- | deployment/mga_buildsystem/manifests/config.pp | 44 | ||||
-rw-r--r-- | modules/buildsystem/manifests/distros.rb | 7 | ||||
-rw-r--r-- | modules/buildsystem/manifests/mainnode.pp | 9 | ||||
-rw-r--r-- | modules/buildsystem/manifests/media_cfg.pp | 4 | ||||
-rw-r--r-- | modules/buildsystem/manifests/var/distros.pp | 14 | ||||
-rw-r--r-- | modules/buildsystem/templates/media.cfg | 487 |
6 files changed, 157 insertions, 408 deletions
diff --git a/deployment/mga_buildsystem/manifests/config.pp b/deployment/mga_buildsystem/manifests/config.pp index 66e64ac0..ffb14ec3 100644 --- a/deployment/mga_buildsystem/manifests/config.pp +++ b/deployment/mga_buildsystem/manifests/config.pp @@ -21,29 +21,51 @@ class mga_buildsystem::config { $std_arch = ['i586', 'x86_64'] $std_repos = { - 'release' => {}, - 'updates_testing' => {}, - 'backports_testing' => {}, - 'backports' => {}, - 'updates' => {}, + 'release' => { + 'media_types' => [ 'release' ], + }, + 'updates_testing' => { + 'media_types' => [ 'testing' ], + 'noauto' => '1', + }, + 'backports_testing' => { + 'media_types' => [ 'testing' ], + 'noauto' => '1', + }, + 'backports' => { + 'media_types' => [ 'backports' ], + 'noauto' => '1', + }, + 'updates' => { + 'media_types' => [ 'updates' ], + 'updates_for' => 'release', + }, } $std_medias = { 'core' => { 'repos' => $std_repos, + 'media_types' => [ 'official', 'free' ], }, 'nonfree' => { 'repos' => $std_repos, + 'media_types' => [ 'official' ], + 'noauto' => '1', }, 'tainted' => { 'repos' => $std_repos, + 'media_types' => [ 'official' ], + 'noauto' => '1', }, } $std_base_media = [ 'core/release', 'core/updates' ] $infra_medias = { 'infra' => { 'repos' => { - 'release' => {}, + 'release' => { + 'media_types' => [ 'release' ], + }, }, + 'media_types' => [ 'infra' ], }, } class { 'buildsystem::var::distros': @@ -52,30 +74,40 @@ class mga_buildsystem::config { 'arch' => $std_arch, 'medias' => $std_medias, 'base_media' => $std_base_media, + 'branch' => 'Devel', + 'version' => '3', }, '1' => { 'arch' => $std_arch, 'medias' => $std_medias, 'base_media' => $std_base_media, + 'branch' => 'Official', + 'version' => '1', }, '2' => { 'arch' => $std_arch, 'medias' => $std_medias, 'base_media' => $std_base_media, + 'branch' => 'Official', + 'version' => '2', }, 'infra_1' => { 'arch' => $std_arch, 'medias' => $infra_medias, 'base_media' => $std_base_media, + 'branch' => 'Official', + 'version' => '1', }, 'infra_2' => { 'arch' => $std_arch, 'medias' => $infra_medias, 'base_media' => $std_base_media, + 'branch' => 'Official', + 'version' => '2', }, } } diff --git a/modules/buildsystem/manifests/distros.rb b/modules/buildsystem/manifests/distros.rb index 6ecc7240..24b394aa 100644 --- a/modules/buildsystem/manifests/distros.rb +++ b/modules/buildsystem/manifests/distros.rb @@ -10,6 +10,13 @@ hostclass "buildsystem::distros" do file [ bootstrap_reporoot, rel ].join('/'), :ensure => 'directory', :owner => mirror_user, :group => mirror_user for arch in distro['arch'] do + # As ruby dsl cannot use defined resources, we have to use a + # workaround with 'find_resource_type' as described in this + # puppet issue: http://projects.puppetlabs.com/issues/11912 + scope.find_resource_type 'buildsystem::media_cfg' + create_resource 'buildsystem::media_cfg', + [ rel, ' ', arch ].join('/'), :distro_name => rel, + :arch => arch file [ bootstrap_reporoot, rel, arch ].join('/'), :ensure => 'directory', :owner => mirror_user, :group => mirror_user diff --git a/modules/buildsystem/manifests/mainnode.pp b/modules/buildsystem/manifests/mainnode.pp index 96e8cc0d..2a4834a0 100644 --- a/modules/buildsystem/manifests/mainnode.pp +++ b/modules/buildsystem/manifests/mainnode.pp @@ -14,13 +14,4 @@ class buildsystem::mainnode { apache::vhost::other_app { "repository.$::domain": vhost_file => 'buildsystem/vhost_repository.conf', } - - buildsystem::media_cfg { "cauldron i586": - distro => 'cauldron', - arch => 'i586', - } - buildsystem::media_cfg { "cauldron x86_64": - distro => 'cauldron', - arch => 'x86_64', - } } diff --git a/modules/buildsystem/manifests/media_cfg.pp b/modules/buildsystem/manifests/media_cfg.pp index 413aa71f..bdec67f7 100644 --- a/modules/buildsystem/manifests/media_cfg.pp +++ b/modules/buildsystem/manifests/media_cfg.pp @@ -1,9 +1,9 @@ -define buildsystem::media_cfg($distro, $arch, $templatefile = 'buildsystem/media.cfg') { +define buildsystem::media_cfg($distro_name, $arch, $templatefile = 'buildsystem/media.cfg') { include buildsystem::var::repository include buildsystem::var::scheduler include buildsystem::repository - file { "${buildsystem::var::repository::bootstrap_reporoot}/${distro}/${arch}/media/media_info/media.cfg": + file { "${buildsystem::var::repository::bootstrap_reporoot}/${distro_name}/${arch}/media/media_info/media.cfg": owner => $buildsystem::var::scheduler::login, group => $buildsystem::var::scheduler::login, content => template($templatefile), diff --git a/modules/buildsystem/manifests/var/distros.pp b/modules/buildsystem/manifests/var/distros.pp index d06e31c9..a0c8aafd 100644 --- a/modules/buildsystem/manifests/var/distros.pp +++ b/modules/buildsystem/manifests/var/distros.pp @@ -12,12 +12,24 @@ # 'core' => { # 'repos' => { # # the 'release' repo in the 'core' media -# 'release' => {}, +# 'release' => { +# 'media_types' => [ 'release' ], +# 'noauto' => '1', +# }, # }, +# # media_types for media.cfg +# 'media_types' => [ 'official', 'free' ], +# # if noauto is set to '1' either in medias or repos, +# # the option will be added to media.cfg +# 'noauto' => '1', # }, # }, # # the list of media used by iurt to build the chroots # 'base_medias' => [ 'core/release' ], +# # branch is Devel or Official. Used in media.cfg. +# 'branch' => 'Devel', +# # Version of the distribution +# 'version' => '3', # }, # } class buildsystem::var::distros( diff --git a/modules/buildsystem/templates/media.cfg b/modules/buildsystem/templates/media.cfg index e0470733..163f1f66 100644 --- a/modules/buildsystem/templates/media.cfg +++ b/modules/buildsystem/templates/media.cfg @@ -1,395 +1,102 @@ +<%- +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.each{|key, value| + 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'] %> arch=<%= @arch %> 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'].each{|medianame, media| + media['repos'].each{|reponame, repo| + media_types = [] + if media['media_types'] != nil + media_types += media['media_types'] + end + if repo['media_types'] != nil + media_types += repo['media_types'] + 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('/'), + :hdlists => [ 'hdlist', medianame, reponame ].join('_') + '.cz', + :name => media_name(medianame, reponame, nil, nil), + :srpms => [ '../../SRPMS', medianame, reponame ].join('/'), + :media_types => media_types.join(':'), + :updates_for => updates_for, + :noauto => noauto + + %> + <%-# debug -%> + <%- + debug_media_types = media_types + [ 'debug' ] + -%><%= + media_out [ 'debug', medianame, reponame ].join('/'), + :hdlists => [ 'hdlist_debug', medianame, reponame ].join('_') + '.cz', + :name => media_name(medianame, reponame, 'debug', nil), + :srpms => [ '../../SRPMS', medianame, reponame ].join('/'), + :media_types => debug_media_types.join(':'), + :noauto => '1' + + %> + <%-# source -%> + <%- + source_media_types = media_types + [ 'source' ] + -%><%= + media_out [ '../../SRPMS', medianame, reponame ].join('/'), + :hdlists => [ 'hdlist', medianame, reponame ].join('_') + '.src.cz', + :name => media_name(medianame, reponame, 'sources', nil), + :rpms => [ medianame, reponame ].join('/'), + :media_types => source_media_types.join(':'), + :noauto => '1' + + %> + <%-# we add 32bit media if arch is x86_64 -%> + <%- + if @arch == 'x86_64' + medianame32 = [ medianame, '32' ].join('') + -%><%= + media_out [ '../../i586/media', medianame, reponame ].join('/'), + :hdlists => [ 'hdlist', medianame32, reponame ].join('_') + '.src.cz', + :name => media_name(medianame, reponame, nil, '32bit'), + :media_types => media_types.join(':'), + :noauto => '1' + + %> + <%- + end + } +} +-%> |