simp-rake-helpers 5.25.0 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +26 -0
  3. data/Gemfile +13 -6
  4. data/lib/simp/command_utils.rb +6 -3
  5. data/lib/simp/componentinfo.rb +47 -33
  6. data/lib/simp/local_gpg_signing_key.rb +302 -303
  7. data/lib/simp/packer/iso_vars_json.rb +17 -15
  8. data/lib/simp/rake/build/auto.rb +415 -432
  9. data/lib/simp/rake/build/build.rb +119 -124
  10. data/lib/simp/rake/build/clean.rb +39 -39
  11. data/lib/simp/rake/build/code.rb +125 -128
  12. data/lib/simp/rake/build/constants.rb +7 -4
  13. data/lib/simp/rake/build/deps.rb +196 -207
  14. data/lib/simp/rake/build/helpers.rb +17 -13
  15. data/lib/simp/rake/build/iso.rb +404 -411
  16. data/lib/simp/rake/build/pkg.rb +752 -759
  17. data/lib/simp/rake/build/rpmdeps.rb +70 -70
  18. data/lib/simp/rake/build/spec.rb +44 -46
  19. data/lib/simp/rake/build/tar.rb +169 -173
  20. data/lib/simp/rake/build/unpack.rb +105 -107
  21. data/lib/simp/rake/build/upload.rb +93 -102
  22. data/lib/simp/rake/fixtures.rb +69 -66
  23. data/lib/simp/rake/helpers/rpm_spec.rb +10 -7
  24. data/lib/simp/rake/helpers/version.rb +3 -1
  25. data/lib/simp/rake/helpers.rb +12 -10
  26. data/lib/simp/rake/pkg.rb +417 -440
  27. data/lib/simp/rake/pupmod/helpers.rb +100 -87
  28. data/lib/simp/rake/pupmod/module_build.rb +39 -0
  29. data/lib/simp/rake/rubygem.rb +57 -56
  30. data/lib/simp/rake.rb +34 -29
  31. data/lib/simp/relchecks.rb +52 -43
  32. data/lib/simp/rpm.rb +123 -127
  33. data/lib/simp/rpm_signer.rb +57 -55
  34. data/lib/simp/yum.rb +54 -53
  35. data/spec/acceptance/nodesets/{default_ruby3_1.yml → almalinux10.yml} +4 -4
  36. data/spec/acceptance/nodesets/{default.yml → almalinux8.yml} +2 -2
  37. data/spec/acceptance/nodesets/almalinux9.yml +25 -0
  38. data/spec/acceptance/suites/default/00_pkg_rpm_custom_scriptlets_spec.rb +23 -28
  39. data/spec/acceptance/suites/default/10_pkg_rpm_spec.rb +54 -56
  40. data/spec/acceptance/suites/default/30_pkg_misc_spec.rb +17 -19
  41. data/spec/acceptance/suites/default/50_local_gpg_signing_key_spec.rb +5 -5
  42. data/spec/acceptance/suites/default/55_build_pkg_signing_spec.rb +109 -101
  43. data/spec/acceptance/suites/default/files/testpackage/spec/classes/init_spec.rb +1 -0
  44. data/spec/acceptance/suites/default/files/testpackage/spec/files/mock_something.rb +3 -1
  45. data/spec/acceptance/suites/default/files/testpackage/utils/convert_v1_to_v2.rb +2 -0
  46. data/spec/acceptance/suites/default/support/build_project_helpers.rb +20 -17
  47. data/spec/acceptance/suites/default/support/build_user_helpers.rb +4 -2
  48. data/spec/acceptance/suites/default/support/pkg_rpm_helpers.rb +30 -31
  49. data/spec/acceptance/support/simp_rake_helpers.rb +3 -1
  50. data/spec/lib/simp/command_utils_spec.rb +13 -10
  51. data/spec/lib/simp/componentinfo_changelog_regex_spec.rb +33 -33
  52. data/spec/lib/simp/componentinfo_spec.rb +99 -86
  53. data/spec/lib/simp/packer/iso_vars_json_spec.rb +16 -14
  54. data/spec/lib/simp/rake/build/helpers_spec.rb +7 -7
  55. data/spec/lib/simp/rake/build/rpmdeps_spec.rb +48 -46
  56. data/spec/lib/simp/rake/helpers_spec.rb +6 -5
  57. data/spec/lib/simp/rake/pkg_spec.rb +7 -5
  58. data/spec/lib/simp/rake/pupmod/fixtures/othermod/spec/classes/init_spec.rb +3 -1
  59. data/spec/lib/simp/rake/pupmod/fixtures/othermod/spec/spec_helper.rb +2 -0
  60. data/spec/lib/simp/rake/pupmod/fixtures/simpmod/spec/acceptance/suites/default/class_spec.rb +6 -5
  61. data/spec/lib/simp/rake/pupmod/fixtures/simpmod/spec/classes/init_spec.rb +51 -33
  62. data/spec/lib/simp/rake/pupmod/fixtures/simpmod/spec/spec_helper.rb +15 -16
  63. data/spec/lib/simp/rake/pupmod/fixtures/simpmod/spec/spec_helper_acceptance.rb +9 -9
  64. data/spec/lib/simp/rake/pupmod/helpers_spec.rb +20 -19
  65. data/spec/lib/simp/rake/pupmod/module_build_spec.rb +87 -0
  66. data/spec/lib/simp/rake_spec.rb +7 -6
  67. data/spec/lib/simp/relchecks_check_rpm_changelog_spec.rb +26 -31
  68. data/spec/lib/simp/relchecks_compare_latest_tag_spec.rb +32 -26
  69. data/spec/lib/simp/relchecks_create_tag_changelog_spec.rb +27 -19
  70. data/spec/lib/simp/rpm_signer_spec.rb +45 -39
  71. data/spec/lib/simp/rpm_spec.rb +190 -194
  72. data/spec/spec_helper.rb +4 -2
  73. data/spec/spec_helper_acceptance.rb +3 -5
  74. metadata +37 -72
  75. data/bin/simp_rake_helpers +0 -3
  76. data/lib/simp/ci/gitlab.rb +0 -226
  77. data/lib/simp/rake/ci.rb +0 -31
  78. data/spec/lib/simp/ci/files/global_nodesets_only/spec/acceptance/nodesets/default.yml +0 -41
  79. data/spec/lib/simp/ci/files/global_nodesets_only/spec/acceptance/nodesets/oel.yml +0 -41
  80. data/spec/lib/simp/ci/files/job_broken_link_nodeset/spec/acceptance/nodesets/centos.yml +0 -41
  81. data/spec/lib/simp/ci/files/job_broken_link_nodeset/spec/acceptance/nodesets/oel.yml +0 -41
  82. data/spec/lib/simp/ci/files/job_broken_link_nodeset/spec/acceptance/suites/default/class_spec.rb +0 -0
  83. data/spec/lib/simp/ci/files/job_invalid_nodeset/spec/acceptance/nodesets/default.yml +0 -41
  84. data/spec/lib/simp/ci/files/job_invalid_nodeset/spec/acceptance/nodesets/oel.yml +0 -41
  85. data/spec/lib/simp/ci/files/job_invalid_nodeset/spec/acceptance/suites/default/class_spec.rb +0 -0
  86. data/spec/lib/simp/ci/files/job_invalid_suite/spec/acceptance/nodesets/default.yml +0 -41
  87. data/spec/lib/simp/ci/files/job_invalid_suite/spec/acceptance/nodesets/oel.yml +0 -41
  88. data/spec/lib/simp/ci/files/job_invalid_suite/spec/acceptance/suites/default/class_spec.rb +0 -0
  89. data/spec/lib/simp/ci/files/job_missing_nodeset/spec/acceptance/nodesets/default.yml +0 -41
  90. data/spec/lib/simp/ci/files/job_missing_nodeset/spec/acceptance/nodesets/oel.yml +0 -41
  91. data/spec/lib/simp/ci/files/job_missing_nodeset/spec/acceptance/suites/default/class_spec.rb +0 -0
  92. data/spec/lib/simp/ci/files/job_missing_suite_and_nodeset/spec/acceptance/nodesets/default.yml +0 -41
  93. data/spec/lib/simp/ci/files/job_missing_suite_and_nodeset/spec/acceptance/nodesets/oel.yml +0 -41
  94. data/spec/lib/simp/ci/files/job_missing_suite_and_nodeset/spec/acceptance/suites/default/class_spec.rb +0 -0
  95. data/spec/lib/simp/ci/files/multiple_invalid_jobs/spec/acceptance/nodesets/default.yml +0 -41
  96. data/spec/lib/simp/ci/files/multiple_invalid_jobs/spec/acceptance/nodesets/oel.yml +0 -41
  97. data/spec/lib/simp/ci/files/multiple_invalid_jobs/spec/acceptance/suites/default/class_spec.rb +0 -0
  98. data/spec/lib/simp/ci/files/multiple_invalid_jobs/spec/acceptance/suites/feature-1/feature-1_spec.rb +0 -0
  99. data/spec/lib/simp/ci/files/multiple_invalid_jobs/spec/acceptance/suites/feature_2/feature_2_spec.rb +0 -0
  100. data/spec/lib/simp/ci/files/multiple_invalid_jobs/spec/acceptance/suites/feature_2/nodesets/default.yml +0 -35
  101. data/spec/lib/simp/ci/files/multiple_invalid_jobs/spec/acceptance/suites/feature_2/nodesets/oel.yml +0 -35
  102. data/spec/lib/simp/ci/files/multiple_valid_jobs/spec/acceptance/nodesets/default.yml +0 -41
  103. data/spec/lib/simp/ci/files/multiple_valid_jobs/spec/acceptance/nodesets/oel.yml +0 -41
  104. data/spec/lib/simp/ci/files/multiple_valid_jobs/spec/acceptance/suites/default/class_spec.rb +0 -0
  105. data/spec/lib/simp/ci/files/multiple_valid_jobs/spec/acceptance/suites/feature-1/feature-1_spec.rb +0 -0
  106. data/spec/lib/simp/ci/files/multiple_valid_jobs/spec/acceptance/suites/feature_2/feature_2_spec.rb +0 -0
  107. data/spec/lib/simp/ci/files/multiple_valid_jobs/spec/acceptance/suites/feature_2/nodesets/default.yml +0 -35
  108. data/spec/lib/simp/ci/files/multiple_valid_jobs/spec/acceptance/suites/feature_2/nodesets/oel.yml +0 -35
  109. data/spec/lib/simp/ci/files/no_acceptance_tests/spec/spec_helper.rb +0 -0
  110. data/spec/lib/simp/ci/files/no_gitlab_config_with_tests/spec/acceptance/nodesets/default.yml +0 -41
  111. data/spec/lib/simp/ci/files/no_gitlab_config_with_tests/spec/acceptance/nodesets/oel.yml +0 -41
  112. data/spec/lib/simp/ci/files/no_gitlab_config_with_tests/spec/acceptance/suites/default/class_spec.rb +0 -0
  113. data/spec/lib/simp/ci/files/no_gitlab_config_without_tests/spec/acceptance/nodesets/default.yml +0 -41
  114. data/spec/lib/simp/ci/files/no_gitlab_config_without_tests/spec/acceptance/nodesets/oel.yml +0 -41
  115. data/spec/lib/simp/ci/files/suite_skeleton_only/spec/acceptance/nodesets/centos.yml +0 -41
  116. data/spec/lib/simp/ci/files/suite_skeleton_only/spec/acceptance/nodesets/oel.yml +0 -41
  117. data/spec/lib/simp/ci/files/valid_job_global_nodeset/spec/acceptance/nodesets/default.yml +0 -41
  118. data/spec/lib/simp/ci/files/valid_job_global_nodeset/spec/acceptance/nodesets/oel.yml +0 -41
  119. data/spec/lib/simp/ci/files/valid_job_global_nodeset/spec/acceptance/suites/default/class_spec.rb +0 -0
  120. data/spec/lib/simp/ci/files/valid_job_nodeset_dir_link/spec/acceptance/nodesets/default.yml +0 -41
  121. data/spec/lib/simp/ci/files/valid_job_nodeset_dir_link/spec/acceptance/nodesets/oel.yml +0 -41
  122. data/spec/lib/simp/ci/files/valid_job_nodeset_dir_link/spec/acceptance/suites/default/class_spec.rb +0 -0
  123. data/spec/lib/simp/ci/files/valid_job_nodeset_link/spec/acceptance/suites/default/class_spec.rb +0 -0
  124. data/spec/lib/simp/ci/files/valid_job_nodeset_link/spec/acceptance/suites/default/nodesets/centos.yml +0 -41
  125. data/spec/lib/simp/ci/files/valid_job_nodeset_link/spec/acceptance/suites/default/nodesets/oel.yml +0 -41
  126. data/spec/lib/simp/ci/files/valid_job_suite_nodeset/spec/acceptance/suites/default/class_spec.rb +0 -0
  127. data/spec/lib/simp/ci/files/valid_job_suite_nodeset/spec/acceptance/suites/default/nodesets/default.yml +0 -41
  128. data/spec/lib/simp/ci/files/valid_job_suite_nodeset/spec/acceptance/suites/default/nodesets/oel.yml +0 -41
  129. data/spec/lib/simp/ci/gitlab_spec.rb +0 -245
@@ -1,499 +1,492 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'simp/rake'
2
4
  require 'simp/rake/build/constants'
3
5
 
4
6
  module Simp; end
5
7
  module Simp::Rake; end
6
- module Simp::Rake::Build
7
-
8
- class Iso < ::Rake::TaskLib
9
- include Simp::Rake
10
- include Simp::Rake::Build::Constants
11
8
 
12
- def initialize( base_dir )
13
- init_member_vars( base_dir )
9
+ class Simp::Rake::Build::Iso < Rake::TaskLib
10
+ include Simp::Rake
11
+ include Simp::Rake::Build::Constants
14
12
 
15
- define_tasks
16
- end
13
+ def initialize(base_dir)
14
+ init_member_vars(base_dir)
17
15
 
18
- def verbose
19
- ENV.fetch('SIMP_ISO_verbose','no') == 'yes'
20
- end
16
+ define_tasks
17
+ end
21
18
 
22
- def define_tasks
19
+ def verbose
20
+ ENV.fetch('SIMP_ISO_verbose', 'no') == 'yes'
21
+ end
23
22
 
24
- File.umask(0007)
23
+ def define_tasks
24
+ File.umask(0o007)
25
25
 
26
- namespace :iso do
27
- task :prep do
28
- if $simp6
29
- @build_dir = $simp6_build_dir || @distro_build_dir
30
- end
26
+ namespace :iso do
27
+ task :prep do
28
+ if $simp6
29
+ @build_dir = $simp6_build_dir || @distro_build_dir
31
30
  end
31
+ end
32
32
 
33
- # Remove packages from the given directory. The goal of this method is to help
34
- # get the distro to be as small as possible.
35
- # [:from_dir] Root directory to remove packages from (removes recursively)
36
- # [:exclude_dirs] Array of directories to not remove any packages from
37
- # [:exclude_pkgs] Array of packages to not remove
38
- def prune_packages(from_dir,exclude_dirs,exclude_pkgs,mkrepo='createrepo -p',use_hack=true)
39
- $stderr.puts "Starting to prune..."
40
- Dir.chdir(from_dir) do
41
- prune_count = 0
42
-
43
- Find.find('.') do |path|
44
- Find.prune if exclude_dirs.include?(File.basename(path))
45
-
46
- if File.basename(path) =~ /.*\.rpm/
47
- # Get the package name from the RPM.
48
- # Note: an alternative method may be to just simply check the names
49
- # of the RPMs themselves instead of the names of the packages.
50
- pkg = nil
51
- if use_hack
52
- # The proper way (defined below) is way too slow, so this hack helps
53
- # speed up the process by reading the file directly. If the code is
54
- # not working, attempt this without using the hack, just be ready
55
- # to wait a long time for the code to complete.
56
- pkgname = File.basename(path).split('-').first
57
- File.open(path,'r').each_line do |line|
58
- if encode_line(line) =~ /C\000(\S+\000)?(#{Regexp.escape(pkgname)}\S*)\000/
59
- pkg = $2.split(/\000/).first
60
- break
61
- end
62
- end
63
- else
64
- # Proper way to obtain the RPM's package name, but WAY too slow
65
- pkg = %x{rpm -qp --qf "%{NAME}" #{path} 2>/dev/null}.chomp
66
- end
67
-
68
- unless exclude_pkgs.include?(pkg)
69
- rm(path, :verbose => verbose)
70
- prune_count += 1
33
+ # Remove packages from the given directory. The goal of this method is to help
34
+ # get the distro to be as small as possible.
35
+ # [:from_dir] Root directory to remove packages from (removes recursively)
36
+ # [:exclude_dirs] Array of directories to not remove any packages from
37
+ # [:exclude_pkgs] Array of packages to not remove
38
+ def prune_packages(from_dir, exclude_dirs, exclude_pkgs, mkrepo = 'createrepo -p', use_hack = true)
39
+ warn 'Starting to prune...'
40
+ Dir.chdir(from_dir) do
41
+ prune_count = 0
42
+
43
+ Find.find('.') do |path|
44
+ Find.prune if exclude_dirs.include?(File.basename(path))
45
+
46
+ next unless %r{.*\.rpm}.match?(File.basename(path))
47
+
48
+ # Get the package name from the RPM.
49
+ # Note: an alternative method may be to just simply check the names
50
+ # of the RPMs themselves instead of the names of the packages.
51
+ pkg = nil
52
+ if use_hack
53
+ # The proper way (defined below) is way too slow, so this hack helps
54
+ # speed up the process by reading the file directly. If the code is
55
+ # not working, attempt this without using the hack, just be ready
56
+ # to wait a long time for the code to complete.
57
+ pkgname = File.basename(path).split('-').first
58
+ File.open(path, 'r').each_line do |line|
59
+ if encode_line(line) =~ %r{C\000(\S+\000)?(#{Regexp.escape(pkgname)}\S*)\000}
60
+ pkg = ::Regexp.last_match(2).split(%r{\000}).first
61
+ break
71
62
  end
72
63
  end
64
+ else
65
+ # Proper way to obtain the RPM's package name, but WAY too slow
66
+ pkg = `rpm -qp --qf "%{NAME}" #{path} 2>/dev/null`.chomp
73
67
  end
74
- $stderr.puts "Info: Pruned #{prune_count} packages from #{from_dir}"
75
-
76
- if prune_count > 0
77
- # Recreate the now-pruned repos
78
- basepath = '.'
79
- if (File.basename(from_dir) =~ /^RHEL/)
80
- # This covers old versions of RHEL that don't follow the new
81
- # way of doing things.
82
- unless Dir.glob("Server/*.rpm").empty?
83
- basepath = 'Server'
84
- end
85
- end
86
68
 
87
- Dir.chdir(basepath) do
88
- cp(Dir.glob("repodata/*comps*.xml").first,"simp_comps.xml")
89
- sh %{#{mkrepo} -g simp_comps.xml .}
90
- rm("simp_comps.xml")
91
- end
69
+ unless exclude_pkgs.include?(pkg)
70
+ rm(path, :verbose => verbose)
71
+ prune_count += 1
92
72
  end
93
73
  end
94
- end # End of prune_packages
95
-
96
- =begin
97
- desc <<-EOM
98
- Build the SIMP ISO(s).
99
- * :tarball - Path of the source tarball or directory containing the source
100
- tarballs.
101
- * :unpacked_dvds - Path of the directory containing the unpacked base OS
102
- directories. Default is the current directory.
103
- * :prune - Flag for whether unwanted packages should be pruned prior to
104
- building the ISO. Default is true.
105
-
106
- ENV vars:
107
- - Set `SIMP_ISO_verbose=yes` to report file operations as they happen.
108
- EOM
109
- =end
110
- task :build,[:tarball,:unpacked_dvds,:prune] => [:prep] do |t,args|
111
- args.with_defaults(:unpacked_dvds => "#{@run_dir}", :prune => 'true')
112
-
113
- if args.tarball.nil?
114
- fail("Error: You must specify a source tarball or tarball directory!")
115
- else
116
- tarball = File.expand_path(args.tarball)
74
+ warn "Info: Pruned #{prune_count} packages from #{from_dir}"
75
+
76
+ if prune_count.positive?
77
+ # Recreate the now-pruned repos
78
+ basepath = '.'
79
+ # This covers old versions of RHEL that don't follow the new
80
+ # way of doing things.
81
+ if (File.basename(from_dir) =~ %r{^RHEL}) && !Dir.glob('Server/*.rpm').empty?
82
+ basepath = 'Server'
83
+ end
117
84
 
118
- unless File.exist?(tarball)
119
- fail("Error: Could not find tarball at '#{tarball}'!")
85
+ Dir.chdir(basepath) do
86
+ cp(Dir.glob('repodata/*comps*.xml').first, 'simp_comps.xml')
87
+ sh %(#{mkrepo} -g simp_comps.xml .)
88
+ rm('simp_comps.xml')
120
89
  end
121
90
  end
91
+ end
92
+ end
122
93
 
123
- reposync_location = File.join(@build_dir,'yum_data','reposync')
124
- reposync_active = !Dir.glob(File.join(reposync_location, '**', 'repomd.xml')).empty?
94
+ # desc <<-EOM
95
+ # Build the SIMP ISO(s).
96
+ # * :tarball - Path of the source tarball or directory containing the source
97
+ # tarballs.
98
+ # * :unpacked_dvds - Path of the directory containing the unpacked base OS
99
+ # directories. Default is the current directory.
100
+ # * :prune - Flag for whether unwanted packages should be pruned prior to
101
+ # building the ISO. Default is true.
102
+ #
103
+ # ENV vars:
104
+ # - Set `SIMP_ISO_verbose=yes` to report file operations as they happen.
105
+ # EOM
106
+ task :build, [:tarball, :unpacked_dvds, :prune] => [:prep] do |_t, args|
107
+ args.with_defaults(:unpacked_dvds => @run_dir.to_s, :prune => 'true')
108
+
109
+ raise('Error: You must specify a source tarball or tarball directory!') if args.tarball.nil?
110
+
111
+ tarball = File.expand_path(args.tarball)
112
+
113
+ unless File.exist?(tarball)
114
+ raise("Error: Could not find tarball at '#{tarball}'!")
115
+ end
125
116
 
126
- tarfiles = File.directory?(tarball) ?
127
- Dir.glob("#{tarball}/*.tar.gz") : [tarball]
128
- vermap = YAML::load_file( File.join( File.dirname(__FILE__), 'vermap.yaml'))
117
+ reposync_location = File.join(@build_dir, 'yum_data', 'reposync')
118
+ reposync_active = !Dir.glob(File.join(reposync_location, '**', 'repomd.xml')).empty?
129
119
 
130
- tarfiles.each do |tball|
131
- namepieces = File.basename(tarball,".tar.gz").split('-')
120
+ tarfiles = if File.directory?(tarball)
121
+ Dir.glob("#{tarball}/*.tar.gz")
122
+ else
123
+ [tarball]
124
+ end
125
+ vermap = YAML.load_file(File.join(File.dirname(__FILE__), 'vermap.yaml'))
132
126
 
133
- # SIMP 6
134
- if namepieces[1] =~ /^\d/
135
- simpver = namepieces[1..2].join('-')
136
- baseos = namepieces[3]
137
- else
138
- simpver = namepieces[3..-1].join('-')
139
- baseos = namepieces[2]
127
+ tarfiles.each do |tball|
128
+ namepieces = File.basename(tarball, '.tar.gz').split('-')
129
+
130
+ # SIMP 6
131
+ if %r{^\d}.match?(namepieces[1])
132
+ simpver = namepieces[1..2].join('-')
133
+ baseos = namepieces[3]
134
+ else
135
+ simpver = namepieces[3..].join('-')
136
+ baseos = namepieces[2]
137
+ end
138
+
139
+ iso_dirs = Dir.glob("#{File.expand_path(args.unpacked_dvds)}/#{baseos}*")
140
+ if iso_dirs.empty?
141
+ raise("Error: No unpacked DVD directories found for '#{baseos}' under '#{File.expand_path(args.unpacked_dvds)}'")
142
+ end
143
+
144
+ # Process each unpacked base OS ISO directory found
145
+ iso_dirs.each do |dir|
146
+ baseosver = '???'
147
+ arch = '???'
148
+
149
+ # read the .treeinfo file (INI format)
150
+ # ------------------------------------
151
+ require 'puppet'
152
+ require 'puppet/util/inifile'
153
+
154
+ file = "#{dir}/.treeinfo"
155
+ raise("ERROR: no file '#{file}'") unless File.file?(file)
156
+
157
+ ini = Puppet::Util::IniConfig::PhysicalFile.new(file)
158
+ ini.read
159
+ sections = ini.sections.map { |s| s.name }
160
+
161
+ # NOTE: RHEL7 discs claim [general] section is deprecated.
162
+ if sections.include?('general')
163
+ h = ini.get_section('general').entries.to_h { |k, v| [k, v] }
164
+ arch = h.fetch('arch', arch).strip
165
+ baseosver = h.fetch('version', baseosver).strip
166
+ baseosver += '.0' if baseosver.count('.') < 1
140
167
  end
168
+ # ------------------------------------
141
169
 
142
- iso_dirs = Dir.glob("#{File.expand_path(args.unpacked_dvds)}/#{baseos}*")
143
- if iso_dirs.empty?
144
- fail("Error: No unpacked DVD directories found for '#{baseos}' under '#{File.expand_path(args.unpacked_dvds)}'")
170
+ # Skip if SIMP version doesn't match target base OS version
171
+ unless Array(vermap[simpver.split('.').first]).include?(baseosver.split('.').first)
172
+ if verbose
173
+ warn("Could not find SIMP version mapping for #{simpver} for Base OS #{baseosver}")
174
+ warn('Do you need to update vermap.yaml in the Gem?')
175
+ end
176
+
177
+ next
145
178
  end
146
179
 
147
- # Process each unpacked base OS ISO directory found
148
- iso_dirs.each do |dir|
149
- baseosver = '???'
150
- arch = '???'
151
-
152
- # read the .treeinfo file (INI format)
153
- # ------------------------------------
154
- require 'puppet'
155
- require 'puppet/util/inifile'
156
-
157
- file = "#{dir}/.treeinfo"
158
- fail("ERROR: no file '#{file}'") unless File.file?(file)
159
-
160
- ini = Puppet::Util::IniConfig::PhysicalFile.new(file)
161
- ini.read
162
- sections = ini.sections.map{ |s| s.name }
163
-
164
- # NOTE: RHEL7 discs claim [general] section is deprecated.
165
- if sections.include?('general')
166
- h = Hash[ ini.get_section('general').entries.map{|k,v| [k,v]} ]
167
- arch = h.fetch('arch', arch).strip
168
- baseosver = h.fetch('version', baseosver).strip
169
- baseosver += '.0' if (baseosver.count('.') < 1)
180
+ mkrepo = (baseosver.split('.').first == '5') ? 'createrepo -s sha -p' : 'createrepo -p'
181
+
182
+ @simp_dvd_dirs.each do |clean_dir|
183
+ if File.directory?("#{dir}/#{clean_dir}")
184
+ rm_rf("#{dir}/#{clean_dir}", :verbose => verbose)
185
+ elsif File.file?("#{dir}/#{clean_dir}")
186
+ raise("Error: #{dir}/#{clean_dir} is a file, expecting directory!")
170
187
  end
171
- # ------------------------------------
188
+ end
172
189
 
173
- # Skip if SIMP version doesn't match target base OS version
174
- unless Array(vermap[simpver.split('.').first]).include?(baseosver.split('.').first)
175
- if verbose
176
- warn("Could not find SIMP version mapping for #{simpver} for Base OS #{baseosver}")
177
- warn("Do you need to update vermap.yaml in the Gem?")
190
+ repo_target_dir = dir
191
+
192
+ # If we've pulled in reposync directories, we expect them to
193
+ # completely overwrite the directory of the same name in the
194
+ # target ISO so no pruning is required
195
+ #
196
+ # Note: CASE MATTERS on the directory names
197
+ if reposync_active
198
+ # We're working with the new EL8+ layout, so we need to target
199
+ # the SimpRepos subdirectory
200
+ repo_target_dir = File.join(dir, 'SimpRepos')
201
+ mkdir_p(repo_target_dir, :verbose => verbose)
202
+
203
+ repos_to_overwrite = Dir.glob(File.join(reposync_location, '*'))
204
+ .delete_if { |x| !File.directory?(x) }
205
+ .map { |x| File.basename(x) }
206
+
207
+ repos_to_overwrite.each do |repo|
208
+ src = File.join(reposync_location, repo)
209
+ target = File.join(dir, repo)
210
+
211
+ if File.directory?(target)
212
+ rm_rf(target, :verbose => verbose) if File.directory?(target)
213
+ else
214
+ target = File.join(repo_target_dir, repo)
178
215
  end
179
216
 
180
- next
217
+ cp_r(src, target, :verbose => verbose)
218
+ end
219
+ else
220
+ # Prune unwanted packages
221
+ begin
222
+ system("tar --no-same-permissions -C #{repo_target_dir} -xzf #{tball} *simp_pkglist.txt")
223
+ rescue StandardError
224
+ # Does not matter if the command fails
181
225
  end
182
226
 
183
- mkrepo = baseosver.split('.').first == '5' ? 'createrepo -s sha -p' : 'createrepo -p'
184
-
185
- @simp_dvd_dirs.each do |clean_dir|
186
- if File.directory?("#{dir}/#{clean_dir}")
187
- rm_rf("#{dir}/#{clean_dir}", :verbose => verbose)
188
- elsif File.file?("#{dir}/#{clean_dir}")
189
- fail("Error: #{dir}/#{clean_dir} is a file, expecting directory!")
227
+ pkglist_file = ENV.fetch(
228
+ 'SIMP_PKGLIST_FILE',
229
+ File.join(dir, "#{baseosver.split('.').first}-simp_pkglist.txt"),
230
+ )
231
+
232
+ puts
233
+ puts '-' * 80
234
+ puts "### Pruning packages not in file '#{pkglist_file}'"
235
+ puts
236
+ puts ' (override this with `SIMP_PKGLIST_FILE=<file>`)'
237
+ puts
238
+ puts '-' * 80
239
+ puts
240
+
241
+ if (args.prune.casecmp('false') != 0) && File.exist?(pkglist_file)
242
+ exclude_pkgs = []
243
+ File.read(pkglist_file).each_line do |line|
244
+ next if %r{^(\s+|#.*)$}.match?(line)
245
+
246
+ exclude_pkgs.push(line.chomp)
190
247
  end
248
+ prune_packages(dir, ['SIMP', 'SimpRepos'], exclude_pkgs, mkrepo)
191
249
  end
250
+ end
192
251
 
252
+ reposync_only = (ENV.fetch('SIMP_BUILD_reposync_only', 'no') == 'yes')
253
+ if reposync_only && !reposync_active
254
+ raise('ERROR: Reposync-only requested, but no reposync content found')
255
+ end
193
256
 
194
- repo_target_dir = dir
257
+ if reposync_only
258
+ puts
259
+ puts '-' * 80
260
+ puts '### Reposync-Only Mode ###'
261
+ puts
262
+ puts ' Locally built packages will not be added'
263
+ puts
264
+ puts '-' * 80
265
+ puts
266
+
267
+ # Only add the ISO modifications
268
+ system(%(tar --no-same-permissions --exclude="*.rpm" -C #{dir} -xzf #{tball}))
269
+ else
270
+ # Add the SIMP code and ISO modifications
271
+ system("tar --no-same-permissions -C #{dir} -xzf #{tball}")
195
272
 
196
- # If we've pulled in reposync directories, we expect them to
197
- # completely overwrite the directory of the same name in the
198
- # target ISO so no pruning is required
199
- #
200
- # Note: CASE MATTERS on the directory names
201
- if reposync_active
202
- # We're working with the new EL8+ layout, so we need to target
203
- # the SimpRepos subdirectory
204
- repo_target_dir = File.join(dir,'SimpRepos')
205
- mkdir_p(repo_target_dir, :verbose => verbose)
206
-
207
- repos_to_overwrite = Dir.glob(File.join(reposync_location, '*'))
208
- .delete_if{|x| !File.directory?(x)}
209
- .map{|x| File.basename(x)}
210
-
211
- repos_to_overwrite.each do |repo|
212
- src = File.join(reposync_location, repo)
213
- target = File.join(dir, repo)
214
-
215
- if File.directory?(target)
216
- rm_rf(target, :verbose => verbose) if File.directory?(target)
217
- else
218
- target = File.join(repo_target_dir, repo)
219
- end
273
+ # Pop the SIMP directory from the tarball into the correct spot
274
+ # FIXME: This is a hack
275
+ unless dir == repo_target_dir
276
+ simpdir = File.join(dir, 'SIMP')
220
277
 
221
- cp_r(src, target, :verbose => verbose)
222
- end
223
- else
224
- # Prune unwanted packages
225
- begin
226
- system("tar --no-same-permissions -C #{repo_target_dir} -xzf #{tball} *simp_pkglist.txt")
227
- rescue
228
- # Does not matter if the command fails
229
- end
230
-
231
- pkglist_file = ENV.fetch(
232
- 'SIMP_PKGLIST_FILE',
233
- File.join(dir,"#{baseosver.split('.').first}-simp_pkglist.txt")
234
- )
235
-
236
- puts
237
- puts '-'*80
238
- puts "### Pruning packages not in file '#{pkglist_file}'"
239
- puts
240
- puts ' (override this with `SIMP_PKGLIST_FILE=<file>`)'
241
- puts
242
- puts '-'*80
243
- puts
244
-
245
- if (args.prune.casecmp("false") != 0) && File.exist?(pkglist_file)
246
- exclude_pkgs = Array.new
247
- File.read(pkglist_file).each_line do |line|
248
- next if line =~ /^(\s+|#.*)$/
249
- exclude_pkgs.push(line.chomp)
250
- end
251
- prune_packages(dir,['SIMP','SimpRepos'],exclude_pkgs,mkrepo)
278
+ if File.directory?(simpdir)
279
+ cp_r(simpdir, repo_target_dir, :verbose => verbose)
280
+ rm_rf(simpdir, :verbose => verbose)
252
281
  end
253
282
  end
254
283
 
255
- reposync_only = (ENV.fetch('SIMP_BUILD_reposync_only', 'no') == 'yes')
256
- if reposync_only && !reposync_active
257
- fail("ERROR: Reposync-only requested, but no reposync content found")
258
- end
284
+ Dir.chdir("#{repo_target_dir}/SIMP") do
285
+ # Add the SIMP Dependencies
286
+ simp_base_ver = simpver.split('-').first
259
287
 
260
- if reposync_only
261
- puts
262
- puts '-'*80
263
- puts '### Reposync-Only Mode ###'
264
- puts
265
- puts ' Locally built packages will not be added'
266
- puts
267
- puts '-'*80
268
- puts
269
-
270
- # Only add the ISO modifications
271
- system(%(tar --no-same-permissions --exclude="*.rpm" -C #{dir} -xzf #{tball}))
272
- else
273
- # Add the SIMP code and ISO modifications
274
- system("tar --no-same-permissions -C #{dir} -xzf #{tball}")
288
+ if $simp6
289
+ yum_dep_location = File.join(@build_dir, 'yum_data', 'packages')
290
+ else
291
+ simp_dep_src = %(SIMP#{simp_base_ver}_#{baseos}#{baseosver}_#{arch})
292
+ yum_dep_location = File.join(@build_dir, 'yum_data', simp_dep_src, 'packages')
293
+ end
275
294
 
276
- # Pop the SIMP directory from the tarball into the correct spot
277
- # FIXME: This is a hack
278
- unless dir == repo_target_dir
279
- simpdir = File.join(dir,'SIMP')
295
+ yum_dep_rpms = Dir.glob(File.join(yum_dep_location, '*.rpm'))
280
296
 
281
- if File.directory?(simpdir)
282
- cp_r(simpdir, repo_target_dir, :verbose => verbose)
283
- rm_rf(simpdir, :verbose => verbose)
284
- end
297
+ if !File.directory?(yum_dep_location) && !reposync_active
298
+ raise("Could not find dependency directory at #{yum_dep_location}")
285
299
  end
286
300
 
287
- Dir.chdir("#{repo_target_dir}/SIMP") do
288
- # Add the SIMP Dependencies
289
- simp_base_ver = simpver.split('-').first
290
-
291
- if $simp6
292
- yum_dep_location = File.join(@build_dir,'yum_data','packages')
293
- else
294
- simp_dep_src = %(SIMP#{simp_base_ver}_#{baseos}#{baseosver}_#{arch})
295
- yum_dep_location = File.join(@build_dir,'yum_data',simp_dep_src,'packages')
296
- end
301
+ if yum_dep_rpms.empty? && !reposync_active
302
+ raise("Could not find any dependency RPMs at #{yum_dep_location}")
303
+ end
297
304
 
298
- yum_dep_rpms = Dir.glob(File.join(yum_dep_location,'*.rpm'))
305
+ # Add any one-off RPMs that you might want to add to your own build
306
+ # These are *not* checked to make sure that they actually match your
307
+ # environment
308
+ aux_packages = File.join(File.dirname(yum_dep_location), 'aux_packages')
309
+ if File.directory?(aux_packages)
310
+ yum_dep_rpms += Dir.glob(File.join(aux_packages, '*.rpm'))
311
+ end
299
312
 
300
- unless File.directory?(yum_dep_location)
301
- fail("Could not find dependency directory at #{yum_dep_location}") unless reposync_active
302
- end
313
+ yum_dep_rpms.each do |rpm|
314
+ rpm_arch = rpm.split('.')[-2]
303
315
 
304
- if yum_dep_rpms.empty?
305
- fail("Could not find any dependency RPMs at #{yum_dep_location}") unless reposync_active
316
+ unless File.directory?(rpm_arch)
317
+ mkdir(rpm_arch)
306
318
  end
307
319
 
308
- # Add any one-off RPMs that you might want to add to your own build
309
- # These are *not* checked to make sure that they actually match your
310
- # environment
311
- aux_packages = File.join(File.dirname(yum_dep_location),'aux_packages')
312
- if File.directory?(aux_packages)
313
- yum_dep_rpms += Dir.glob(File.join(aux_packages,'*.rpm'))
314
- end
320
+ # Just in case this is a symlink, broken, or some other nonsense.
321
+ target_file = File.join(rpm_arch, File.basename(rpm))
322
+ rm_f(target_file) if File.exist?(target_file)
315
323
 
316
- yum_dep_rpms.each do |rpm|
317
- rpm_arch = rpm.split('.')[-2]
318
-
319
- unless File.directory?(rpm_arch)
320
- mkdir(rpm_arch)
321
- end
322
-
323
- # Just in case this is a symlink, broken, or some other nonsense.
324
- target_file = File.join(rpm_arch,File.basename(rpm))
325
- rm_f(target_file) if File.exist?(target_file)
326
-
327
- cp(rpm,rpm_arch, :verbose => verbose)
328
- end
324
+ cp(rpm, rpm_arch, :verbose => verbose)
325
+ end
329
326
 
330
- unless File.exist?('repodata/repomd.xml')
331
- fail("Error: Could not run createrepo in #{Dir.pwd}") unless system(%(#{mkrepo} .))
332
- end
327
+ if !File.exist?('repodata/repomd.xml') && !system(%(#{mkrepo} .))
328
+ raise("Error: Could not run createrepo in #{Dir.pwd}")
333
329
  end
330
+ end
334
331
 
335
- if reposync_active
336
- fail("Error: Could not run createrepo in #{Dir.pwd}") unless system(%(#{mkrepo} .))
337
- else
338
- ln_sf('noarch', arch, :verbose => verbose) if (!File.directory?(arch) && File.directory?('noarch'))
339
- fail("Could not find architecture '#{arch}' in the SIMP distribution") unless (File.directory?(arch) || File.symlink?(arch))
340
-
341
- # Get everything set up properly...
342
- Dir.chdir(arch) do
343
- Dir.glob('../*') do |rpm_dir|
344
- # Don't dive into ourselves
345
- next if File.basename(rpm_dir) == arch
346
-
347
- Dir.glob(%(#{rpm_dir}/*.rpm)) do |source_rpm|
348
- link_target = File.basename(source_rpm)
349
- if File.exist?(source_rpm) && File.exist?(link_target)
350
- next if Pathname.new(source_rpm).realpath == Pathname.new(link_target).realpath
351
- end
352
-
353
- ln_sf(source_rpm,link_target, :verbose => verbose)
332
+ if reposync_active
333
+ raise("Error: Could not run createrepo in #{Dir.pwd}") unless system(%(#{mkrepo} .))
334
+ else
335
+ ln_sf('noarch', arch, :verbose => verbose) if !File.directory?(arch) && File.directory?('noarch')
336
+ raise("Could not find architecture '#{arch}' in the SIMP distribution") unless File.directory?(arch) || File.symlink?(arch)
337
+
338
+ # Get everything set up properly...
339
+ Dir.chdir(arch) do
340
+ Dir.glob('../*') do |rpm_dir|
341
+ # Don't dive into ourselves
342
+ next if File.basename(rpm_dir) == arch
343
+
344
+ Dir.glob(%(#{rpm_dir}/*.rpm)) do |source_rpm|
345
+ link_target = File.basename(source_rpm)
346
+ if File.exist?(source_rpm) && File.exist?(link_target) && (Pathname.new(source_rpm).realpath == Pathname.new(link_target).realpath)
347
+ next
354
348
  end
355
- end
356
349
 
357
- fail("Error: Could not run createrepo in #{Dir.pwd}") unless system(%(#{mkrepo} .))
350
+ ln_sf(source_rpm, link_target, :verbose => verbose)
351
+ end
358
352
  end
353
+
354
+ raise("Error: Could not run createrepo in #{Dir.pwd}") unless system(%(#{mkrepo} .))
359
355
  end
360
356
  end
357
+ end
361
358
 
362
- ### Munge the Repos
359
+ ### Munge the Repos
363
360
 
364
- # Create an Updates directory that is properly populated
365
- updates_readme = <<~README
361
+ # Create an Updates directory that is properly populated
362
+ updates_readme = <<~README
366
363
  This directory houses updates to NON-MODULAR RPMs.
367
364
 
368
365
  DO NOT put modular RPMs in this directory or you will break your
369
366
  system updates!
370
- README
371
-
372
- updates_dir = File.join(dir, 'Updates')
373
- mkdir_p(updates_dir)
374
-
375
- Dir.chdir(updates_dir) do
376
- File.open('README','w'){|fh| fh.puts(updates_readme) }
377
-
378
- repos = Dir.glob(File.join('..','**','repodata'))
379
- modular_repos = Dir.glob(File.join('..','**','repodata','*-modules.*'))
380
- non_modular_repos = repos.select{|x| modular_repos.grep(%r{^#{Regexp.escape(x)}}).empty? }
381
- non_modular_repos.map!{|x| File.split(x).first}
382
- non_modular_repos.delete_if{|x| x.match(%r{/SimpRepos|/SIMP}) }
383
- non_modular_repos.each do |non_modular_repo|
384
- Dir.glob(File.join(non_modular_repo, '**', '*.rpm')).each do |rpm|
385
- # when non_modular_repo is '..', can still find RPMs we need
386
- # to exclude
387
- next if rpm.match(%r{/SimpRepos|/SIMP})
388
-
389
- rpm_dest = File.basename(rpm)
390
- if File.exist?(rpm) && File.exist?(rpm_dest)
391
- next if (File.realpath(rpm) == File.realpath(rpm_dest))
392
- end
393
-
394
- ln_sf(rpm, rpm_dest, :verbose => verbose)
367
+ README
368
+
369
+ updates_dir = File.join(dir, 'Updates')
370
+ mkdir_p(updates_dir)
371
+
372
+ Dir.chdir(updates_dir) do
373
+ File.open('README', 'w') { |fh| fh.puts(updates_readme) }
374
+
375
+ repos = Dir.glob(File.join('..', '**', 'repodata'))
376
+ modular_repos = Dir.glob(File.join('..', '**', 'repodata', '*-modules.*'))
377
+ non_modular_repos = repos.select { |x| modular_repos.grep(%r{^#{Regexp.escape(x)}}).empty? }
378
+ non_modular_repos.map! { |x| File.split(x).first }
379
+ non_modular_repos.delete_if { |x| x.match(%r{/SimpRepos|/SIMP}) }
380
+ non_modular_repos.each do |non_modular_repo|
381
+ Dir.glob(File.join(non_modular_repo, '**', '*.rpm')).each do |rpm|
382
+ # when non_modular_repo is '..', can still find RPMs we need
383
+ # to exclude
384
+ next if %r{/SimpRepos|/SIMP}.match?(rpm)
385
+
386
+ rpm_dest = File.basename(rpm)
387
+ if File.exist?(rpm) && File.exist?(rpm_dest) && (File.realpath(rpm) == File.realpath(rpm_dest))
388
+ next
395
389
  end
396
- end
397
390
 
398
- fail("Error: Could not run createrepo in #{Dir.pwd}") unless system(%(#{mkrepo} .))
391
+ ln_sf(rpm, rpm_dest, :verbose => verbose)
392
+ end
399
393
  end
400
394
 
401
- # New ISO Layout
402
- if reposync_active
403
- Dir.chdir(repo_target_dir) do
404
- gpgkeysdir = File.join('SIMP','GPGKEYS')
395
+ raise("Error: Could not run createrepo in #{Dir.pwd}") unless system(%(#{mkrepo} .))
396
+ end
405
397
 
406
- if File.directory?(gpgkeysdir)
407
- cp_r(gpgkeysdir, '.', :verbose => verbose)
408
- rm_rf(gpgkeysdir, :verbose => verbose)
409
- end
398
+ # New ISO Layout
399
+ if reposync_active
400
+ Dir.chdir(repo_target_dir) do
401
+ gpgkeysdir = File.join('SIMP', 'GPGKEYS')
402
+
403
+ if File.directory?(gpgkeysdir)
404
+ cp_r(gpgkeysdir, '.', :verbose => verbose)
405
+ rm_rf(gpgkeysdir, :verbose => verbose)
410
406
  end
411
407
  end
408
+ end
412
409
 
410
+ # NOTE: repoclosure doesn't work with modular repos, and probably
411
+ # never can:
412
+ #
413
+ # https://bugzilla.redhat.com/show_bug.cgi?id=1547041
414
+ #
415
+ # If an ISO somehow has *NO* modular repos/packages, than running
416
+ # with SIMP_BUILD_repoclosure=yes is safe. Otherwise, it will
417
+ # probably fail even if all the packages depsolve cleanly in real
418
+ # life
419
+ if ENV.fetch('SIMP_BUILD_repoclosure', 'no') == 'yes'
420
+ # Make sure we have all of the necessary RPMs!
421
+ Rake::Task['pkg:repoclosure'].invoke(File.expand_path(dir))
422
+ end
413
423
 
414
- # NOTE: repoclosure doesn't work with modular repos, and probably
415
- # never can:
416
- #
417
- # https://bugzilla.redhat.com/show_bug.cgi?id=1547041
418
- #
419
- # If an ISO somehow has *NO* modular repos/packages, than running
420
- # with SIMP_BUILD_repoclosure=yes is safe. Otherwise, it will
421
- # probably fail even if all the packages depsolve cleanly in real
422
- # life
423
- if ENV.fetch('SIMP_BUILD_repoclosure', 'no') == 'yes'
424
- # Make sure we have all of the necessary RPMs!
425
- Rake::Task['pkg:repoclosure'].invoke(File.expand_path(dir))
426
- end
424
+ # Do some sane chmod'ing and build ISO
425
+ system("chmod -fR u+rwX,g+rX,o=g #{dir}")
426
+ simp_output_name = "SIMP-#{simpver}-#{baseos}-#{baseosver}-#{arch}"
427
+ @simp_output_iso = "#{simp_output_name}.iso"
428
+
429
+ mkisofs_cmd = [
430
+ 'mkisofs',
431
+ "-A SIMP-#{simpver}",
432
+ "-V SIMP-#{simpver}",
433
+ "-volset SIMP-#{simpver}",
434
+ '-uid 0',
435
+ '-gid 0',
436
+ '-J',
437
+ '-joliet-long',
438
+ '-r',
439
+ '-v',
440
+ '-T',
441
+ '-b isolinux/isolinux.bin',
442
+ '-c boot.cat',
443
+ '-boot-load-size 4',
444
+ '-boot-info-table',
445
+ '-no-emul-boot',
446
+ '-eltorito-alt-boot',
447
+ '-e images/efiboot.img',
448
+ # This is apparently needed twice to get the lines above it to
449
+ # take. Not sure why.
450
+ '-no-emul-boot',
451
+ '-m TRANS.TBL',
452
+ '-x ./lost+found',
453
+ "-o #{@simp_output_iso}",
454
+ dir,
455
+ ].join(' ')
456
+
457
+ $stdout.puts "Running: #{mkisofs_cmd}"
458
+
459
+ system(mkisofs_cmd)
460
+ end
461
+ end
427
462
 
428
- # Do some sane chmod'ing and build ISO
429
- system("chmod -fR u+rwX,g+rX,o=g #{dir}")
430
- simp_output_name = "SIMP-#{simpver}-#{baseos}-#{baseosver}-#{arch}"
431
- @simp_output_iso = "#{simp_output_name}.iso"
432
-
433
- mkisofs_cmd = [
434
- 'mkisofs',
435
- "-A SIMP-#{simpver}",
436
- "-V SIMP-#{simpver}",
437
- "-volset SIMP-#{simpver}",
438
- '-uid 0',
439
- '-gid 0',
440
- '-J',
441
- '-joliet-long',
442
- '-r',
443
- '-v',
444
- '-T',
445
- '-b isolinux/isolinux.bin',
446
- '-c boot.cat',
447
- '-boot-load-size 4',
448
- '-boot-info-table',
449
- '-no-emul-boot',
450
- '-eltorito-alt-boot',
451
- '-e images/efiboot.img',
452
- # This is apparently needed twice to get the lines above it to
453
- # take. Not sure why.
454
- '-no-emul-boot',
455
- '-m TRANS.TBL',
456
- '-x ./lost+found',
457
- "-o #{@simp_output_iso}",
458
- dir
459
- ].join(' ')
460
-
461
- $stdout.puts "Running: #{mkisofs_cmd}"
462
-
463
- system(mkisofs_cmd)
464
- end
465
- end # End of tarfiles loop
463
+ # If we got here and didn't generate any ISOs, something went horribly wrong
464
+ raise('Error: No ISO was built!') unless @simp_output_iso && File.exist?(@simp_output_iso)
466
465
 
467
- # If we got here and didn't generate any ISOs, something went horribly wrong
468
- fail('Error: No ISO was built!') unless ( @simp_output_iso && File.exist?(@simp_output_iso) )
466
+ # Embed the validation checksum
467
+ system("implantisomd5 --supported-iso #{@simp_output_iso}")
468
+ end
469
469
 
470
- # Embed the validation checksum
471
- system("implantisomd5 --supported-iso #{@simp_output_iso}")
470
+ # desc <<-EOM
471
+ # Build the source ISO.
472
+ # Note: The process clobbers the temporary and built files, rebuilds the
473
+ # tarball(s) and packages the source ISO. Therefore it will take a
474
+ # while.
475
+ # * :key - The GPG key to sign the RPMs with. Defaults to 'prod'.
476
+ # EOM
477
+ task :src, [:prep, :key] do |_t, args|
478
+ args.with_defaults(:key => 'prod')
479
+
480
+ if Dir.glob("#{@dvd_dir}/*.gz").empty?
481
+ raise('Error: Could not find compiled source tarballs')
472
482
  end
473
483
 
474
- =begin
475
- desc <<-EOM
476
- Build the source ISO.
477
- Note: The process clobbers the temporary and built files, rebuilds the
478
- tarball(s) and packages the source ISO. Therefore it will take a
479
- while.
480
- * :key - The GPG key to sign the RPMs with. Defaults to 'prod'.
481
- EOM
482
- =end
483
- task :src,[:prep, :key] do |t,args|
484
- args.with_defaults(:key => 'prod')
485
-
486
- if Dir.glob("#{@dvd_dir}/*.gz").empty?
487
- fail("Error: Could not find compiled source tarballs")
488
- end
484
+ Rake::Task['tar:build']
489
485
 
490
- Rake::Task['tar:build']
491
-
492
- Dir.chdir(@base_dir) do
493
- File.basename(Dir.glob("#{@dvd_dir}/*.tar.gz").first,'.tar.gz') =~ /SIMP-DVD-[^-]+-(.+)/
494
- name = "SIMP-#{$1}"
495
- sh %{mkisofs -uid 0 -gid 0 -D -A #{name} -J -joliet-long -m ".git*" -m "./build/tmp" -m "./build/SRPMS" -m "./build/RPMS" -m "./build/build_keys" -o #{name}.src.iso .}
496
- end
486
+ Dir.chdir(@base_dir) do
487
+ File.basename(Dir.glob("#{@dvd_dir}/*.tar.gz").first, '.tar.gz') =~ %r{SIMP-DVD-[^-]+-(.+)}
488
+ name = "SIMP-#{::Regexp.last_match(1)}"
489
+ sh %(mkisofs -uid 0 -gid 0 -D -A #{name} -J -joliet-long -m ".git*" -m "./build/tmp" -m "./build/SRPMS" -m "./build/RPMS" -m "./build/build_keys" -o #{name}.src.iso .)
497
490
  end
498
491
  end
499
492
  end