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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +26 -0
- data/Gemfile +13 -6
- data/lib/simp/command_utils.rb +6 -3
- data/lib/simp/componentinfo.rb +47 -33
- data/lib/simp/local_gpg_signing_key.rb +302 -303
- data/lib/simp/packer/iso_vars_json.rb +17 -15
- data/lib/simp/rake/build/auto.rb +415 -432
- data/lib/simp/rake/build/build.rb +119 -124
- data/lib/simp/rake/build/clean.rb +39 -39
- data/lib/simp/rake/build/code.rb +125 -128
- data/lib/simp/rake/build/constants.rb +7 -4
- data/lib/simp/rake/build/deps.rb +196 -207
- data/lib/simp/rake/build/helpers.rb +17 -13
- data/lib/simp/rake/build/iso.rb +404 -411
- data/lib/simp/rake/build/pkg.rb +752 -759
- data/lib/simp/rake/build/rpmdeps.rb +70 -70
- data/lib/simp/rake/build/spec.rb +44 -46
- data/lib/simp/rake/build/tar.rb +169 -173
- data/lib/simp/rake/build/unpack.rb +105 -107
- data/lib/simp/rake/build/upload.rb +93 -102
- data/lib/simp/rake/fixtures.rb +69 -66
- data/lib/simp/rake/helpers/rpm_spec.rb +10 -7
- data/lib/simp/rake/helpers/version.rb +3 -1
- data/lib/simp/rake/helpers.rb +12 -10
- data/lib/simp/rake/pkg.rb +417 -440
- data/lib/simp/rake/pupmod/helpers.rb +100 -87
- data/lib/simp/rake/pupmod/module_build.rb +39 -0
- data/lib/simp/rake/rubygem.rb +57 -56
- data/lib/simp/rake.rb +34 -29
- data/lib/simp/relchecks.rb +52 -43
- data/lib/simp/rpm.rb +123 -127
- data/lib/simp/rpm_signer.rb +57 -55
- data/lib/simp/yum.rb +54 -53
- data/spec/acceptance/nodesets/{default_ruby3_1.yml → almalinux10.yml} +4 -4
- data/spec/acceptance/nodesets/{default.yml → almalinux8.yml} +2 -2
- data/spec/acceptance/nodesets/almalinux9.yml +25 -0
- data/spec/acceptance/suites/default/00_pkg_rpm_custom_scriptlets_spec.rb +23 -28
- data/spec/acceptance/suites/default/10_pkg_rpm_spec.rb +54 -56
- data/spec/acceptance/suites/default/30_pkg_misc_spec.rb +17 -19
- data/spec/acceptance/suites/default/50_local_gpg_signing_key_spec.rb +5 -5
- data/spec/acceptance/suites/default/55_build_pkg_signing_spec.rb +109 -101
- data/spec/acceptance/suites/default/files/testpackage/spec/classes/init_spec.rb +1 -0
- data/spec/acceptance/suites/default/files/testpackage/spec/files/mock_something.rb +3 -1
- data/spec/acceptance/suites/default/files/testpackage/utils/convert_v1_to_v2.rb +2 -0
- data/spec/acceptance/suites/default/support/build_project_helpers.rb +20 -17
- data/spec/acceptance/suites/default/support/build_user_helpers.rb +4 -2
- data/spec/acceptance/suites/default/support/pkg_rpm_helpers.rb +30 -31
- data/spec/acceptance/support/simp_rake_helpers.rb +3 -1
- data/spec/lib/simp/command_utils_spec.rb +13 -10
- data/spec/lib/simp/componentinfo_changelog_regex_spec.rb +33 -33
- data/spec/lib/simp/componentinfo_spec.rb +99 -86
- data/spec/lib/simp/packer/iso_vars_json_spec.rb +16 -14
- data/spec/lib/simp/rake/build/helpers_spec.rb +7 -7
- data/spec/lib/simp/rake/build/rpmdeps_spec.rb +48 -46
- data/spec/lib/simp/rake/helpers_spec.rb +6 -5
- data/spec/lib/simp/rake/pkg_spec.rb +7 -5
- data/spec/lib/simp/rake/pupmod/fixtures/othermod/spec/classes/init_spec.rb +3 -1
- data/spec/lib/simp/rake/pupmod/fixtures/othermod/spec/spec_helper.rb +2 -0
- data/spec/lib/simp/rake/pupmod/fixtures/simpmod/spec/acceptance/suites/default/class_spec.rb +6 -5
- data/spec/lib/simp/rake/pupmod/fixtures/simpmod/spec/classes/init_spec.rb +51 -33
- data/spec/lib/simp/rake/pupmod/fixtures/simpmod/spec/spec_helper.rb +15 -16
- data/spec/lib/simp/rake/pupmod/fixtures/simpmod/spec/spec_helper_acceptance.rb +9 -9
- data/spec/lib/simp/rake/pupmod/helpers_spec.rb +20 -19
- data/spec/lib/simp/rake/pupmod/module_build_spec.rb +87 -0
- data/spec/lib/simp/rake_spec.rb +7 -6
- data/spec/lib/simp/relchecks_check_rpm_changelog_spec.rb +26 -31
- data/spec/lib/simp/relchecks_compare_latest_tag_spec.rb +32 -26
- data/spec/lib/simp/relchecks_create_tag_changelog_spec.rb +27 -19
- data/spec/lib/simp/rpm_signer_spec.rb +45 -39
- data/spec/lib/simp/rpm_spec.rb +190 -194
- data/spec/spec_helper.rb +4 -2
- data/spec/spec_helper_acceptance.rb +3 -5
- metadata +37 -72
- data/bin/simp_rake_helpers +0 -3
- data/lib/simp/ci/gitlab.rb +0 -226
- data/lib/simp/rake/ci.rb +0 -31
- data/spec/lib/simp/ci/files/global_nodesets_only/spec/acceptance/nodesets/default.yml +0 -41
- data/spec/lib/simp/ci/files/global_nodesets_only/spec/acceptance/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/job_broken_link_nodeset/spec/acceptance/nodesets/centos.yml +0 -41
- data/spec/lib/simp/ci/files/job_broken_link_nodeset/spec/acceptance/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/job_broken_link_nodeset/spec/acceptance/suites/default/class_spec.rb +0 -0
- data/spec/lib/simp/ci/files/job_invalid_nodeset/spec/acceptance/nodesets/default.yml +0 -41
- data/spec/lib/simp/ci/files/job_invalid_nodeset/spec/acceptance/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/job_invalid_nodeset/spec/acceptance/suites/default/class_spec.rb +0 -0
- data/spec/lib/simp/ci/files/job_invalid_suite/spec/acceptance/nodesets/default.yml +0 -41
- data/spec/lib/simp/ci/files/job_invalid_suite/spec/acceptance/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/job_invalid_suite/spec/acceptance/suites/default/class_spec.rb +0 -0
- data/spec/lib/simp/ci/files/job_missing_nodeset/spec/acceptance/nodesets/default.yml +0 -41
- data/spec/lib/simp/ci/files/job_missing_nodeset/spec/acceptance/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/job_missing_nodeset/spec/acceptance/suites/default/class_spec.rb +0 -0
- data/spec/lib/simp/ci/files/job_missing_suite_and_nodeset/spec/acceptance/nodesets/default.yml +0 -41
- data/spec/lib/simp/ci/files/job_missing_suite_and_nodeset/spec/acceptance/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/job_missing_suite_and_nodeset/spec/acceptance/suites/default/class_spec.rb +0 -0
- data/spec/lib/simp/ci/files/multiple_invalid_jobs/spec/acceptance/nodesets/default.yml +0 -41
- data/spec/lib/simp/ci/files/multiple_invalid_jobs/spec/acceptance/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/multiple_invalid_jobs/spec/acceptance/suites/default/class_spec.rb +0 -0
- data/spec/lib/simp/ci/files/multiple_invalid_jobs/spec/acceptance/suites/feature-1/feature-1_spec.rb +0 -0
- data/spec/lib/simp/ci/files/multiple_invalid_jobs/spec/acceptance/suites/feature_2/feature_2_spec.rb +0 -0
- data/spec/lib/simp/ci/files/multiple_invalid_jobs/spec/acceptance/suites/feature_2/nodesets/default.yml +0 -35
- data/spec/lib/simp/ci/files/multiple_invalid_jobs/spec/acceptance/suites/feature_2/nodesets/oel.yml +0 -35
- data/spec/lib/simp/ci/files/multiple_valid_jobs/spec/acceptance/nodesets/default.yml +0 -41
- data/spec/lib/simp/ci/files/multiple_valid_jobs/spec/acceptance/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/multiple_valid_jobs/spec/acceptance/suites/default/class_spec.rb +0 -0
- data/spec/lib/simp/ci/files/multiple_valid_jobs/spec/acceptance/suites/feature-1/feature-1_spec.rb +0 -0
- data/spec/lib/simp/ci/files/multiple_valid_jobs/spec/acceptance/suites/feature_2/feature_2_spec.rb +0 -0
- data/spec/lib/simp/ci/files/multiple_valid_jobs/spec/acceptance/suites/feature_2/nodesets/default.yml +0 -35
- data/spec/lib/simp/ci/files/multiple_valid_jobs/spec/acceptance/suites/feature_2/nodesets/oel.yml +0 -35
- data/spec/lib/simp/ci/files/no_acceptance_tests/spec/spec_helper.rb +0 -0
- data/spec/lib/simp/ci/files/no_gitlab_config_with_tests/spec/acceptance/nodesets/default.yml +0 -41
- data/spec/lib/simp/ci/files/no_gitlab_config_with_tests/spec/acceptance/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/no_gitlab_config_with_tests/spec/acceptance/suites/default/class_spec.rb +0 -0
- data/spec/lib/simp/ci/files/no_gitlab_config_without_tests/spec/acceptance/nodesets/default.yml +0 -41
- data/spec/lib/simp/ci/files/no_gitlab_config_without_tests/spec/acceptance/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/suite_skeleton_only/spec/acceptance/nodesets/centos.yml +0 -41
- data/spec/lib/simp/ci/files/suite_skeleton_only/spec/acceptance/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/valid_job_global_nodeset/spec/acceptance/nodesets/default.yml +0 -41
- data/spec/lib/simp/ci/files/valid_job_global_nodeset/spec/acceptance/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/valid_job_global_nodeset/spec/acceptance/suites/default/class_spec.rb +0 -0
- data/spec/lib/simp/ci/files/valid_job_nodeset_dir_link/spec/acceptance/nodesets/default.yml +0 -41
- data/spec/lib/simp/ci/files/valid_job_nodeset_dir_link/spec/acceptance/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/valid_job_nodeset_dir_link/spec/acceptance/suites/default/class_spec.rb +0 -0
- data/spec/lib/simp/ci/files/valid_job_nodeset_link/spec/acceptance/suites/default/class_spec.rb +0 -0
- data/spec/lib/simp/ci/files/valid_job_nodeset_link/spec/acceptance/suites/default/nodesets/centos.yml +0 -41
- data/spec/lib/simp/ci/files/valid_job_nodeset_link/spec/acceptance/suites/default/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/valid_job_suite_nodeset/spec/acceptance/suites/default/class_spec.rb +0 -0
- data/spec/lib/simp/ci/files/valid_job_suite_nodeset/spec/acceptance/suites/default/nodesets/default.yml +0 -41
- data/spec/lib/simp/ci/files/valid_job_suite_nodeset/spec/acceptance/suites/default/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/gitlab_spec.rb +0 -245
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'spec_helper_acceptance'
|
|
2
4
|
require_relative 'support/pkg_rpm_helpers'
|
|
3
5
|
|
|
@@ -7,11 +9,11 @@ RSpec.configure do |c|
|
|
|
7
9
|
end
|
|
8
10
|
|
|
9
11
|
shared_examples_for 'an RPM generator with customized scriptlets' do
|
|
10
|
-
it '
|
|
12
|
+
it 'creates an RPM with customized scriptlets' do
|
|
11
13
|
scriptlets = rpm_scriptlets_for(
|
|
12
14
|
host,
|
|
13
|
-
"#{pkg_root_dir}/testpackage_custom_scriptlet/dist/"
|
|
14
|
-
"pupmod-simp-testpackage-0.0.1-1#{rpm_dist}.noarch.rpm"
|
|
15
|
+
"#{pkg_root_dir}/testpackage_custom_scriptlet/dist/" \
|
|
16
|
+
"pupmod-simp-testpackage-0.0.1-1#{rpm_dist}.noarch.rpm",
|
|
15
17
|
)
|
|
16
18
|
|
|
17
19
|
comment '...the expected scriptlet types are present'
|
|
@@ -24,18 +26,18 @@ shared_examples_for 'an RPM generator with customized scriptlets' do
|
|
|
24
26
|
].sort
|
|
25
27
|
|
|
26
28
|
comment '...there are no duplicates' # this *should* be impossible
|
|
27
|
-
expect(scriptlets.map{|
|
|
29
|
+
expect(scriptlets.map { |_k, v| v[:count] }.max).to eq 1
|
|
28
30
|
|
|
29
31
|
comment '...pretrans scriptlet contains custom content'
|
|
30
32
|
expect(scriptlets['pretrans'][:content]).to eq '-- Custom scriptlet'
|
|
31
33
|
|
|
32
34
|
comment '...preinstall scriptlet has been overridden with custom content'
|
|
33
35
|
expect(scriptlets['preinstall'][:bare_content]).to eq(
|
|
34
|
-
"echo 'I override the default %%pre section provided by the spec file.'"
|
|
36
|
+
"echo 'I override the default %%pre section provided by the spec file.'",
|
|
35
37
|
)
|
|
36
38
|
|
|
37
39
|
comment '...default preun postun scriptlets call simp_rpm_helper with correct arguments'
|
|
38
|
-
expected_simp_rpm_helper_scriptlets = scriptlet_label_map.select{|
|
|
40
|
+
expected_simp_rpm_helper_scriptlets = scriptlet_label_map.select { |_k, v| ['preun', 'postun'].include? v }
|
|
39
41
|
expected_simp_rpm_helper_scriptlets.each do |rpm_label, simp_helper_label|
|
|
40
42
|
expected = <<~EOM
|
|
41
43
|
if [ -x /usr/local/sbin/simp_rpm_helper ] ; then
|
|
@@ -64,15 +66,13 @@ shared_examples_for 'an RPM generator with customized scriptlets' do
|
|
|
64
66
|
end
|
|
65
67
|
|
|
66
68
|
shared_examples_for 'an RPM generator with customized triggers' do
|
|
67
|
-
|
|
68
|
-
it 'should create an RPM with customized triggers' do
|
|
69
|
+
it 'creates an RPM with customized triggers' do
|
|
69
70
|
triggers = rpm_triggers_for(
|
|
70
71
|
host,
|
|
71
|
-
"#{pkg_root_dir}/testpackage_custom_scriptlet/dist/"
|
|
72
|
-
"pupmod-simp-testpackage-0.0.1-1#{rpm_dist}.noarch.rpm"
|
|
72
|
+
"#{pkg_root_dir}/testpackage_custom_scriptlet/dist/" \
|
|
73
|
+
"pupmod-simp-testpackage-0.0.1-1#{rpm_dist}.noarch.rpm",
|
|
73
74
|
)
|
|
74
75
|
|
|
75
|
-
|
|
76
76
|
comment '...the expected trigger types are present'
|
|
77
77
|
expect(triggers.keys.sort).to eq [
|
|
78
78
|
'triggerun scriptlet (using /bin/sh) -- bar',
|
|
@@ -80,55 +80,50 @@ shared_examples_for 'an RPM generator with customized triggers' do
|
|
|
80
80
|
]
|
|
81
81
|
|
|
82
82
|
comment '...there are no duplicates' # <-- this also should be impossible
|
|
83
|
-
expect(triggers.map{|
|
|
83
|
+
expect(triggers.map { |_k, v| v[:count] }.max).to eq 1
|
|
84
84
|
|
|
85
85
|
comment '..."triggerun -- foo" contains the expected content'
|
|
86
86
|
expect(triggers['triggerun scriptlet (using /bin/sh) -- foo'][:bare_content]).to eq(
|
|
87
|
-
%q
|
|
87
|
+
%q(echo "The 'foo' package is great; why would you uninstall it?"),
|
|
88
88
|
)
|
|
89
89
|
|
|
90
90
|
comment '..."triggerun -- bar" contains the expected content'
|
|
91
91
|
expect(triggers['triggerun scriptlet (using /bin/sh) -- bar'][:bare_content]).to eq(
|
|
92
|
-
%q
|
|
92
|
+
%q(echo "This trigger runs just before the 'bar' package's %%preun"),
|
|
93
93
|
)
|
|
94
94
|
end
|
|
95
|
-
|
|
96
95
|
end
|
|
97
96
|
|
|
98
97
|
describe 'rake pkg:rpm with customized content' do
|
|
99
|
-
|
|
100
98
|
before :all do
|
|
101
99
|
copy_host_files_into_build_user_homedir(hosts)
|
|
102
100
|
end
|
|
103
101
|
|
|
104
|
-
let(:pkg_root_dir){'/home/build_user/host_files/spec/acceptance/suites/default/files'}
|
|
105
|
-
let(:testpackage_dir){"#{pkg_root_dir}/testpackage"}
|
|
102
|
+
let(:pkg_root_dir) { '/home/build_user/host_files/spec/acceptance/suites/default/files' }
|
|
103
|
+
let(:testpackage_dir) { "#{pkg_root_dir}/testpackage" }
|
|
106
104
|
|
|
107
105
|
hosts.each do |_host|
|
|
108
106
|
context "on #{_host}" do
|
|
109
|
-
let!(:host){ _host }
|
|
110
|
-
let(:rpm_dist){ on(host, %
|
|
107
|
+
let!(:host) { _host }
|
|
108
|
+
let(:rpm_dist) { on(host, %(rpm --eval '%{dist}')).output.strip.gsub(%r{\.centos$}, '') }
|
|
111
109
|
|
|
112
110
|
it 'can prep the package directories' do
|
|
113
111
|
testpackages = [
|
|
114
|
-
|
|
112
|
+
'testpackage_custom_scriptlet',
|
|
115
113
|
]
|
|
116
114
|
|
|
117
115
|
testpackages.each do |package|
|
|
118
|
-
on hosts,
|
|
119
|
-
%Q(rvm use default; bundle update --local || bundle update")
|
|
116
|
+
on hosts, "#{run_cmd} \"cd #{pkg_root_dir}/#{package}; bundle update --local || bundle update\""
|
|
120
117
|
end
|
|
121
118
|
end
|
|
122
119
|
|
|
123
120
|
context 'when valid custom content is defined under rpm_metadata' do
|
|
124
|
-
|
|
125
|
-
it 'should create an RPM' do
|
|
121
|
+
it 'creates an RPM' do
|
|
126
122
|
on host, %(#{run_cmd} "cd #{pkg_root_dir}/testpackage_custom_scriptlet; #{rake_cmd} pkg:rpm")
|
|
127
123
|
end
|
|
128
124
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
125
|
+
it_behaves_like 'an RPM generator with customized scriptlets'
|
|
126
|
+
it_behaves_like 'an RPM generator with customized triggers'
|
|
132
127
|
end
|
|
133
128
|
end
|
|
134
129
|
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'spec_helper_acceptance'
|
|
2
4
|
require_relative 'support/pkg_rpm_helpers'
|
|
3
5
|
|
|
@@ -7,65 +9,64 @@ RSpec.configure do |c|
|
|
|
7
9
|
end
|
|
8
10
|
|
|
9
11
|
shared_examples_for 'an RPM generator with edge cases' do
|
|
10
|
-
it '
|
|
12
|
+
it 'uses specified release number for the RPM' do
|
|
11
13
|
on host, %(#{run_cmd} "cd #{pkg_root_dir}/testpackage_with_release; #{rake_cmd} pkg:rpm")
|
|
12
14
|
release_test_rpm = File.join(pkg_root_dir, 'testpackage_with_release',
|
|
13
|
-
|
|
15
|
+
'dist', "pupmod-simp-testpackage-0.0.1-42#{rpm_dist}.noarch.rpm")
|
|
14
16
|
on host, %(test -f #{release_test_rpm})
|
|
15
17
|
end
|
|
16
18
|
|
|
17
|
-
it '
|
|
19
|
+
it 'generates a changelog for the RPM when no CHANGELOG exists' do
|
|
18
20
|
on host, %(#{run_cmd} "cd #{pkg_root_dir}/testpackage_without_changelog; #{rake_cmd} pkg:rpm")
|
|
19
21
|
changelog_test_rpm = File.join(pkg_root_dir, 'testpackage_without_changelog',
|
|
20
|
-
|
|
22
|
+
'dist', File.basename(testpackage_rpm))
|
|
21
23
|
on host, %(rpm --changelog -qp #{changelog_test_rpm} | grep -q 'Auto Changelog')
|
|
22
24
|
end
|
|
23
25
|
|
|
24
|
-
it '
|
|
26
|
+
it 'does not fail to create an RPM when the CHANGELOG has a bad date' do
|
|
25
27
|
on host,
|
|
26
|
-
|
|
28
|
+
%(#{run_cmd} "cd #{pkg_root_dir}/testpackage_with_bad_changelog_date; #{rake_cmd} pkg:rpm")
|
|
27
29
|
|
|
28
30
|
bad_date_test_rpm = File.join(pkg_root_dir, 'testpackage_with_bad_changelog_date',
|
|
29
|
-
|
|
31
|
+
'dist', File.basename(testpackage_rpm))
|
|
30
32
|
on host, %(test -f #{bad_date_test_rpm})
|
|
31
33
|
end
|
|
32
34
|
|
|
33
|
-
it '
|
|
35
|
+
it 'fails to create an RPM when metadata.json is missing' do
|
|
34
36
|
on host,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
%(#{run_cmd} "cd #{pkg_root_dir}/testpackage_missing_metadata_file; #{rake_cmd} pkg:rpm"),
|
|
38
|
+
:acceptable_exit_codes => [1]
|
|
37
39
|
end
|
|
38
40
|
|
|
39
|
-
it '
|
|
41
|
+
it 'fails to create an RPM when license metadata is missing' do
|
|
40
42
|
on host,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
%(#{run_cmd} "cd #{pkg_root_dir}/testpackage_missing_license; #{rake_cmd} pkg:rpm"),
|
|
44
|
+
:acceptable_exit_codes => [1]
|
|
43
45
|
end
|
|
44
46
|
|
|
45
|
-
it '
|
|
47
|
+
it 'fails to create an RPM when name metadata is missing' do
|
|
46
48
|
on host,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
%(#{run_cmd} "cd #{pkg_root_dir}/testpackage_missing_name; #{rake_cmd} pkg:rpm"),
|
|
50
|
+
:acceptable_exit_codes => [1]
|
|
49
51
|
end
|
|
50
52
|
|
|
51
|
-
it '
|
|
53
|
+
it 'fails to create an RPM when source metadata is missing' do
|
|
52
54
|
on host,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
+
%(#{run_cmd} "cd #{pkg_root_dir}/testpackage_missing_source; #{rake_cmd} pkg:rpm"),
|
|
56
|
+
:acceptable_exit_codes => [1]
|
|
55
57
|
end
|
|
56
58
|
|
|
57
|
-
it '
|
|
59
|
+
it 'fails to create an RPM when summary metadata is missing' do
|
|
58
60
|
on host,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
%(#{run_cmd} "cd #{pkg_root_dir}/testpackage_missing_summary; #{rake_cmd} pkg:rpm"),
|
|
62
|
+
:acceptable_exit_codes => [1]
|
|
61
63
|
end
|
|
62
64
|
|
|
63
|
-
it '
|
|
65
|
+
it 'fails to create an RPM when version metadata is missing' do
|
|
64
66
|
on host,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
+
%(#{run_cmd} "cd #{pkg_root_dir}/testpackage_missing_version; #{rake_cmd} pkg:rpm"),
|
|
68
|
+
:acceptable_exit_codes => [1]
|
|
67
69
|
end
|
|
68
|
-
|
|
69
70
|
end
|
|
70
71
|
|
|
71
72
|
describe 'rake pkg:rpm' do
|
|
@@ -75,41 +76,38 @@ describe 'rake pkg:rpm' do
|
|
|
75
76
|
|
|
76
77
|
hosts.each do |_host|
|
|
77
78
|
context "on #{_host}" do
|
|
78
|
-
let!(:host){ _host }
|
|
79
|
-
let(:rpm_dist){ on(host, %
|
|
79
|
+
let!(:host) { _host }
|
|
80
|
+
let(:rpm_dist) { on(host, %(rpm --eval '%{dist}')).output.strip.gsub(%r{\.centos$}, '') }
|
|
80
81
|
|
|
81
82
|
context 'rpm building' do
|
|
82
|
-
|
|
83
|
-
let(:
|
|
84
|
-
let(:testpackage_dir){"#{pkg_root_dir}/testpackage"}
|
|
83
|
+
let(:pkg_root_dir) { '/home/build_user/host_files/spec/acceptance/suites/default/files' }
|
|
84
|
+
let(:testpackage_dir) { "#{pkg_root_dir}/testpackage" }
|
|
85
85
|
|
|
86
86
|
it 'can prep the package directories' do
|
|
87
87
|
testpackages = [
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
88
|
+
'simplib',
|
|
89
|
+
'testpackage',
|
|
90
|
+
'testpackage_missing_license',
|
|
91
|
+
'testpackage_missing_metadata_file',
|
|
92
|
+
'testpackage_missing_name',
|
|
93
|
+
'testpackage_missing_source',
|
|
94
|
+
'testpackage_missing_summary',
|
|
95
|
+
'testpackage_missing_version',
|
|
96
|
+
'testpackage_with_bad_changelog_date',
|
|
97
|
+
'testpackage_with_release',
|
|
98
|
+
'testpackage_without_changelog',
|
|
99
99
|
]
|
|
100
100
|
|
|
101
101
|
testpackages.each do |package|
|
|
102
|
-
on hosts,
|
|
103
|
-
%Q(rvm use default; bundle update --local || bundle update")
|
|
102
|
+
on hosts, "#{run_cmd} \"cd #{pkg_root_dir}/#{package}; bundle update --local || bundle update\""
|
|
104
103
|
end
|
|
105
104
|
end
|
|
106
105
|
|
|
107
106
|
context 'using simpdefault.spec' do
|
|
108
|
-
|
|
109
|
-
let(:build_type) {:default}
|
|
107
|
+
let(:build_type) { :default }
|
|
110
108
|
let(:testpackage_rpm) { File.join(testpackage_dir, "dist/pupmod-simp-testpackage-0.0.1-1#{rpm_dist}.noarch.rpm") }
|
|
111
109
|
|
|
112
|
-
it '
|
|
110
|
+
it 'creates an RPM' do
|
|
113
111
|
comment "produces RPM on #{host}"
|
|
114
112
|
on host, %(#{run_cmd} "cd #{testpackage_dir}; #{rake_cmd} pkg:rpm")
|
|
115
113
|
on host, %(test -f #{testpackage_rpm})
|
|
@@ -139,7 +137,7 @@ describe 'rake pkg:rpm' do
|
|
|
139
137
|
].sort
|
|
140
138
|
|
|
141
139
|
comment '...default preinstall scriptlet'
|
|
142
|
-
expected
|
|
140
|
+
expected = <<~EOM
|
|
143
141
|
# (default scriptlet for SIMP 6.x)
|
|
144
142
|
# when $1 = 1, this is an install
|
|
145
143
|
# when $1 = 2, this is an upgrade
|
|
@@ -149,10 +147,10 @@ describe 'rake pkg:rpm' do
|
|
|
149
147
|
/usr/local/sbin/simp_rpm_helper --rpm_dir=/usr/share/simp/modules/testpackage --rpm_section='pre' --rpm_status=$1
|
|
150
148
|
fi
|
|
151
149
|
EOM
|
|
152
|
-
expect(scriptlets['preinstall'][:content]).to eq(
|
|
150
|
+
expect(scriptlets['preinstall'][:content]).to eq(expected.strip)
|
|
153
151
|
|
|
154
152
|
comment '...default preuninstall scriptlet'
|
|
155
|
-
expected
|
|
153
|
+
expected = <<~EOM
|
|
156
154
|
# (default scriptlet for SIMP 6.x)
|
|
157
155
|
# when $1 = 1, this is the uninstall of the previous version during an upgrade
|
|
158
156
|
# when $1 = 0, this is the uninstall of the only version during an erase
|
|
@@ -160,10 +158,10 @@ describe 'rake pkg:rpm' do
|
|
|
160
158
|
/usr/local/sbin/simp_rpm_helper --rpm_dir=/usr/share/simp/modules/testpackage --rpm_section='preun' --rpm_status=$1
|
|
161
159
|
fi
|
|
162
160
|
EOM
|
|
163
|
-
expect(scriptlets['preuninstall'][:content]).to eq(
|
|
161
|
+
expect(scriptlets['preuninstall'][:content]).to eq(expected.strip)
|
|
164
162
|
|
|
165
163
|
comment '...default postuninstall scriptlet'
|
|
166
|
-
expected
|
|
164
|
+
expected = <<~EOM
|
|
167
165
|
# (default scriptlet for SIMP 6.x)
|
|
168
166
|
# when $1 = 1, this is the uninstall of the previous version during an upgrade
|
|
169
167
|
# when $1 = 0, this is the uninstall of the only version during an erase
|
|
@@ -171,10 +169,10 @@ describe 'rake pkg:rpm' do
|
|
|
171
169
|
/usr/local/sbin/simp_rpm_helper --rpm_dir=/usr/share/simp/modules/testpackage --rpm_section='postun' --rpm_status=$1
|
|
172
170
|
fi
|
|
173
171
|
EOM
|
|
174
|
-
expect(scriptlets['postuninstall'][:content]).to eq(
|
|
172
|
+
expect(scriptlets['postuninstall'][:content]).to eq(expected.strip)
|
|
175
173
|
|
|
176
174
|
comment '...default posttrans scriptlet'
|
|
177
|
-
expected
|
|
175
|
+
expected = <<~EOM
|
|
178
176
|
# (default scriptlet for SIMP 6.x)
|
|
179
177
|
# Marker file is created in %pre and only exists for installs or upgrades
|
|
180
178
|
# when marker file is prepended with 'rpm_status1.', this is an install
|
|
@@ -191,7 +189,7 @@ describe 'rake pkg:rpm' do
|
|
|
191
189
|
fi
|
|
192
190
|
fi
|
|
193
191
|
EOM
|
|
194
|
-
expect(scriptlets['posttrans'][:content]).to eq(
|
|
192
|
+
expect(scriptlets['posttrans'][:content]).to eq(expected.strip)
|
|
195
193
|
|
|
196
194
|
comment 'does not modify the shebangs in executable scripts in the RPM'
|
|
197
195
|
# if the shebangs were modified, we should see /usr/bin/ruby and /usr/bin/rspec
|
|
@@ -200,7 +198,7 @@ describe 'rake pkg:rpm' do
|
|
|
200
198
|
on host, %(rpm -qpR #{testpackage_rpm} | grep -q /usr/bin/rspec), :acceptable_exit_codes => [1]
|
|
201
199
|
end
|
|
202
200
|
|
|
203
|
-
|
|
201
|
+
it_behaves_like 'an RPM generator with edge cases'
|
|
204
202
|
end
|
|
205
203
|
end
|
|
206
204
|
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'spec_helper_acceptance'
|
|
2
4
|
require_relative 'support/pkg_rpm_helpers'
|
|
3
5
|
|
|
@@ -6,28 +8,27 @@ RSpec.configure do |c|
|
|
|
6
8
|
c.extend Simp::BeakerHelpers::SimpRakeHelpers::PkgRpmHelpers
|
|
7
9
|
end
|
|
8
10
|
|
|
9
|
-
|
|
10
11
|
shared_examples_for 'a valid RPM changelog processor' do |project|
|
|
11
|
-
it '
|
|
12
|
+
it 'validates the RPM changelog' do
|
|
12
13
|
on host, %(#{run_cmd} "cd #{pkg_root_dir}/#{project}; #{rake_cmd} pkg:check_rpm_changelog")
|
|
13
14
|
end
|
|
14
15
|
|
|
15
|
-
it '
|
|
16
|
+
it 'generates the tag changelog' do
|
|
16
17
|
on host, %(#{run_cmd} "cd #{pkg_root_dir}/#{project}; #{rake_cmd} pkg:create_tag_changelog")
|
|
17
18
|
end
|
|
18
19
|
end
|
|
19
20
|
|
|
20
21
|
shared_examples_for 'an invalid RPM changelog processor' do |project|
|
|
21
|
-
it '
|
|
22
|
+
it 'rejects the RPM changelog' do
|
|
22
23
|
on host,
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
%(#{run_cmd} "cd #{pkg_root_dir}/#{project}; #{rake_cmd} pkg:check_rpm_changelog"),
|
|
25
|
+
:acceptable_exit_codes => [1]
|
|
25
26
|
end
|
|
26
27
|
|
|
27
|
-
it '
|
|
28
|
+
it 'does not generate the tag changelog' do
|
|
28
29
|
on host,
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
%(#{run_cmd} "cd #{pkg_root_dir}/#{project}; #{rake_cmd} pkg:create_tag_changelog"),
|
|
31
|
+
:acceptable_exit_codes => [1]
|
|
31
32
|
end
|
|
32
33
|
end
|
|
33
34
|
|
|
@@ -36,10 +37,9 @@ describe 'rake pkg:check_rpm_changelog' do
|
|
|
36
37
|
copy_host_files_into_build_user_homedir(hosts)
|
|
37
38
|
end
|
|
38
39
|
|
|
39
|
-
|
|
40
40
|
hosts.each do |_host|
|
|
41
41
|
context "on #{_host}" do
|
|
42
|
-
let!(:host){ _host }
|
|
42
|
+
let!(:host) { _host }
|
|
43
43
|
let(:pkg_root_dir) { '/home/build_user/host_files/spec/acceptance/suites/default/files' }
|
|
44
44
|
|
|
45
45
|
it 'can prep the package directories' do
|
|
@@ -47,24 +47,22 @@ describe 'rake pkg:check_rpm_changelog' do
|
|
|
47
47
|
'asset',
|
|
48
48
|
'asset_with_misordered_entries',
|
|
49
49
|
'module',
|
|
50
|
-
'module_with_misordered_entries'
|
|
50
|
+
'module_with_misordered_entries',
|
|
51
51
|
]
|
|
52
52
|
|
|
53
53
|
testpackages.each do |package|
|
|
54
|
-
on hosts,
|
|
55
|
-
%Q(rvm use default; bundle update --local || bundle update")
|
|
54
|
+
on hosts, "#{run_cmd} \"cd #{pkg_root_dir}/#{package}; bundle update --local || bundle update\""
|
|
56
55
|
end
|
|
57
56
|
end
|
|
58
57
|
|
|
59
58
|
context 'with no project changelog errors' do
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
it_behaves_like('a valid RPM changelog processor', 'asset')
|
|
60
|
+
it_behaves_like('a valid RPM changelog processor', 'module')
|
|
62
61
|
end
|
|
63
62
|
|
|
64
|
-
|
|
65
63
|
context 'with project changelog errors' do
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
it_behaves_like('an invalid RPM changelog processor', 'asset_with_misordered_entries')
|
|
65
|
+
it_behaves_like('an invalid RPM changelog processor', 'module_with_misordered_entries')
|
|
68
66
|
end
|
|
69
67
|
end
|
|
70
68
|
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'spec_helper_acceptance'
|
|
2
4
|
require_relative 'support/build_user_helpers'
|
|
3
5
|
|
|
@@ -14,8 +16,7 @@ end
|
|
|
14
16
|
# It should be possible manage GPG keys using this logic from many OSes,
|
|
15
17
|
# but it's silly to try to mock them all directly in RSpec.
|
|
16
18
|
describe 'local_gpg_signing_key unit test' do
|
|
17
|
-
|
|
18
|
-
def hf_cmd( hosts, cmd, env_str=nil, opts={})
|
|
19
|
+
def hf_cmd(hosts, cmd, env_str = nil, opts = {})
|
|
19
20
|
if ENV['PUPPET_VERSION']
|
|
20
21
|
env_str ||= %(export PUPPET_VERSION='#{ENV['PUPPET_VERSION']}';)
|
|
21
22
|
end
|
|
@@ -28,11 +29,10 @@ describe 'local_gpg_signing_key unit test' do
|
|
|
28
29
|
# If the build environment of user executing this test has a newer
|
|
29
30
|
# version of bundler than provided by the published docker container,
|
|
30
31
|
# the Gemfile.lock will cause problems. So, make sure to remove it!
|
|
31
|
-
hf_cmd(hosts, 'rm Gemfile.lock; bundle --local || bundle', nil, {run_in_parallel: true})
|
|
32
|
+
hf_cmd(hosts, 'rm Gemfile.lock; bundle --local || bundle', nil, { run_in_parallel: true })
|
|
32
33
|
end
|
|
33
34
|
|
|
34
35
|
it 'can run the os-dependent Simp::LocalGpgSigningKey spec tests' do
|
|
35
|
-
hf_cmd(
|
|
36
|
+
hf_cmd(hosts, 'bundle exec rspec spec/lib/simp/local_gpg_signing_key_spec.rb.beaker-only')
|
|
36
37
|
end
|
|
37
38
|
end
|
|
38
|
-
|