simp-rake-helpers 5.12.2 → 5.12.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4da7d0cf624209586f4a159cd06bf86cc61da199ddecc3d2730e53a267225316
4
- data.tar.gz: 44fcb7049d7a6a39b433e88de24894db6817fc06620fddc6ac7f67d3481c6a42
3
+ metadata.gz: 33beb8e656840401f0fb3a07f7aee982fe3931d53b2e233f2e0024398fd03d6c
4
+ data.tar.gz: 81111ce62e4e8b3ca03a478d765e3944ee8b297af7b2ee1ef5e182e8bacf36f3
5
5
  SHA512:
6
- metadata.gz: 6f4a80dd4864f3ade29b60932b83d87b8d2fd56384fd03bc5df9de9a03f70f54445333e3654b3d2225d67e0ffdc5f1f772c5a23908a0ea40378c648043c00fb2
7
- data.tar.gz: 862aaaac472efde1959b314d66ddb254379be34f2ecbfa1f4715fc58882010fcfc14c5caf41a090947b2d3955b2c27eb146bec1b2236a817caebc95ada01f857
6
+ metadata.gz: 9589c0d228dc77b2e75a641f158ca878c56498566696039c71eca0c414078299c2a7c4951cf48d45e0388b9cb72a1615321381084a11837fbbc42259a65ea880
7
+ data.tar.gz: 4267702fa365999433e673f26ff0896ad9a088ea7ce7ae26fff38bbc4d9c37b1c6239956bc016644ea8b2aa3b10925989f44fbb178a3d611380eb79db4b5cc6e
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ### 5.12.3 / 2021-09-15
2
+ - Handle multiple options for required applications in build:auto
3
+ - Allow users to populate a `reposync` directory in the YUM build space that
4
+ will overwrite any target directories on the ISO.
5
+ - The SIMP tarball is unpacked after the copy so you always get the latest
6
+ built artifacts.
7
+ - Pruning will not occur if this technique is used since it is presumed that
8
+ you are overwriting the data with authoritative content.
9
+ - Added a helpful tip about updating vermap.yaml
10
+ - Fixed the call to repoclosure if on a system with DNF
11
+ - Added support for EL8 to vermap.yaml
12
+
1
13
  ### 5.12.2 / 2021-06-22
2
14
  - Change to '-1' from '-0' as the default RPM release
3
15
 
@@ -18,6 +18,8 @@ module Simp::Rake::Build
18
18
  class Auto < ::Rake::TaskLib
19
19
 
20
20
  # Commands that are required by some part of the rake stack
21
+ #
22
+ # Use an array for commands that may have multiple valid options
21
23
  BUILD_REQUIRED_COMMANDS = [
22
24
  'basename',
23
25
  'cat',
@@ -42,7 +44,7 @@ module Simp::Rake::Build
42
44
  'make',
43
45
  'mkdir',
44
46
  'mktemp',
45
- 'python',
47
+ ['python','python2','python3'],
46
48
  'readlink',
47
49
  'repoclosure',
48
50
  'rm',
@@ -62,7 +64,7 @@ module Simp::Rake::Build
62
64
  'wc',
63
65
  'which',
64
66
  'xargs',
65
- 'yum',
67
+ ['dnf','yum'],
66
68
  'yumdownloader'
67
69
  ]
68
70
 
@@ -204,7 +204,8 @@ module Simp::Rake::Build
204
204
 
205
205
  Dir.chdir(target_dir) do
206
206
  if File.exist?('packages.yaml')
207
- known_package_hash = YAML::load_file('packages.yaml')
207
+ # The empty YAML file returns 'false'
208
+ known_package_hash = YAML::load_file('packages.yaml') || {}
208
209
  end
209
210
  end
210
211
 
@@ -276,7 +277,7 @@ module Simp::Rake::Build
276
277
  pkg = downloaded_package_hash[pkg][:rpm_name]
277
278
  }.compact
278
279
 
279
- if known_packages.empty? && downloaded_packages.empty?
280
+ if known_packages.empty? && downloaded_packages.empty? && Dir.glob('reposync/**/repomd.xml').empty?
280
281
  fail <<-EOM
281
282
  Error: Could not find anything to do!
282
283
 
@@ -120,6 +120,9 @@ module Simp::Rake::Build
120
120
  end
121
121
  end
122
122
 
123
+ reposync_location = File.join(@build_dir,'yum_data','reposync')
124
+ reposync_active = !Dir.glob(File.join(reposync_location, '**', 'repomd.xml')).empty?
125
+
123
126
  tarfiles = File.directory?(tarball) ?
124
127
  Dir.glob("#{tarball}/*.tar.gz") : [tarball]
125
128
  vermap = YAML::load_file( File.join( File.dirname(__FILE__), 'vermap.yaml'))
@@ -171,6 +174,7 @@ module Simp::Rake::Build
171
174
  unless Array(vermap[simpver.split('.').first]).include?(baseosver.split('.').first)
172
175
  if verbose
173
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?")
174
178
  end
175
179
 
176
180
  next
@@ -186,34 +190,53 @@ module Simp::Rake::Build
186
190
  end
187
191
  end
188
192
 
189
- # Prune unwanted packages
190
- begin
191
- system("tar --no-same-permissions -C #{dir} -xzf #{tball} *simp_pkglist.txt")
192
- rescue
193
- # Does not matter if the command fails
194
- end
193
+ # If we've pulled in reposync directories, we expect them to
194
+ # completely overwrite the directory of the same name in the
195
+ # target ISO so no pruning is required
196
+ #
197
+ # Note: CASE MATTERS on the directory names
198
+ if reposync_active
199
+ repos_to_overwrite = Dir.glob(File.join(reposync_location, '*'))
200
+ .delete_if{|x| !File.directory?(x)}
201
+ .map{|x| File.basename(x)}
202
+
203
+ repos_to_overwrite.each do |repo|
204
+ src = File.join(reposync_location, repo)
205
+ target = File.join(dir, repo)
206
+
207
+ rm_rf(target, :verbose => verbose) if File.directory?(target)
208
+ cp_r(src, dir, :verbose => verbose)
209
+ end
210
+ else
211
+ # Prune unwanted packages
212
+ begin
213
+ system("tar --no-same-permissions -C #{dir} -xzf #{tball} *simp_pkglist.txt")
214
+ rescue
215
+ # Does not matter if the command fails
216
+ end
195
217
 
196
- pkglist_file = ENV.fetch(
197
- 'SIMP_PKGLIST_FILE',
198
- File.join(dir,"#{baseosver.split('.').first}-simp_pkglist.txt")
199
- )
200
-
201
- puts
202
- puts '-'*80
203
- puts "### Pruning packages not in file '#{pkglist_file}'"
204
- puts
205
- puts ' (override this with `SIMP_PKGLIST_FILE=<file>`)'
206
- puts
207
- puts '-'*80
208
- puts
209
-
210
- if (args.prune.casecmp("false") != 0) && File.exist?(pkglist_file)
211
- exclude_pkgs = Array.new
212
- File.read(pkglist_file).each_line do |line|
213
- next if line =~ /^(\s+|#.*)$/
214
- exclude_pkgs.push(line.chomp)
218
+ pkglist_file = ENV.fetch(
219
+ 'SIMP_PKGLIST_FILE',
220
+ File.join(dir,"#{baseosver.split('.').first}-simp_pkglist.txt")
221
+ )
222
+
223
+ puts
224
+ puts '-'*80
225
+ puts "### Pruning packages not in file '#{pkglist_file}'"
226
+ puts
227
+ puts ' (override this with `SIMP_PKGLIST_FILE=<file>`)'
228
+ puts
229
+ puts '-'*80
230
+ puts
231
+
232
+ if (args.prune.casecmp("false") != 0) && File.exist?(pkglist_file)
233
+ exclude_pkgs = Array.new
234
+ File.read(pkglist_file).each_line do |line|
235
+ next if line =~ /^(\s+|#.*)$/
236
+ exclude_pkgs.push(line.chomp)
237
+ end
238
+ prune_packages(dir,['SIMP'],exclude_pkgs,mkrepo)
215
239
  end
216
- prune_packages(dir,['SIMP'],exclude_pkgs,mkrepo)
217
240
  end
218
241
 
219
242
  # Add the SIMP code
@@ -230,13 +253,14 @@ module Simp::Rake::Build
230
253
  yum_dep_location = File.join(@build_dir,'yum_data',simp_dep_src,'packages')
231
254
  end
232
255
 
256
+ yum_dep_rpms = Dir.glob(File.join(yum_dep_location,'*.rpm'))
257
+
233
258
  unless File.directory?(yum_dep_location)
234
- fail("Could not find dependency directory at #{yum_dep_location}")
259
+ fail("Could not find dependency directory at #{yum_dep_location}") unless reposync_active
235
260
  end
236
261
 
237
- yum_dep_rpms = Dir.glob(File.join(yum_dep_location,'*.rpm'))
238
262
  if yum_dep_rpms.empty?
239
- fail("Could not find any dependency RPMs at #{yum_dep_location}")
263
+ fail("Could not find any dependency RPMs at #{yum_dep_location}") unless reposync_active
240
264
  end
241
265
 
242
266
  # Add any one-off RPMs that you might want to add to your own build
@@ -261,7 +285,9 @@ module Simp::Rake::Build
261
285
  cp(rpm,rpm_arch, :verbose => verbose)
262
286
  end
263
287
 
264
- fail("Could not find architecture '#{arch}' in the SIMP distribution") unless File.directory?(arch)
288
+ ln_s('noarch', arch, :verbose => verbose) if (!File.directory?(arch) && File.directory?('noarch'))
289
+ fail("Could not find architecture '#{arch}' in the SIMP distribution") unless (File.directory?(arch) || File.symlink?(arch))
290
+
265
291
  # Get everything set up properly...
266
292
  Dir.chdir(arch) do
267
293
  Dir.glob('../*') do |rpm_dir|
@@ -606,23 +606,19 @@ protect=1
606
606
  mkdir_p('repos/lookaside')
607
607
  mkdir_p('repodata')
608
608
 
609
- Dir.glob(args[:target_dir]).each do |base_dir|
610
- Find.find(base_dir) do |path|
611
- if (path =~ /.*\.rpm$/) and (path !~ /.*.src\.rpm$/)
612
- sym_path = "repos/base/#{File.basename(path)}"
613
- ln_s(path,sym_path, :verbose => @verbose) unless File.exists?(sym_path)
614
- end
615
- end
609
+ Dir.glob(File.join(args[:target_dir], '**', '*.rpm'))
610
+ .delete_if{|x| x =~ /\.src\.rpm$/}
611
+ .each do |path|
612
+ sym_path = "repos/base/#{File.basename(path)}"
613
+ ln_s(path,sym_path, :verbose => @verbose) unless File.exists?(sym_path)
616
614
  end
617
615
 
618
616
  if args[:aux_dir]
619
- Dir.glob(args[:aux_dir]).each do |aux_dir|
620
- Find.find(aux_dir) do |path|
621
- if (path =~ /.*\.rpm$/) and (path !~ /.*.src\.rpm$/)
622
- sym_path = "repos/lookaside/#{File.basename(path)}"
623
- ln_s(path,sym_path, :verbose => @verbose) unless File.exists?(sym_path)
624
- end
625
- end
617
+ Dir.glob(File.join(args[:aux_dir], '**', '*.rpm'))
618
+ .delete_if{|x| x =~ /\.src\.rpm$/}
619
+ .each do |path|
620
+ sym_path = "repos/lookaside/#{File.basename(path)}"
621
+ ln_s(path,sym_path, :verbose => @verbose) unless File.exists?(sym_path)
626
622
  end
627
623
  end
628
624
 
@@ -647,7 +643,11 @@ protect=1
647
643
  file.write(ERB.new(yum_conf_template,nil,'-').result(binding))
648
644
  end
649
645
 
650
- cmd = 'repoclosure -c repodata -n -t -r base -l lookaside -c yum.conf'
646
+ if which('dnf')
647
+ cmd = 'repoclosure -c base.conf --disablerepo=* --enablerepo=base'
648
+ else
649
+ cmd = 'repoclosure -c repodata -n -t -r base -l lookaside -c yum.conf'
650
+ end
651
651
 
652
652
  if ENV['SIMP_BUILD_verbose'] == 'yes'
653
653
  puts
@@ -1,5 +1,5 @@
1
1
  ---
2
- "6": ["6","7"]
2
+ "6": ["6","7","8"]
3
3
  "5": "7"
4
4
  "4": "6"
5
5
  "2": "5"
@@ -2,5 +2,5 @@ module Simp; end
2
2
  module Simp::Rake; end
3
3
 
4
4
  class Simp::Rake::Helpers
5
- VERSION = '5.12.2'
5
+ VERSION = '5.12.3'
6
6
  end
@@ -20,8 +20,8 @@ class Simp::Rake::Helpers
20
20
  invalid_commands = Array.new
21
21
 
22
22
  Array(required_commands).each do |command|
23
- unless Facter::Core::Execution.which(command)
24
- invalid_commands << command
23
+ unless Array(command).find { |x| Facter::Core::Execution.which(x) }
24
+ invalid_commands << Array(command).join(' or ')
25
25
  end
26
26
  end
27
27
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simp-rake-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.12.2
4
+ version: 5.12.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Tessmer
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-06-28 00:00:00.000000000 Z
12
+ date: 2021-09-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: simp-beaker-helpers