diff options
author | Nicolas Vigier <boklm@mageia.org> | 2013-05-23 15:06:02 +0000 |
---|---|---|
committer | Nicolas Vigier <boklm@mageia.org> | 2013-05-23 15:06:02 +0000 |
commit | fb6f9b67ca4bf82b22fc9ec469b9b6beeb08c0a2 (patch) | |
tree | 1c70be9551a91c87bce98bcbc19244022c80f48c /modules/buildsystem/templates/mgarepo.conf | |
parent | 03f72e194890b250aa7462ca2b763adc9e4b06ff (diff) | |
download | puppet-fb6f9b67ca4bf82b22fc9ec469b9b6beeb08c0a2.tar puppet-fb6f9b67ca4bf82b22fc9ec469b9b6beeb08c0a2.tar.gz puppet-fb6f9b67ca4bf82b22fc9ec469b9b6beeb08c0a2.tar.bz2 puppet-fb6f9b67ca4bf82b22fc9ec469b9b6beeb08c0a2.tar.xz puppet-fb6f9b67ca4bf82b22fc9ec469b9b6beeb08c0a2.zip |
buildsystem: remove use of .each on hashes
Remove use of "each" methods on hashes in template files. With ruby 1.8,
the order in which the hash is enumerated is random. When using the each
method to scan all hash keys and elements in template files, puppet will
do unnecessary changes in files installed on the server, making it more
difficult to see the real changes. In order to avoid this, we stop using
the "each" method on hashes and instead use the "keys" method to get an
array of all keys and sort it alphabetically.
With ruby 1.9 the hashes enumerate their values in the order that the
corresponding keys were inserted, but we are still using ruby 1.8 with
Mageia 2.
Diffstat (limited to 'modules/buildsystem/templates/mgarepo.conf')
-rw-r--r-- | modules/buildsystem/templates/mgarepo.conf | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/modules/buildsystem/templates/mgarepo.conf b/modules/buildsystem/templates/mgarepo.conf index d92c6cd1..cecec703 100644 --- a/modules/buildsystem/templates/mgarepo.conf +++ b/modules/buildsystem/templates/mgarepo.conf @@ -11,7 +11,8 @@ trunk-dir = <%= default_distro %> <%- conf = scope.lookupvar('buildsystem::var::mgarepo::conf') if conf['global'] != nil - conf['global'].each{|key,value| + conf['global'].keys.sort.each{|key| + value = conf['global'][key] -%><%= key %> = <%= value %> <%- } @@ -39,7 +40,8 @@ default = <%= default_distro %> host = <%= scope.lookupvar('buildsystem::var::mgarepo::submit_host') %> <%- - distros.each{|d, distro| + distros.keys.sort.each{|d| + distro = distros[d] -%> [submit <%= d %>] target = <%= sched_home_dir %>/repsys/srpms @@ -55,12 +57,14 @@ rpm-macros = global <%= d %> mkrel(c:) = %{-c: 0.%{-c*}.}%{1}%{?subrel:.%subrel}%{?distsuffix:%distsuffix}%{?!distsuffix:.mga}%{?distro_release:%distro_release} <%- - distros.each{|d, distro| + distros.keys.sort.each{|d| + distro = distros[d] -%> [macros <%= d %>] distro_release = <%= distro['version'] %> <%- - distro['macros'].each{|macro, value| + distro['macros'].keys.sort.each{|macro| + value = distro['macros'][macro] -%><%= macro %> = <%= value %> <%- } %> <%- } |