simp-rake-helpers 5.9.0 → 5.9.1
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 +8 -0
- data/lib/simp/rake/helpers/assets/rpm_spec/simp6.spec +21 -6
- data/lib/simp/rake/helpers/assets/rpm_spec/simpdefault.spec +21 -6
- data/lib/simp/rake/helpers/version.rb +1 -1
- data/spec/acceptance/00_pkg_rpm_custom_scriptlets_spec.rb +4 -4
- data/spec/acceptance/10_pkg_rpm_spec.rb +23 -10
- data/spec/acceptance/20_pkg_rpm_upgrade_spec.rb +16 -0
- data/spec/acceptance/nodesets/default.yml +2 -2
- data/spec/lib/simp/files/build/testpackage.spec +1 -1
- data/spec/lib/simp/rake/pupmod/fixtures/simpmod/spec/acceptance/suites/default/nodesets +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45a26553d93f116f66c155c12b0f9eb68f09b1e9a2d73b84f6400e6fed5e5035
|
4
|
+
data.tar.gz: 7af4c08f2164fa751aa0d1c22a704ac1f863092e6f609b588eb354f70975919f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79b23961c02194be0ca7014096f87f6edbbef853f4e9bc84f25457fb1837d4f3aa0ee90dbf0bc9410a47cebb01a0b340eb741a5643a1e9412fb71671d03aba3b
|
7
|
+
data.tar.gz: 483d7cc338ab38e359c5ca7be792b03c3e50fe7e72f946b65d232475c551bb3666496676179ddb2df38967a9b2cdadca0e2ecf41b453fc84ba080418c7d35c1d
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
### 5.9.1 /2019-08-06
|
2
|
+
Fixed 2 bugs in the SIMP Puppet module generated RPM spec files
|
3
|
+
* When SIMP Puppet module RPMs were installed, they created the wrong
|
4
|
+
state directory, '/%{_localstatedir}/lib/rpm-state/simp-adapter'.
|
5
|
+
This incorrect directory was created because the ``_localstatedir``
|
6
|
+
RPM macro was not evaluated at run time.
|
7
|
+
* The %preun and $postun scriptlet comments were incorrect.
|
8
|
+
|
1
9
|
### 5.9.0 /2019-05-31
|
2
10
|
* Increase the upper bound of the Bundler dependency to < 3.0
|
3
11
|
|
@@ -485,22 +485,37 @@ mkdir -p %{buildroot}/%{prefix}
|
|
485
485
|
-- This function should be called last
|
486
486
|
--
|
487
487
|
function declare_default_scriptlets(custom_content_table, declared_scriptlets_table)
|
488
|
-
local marker_dir = '%{_localstatedir}/lib/rpm-state/simp-adapter'
|
488
|
+
local marker_dir = rpm.expand('%{_localstatedir}/lib/rpm-state/simp-adapter')
|
489
489
|
local marker_file = marker_dir..'/rpm_status$1.'..module_name
|
490
490
|
|
491
|
+
local pre_comment = (
|
492
|
+
'# when $1 = 1, this is an install\n'..
|
493
|
+
'# when $1 = 2, this is an upgrade\n'
|
494
|
+
)
|
495
|
+
|
496
|
+
local preun_comment = (
|
497
|
+
'# when $1 = 1, this is the uninstall of the previous version during an upgrade\n'..
|
498
|
+
'# when $1 = 0, this is the uninstall of the only version during an erase\n'
|
499
|
+
)
|
500
|
+
|
501
|
+
local postun_comment = (
|
502
|
+
'# when $1 = 1, this is the uninstall of the previous version during an upgrade\n'..
|
503
|
+
'# when $1 = 0, this is the uninstall of the only version during an erase\n'
|
504
|
+
)
|
505
|
+
|
491
506
|
|
492
507
|
local DEFAULT_SCRIPTLETS = {
|
493
|
-
['pre'] = {
|
494
|
-
['preun'] = {
|
495
|
-
['postun'] = {
|
508
|
+
['pre'] = {comment = pre_comment, custom='mkdir -p '..marker_dir..'\ntouch '..marker_file..'\n'},
|
509
|
+
['preun'] = {comment = preun_comment, custom=''},
|
510
|
+
['postun'] = {comment = postun_comment, custom=''}
|
496
511
|
}
|
512
|
+
|
497
513
|
local rpm_dir = rpm.expand('%{prefix}/' .. module_name)
|
498
514
|
|
499
515
|
for name,data in pairs(DEFAULT_SCRIPTLETS) do
|
500
516
|
local content = ('%'..name.."\n"..
|
501
517
|
'# (default scriptlet for SIMP 6.x)\n'..
|
502
|
-
|
503
|
-
'# when $1 = '.. data.upgrade ..', this is an upgrade\n'..
|
518
|
+
data.comment ..
|
504
519
|
data.custom ..
|
505
520
|
'if [ -x /usr/local/sbin/simp_rpm_helper ] ; then\n'..
|
506
521
|
' /usr/local/sbin/simp_rpm_helper --rpm_dir='..
|
@@ -485,22 +485,37 @@ mkdir -p %{buildroot}/%{prefix}
|
|
485
485
|
-- This function should be called last
|
486
486
|
--
|
487
487
|
function declare_default_scriptlets(custom_content_table, declared_scriptlets_table)
|
488
|
-
local marker_dir = '%{_localstatedir}/lib/rpm-state/simp-adapter'
|
488
|
+
local marker_dir = rpm.expand('%{_localstatedir}/lib/rpm-state/simp-adapter')
|
489
489
|
local marker_file = marker_dir..'/rpm_status$1.'..module_name
|
490
490
|
|
491
|
+
local pre_comment = (
|
492
|
+
'# when $1 = 1, this is an install\n'..
|
493
|
+
'# when $1 = 2, this is an upgrade\n'
|
494
|
+
)
|
495
|
+
|
496
|
+
local preun_comment = (
|
497
|
+
'# when $1 = 1, this is the uninstall of the previous version during an upgrade\n'..
|
498
|
+
'# when $1 = 0, this is the uninstall of the only version during an erase\n'
|
499
|
+
)
|
500
|
+
|
501
|
+
local postun_comment = (
|
502
|
+
'# when $1 = 1, this is the uninstall of the previous version during an upgrade\n'..
|
503
|
+
'# when $1 = 0, this is the uninstall of the only version during an erase\n'
|
504
|
+
)
|
505
|
+
|
491
506
|
|
492
507
|
local DEFAULT_SCRIPTLETS = {
|
493
|
-
['pre'] = {
|
494
|
-
['preun'] = {
|
495
|
-
['postun'] = {
|
508
|
+
['pre'] = {comment = pre_comment, custom='mkdir -p '..marker_dir..'\ntouch '..marker_file..'\n'},
|
509
|
+
['preun'] = {comment = preun_comment, custom=''},
|
510
|
+
['postun'] = {comment = postun_comment, custom=''}
|
496
511
|
}
|
512
|
+
|
497
513
|
local rpm_dir = rpm.expand('%{prefix}/' .. module_name)
|
498
514
|
|
499
515
|
for name,data in pairs(DEFAULT_SCRIPTLETS) do
|
500
516
|
local content = ('%'..name.."\n"..
|
501
517
|
'# (default scriptlet for SIMP 6.x)\n'..
|
502
|
-
|
503
|
-
'# when $1 = '.. data.upgrade ..', this is an upgrade\n'..
|
518
|
+
data.comment ..
|
504
519
|
data.custom ..
|
505
520
|
'if [ -x /usr/local/sbin/simp_rpm_helper ] ; then\n'..
|
506
521
|
' /usr/local/sbin/simp_rpm_helper --rpm_dir='..
|
@@ -47,13 +47,13 @@ EOM
|
|
47
47
|
|
48
48
|
comment '...default posttrans scriptlet calls simp_rpm_helper with correct arguments'
|
49
49
|
expected = <<EOM
|
50
|
-
if [ -e
|
51
|
-
rm
|
50
|
+
if [ -e /var/lib/rpm-state/simp-adapter/rpm_status1.testpackage ] ; then
|
51
|
+
rm /var/lib/rpm-state/simp-adapter/rpm_status1.testpackage
|
52
52
|
if [ -x /usr/local/sbin/simp_rpm_helper ] ; then
|
53
53
|
/usr/local/sbin/simp_rpm_helper --rpm_dir=/usr/share/simp/modules/testpackage --rpm_section='posttrans' --rpm_status=1
|
54
54
|
fi
|
55
|
-
elif [ -e
|
56
|
-
rm
|
55
|
+
elif [ -e /var/lib/rpm-state/simp-adapter/rpm_status2.testpackage ] ; then
|
56
|
+
rm /var/lib/rpm-state/simp-adapter/rpm_status2.testpackage
|
57
57
|
if [ -x /usr/local/sbin/simp_rpm_helper ] ; then
|
58
58
|
/usr/local/sbin/simp_rpm_helper --rpm_dir=/usr/share/simp/modules/testpackage --rpm_section='posttrans' --rpm_status=2
|
59
59
|
fi
|
@@ -148,45 +148,58 @@ describe 'rake pkg:rpm' do
|
|
148
148
|
|
149
149
|
comment '...default preinstall scriptlet'
|
150
150
|
expected =<<-EOM
|
151
|
-
|
152
|
-
|
151
|
+
# (default scriptlet for SIMP 6.x)
|
152
|
+
# when $1 = 1, this is an install
|
153
|
+
# when $1 = 2, this is an upgrade
|
154
|
+
mkdir -p /var/lib/rpm-state/simp-adapter
|
155
|
+
touch /var/lib/rpm-state/simp-adapter/rpm_status$1.testpackage
|
153
156
|
if [ -x /usr/local/sbin/simp_rpm_helper ] ; then
|
154
157
|
/usr/local/sbin/simp_rpm_helper --rpm_dir=/usr/share/simp/modules/testpackage --rpm_section='pre' --rpm_status=$1
|
155
158
|
fi
|
156
159
|
EOM
|
157
|
-
expect(scriptlets['preinstall'][:
|
160
|
+
expect(scriptlets['preinstall'][:content]).to eq( expected.strip )
|
158
161
|
|
159
162
|
comment '...default preuninstall scriptlet'
|
160
163
|
expected =<<-EOM
|
164
|
+
# (default scriptlet for SIMP 6.x)
|
165
|
+
# when $1 = 1, this is the uninstall of the previous version during an upgrade
|
166
|
+
# when $1 = 0, this is the uninstall of the only version during an erase
|
161
167
|
if [ -x /usr/local/sbin/simp_rpm_helper ] ; then
|
162
168
|
/usr/local/sbin/simp_rpm_helper --rpm_dir=/usr/share/simp/modules/testpackage --rpm_section='preun' --rpm_status=$1
|
163
169
|
fi
|
164
170
|
EOM
|
165
|
-
expect(scriptlets['preuninstall'][:
|
171
|
+
expect(scriptlets['preuninstall'][:content]).to eq( expected.strip )
|
166
172
|
|
167
173
|
comment '...default postuninstall scriptlet'
|
168
174
|
expected =<<-EOM
|
175
|
+
# (default scriptlet for SIMP 6.x)
|
176
|
+
# when $1 = 1, this is the uninstall of the previous version during an upgrade
|
177
|
+
# when $1 = 0, this is the uninstall of the only version during an erase
|
169
178
|
if [ -x /usr/local/sbin/simp_rpm_helper ] ; then
|
170
179
|
/usr/local/sbin/simp_rpm_helper --rpm_dir=/usr/share/simp/modules/testpackage --rpm_section='postun' --rpm_status=$1
|
171
180
|
fi
|
172
181
|
EOM
|
173
|
-
expect(scriptlets['postuninstall'][:
|
182
|
+
expect(scriptlets['postuninstall'][:content]).to eq( expected.strip )
|
174
183
|
|
175
184
|
comment '...default posttrans scriptlet'
|
176
185
|
expected =<<-EOM
|
177
|
-
|
178
|
-
|
186
|
+
# (default scriptlet for SIMP 6.x)
|
187
|
+
# Marker file is created in %pre and only exists for installs or upgrades
|
188
|
+
# when marker file is prepended with 'rpm_status1.', this is an install
|
189
|
+
# when marker file is prepended with 'rpm_status2.', this is an upgrade
|
190
|
+
if [ -e /var/lib/rpm-state/simp-adapter/rpm_status1.testpackage ] ; then
|
191
|
+
rm /var/lib/rpm-state/simp-adapter/rpm_status1.testpackage
|
179
192
|
if [ -x /usr/local/sbin/simp_rpm_helper ] ; then
|
180
193
|
/usr/local/sbin/simp_rpm_helper --rpm_dir=/usr/share/simp/modules/testpackage --rpm_section='posttrans' --rpm_status=1
|
181
194
|
fi
|
182
|
-
elif [ -e
|
183
|
-
rm
|
195
|
+
elif [ -e /var/lib/rpm-state/simp-adapter/rpm_status2.testpackage ] ; then
|
196
|
+
rm /var/lib/rpm-state/simp-adapter/rpm_status2.testpackage
|
184
197
|
if [ -x /usr/local/sbin/simp_rpm_helper ] ; then
|
185
198
|
/usr/local/sbin/simp_rpm_helper --rpm_dir=/usr/share/simp/modules/testpackage --rpm_section='posttrans' --rpm_status=2
|
186
199
|
fi
|
187
200
|
fi
|
188
201
|
EOM
|
189
|
-
expect(scriptlets['posttrans'][:
|
202
|
+
expect(scriptlets['posttrans'][:content]).to eq( expected.strip )
|
190
203
|
end
|
191
204
|
|
192
205
|
it_should_behave_like 'an RPM generator with edge cases'
|
@@ -100,6 +100,12 @@ describe 'rake pkg:rpm + component upgrade scenarios' do
|
|
100
100
|
'/opt/puppetlabs/bin/puppet config --section master set confdir /opt/test/puppet/code'
|
101
101
|
|
102
102
|
|
103
|
+
# TODO This mock simp-adapter has old functionality that corresponds to
|
104
|
+
# SIMP < 6.4.0 (i.e, a version that rsync's modules to a directory).
|
105
|
+
# Once SIMP 6.4.0 is released, we may want to update it to match that
|
106
|
+
# of the newer simp-adapter (i.e., the version that creates and updates
|
107
|
+
# local Git repositories). The tests that assume the copy behavior will
|
108
|
+
# have to be updated as well.
|
103
109
|
comment 'build and install mock RPMs'
|
104
110
|
mock_pkg_dir = '/home/build_user/host_files/spec/acceptance/files/mock_packages'
|
105
111
|
on hosts, %Q[#{run_cmd} "cd #{mock_pkg_dir}; rm -rf pkg"]
|
@@ -144,6 +150,16 @@ describe 'rake pkg:rpm + component upgrade scenarios' do
|
|
144
150
|
on host, 'ls /opt/test/puppet/code/testpackage', acceptable_exit_codes: [2]
|
145
151
|
end
|
146
152
|
end
|
153
|
+
|
154
|
+
context 'RPM transaction state directory' do
|
155
|
+
it 'should use /var/lib/rpm-state/simp-adapter for RPM state' do
|
156
|
+
on host, 'test -d /var/lib/rpm-state/simp-adapter'
|
157
|
+
end
|
158
|
+
|
159
|
+
it 'should not use /%{_localstatedir}/lib/rpm-state/simp-adapter for RPM state' do
|
160
|
+
on host, "test ! -d '/%{_localstatedir}/lib/rpm-state/simp-adapter'"
|
161
|
+
end
|
162
|
+
end
|
147
163
|
end
|
148
164
|
|
149
165
|
# These tests demonstrate custom RPM triggers that work around the obsolete
|
@@ -47,7 +47,7 @@ HOSTS:
|
|
47
47
|
- 'runuser build_user -l -c "curl -sSL https://raw.githubusercontent.com/rvm/rvm/stable/binscripts/rvm-installer -o rvm-installer && curl -sSL https://raw.githubusercontent.com/rvm/rvm/stable/binscripts/rvm-installer.asc -o rvm-installer.asc && gpg2 --verify rvm-installer.asc rvm-installer && bash rvm-installer"'
|
48
48
|
- 'runuser build_user -l -c "rvm install 2.4"'
|
49
49
|
- 'runuser build_user -l -c "rvm use --default 2.4"'
|
50
|
-
- 'runuser build_user -l -c "rvm all do gem install bundler
|
50
|
+
- 'runuser build_user -l -c "rvm all do gem install bundler"'
|
51
51
|
mount_folders:
|
52
52
|
folder1:
|
53
53
|
host_path: ./
|
@@ -105,7 +105,7 @@ HOSTS:
|
|
105
105
|
- 'runuser build_user -l -c "curl -sSL https://raw.githubusercontent.com/rvm/rvm/stable/binscripts/rvm-installer -o rvm-installer && curl -sSL https://raw.githubusercontent.com/rvm/rvm/stable/binscripts/rvm-installer.asc -o rvm-installer.asc && gpg2 --verify rvm-installer.asc rvm-installer && bash rvm-installer"'
|
106
106
|
- 'runuser build_user -l -c "rvm install 2.4"'
|
107
107
|
- 'runuser build_user -l -c "rvm use --default 2.4"'
|
108
|
-
- 'runuser build_user -l -c "rvm all do gem install bundler
|
108
|
+
- 'runuser build_user -l -c "rvm all do gem install bundler"'
|
109
109
|
- 'yum install -y rpm-sign'
|
110
110
|
mount_folders:
|
111
111
|
folder1:
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
spec/lib/simp/files/build/../testpackage.spec
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
spec/lib/simp/rake/pupmod/fixtures/simpmod/spec/acceptance/suites/default/../../nodesets
|
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.9.
|
4
|
+
version: 5.9.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: 2019-
|
12
|
+
date: 2019-08-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: simp-beaker-helpers
|
@@ -574,7 +574,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
574
574
|
- !ruby/object:Gem::Version
|
575
575
|
version: '0'
|
576
576
|
requirements: []
|
577
|
-
|
577
|
+
rubyforge_project:
|
578
|
+
rubygems_version: 2.7.7
|
578
579
|
signing_key:
|
579
580
|
specification_version: 4
|
580
581
|
summary: SIMP rake helpers
|