simp-rake-helpers 5.3.0 → 5.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +8 -2
  3. data/.travis.yml +54 -37
  4. data/CHANGELOG.md +40 -2
  5. data/Gemfile +1 -0
  6. data/README.md +70 -82
  7. data/lib/simp/rake/build/auto.rb +6 -0
  8. data/lib/simp/rake/build/pkg.rb +2 -2
  9. data/lib/simp/rake/build/rpmdeps.rb +6 -3
  10. data/lib/simp/rake/helpers/assets/rpm_spec/simpdefault.spec +284 -71
  11. data/lib/simp/rake/helpers/version.rb +1 -1
  12. data/lib/simp/rake/pkg.rb +38 -18
  13. data/lib/simp/rake/rubygem.rb +1 -1
  14. data/lib/simp/rpm.rb +49 -6
  15. data/spec/acceptance/00_pkg_rpm_custom_scriptlets_spec.rb +117 -0
  16. data/spec/acceptance/10_pkg_rpm_spec.rb +153 -0
  17. data/spec/acceptance/20_pkg_rpm_safely_upgrading_obsolete_modules_spec.rb +175 -0
  18. data/spec/acceptance/development/docker_env.sh +29 -0
  19. data/spec/acceptance/development/rerun_acceptance_tests.sh +15 -0
  20. data/spec/acceptance/development/vagrant_rsync.sh +23 -0
  21. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-2.1/CHANGELOG +2 -0
  22. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-2.1/Rakefile +3 -0
  23. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-2.1/build/rpm_metadata/custom/overrides +14 -0
  24. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-2.1/build/rpm_metadata/requires +1 -0
  25. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-2.1/metadata.json +33 -0
  26. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-3.0/CHANGELOG +2 -0
  27. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-3.0/Rakefile +3 -0
  28. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-3.0/build/rpm_metadata/custom/overrides +14 -0
  29. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-3.0/build/rpm_metadata/requires +1 -0
  30. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-3.0/metadata.json +33 -0
  31. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-1.0/CHANGELOG +2 -0
  32. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-1.0/Rakefile +3 -0
  33. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-1.0/build/rpm_metadata/requires +1 -0
  34. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-1.0/metadata.json +33 -0
  35. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-2.0/CHANGELOG +2 -0
  36. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-2.0/Rakefile +3 -0
  37. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-2.0/build/rpm_metadata/requires +1 -0
  38. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-2.0/metadata.json +33 -0
  39. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-2.2/CHANGELOG +2 -0
  40. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-2.2/Rakefile +3 -0
  41. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-2.2/build/rpm_metadata/custom/overrides +14 -0
  42. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-2.2/build/rpm_metadata/requires +1 -0
  43. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-2.2/metadata.json +33 -0
  44. data/spec/acceptance/files/mock_packages/pupmod-puppetlabs-stdlib.spec +32 -0
  45. data/spec/acceptance/files/mock_packages/pupmod-simp-foo.spec +32 -0
  46. data/spec/acceptance/files/mock_packages/pupmod-simp-simplib.spec +32 -0
  47. data/spec/acceptance/files/mock_packages/rpmbuild.sh +25 -0
  48. data/spec/acceptance/files/mock_packages/simp-adapter/etc/simp/adapter_config.yaml +3 -0
  49. data/spec/acceptance/files/mock_packages/simp-adapter/usr/local/sbin/simp_rpm_helper +406 -0
  50. data/spec/acceptance/files/mock_packages/simp-adapter.spec +43 -0
  51. data/spec/acceptance/files/testpackage_custom_scriptlet/CHANGELOG +2 -0
  52. data/spec/acceptance/files/testpackage_custom_scriptlet/Rakefile +3 -0
  53. data/spec/acceptance/files/testpackage_custom_scriptlet/build/rpm_metadata/custom/overrides +18 -0
  54. data/spec/acceptance/files/testpackage_custom_scriptlet/build/rpm_metadata/requires +1 -0
  55. data/spec/acceptance/files/testpackage_custom_scriptlet/metadata.json +33 -0
  56. data/spec/acceptance/nodesets/default.yml +2 -4
  57. data/spec/acceptance/support/pkg_rpm_helpers.rb +81 -0
  58. data/spec/lib/simp/rake/build/files/unmanaged_mod/build/rpm_metadata/requires +2 -1
  59. data/spec/lib/simp/rake/build/rpmdeps_spec.rb +2 -1
  60. data/spec/spec_helper_acceptance.rb +20 -1
  61. metadata +44 -17
  62. data/spec/acceptance/pkg_rpm_spec.rb +0 -164
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.3.0
4
+ version: 5.4.1
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: 2018-02-20 00:00:00.000000000 Z
12
+ date: 2018-03-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -281,20 +281,6 @@ dependencies:
281
281
  - - "~>"
282
282
  - !ruby/object:Gem::Version
283
283
  version: 3.0.6
284
- - !ruby/object:Gem::Dependency
285
- name: gitlog-md
286
- requirement: !ruby/object:Gem::Requirement
287
- requirements:
288
- - - "~>"
289
- - !ruby/object:Gem::Version
290
- version: '0'
291
- type: :development
292
- prerelease: false
293
- version_requirements: !ruby/object:Gem::Requirement
294
- requirements:
295
- - - "~>"
296
- - !ruby/object:Gem::Version
297
- version: '0'
298
284
  - !ruby/object:Gem::Dependency
299
285
  name: pry
300
286
  requirement: !ruby/object:Gem::Requirement
@@ -435,6 +421,42 @@ files:
435
421
  - lib/simp/relchecks.rb
436
422
  - lib/simp/rpm.rb
437
423
  - lib/simp/yum.rb
424
+ - spec/acceptance/00_pkg_rpm_custom_scriptlets_spec.rb
425
+ - spec/acceptance/10_pkg_rpm_spec.rb
426
+ - spec/acceptance/20_pkg_rpm_safely_upgrading_obsolete_modules_spec.rb
427
+ - spec/acceptance/development/docker_env.sh
428
+ - spec/acceptance/development/rerun_acceptance_tests.sh
429
+ - spec/acceptance/development/vagrant_rsync.sh
430
+ - spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-2.1/CHANGELOG
431
+ - spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-2.1/Rakefile
432
+ - spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-2.1/build/rpm_metadata/custom/overrides
433
+ - spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-2.1/build/rpm_metadata/requires
434
+ - spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-2.1/metadata.json
435
+ - spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-3.0/CHANGELOG
436
+ - spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-3.0/Rakefile
437
+ - spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-3.0/build/rpm_metadata/custom/overrides
438
+ - spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-3.0/build/rpm_metadata/requires
439
+ - spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-3.0/metadata.json
440
+ - spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-1.0/CHANGELOG
441
+ - spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-1.0/Rakefile
442
+ - spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-1.0/build/rpm_metadata/requires
443
+ - spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-1.0/metadata.json
444
+ - spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-2.0/CHANGELOG
445
+ - spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-2.0/Rakefile
446
+ - spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-2.0/build/rpm_metadata/requires
447
+ - spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-2.0/metadata.json
448
+ - spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-2.2/CHANGELOG
449
+ - spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-2.2/Rakefile
450
+ - spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-2.2/build/rpm_metadata/custom/overrides
451
+ - spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-2.2/build/rpm_metadata/requires
452
+ - spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-2.2/metadata.json
453
+ - spec/acceptance/files/mock_packages/pupmod-puppetlabs-stdlib.spec
454
+ - spec/acceptance/files/mock_packages/pupmod-simp-foo.spec
455
+ - spec/acceptance/files/mock_packages/pupmod-simp-simplib.spec
456
+ - spec/acceptance/files/mock_packages/rpmbuild.sh
457
+ - spec/acceptance/files/mock_packages/simp-adapter.spec
458
+ - spec/acceptance/files/mock_packages/simp-adapter/etc/simp/adapter_config.yaml
459
+ - spec/acceptance/files/mock_packages/simp-adapter/usr/local/sbin/simp_rpm_helper
438
460
  - spec/acceptance/files/simplib/CHANGELOG
439
461
  - spec/acceptance/files/simplib/Rakefile
440
462
  - spec/acceptance/files/simplib/build/rpm_metadata/requires
@@ -443,6 +465,11 @@ files:
443
465
  - spec/acceptance/files/testpackage/Rakefile
444
466
  - spec/acceptance/files/testpackage/build/rpm_metadata/requires
445
467
  - spec/acceptance/files/testpackage/metadata.json
468
+ - spec/acceptance/files/testpackage_custom_scriptlet/CHANGELOG
469
+ - spec/acceptance/files/testpackage_custom_scriptlet/Rakefile
470
+ - spec/acceptance/files/testpackage_custom_scriptlet/build/rpm_metadata/custom/overrides
471
+ - spec/acceptance/files/testpackage_custom_scriptlet/build/rpm_metadata/requires
472
+ - spec/acceptance/files/testpackage_custom_scriptlet/metadata.json
446
473
  - spec/acceptance/files/testpackage_missing_license/CHANGELOG
447
474
  - spec/acceptance/files/testpackage_missing_license/Rakefile
448
475
  - spec/acceptance/files/testpackage_missing_license/build/rpm_metadata/requires
@@ -479,7 +506,7 @@ files:
479
506
  - spec/acceptance/files/testpackage_without_changelog/build/rpm_metadata/requires
480
507
  - spec/acceptance/files/testpackage_without_changelog/metadata.json
481
508
  - spec/acceptance/nodesets/default.yml
482
- - spec/acceptance/pkg_rpm_spec.rb
509
+ - spec/acceptance/support/pkg_rpm_helpers.rb
483
510
  - spec/lib/simp/componentinfo_changelog_regex_spec.rb
484
511
  - spec/lib/simp/componentinfo_spec.rb
485
512
  - spec/lib/simp/files/build/testpackage.spec
@@ -1,164 +0,0 @@
1
- require 'spec_helper_acceptance'
2
-
3
-
4
- shared_examples_for "a RPM generator" do
5
- it 'should use specified release number for the RPM' do
6
- on test_host, %(#{run_cmd} "cd #{pkg_root_dir}/testpackage_with_release; rake pkg:rpm")
7
- release_test_rpm = File.join(pkg_root_dir, 'testpackage_with_release',
8
- 'dist', 'pupmod-simp-testpackage-0.0.1-42.noarch.rpm')
9
- on test_host, %(test -f #{release_test_rpm})
10
- end
11
-
12
- it 'should generate a changelog for the RPM when no CHANGELOG exists' do
13
- on test_host, %(#{run_cmd} "cd #{pkg_root_dir}/testpackage_without_changelog; rake pkg:rpm")
14
- changelog_test_rpm = File.join(pkg_root_dir, 'testpackage_without_changelog',
15
- 'dist', File.basename(testpackage_rpm))
16
- on test_host, %(rpm --changelog -qp #{changelog_test_rpm} | grep -q 'Auto Changelog')
17
- end
18
-
19
- it 'should not require pupmod-simp-simplib for simp-simplib RPM' do
20
- on test_host, %(#{run_cmd} "cd #{pkg_root_dir}/simplib; rake pkg:rpm")
21
- simplib_rpm = File.join(pkg_root_dir, 'simplib', 'dist',
22
- File.basename(testpackage_rpm).gsub(/simp-testpackage-0.0.1/,'simp-simplib-1.2.3'))
23
- on test_host, %(test -f #{simplib_rpm})
24
- on test_host, %(rpm -qpR #{simplib_rpm} | grep -q pupmod-simp-simplib), {:acceptable_exit_codes => [1]}
25
- end
26
-
27
- it 'should not fail to create an RPM when the CHANGELOG has a bad date' do
28
- on test_host,
29
- %(#{run_cmd} "cd #{pkg_root_dir}/testpackage_with_bad_changelog_date; rake pkg:rpm")
30
-
31
- bad_date_test_rpm = File.join(pkg_root_dir, 'testpackage_with_bad_changelog_date',
32
- 'dist', File.basename(testpackage_rpm))
33
- on test_host, %(test -f #{bad_date_test_rpm})
34
- end
35
-
36
- it 'should fail to create an RPM when metadata.json is missing' do
37
- on test_host,
38
- %(#{run_cmd} "cd #{pkg_root_dir}/testpackage_missing_metadata_file; rake pkg:rpm"),
39
- :acceptable_exit_codes => [1]
40
- end
41
-
42
- it 'should fail to create an RPM when license metadata is missing' do
43
- on test_host,
44
- %(#{run_cmd} "cd #{pkg_root_dir}/testpackage_missing_license; rake pkg:rpm"),
45
- :acceptable_exit_codes => [1]
46
- end
47
-
48
- it 'should fail to create an RPM when name metadata is missing' do
49
- on test_host,
50
- %(#{run_cmd} "cd #{pkg_root_dir}/testpackage_missing_name; rake pkg:rpm"),
51
- :acceptable_exit_codes => [1]
52
- end
53
-
54
- it 'should fail to create an RPM when source metadata is missing' do
55
- on test_host,
56
- %(#{run_cmd} "cd #{pkg_root_dir}/testpackage_missing_source; rake pkg:rpm"),
57
- :acceptable_exit_codes => [1]
58
- end
59
-
60
- it 'should fail to create an RPM when summary metadata is missing' do
61
- on test_host,
62
- %(#{run_cmd} "cd #{pkg_root_dir}/testpackage_missing_summary; rake pkg:rpm"),
63
- :acceptable_exit_codes => [1]
64
- end
65
-
66
- it 'should fail to create an RPM when version metadata is missing' do
67
- on test_host,
68
- %(#{run_cmd} "cd #{pkg_root_dir}/testpackage_missing_version; rake pkg:rpm"),
69
- :acceptable_exit_codes => [1]
70
- end
71
- end
72
-
73
- def comment(msg, indent=10)
74
- logger.optionally_color(Beaker::Logger::MAGENTA, " "*indent + msg)
75
- end
76
-
77
-
78
- describe 'rake pkg:rpm' do
79
- before :all do
80
- # make sure all generated files from previous rake tasks have
81
- # permissions that allow the copy in the 'prep' below
82
- root_dir = File.dirname(File.dirname(File.dirname(File.expand_path(__FILE__))))
83
- dist_dirs = Dir.glob(File.join(root_dir, '**', 'dist'))
84
- dist_dirs.each { |dir| FileUtils.chmod_R(0755, dir) }
85
- FileUtils.chmod_R(0755, 'junit')
86
- FileUtils.chmod_R(0755, 'log')
87
- end
88
-
89
- let(:run_cmd) { 'runuser build_user -l -c ' }
90
-
91
- let(:testpackages) {
92
- ['simplib',
93
- 'testpackage',
94
- 'testpackage_missing_license',
95
- 'testpackage_missing_metadata_file',
96
- 'testpackage_missing_name',
97
- 'testpackage_missing_source',
98
- 'testpackage_missing_summary',
99
- 'testpackage_missing_version',
100
- 'testpackage_with_bad_changelog_date',
101
- 'testpackage_with_release',
102
- 'testpackage_without_changelog']
103
- }
104
-
105
- let(:pkg_root_dir) { '/home/build_user/host_files/spec/acceptance/files' }
106
- let(:testpackage_dir) { '/home/build_user/host_files/spec/acceptance/files/testpackage' }
107
-
108
- hosts.each do |host|
109
- context "rpm building on #{host}" do
110
-
111
- context 'prep' do
112
- it 'should have a local copy of the test directory' do
113
- on host, %(#{run_cmd} "cp -a /host_files ~")
114
- end
115
-
116
- it 'should set up the Ruby gems' do
117
- # all our test packages use the same set of ruby gems, so only bundle
118
- # update once to save time
119
- on host, %(#{run_cmd} "cd #{testpackage_dir}; rvm use default; bundle update")
120
- end
121
-
122
- end
123
-
124
- context "using simpdefault.spec" do
125
- let(:test_host) { host }
126
- let(:build_type) {:default}
127
- let(:testpackage_rpm) { File.join(testpackage_dir, 'dist/pupmod-simp-testpackage-0.0.1-0.noarch.rpm') }
128
-
129
- it 'should have a clean working environment' do
130
- testpackages.each do |package|
131
- on host, %(#{run_cmd} "cd #{pkg_root_dir}/#{package}; rake clean")
132
- end
133
- end
134
-
135
- it "should create an RPM" do
136
- comment "produces RPM"
137
- on test_host, %(#{run_cmd} "cd #{testpackage_dir}; rake pkg:rpm")
138
- on test_host, %(test -f #{testpackage_rpm})
139
-
140
- comment "produces RPM with appropriate dependencies"
141
- on test_host, %(rpm -qpR #{testpackage_rpm} | grep -q simp-adapter)
142
- on test_host, %(rpm -qpR #{testpackage_rpm} | grep -q pupmod-simp-foo)
143
- on test_host, %(rpm -qpR #{testpackage_rpm} | grep -q pupmod-simp-simplib)
144
- on test_host, %(rpm -qpR #{testpackage_rpm} | grep -q pupmod-puppetlabs-stdlib)
145
- on test_host, %(rpm -qp --provides #{testpackage_rpm} | grep -q -x "pupmod-testpackage = 0.0.1-0")
146
- on test_host, %(rpm -qp --provides #{testpackage_rpm} | grep -q -x "simp-testpackage = 0.0.1-0")
147
- on test_host, %(rpm -qp --queryformat "[%{obsoletes}\\n]" #{testpackage_rpm} | grep -q "^pupmod-testpackage")
148
- on test_host, %(rpm -qp --queryformat "[%{obsoletes}\\n]" #{testpackage_rpm} | grep -q "^simp-testpackage")
149
-
150
- comment "produces RPM with a sourced CHANGELOG"
151
- on test_host, %(rpm --changelog -qp #{testpackage_rpm} | grep -q Stallman)
152
-
153
- comment "produces RPM with appropriate pre/post/preun/postun"
154
- on test_host, %(rpm -qp --scripts #{testpackage_rpm} | grep -q -x "/usr/local/sbin/simp_rpm_helper --rpm_dir=/usr/share/simp/modules/testpackage --rpm_section='pre' --rpm_status=\\$1")
155
- on test_host, %(rpm -qp --scripts #{testpackage_rpm} | grep -q -x "/usr/local/sbin/simp_rpm_helper --rpm_dir=/usr/share/simp/modules/testpackage --rpm_section='post' --rpm_status=\\$1")
156
- on test_host, %(rpm -qp --scripts #{testpackage_rpm} | grep -q -x "/usr/local/sbin/simp_rpm_helper --rpm_dir=/usr/share/simp/modules/testpackage --rpm_section='preun' --rpm_status=\\$1")
157
- on test_host, %(rpm -qp --scripts #{testpackage_rpm} | grep -q -x "/usr/local/sbin/simp_rpm_helper --rpm_dir=/usr/share/simp/modules/testpackage --rpm_section='postun' --rpm_status=\\$1")
158
- end
159
-
160
- it_should_behave_like "a RPM generator"
161
- end
162
- end
163
- end
164
- end