simp-rake-helpers 2.4.7 → 2.5.0

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
  SHA1:
3
- metadata.gz: e3c3b2c1a47ba2ce959ba6e31716fd3dcc288dd3
4
- data.tar.gz: 8222f40ce96eab1ec4e4477f5d140de3cdb4cead
3
+ metadata.gz: 6ac44b8dfa44bfa0bde4f0752f8698c347ad93bd
4
+ data.tar.gz: e425013cffa3024ad3538d3679119c2f4f4855f7
5
5
  SHA512:
6
- metadata.gz: c5f7b59e386f9cead4d67a12a11d328079de00a2482ef0209dd83a1c1224327fa7a0e5c499512d56292e99f6e1fb5503e2a2fbdd5509cd85b875c80ca99b280b
7
- data.tar.gz: a031834da602e106f958bd0724ea441ab8d29a87e8ba1b2fc7d50448e1226016b753136b24a34bd94a1fec7824f3fd7efb7ff804b66f9e953ba0ec745bd6431b
6
+ metadata.gz: 8927124043e3a9494ec35b679c2b8a2dd1a594b0bdc26c8c9f262684e26ceeeb04351eda37256dcf88bf5940f7ac286c996ec7a6da5672b3b236e7b757644839
7
+ data.tar.gz: f09399ce4a60cd02aa848d87668d417c64fd22d3400f60dbaa1f6b6f3cd91ab220a06616173fe2ab45909e51ec4eb0229524260578f1bef062d0ede804d74dd6
data/Gemfile CHANGED
@@ -9,6 +9,8 @@ gem_sources.each { |gem_source| source gem_source }
9
9
 
10
10
  gemspec
11
11
 
12
+ gem 'ruby-progressbar'
13
+ gem 'simp-build-helpers'
12
14
  gem 'simp-beaker-helpers'
13
15
 
14
16
  if puppetversion
@@ -11,6 +11,28 @@ module Simp::Rake
11
11
  require 'simp/rpm'
12
12
  require 'simp/rake/pkg'
13
13
 
14
+ attr_reader(:puppetfile)
15
+ attr_reader(:module_paths)
16
+
17
+ def load_puppetfile(method='tracking')
18
+ unless @puppetfile
19
+
20
+ @puppetfile = R10KHelper.new("Puppetfile.#{method}")
21
+ @module_paths = []
22
+
23
+ @puppetfile.each_module do |mod|
24
+ path = mod[:path]
25
+ if Dir.exists?(path)
26
+ @module_paths.push(path)
27
+ end
28
+ end
29
+
30
+ if @module_paths.empty?
31
+ fail("Error: Could not find any module paths in 'Puppetfile.#{method}'")
32
+ end
33
+ end
34
+ end
35
+
14
36
  # Force the encoding to something that Ruby >= 1.9 is happy with
15
37
  def encode_line(line)
16
38
  if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('1.9')
@@ -27,16 +27,16 @@ module Simp::Rake::Build
27
27
 
28
28
  Arguments:
29
29
  * :release => SIMP release to build (e.g., '5.1.X')
30
- - :iso_paths => path to source ISO(s) (colon-delimited list of files/directories) [Default: '.']
30
+ - :iso_paths => path to source ISO(s) and/or directories [Default: '.']
31
+ NOTE: colon-delimited list
31
32
  - :tarball => SIMP build tarball file; if given, skips tar build. [Default: 'false']
32
33
  - :output_dir => path to write SIMP ISO. [Default: './SIMP_ISO']
33
34
  - :do_checksum => Use sha256sum checksum to compare each ISO. [Default: 'false']
34
35
  - :key_name => Key name to sign packages [Default: 'dev']
35
- - :packer_vars => Write a packer vars.json to go with this ISO [Default: 'true']
36
- - :verbose => Enable verbose reporting. [Default: 'false']
37
36
 
38
37
  ENV vars:
39
- - SIMP_BUILD_staging_dir => Path to stage big build assets [Default: './SIMP_ISO_STAGING']
38
+ - SIMP_BUILD_staging_dir => Path to stage big build assets
39
+ [Default: './SIMP_ISO_STAGING']
40
40
  - SIMP_BUILD_rm_staging_dir => 'yes' forcibly removes the staging dir before starting
41
41
  - SIMP_BUILD_force_dirty => 'yes' tries to checks out subrepos even if dirty
42
42
  - SIMP_BUILD_docs => 'yes' builds & includes documentation
@@ -47,6 +47,8 @@ module Simp::Rake::Build
47
47
  - SIMP_BUILD_prune => 'no' passes :prune=>false to iso:build
48
48
  - SIMP_BUILD_iso_name => Renames the output ISO filename [Default: false]
49
49
  - SIMP_BUILD_iso_tag => Appended to the output ISO's filename [Default: false]
50
+ - SIMP_BUILD_verbose => 'yes' enables verbose reporting. [Default: 'no']
51
+ - SIMP_BUILD_packer_vars => Write a packer vars.json to go with this ISO [Default: 'yes']
50
52
 
51
53
  Notes:
52
54
  - To skip `tar:build` (including `pkg:build`), use the `tarball` argument
@@ -59,7 +61,7 @@ module Simp::Rake::Build
59
61
  :do_checksum,
60
62
  :key_name,
61
63
  :packer_vars,
62
- :verbose] do |t, args|
64
+ ] do |t, args|
63
65
  # set up data
64
66
  # --------------------------------------------------------------------------
65
67
 
@@ -69,8 +71,6 @@ module Simp::Rake::Build
69
71
  :output_dir => '',
70
72
  :do_checksum => 'false',
71
73
  :key_name => 'dev',
72
- :packer_vars => 'true',
73
- :verbose => 'false',
74
74
  )
75
75
 
76
76
  # locals
@@ -82,8 +82,8 @@ module Simp::Rake::Build
82
82
  key_name = args[:key_name]
83
83
  staging_dir = ENV.fetch('SIMP_BUILD_staging_dir',
84
84
  File.expand_path( 'SIMP_ISO_STAGING', Dir.pwd ))
85
- do_packer_vars = (args.packer_vars == 'false' ? false : true)
86
- verbose = (args.verbose == 'false' ? false : true)
85
+ do_packer_vars = ENV.fetch('SIMP_BUILD_packer_vars', 'yes') == 'yes'
86
+ verbose = ENV.fetch('SIMP_BUILD_verbose', 'no') == 'yes'
87
87
 
88
88
  yaml_file = File.expand_path('build/release_mappings.yaml', @base_dir)
89
89
  pwd = Dir.pwd
@@ -238,6 +238,8 @@ module Simp::Rake::Build
238
238
  puts '='*80
239
239
  puts
240
240
 
241
+ ENV['SIMP_ISO_verbose'] = 'yes' if verbose
242
+ ENV['SIMP_PKG_verbose'] = 'yes' if verbose
241
243
  Rake::Task['iso:build'].invoke(tarball,staging_dir,do_prune)
242
244
 
243
245
 
@@ -40,18 +40,11 @@ module Simp::Rake::Build
40
40
 
41
41
  verbose = args.verbose == 'false' ? false : true
42
42
 
43
- # Grab all currently tracked submodules.
44
- r10k = R10KHelper.new("Puppetfile.#{args[:method]}")
45
- mod_list = []
46
- r10k.each_module do |mod|
47
- path = mod[:path]
48
- if Dir.exists?(path)
49
- mod_list.push(path)
50
- end
51
- end
43
+ load_puppetfile(args.method)
52
44
 
45
+ # Grab all currently tracked submodules.
53
46
  failed_mods = Parallel.map(
54
- mod_list,
47
+ module_paths,
55
48
  :in_processes => 1,
56
49
  :progress => t.name
57
50
  ) do |mod|
@@ -64,8 +57,11 @@ module Simp::Rake::Build
64
57
  puts "Cleaning Gemfile.lock from #{mod}" if verbose
65
58
  rm('Gemfile.lock')
66
59
  end
67
- # Any ruby code that opens a subshell will automatically use the current Bundler environment.
68
- # Clean env will give bundler the environment present before Bundler is activated.
60
+ # Any ruby code that opens a subshell will automatically use the
61
+ # current Bundler environment.
62
+ #
63
+ # Clean env will give bundler the environment present before
64
+ # Bundler is activated.
69
65
  ::Bundler.with_clean_env do
70
66
  out = %x(bundle #{args.action} 2>&1)
71
67
  status = $?.success?
@@ -27,6 +27,8 @@ module Simp::Rake::Build
27
27
  # [:exclude_dirs] Array of directories to not remove any packages from
28
28
  # [:exclude_pkgs] Array of packages to not remove
29
29
  def prune_packages(from_dir,exclude_dirs,exclude_pkgs,mkrepo='createrepo -p',use_hack=true)
30
+ verbose = ENV.fetch('SIMP_ISO_verbose','no') == 'yes'
31
+
30
32
  $stderr.puts "Starting to prune..."
31
33
  Dir.chdir(from_dir) do
32
34
  prune_count = 0
@@ -57,7 +59,7 @@ module Simp::Rake::Build
57
59
  end
58
60
 
59
61
  unless exclude_pkgs.include?(pkg)
60
- rm(path)
62
+ rm(path, :verbose => verbose)
61
63
  prune_count += 1
62
64
  end
63
65
  end
@@ -92,6 +94,9 @@ module Simp::Rake::Build
92
94
  directories. Default is the current directory.
93
95
  * :prune - Flag for whether unwanted packages should be pruned prior to
94
96
  building the ISO. Default is true.
97
+
98
+ ENV vars:
99
+ - Set `SIMP_ISO_verbose=yes` to report file operations as they happen.
95
100
  EOM
96
101
  task :build,[:tarball,:unpacked_dvds,:prune] do |t,args|
97
102
  args.with_defaults(:unpacked_dvds => "#{@run_dir}", :prune => 'true')
@@ -105,6 +110,8 @@ module Simp::Rake::Build
105
110
  end
106
111
  end
107
112
 
113
+ verbose = ENV.fetch('SIMP_ISO_verbose','no') == 'yes'
114
+
108
115
  tarfiles = File.directory?(tarball) ?
109
116
  Dir.glob("#{tarball}/*.tar.gz") : [tarball]
110
117
  vermap = YAML::load_file( File.join( File.dirname(__FILE__), 'vermap.yaml'))
@@ -152,7 +159,7 @@ module Simp::Rake::Build
152
159
 
153
160
  @simp_dvd_dirs.each do |clean_dir|
154
161
  if File.directory?("#{dir}/#{clean_dir}")
155
- rm_rf("#{dir}/#{clean_dir}")
162
+ rm_rf("#{dir}/#{clean_dir}", :verbose => verbose)
156
163
  elsif File.file?("#{dir}/#{clean_dir}")
157
164
  fail("Error: #{dir}/#{clean_dir} is a file, expecting directory!")
158
165
  end
@@ -223,7 +230,7 @@ module Simp::Rake::Build
223
230
  target_file = File.join(rpm_arch,File.basename(rpm))
224
231
  rm_f(target_file) if File.exist?(target_file)
225
232
 
226
- cp(rpm,rpm_arch)
233
+ cp(rpm,rpm_arch, :verbose => verbose)
227
234
  end
228
235
 
229
236
  fail("Could not find architecture '#{arch}' in the SIMP distribution") unless File.directory?(arch)
@@ -239,7 +246,7 @@ module Simp::Rake::Build
239
246
  next if Pathname.new(source_rpm).realpath == Pathname.new(link_target).realpath
240
247
  end
241
248
 
242
- ln_sf(source_rpm,link_target)
249
+ ln_sf(source_rpm,link_target, :verbose => verbose)
243
250
  end
244
251
  end
245
252
 
@@ -7,6 +7,7 @@ module Simp::Rake; end
7
7
  module Simp::Rake::Build
8
8
 
9
9
  class Pkg < ::Rake::TaskLib
10
+ include Simp::Rake
10
11
  include Simp::Rake::Build::Constants
11
12
 
12
13
  def initialize( base_dir )
@@ -31,9 +32,11 @@ module Simp::Rake::Build
31
32
  ##############################################################################
32
33
 
33
34
  # Have to get things set up inside the proper namespace
34
- task :prep do
35
+ task :prep,[:method] do |t,args|
36
+ args.with_defaults(:method => 'tracking')
37
+
35
38
  @build_dirs = {
36
- :modules => get_module_dirs,
39
+ :modules => get_module_dirs(args[:method]),
37
40
  :aux => [
38
41
  "#{@build_dir}/GPGKEYS",
39
42
  "#{@src_dir}/puppet/bootstrap",
@@ -78,7 +81,8 @@ module Simp::Rake::Build
78
81
  ) do |dir|
79
82
  Dir.chdir(dir) do
80
83
  begin
81
- sh %{rake clean[#{args.chroot}]}
84
+ rake_flags = Rake.application.options.trace ? '--trace' : ''
85
+ sh %{rake clean[#{args.chroot}] #{rake_flags}}
82
86
  rescue Exception => e
83
87
  raise Parallel::Kill
84
88
  end
@@ -100,7 +104,8 @@ module Simp::Rake::Build
100
104
  :progress => t.name
101
105
  ) do |dir|
102
106
  Dir.chdir(dir) do
103
- sh %{rake clobber[#{args.chroot}]}
107
+ rake_flags = Rake.application.options.trace ? '--trace' : ''
108
+ sh %{rake clobber[#{args.chroot}] #{rake_flags}}
104
109
  end
105
110
  end
106
111
  end
@@ -111,9 +116,13 @@ module Simp::Rake::Build
111
116
 
112
117
  If passed anything but 'dev', will fail if the directory is not present in
113
118
  the 'build/build_keys' directory.
119
+
120
+ ENV vars:
121
+ - Set `SIMP_PKG_verbose=yes` to report file operations as they happen.
114
122
  EOM
115
123
  task :key_prep,[:key] do |t,args|
116
124
  require 'securerandom'
125
+ _verbose = ENV.fetch('SIMP_PKG_verbose','no') == 'yes'
117
126
 
118
127
  args.with_defaults(:key => 'dev')
119
128
 
@@ -140,7 +149,7 @@ module Simp::Rake::Build
140
149
  puts "Generating new GPG key"
141
150
 
142
151
  Dir.glob('*').each do |todel|
143
- rm_rf(todel)
152
+ rm_rf(todel, :verbose => _verbose)
144
153
  end
145
154
 
146
155
  expire_date = (DateTime.now + 14)
@@ -239,7 +248,7 @@ module Simp::Rake::Build
239
248
  dkfh = File.open("#{target_dir}/.dropped_keys",'w')
240
249
 
241
250
  rpm_build_keys.each do |gpgkey|
242
- cp(gpgkey,target_dir)
251
+ cp(gpgkey,target_dir, :verbose => _verbose)
243
252
  dkfh.puts(gpgkey)
244
253
  end
245
254
 
@@ -256,9 +265,13 @@ module Simp::Rake::Build
256
265
  * :chroot - The Mock chroot configuration to use. See the '--root' option in mock(1).
257
266
  * :docs - Build the docs. Set this to false if you wish to skip building the docs.
258
267
  * :key - The GPG key to sign the RPMs with. Defaults to 'dev'.
268
+
269
+ ENV vars:
270
+ - Set `SIMP_PKG_verbose=yes` to report file operations as they happen.
259
271
  EOM
260
272
  task :build,[:chroot,:docs,:key,:snapshot_release] => [:prep,:mock_prep,:key_prep] do |t,args|
261
273
  validate_in_mock_group?
274
+ _verbose = ENV.fetch('SIMP_PKG_verbose','no') == 'yes'
262
275
 
263
276
  args.with_defaults(:key => 'dev')
264
277
  args.with_defaults(:docs => true)
@@ -278,7 +291,7 @@ module Simp::Rake::Build
278
291
  Rake::Task['pkg:simp'].invoke(args.chroot,args.snapshot_release)
279
292
 
280
293
  # Prepare for the build!
281
- rm_rf(output_dir)
294
+ rm_rf(output_dir, :verbose => _verbose)
282
295
 
283
296
  # Copy all the resulting files into the target output directory
284
297
  mkdir_p(output_dir)
@@ -299,19 +312,19 @@ module Simp::Rake::Build
299
312
 
300
313
  srpms.each do |srpm|
301
314
  out_dir = "#{output_dir}/SRPMS"
302
- mkdir_p(out_dir) unless File.directory?(out_dir)
315
+ mkdir_p(out_dir, :verbose => _verbose) unless File.directory?(out_dir)
303
316
 
304
317
  if not uptodate?("#{out_dir}/#{File.basename(srpm)}",[srpm])
305
- cp(srpm,out_dir)
318
+ cp(srpm,out_dir, :verbose => _verbose)
306
319
  end
307
320
  end
308
321
 
309
322
  rpms.each do |rpm|
310
323
  out_dir = "#{output_dir}/RPMS/#{rpm.split('.')[-2]}"
311
- mkdir_p(out_dir) unless File.directory?(out_dir)
324
+ mkdir_p(out_dir, :verbose => _verbose) unless File.directory?(out_dir)
312
325
 
313
326
  if not uptodate?("#{out_dir}/#{File.basename(rpm)}",[rpm])
314
- cp(rpm,out_dir)
327
+ cp(rpm,out_dir, :verbose => _verbose)
315
328
  end
316
329
  end
317
330
  end
@@ -325,14 +338,24 @@ module Simp::Rake::Build
325
338
 
326
339
  This also builds the simp-mit RPM due to its location.
327
340
  Building this environment requires a working Mock setup (http://fedoraproject.org/wiki/Projects/Mock)
341
+
328
342
  * :chroot - The Mock chroot configuration to use. See the '--root' option in mock(1).
343
+ * :method - The Puppetfile from which the repository information should be read. Defaults to 'tracking'
344
+
345
+ ENV vars:
346
+ - Set `SIMP_PKG_verbose=yes` to report file operations as they happen.
329
347
  EOM
330
- task :modules,[:chroot] => [:prep,:mock_prep] do |t,args|
348
+ task :modules,[:chroot,:method] => [:prep,:mock_prep] do |t,args|
331
349
  build(args.chroot,@build_dirs[:modules],t)
332
350
  end
333
351
 
334
352
  desc <<-EOM
335
353
  Build simp config rubygem RPM.
354
+
355
+ * :method - The Puppetfile from which the repository information should be read. Defaults to 'tracking'
356
+
357
+ ENV vars:
358
+ - Set `SIMP_PKG_verbose=yes` to report file operations as they happen.
336
359
  EOM
337
360
  task :simp_cli,[:chroot] => [:prep,:mock_prep] do |t,args|
338
361
  build(args.chroot,@build_dirs[:simp_cli],t)
@@ -342,6 +365,9 @@ module Simp::Rake::Build
342
365
  Build the SIMP non-module RPMs.
343
366
 
344
367
  Building this environment requires a working Mock setup (http://fedoraproject.org/wiki/Projects/Mock)
368
+
369
+ ENV vars:
370
+ - Set `SIMP_PKG_verbose=yes` to report file operations as they happen.
345
371
  * :chroot - The Mock chroot configuration to use. See the '--root' option in mock(1).
346
372
  EOM
347
373
  task :aux,[:chroot] => [:prep,:mock_prep] do |t,args|
@@ -353,6 +379,9 @@ module Simp::Rake::Build
353
379
 
354
380
  Building this environment requires a working Mock setup (http://fedoraproject.org/wiki/Projects/Mock)
355
381
  * :chroot - The Mock chroot configuration to use. See the '--root' option in mock(1).
382
+
383
+ ENV vars:
384
+ - Set `SIMP_PKG_verbose=yes` to report file operations as they happen.
356
385
  EOM
357
386
  task :doc,[:chroot] => [:prep,:mock_prep] do |t,args|
358
387
  build(args.chroot,@build_dirs[:doc],t)
@@ -364,6 +393,9 @@ module Simp::Rake::Build
364
393
  Building this environment requires a working Mock setup (http://fedoraproject.org/wiki/Projects/Mock)
365
394
  * :chroot - The Mock chroot configuration to use. See the '--root' option in mock(1).
366
395
  * :snapshot_release - Will add a define to the Mock to set snapshot_release to current date and time.
396
+
397
+ ENV vars:
398
+ - Set `SIMP_PKG_verbose=yes` to report file operations as they happen.
367
399
  EOM
368
400
  task :simp,[:chroot,:snapshot_release] => [:prep,:mock_prep] do |t,args|
369
401
  build(args.chroot,@build_dirs[:simp],t,false,args.snapshot_release)
@@ -468,6 +500,9 @@ module Simp::Rake::Build
468
500
  * :aux_dir - Auxillary repo glob to use when assessing. Default #{@build_dir}/Ext_*.
469
501
  Defaults to ''(empty) if :target_dir is not the system default.
470
502
 
503
+ ENV vars:
504
+ - Set `SIMP_PKG_verbose=yes` to report file operations as they happen.
505
+
471
506
  EOM
472
507
  task :repoclosure,[:target_dir,:aux_dir] => [:prep] do |t,args|
473
508
  default_target = @pkg_dirs[:simp]
@@ -478,6 +513,8 @@ module Simp::Rake::Build
478
513
  args.with_defaults(:aux_dir => '')
479
514
  end
480
515
 
516
+ _verbose = ENV.fetch('SIMP_PKG_verbose','no') == 'yes'
517
+
481
518
  yum_conf_template = <<-EOF
482
519
  [main]
483
520
  keepcache=0
@@ -514,7 +551,7 @@ protect=1
514
551
  Find.find(base_dir) do |path|
515
552
  if (path =~ /.*\.rpm$/) and (path !~ /.*.src\.rpm$/)
516
553
  sym_path = "#{temp_pkg_dir}/repos/base/#{File.basename(path)}"
517
- ln_s(path,sym_path) unless File.exists?(sym_path)
554
+ ln_s(path,sym_path, :verbose => _verbose) unless File.exists?(sym_path)
518
555
  end
519
556
  end
520
557
  end
@@ -523,7 +560,7 @@ protect=1
523
560
  Find.find(aux_dir) do |path|
524
561
  if (path =~ /.*\.rpm$/) and (path !~ /.*.src\.rpm$/)
525
562
  sym_path = "#{temp_pkg_dir}/repos/lookaside/#{File.basename(path)}"
526
- ln_s(path,sym_path) unless File.exists?(sym_path)
563
+ ln_s(path,sym_path, :verbose => _verbose) unless File.exists?(sym_path)
527
564
  end
528
565
  end
529
566
  end
@@ -583,12 +620,15 @@ protect=1
583
620
  # status bar.
584
621
  def build(chroot,dirs,task,add_to_autoreq=true,snapshot_release=false)
585
622
  validate_in_mock_group?
623
+ _verbose = ENV.fetch('SIMP_PKG_verbose','no') == 'yes'
586
624
 
587
625
  mock_pre_check(chroot)
588
626
 
589
627
  # Default package metadata for reference
590
628
  default_metadata = YAML.load(File.read("#{@src_dir}/build/package_metadata_defaults.yaml"))
591
629
 
630
+ failures = {}
631
+
592
632
  metadata = Parallel.map(
593
633
  Array(dirs),
594
634
  :in_processes => get_cpu_limit,
@@ -596,26 +636,66 @@ protect=1
596
636
  ) do |dir|
597
637
  result = []
598
638
 
599
- Dir.chdir(dir) do
600
- if File.exist?('Rakefile')
601
- unique_build = (get_cpu_limit != 1)
602
- %x{rake pkg:rpm[#{chroot},unique_build,#{snapshot_release}]}
603
-
604
- # Glob all generated rpms, and add their metadata to a result array.
605
- pkginfo = Hash.new
606
- Dir.glob('dist/*.rpm') do |rpm|
607
- if not rpm =~ /.*.src.rpm/ then
608
- # get_info from each generated rpm, not the spec file, so macros in the
609
- # metadata have already been resolved in the mock chroot.
610
- result << Simp::RPM.get_info(rpm)
639
+ begin
640
+ build_attempt = 0
641
+ try_build = true
642
+ while(try_build) do
643
+ begin
644
+ Dir.chdir(dir) do
645
+ if File.exist?('Rakefile')
646
+ unique_build = (get_cpu_limit != 1)
647
+ rake_flags = Rake.application.options.trace ? '--trace' : ''
648
+ output = %x{rake pkg:rpm[#{chroot},unique_build,#{snapshot_release}] #{rake_flags} 2>&1}
649
+ raise(output) unless $?.success?
650
+
651
+ # Glob all generated rpms, and add their metadata to a result array.
652
+ pkginfo = Hash.new
653
+ Dir.glob('dist/*.rpm') do |rpm|
654
+ if not rpm =~ /.*.src.rpm/ then
655
+ # get_info from each generated rpm, not the spec file, so macros in the
656
+ # metadata have already been resolved in the mock chroot.
657
+ result << Simp::RPM.get_info(rpm)
658
+ end
659
+ end
660
+ else
661
+ puts "Warning: Could not find Rakefile in '#{dir}'"
662
+ end
663
+ end
664
+ rescue Exception => e
665
+ if build_attempt == 0
666
+ # Run 'bundle' and try again
667
+ ::Bundler.with_clean_env do
668
+ out = %x(bundle install 2>&1)
669
+ status = $?.success?
670
+ puts out if _verbose
671
+ end
672
+ else
673
+ build_attempt += 1
674
+ try_build = false
675
+ failures[dir] = e.to_s
676
+ if _verbose
677
+ stderr.puts(e.to_s)
678
+ else
679
+ stderr.puts("Error found in: #{File.basename(dir)}")
680
+ end
611
681
  end
612
682
  end
613
- else
614
- puts "Warning: Could not find Rakefile in '#{dir}'"
683
+
684
+ try_build = false
615
685
  end
616
- end
617
686
 
618
- result
687
+ result
688
+ ensure
689
+ unless failures.empty?
690
+ errmsg = ['Error: Failures found during module build']
691
+ failures.keys.each do |dir|
692
+ errmsg << ('* ' + dir)
693
+ errmsg << (failures[dir].lines.map{|ln| ln = " #{ln}}"})
694
+ end
695
+
696
+ raise errmsg
697
+ end
698
+ end
619
699
  end
620
700
 
621
701
  metadata.each do |mod|
@@ -657,19 +737,10 @@ protect=1
657
737
  end
658
738
  end
659
739
 
660
- # Return a list of all puppet module directories with Rakefiles
661
- def get_module_dirs
662
- moddir = "#{@src_dir}/puppet/modules"
663
-
664
- toret = []
665
-
666
- Dir.glob("#{moddir}/*").map { |x| x = File.basename(x).chomp }.sort.each do |mod|
667
- if File.exist?("#{moddir}/#{mod}/Rakefile")
668
- toret << "#{moddir}/#{mod}"
669
- end
670
- end
671
-
672
- toret
740
+ # Return an Array of all puppet module directories
741
+ def get_module_dirs(method='tracking')
742
+ load_puppetfile(method)
743
+ module_paths.select{|x| File.basename(File.dirname(x)) == 'modules'}
673
744
  end
674
745
 
675
746
  # Get a list of all of the mock configs available on the system.
@@ -32,6 +32,42 @@ module Simp::Rake::Build
32
32
  # Main tasks
33
33
  ##############################################################################
34
34
 
35
+ task :validate do |t,args|
36
+ rpm_dir = File.join(@base_dir,'build','SIMP','RPMS')
37
+ fail("Could not find output dir: '#{rpm_dir}'") unless File.directory?(rpm_dir)
38
+
39
+ required_rpms = {
40
+ 'noarch' => [
41
+ 'rubygem-simp-cli',
42
+ 'simp',
43
+ 'simp-bootstrap',
44
+ 'simp-gpgkeys',
45
+ 'simp-rsync',
46
+ 'simp-utils'
47
+ ]
48
+ }
49
+
50
+ Dir.chdir(rpm_dir) do
51
+ failures = []
52
+ required_rpms.keys.each do |dir|
53
+ fail("Could not find directory '#{File.join(rpm_dir,dir)}'") unless File.directory?(dir)
54
+
55
+ Dir.chdir(dir) do
56
+ required_rpms[dir].each do |pkg|
57
+ if Dir.glob("#{pkg}-[0-9]*.rpm").empty?
58
+ failures << " * #{pkg}"
59
+ end
60
+ end
61
+ end
62
+ end
63
+
64
+ unless failures.empty?
65
+ msg = ['Error: Could not find the following packages:']
66
+ fail((msg + failures).join("\n"))
67
+ end
68
+ end
69
+ end
70
+
35
71
  desc <<-EOM
36
72
  Build the DVD tarball(s).
37
73
 
@@ -40,7 +76,7 @@ module Simp::Rake::Build
40
76
  * :docs - Whether or not to build the documentation
41
77
  * :snapshot_release - Append the timestamp to the SIMP tarball(s)
42
78
  EOM
43
- task :build,[:chroot,:key,:docs,:snapshot_release] => ['pkg:build','pkg:checksig'] do |t,args|
79
+ task :build,[:chroot,:key,:docs,:snapshot_release] => ['pkg:build','pkg:checksig','tar:validate'] do |t,args|
44
80
  args.with_defaults(:docs => 'true')
45
81
 
46
82
  validate_in_mock_group?
@@ -2,5 +2,5 @@ module Simp; end
2
2
  module Simp::Rake; end
3
3
 
4
4
  class Simp::Rake::Helpers
5
- VERSION = '2.4.7'
5
+ VERSION = '2.5.0'
6
6
  end
@@ -0,0 +1,32 @@
1
+ Name: testpackage
2
+ Version: 1
3
+ Release: 0
4
+ Summary: dummy test package
5
+ BuildArch: noarch
6
+
7
+ License: Apache-2.0
8
+ URL: http://foo.bar
9
+
10
+ %description
11
+ A dummy package used to test Simp::RPM methods
12
+
13
+ %prep
14
+ exit 0
15
+
16
+ %build
17
+ exit 0
18
+
19
+
20
+ %install
21
+ exit 0
22
+
23
+ %clean
24
+ exit 0
25
+
26
+ %files
27
+ %doc
28
+
29
+
30
+ %changelog
31
+ * Wed Jun 10 2015 nobody
32
+ - some comment
@@ -0,0 +1,17 @@
1
+ require 'simp/rake/build/helpers'
2
+ require 'spec_helper'
3
+
4
+ describe Simp::Rake::Build::Helpers do
5
+ before :each do
6
+ dir = File.expand_path( '../../files/simp_build', File.dirname( __FILE__ ) )
7
+ @obj = Simp::Rake::Build::Helpers.new( dir )
8
+ end
9
+
10
+ describe "#initialize" do
11
+ it "initialized (smoke test)" do
12
+ expect( @obj.class ).to eq Simp::Rake::Build::Helpers
13
+ end
14
+ end
15
+ end
16
+
17
+
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: 2.4.7
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Tessmer
@@ -9,368 +9,368 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-08-22 00:00:00.000000000 Z
12
+ date: 2016-08-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ~>
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
20
  version: '1.0'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ~>
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
27
  version: '1.0'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rake
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - '>='
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
34
  version: '10.0'
35
- - - <
35
+ - - "<"
36
36
  - !ruby/object:Gem::Version
37
37
  version: '12.0'
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
41
41
  requirements:
42
- - - '>='
42
+ - - ">="
43
43
  - !ruby/object:Gem::Version
44
44
  version: '10.0'
45
- - - <
45
+ - - "<"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '12.0'
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: coderay
50
50
  requirement: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.0'
55
55
  type: :runtime
56
56
  prerelease: false
57
57
  version_requirements: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '1.0'
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: puppet
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '3.0'
69
69
  type: :runtime
70
70
  prerelease: false
71
71
  version_requirements: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '3.0'
76
76
  - !ruby/object:Gem::Dependency
77
77
  name: puppet-lint
78
78
  requirement: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '1.0'
83
83
  type: :runtime
84
84
  prerelease: false
85
85
  version_requirements: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
89
  version: '1.0'
90
90
  - !ruby/object:Gem::Dependency
91
91
  name: puppetlabs_spec_helper
92
92
  requirement: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ~>
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0.0'
97
97
  type: :runtime
98
98
  prerelease: false
99
99
  version_requirements: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ~>
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0.0'
104
104
  - !ruby/object:Gem::Dependency
105
105
  name: parallel
106
106
  requirement: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ~>
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '1.0'
111
111
  type: :runtime
112
112
  prerelease: false
113
113
  version_requirements: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ~>
115
+ - - "~>"
116
116
  - !ruby/object:Gem::Version
117
117
  version: '1.0'
118
118
  - !ruby/object:Gem::Dependency
119
119
  name: simp-rspec-puppet-facts
120
120
  requirement: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ~>
122
+ - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: '1.0'
125
125
  type: :runtime
126
126
  prerelease: false
127
127
  version_requirements: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ~>
129
+ - - "~>"
130
130
  - !ruby/object:Gem::Version
131
131
  version: '1.0'
132
132
  - !ruby/object:Gem::Dependency
133
133
  name: puppet-blacksmith
134
134
  requirement: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ~>
136
+ - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: '3.3'
139
139
  type: :runtime
140
140
  prerelease: false
141
141
  version_requirements: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ~>
143
+ - - "~>"
144
144
  - !ruby/object:Gem::Version
145
145
  version: '3.3'
146
146
  - !ruby/object:Gem::Dependency
147
147
  name: simp-beaker-helpers
148
148
  requirement: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - ~>
150
+ - - "~>"
151
151
  - !ruby/object:Gem::Version
152
152
  version: '1.0'
153
153
  type: :runtime
154
154
  prerelease: false
155
155
  version_requirements: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - ~>
157
+ - - "~>"
158
158
  - !ruby/object:Gem::Version
159
159
  version: '1.0'
160
160
  - !ruby/object:Gem::Dependency
161
161
  name: parallel_tests
162
162
  requirement: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - ~>
164
+ - - "~>"
165
165
  - !ruby/object:Gem::Version
166
166
  version: '2.4'
167
167
  type: :runtime
168
168
  prerelease: false
169
169
  version_requirements: !ruby/object:Gem::Requirement
170
170
  requirements:
171
- - - ~>
171
+ - - "~>"
172
172
  - !ruby/object:Gem::Version
173
173
  version: '2.4'
174
174
  - !ruby/object:Gem::Dependency
175
175
  name: r10k
176
176
  requirement: !ruby/object:Gem::Requirement
177
177
  requirements:
178
- - - ~>
178
+ - - "~>"
179
179
  - !ruby/object:Gem::Version
180
180
  version: '2.2'
181
181
  type: :runtime
182
182
  prerelease: false
183
183
  version_requirements: !ruby/object:Gem::Requirement
184
184
  requirements:
185
- - - ~>
185
+ - - "~>"
186
186
  - !ruby/object:Gem::Version
187
187
  version: '2.2'
188
188
  - !ruby/object:Gem::Dependency
189
189
  name: pager
190
190
  requirement: !ruby/object:Gem::Requirement
191
191
  requirements:
192
- - - '>='
192
+ - - ">="
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0'
195
195
  type: :runtime
196
196
  prerelease: false
197
197
  version_requirements: !ruby/object:Gem::Requirement
198
198
  requirements:
199
- - - '>='
199
+ - - ">="
200
200
  - !ruby/object:Gem::Version
201
201
  version: '0'
202
202
  - !ruby/object:Gem::Dependency
203
203
  name: rspec
204
204
  requirement: !ruby/object:Gem::Requirement
205
205
  requirements:
206
- - - ~>
206
+ - - "~>"
207
207
  - !ruby/object:Gem::Version
208
208
  version: '3.0'
209
209
  type: :runtime
210
210
  prerelease: false
211
211
  version_requirements: !ruby/object:Gem::Requirement
212
212
  requirements:
213
- - - ~>
213
+ - - "~>"
214
214
  - !ruby/object:Gem::Version
215
215
  version: '3.0'
216
216
  - !ruby/object:Gem::Dependency
217
217
  name: beaker
218
218
  requirement: !ruby/object:Gem::Requirement
219
219
  requirements:
220
- - - ~>
220
+ - - "~>"
221
221
  - !ruby/object:Gem::Version
222
222
  version: '2.0'
223
223
  type: :runtime
224
224
  prerelease: false
225
225
  version_requirements: !ruby/object:Gem::Requirement
226
226
  requirements:
227
- - - ~>
227
+ - - "~>"
228
228
  - !ruby/object:Gem::Version
229
229
  version: '2.0'
230
230
  - !ruby/object:Gem::Dependency
231
231
  name: beaker-rspec
232
232
  requirement: !ruby/object:Gem::Requirement
233
233
  requirements:
234
- - - ~>
234
+ - - "~>"
235
235
  - !ruby/object:Gem::Version
236
236
  version: '5.0'
237
237
  type: :runtime
238
238
  prerelease: false
239
239
  version_requirements: !ruby/object:Gem::Requirement
240
240
  requirements:
241
- - - ~>
241
+ - - "~>"
242
242
  - !ruby/object:Gem::Version
243
243
  version: '5.0'
244
244
  - !ruby/object:Gem::Dependency
245
245
  name: rspec-core
246
246
  requirement: !ruby/object:Gem::Requirement
247
247
  requirements:
248
- - - ~>
248
+ - - "~>"
249
249
  - !ruby/object:Gem::Version
250
250
  version: '3.0'
251
251
  type: :runtime
252
252
  prerelease: false
253
253
  version_requirements: !ruby/object:Gem::Requirement
254
254
  requirements:
255
- - - ~>
255
+ - - "~>"
256
256
  - !ruby/object:Gem::Version
257
257
  version: '3.0'
258
258
  - !ruby/object:Gem::Dependency
259
259
  name: listen
260
260
  requirement: !ruby/object:Gem::Requirement
261
261
  requirements:
262
- - - ~>
262
+ - - "~>"
263
263
  - !ruby/object:Gem::Version
264
264
  version: 3.0.6
265
265
  type: :runtime
266
266
  prerelease: false
267
267
  version_requirements: !ruby/object:Gem::Requirement
268
268
  requirements:
269
- - - ~>
269
+ - - "~>"
270
270
  - !ruby/object:Gem::Version
271
271
  version: 3.0.6
272
272
  - !ruby/object:Gem::Dependency
273
273
  name: gitlog-md
274
274
  requirement: !ruby/object:Gem::Requirement
275
275
  requirements:
276
- - - ~>
276
+ - - "~>"
277
277
  - !ruby/object:Gem::Version
278
278
  version: '0'
279
279
  type: :development
280
280
  prerelease: false
281
281
  version_requirements: !ruby/object:Gem::Requirement
282
282
  requirements:
283
- - - ~>
283
+ - - "~>"
284
284
  - !ruby/object:Gem::Version
285
285
  version: '0'
286
286
  - !ruby/object:Gem::Dependency
287
287
  name: pry
288
288
  requirement: !ruby/object:Gem::Requirement
289
289
  requirements:
290
- - - ~>
290
+ - - "~>"
291
291
  - !ruby/object:Gem::Version
292
292
  version: '0.0'
293
293
  type: :development
294
294
  prerelease: false
295
295
  version_requirements: !ruby/object:Gem::Requirement
296
296
  requirements:
297
- - - ~>
297
+ - - "~>"
298
298
  - !ruby/object:Gem::Version
299
299
  version: '0.0'
300
300
  - !ruby/object:Gem::Dependency
301
301
  name: pry-doc
302
302
  requirement: !ruby/object:Gem::Requirement
303
303
  requirements:
304
- - - ~>
304
+ - - "~>"
305
305
  - !ruby/object:Gem::Version
306
306
  version: '0.0'
307
307
  type: :development
308
308
  prerelease: false
309
309
  version_requirements: !ruby/object:Gem::Requirement
310
310
  requirements:
311
- - - ~>
311
+ - - "~>"
312
312
  - !ruby/object:Gem::Version
313
313
  version: '0.0'
314
314
  - !ruby/object:Gem::Dependency
315
315
  name: highline
316
316
  requirement: !ruby/object:Gem::Requirement
317
317
  requirements:
318
- - - ~>
318
+ - - "~>"
319
319
  - !ruby/object:Gem::Version
320
320
  version: '1.6'
321
- - - '>'
321
+ - - ">"
322
322
  - !ruby/object:Gem::Version
323
323
  version: 1.6.1
324
324
  type: :development
325
325
  prerelease: false
326
326
  version_requirements: !ruby/object:Gem::Requirement
327
327
  requirements:
328
- - - ~>
328
+ - - "~>"
329
329
  - !ruby/object:Gem::Version
330
330
  version: '1.6'
331
- - - '>'
331
+ - - ">"
332
332
  - !ruby/object:Gem::Version
333
333
  version: 1.6.1
334
334
  - !ruby/object:Gem::Dependency
335
335
  name: guard
336
336
  requirement: !ruby/object:Gem::Requirement
337
337
  requirements:
338
- - - ~>
338
+ - - "~>"
339
339
  - !ruby/object:Gem::Version
340
340
  version: '2.0'
341
341
  type: :development
342
342
  prerelease: false
343
343
  version_requirements: !ruby/object:Gem::Requirement
344
344
  requirements:
345
- - - ~>
345
+ - - "~>"
346
346
  - !ruby/object:Gem::Version
347
347
  version: '2.0'
348
348
  - !ruby/object:Gem::Dependency
349
349
  name: guard-shell
350
350
  requirement: !ruby/object:Gem::Requirement
351
351
  requirements:
352
- - - ~>
352
+ - - "~>"
353
353
  - !ruby/object:Gem::Version
354
354
  version: '0.0'
355
355
  type: :development
356
356
  prerelease: false
357
357
  version_requirements: !ruby/object:Gem::Requirement
358
358
  requirements:
359
- - - ~>
359
+ - - "~>"
360
360
  - !ruby/object:Gem::Version
361
361
  version: '0.0'
362
362
  - !ruby/object:Gem::Dependency
363
363
  name: guard-rspec
364
364
  requirement: !ruby/object:Gem::Requirement
365
365
  requirements:
366
- - - ~>
366
+ - - "~>"
367
367
  - !ruby/object:Gem::Version
368
368
  version: '4.0'
369
369
  type: :development
370
370
  prerelease: false
371
371
  version_requirements: !ruby/object:Gem::Requirement
372
372
  requirements:
373
- - - ~>
373
+ - - "~>"
374
374
  - !ruby/object:Gem::Version
375
375
  version: '4.0'
376
376
  description: |2
@@ -380,9 +380,9 @@ executables: []
380
380
  extensions: []
381
381
  extra_rdoc_files: []
382
382
  files:
383
- - .gitignore
384
- - .rspec
385
- - .travis.yml
383
+ - ".gitignore"
384
+ - ".rspec"
385
+ - ".travis.yml"
386
386
  - CHANGELOG.md
387
387
  - CONTRIBUTING.md
388
388
  - Gemfile
@@ -421,9 +421,11 @@ files:
421
421
  - spec/acceptance/nodesets/default.yml
422
422
  - spec/acceptance/pkg_rpm_spec.rb
423
423
  - spec/lib/simp/files/build/testpackage.spec
424
+ - spec/lib/simp/files/simp_build/src/build/simp.spec
424
425
  - spec/lib/simp/files/testpackage-1-0.noarch.rpm
425
426
  - spec/lib/simp/files/testpackage-multi.spec
426
427
  - spec/lib/simp/files/testpackage.spec
428
+ - spec/lib/simp/rake/build/helpers_spec.rb
427
429
  - spec/lib/simp/rake/helpers_spec.rb
428
430
  - spec/lib/simp/rake/pkg_spec.rb
429
431
  - spec/lib/simp/rake/pupmod/helpers_spec.rb
@@ -442,12 +444,12 @@ require_paths:
442
444
  - lib
443
445
  required_ruby_version: !ruby/object:Gem::Requirement
444
446
  requirements:
445
- - - '>='
447
+ - - ">="
446
448
  - !ruby/object:Gem::Version
447
449
  version: '0'
448
450
  required_rubygems_version: !ruby/object:Gem::Requirement
449
451
  requirements:
450
- - - '>='
452
+ - - ">="
451
453
  - !ruby/object:Gem::Version
452
454
  version: '0'
453
455
  requirements: []
@@ -457,4 +459,3 @@ signing_key:
457
459
  specification_version: 4
458
460
  summary: SIMP rake helpers
459
461
  test_files: []
460
- has_rdoc: