simp-rake-helpers 5.9.0 → 5.9.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '029d7ccf4bca3448f89ca0df609d3b8e672a5623bbdc0e9dab48ab958a92c717'
4
- data.tar.gz: 14fea72bb12ba330268d4a9c21425ed5989b3484549fe01e999228cf28582211
3
+ metadata.gz: 45a26553d93f116f66c155c12b0f9eb68f09b1e9a2d73b84f6400e6fed5e5035
4
+ data.tar.gz: 7af4c08f2164fa751aa0d1c22a704ac1f863092e6f609b588eb354f70975919f
5
5
  SHA512:
6
- metadata.gz: 6bb178fae8a2d7ff99c3ae68eb634165c489eaa76b0739edc4c3f1b27e3463fb39fb59f9a7a8cd0fa66a427539a6b14517c220cb8e68335673e5f6b323c2180b
7
- data.tar.gz: e1b3e0f7ec04b1d45c621d12861d0af77126590a078d1f235dbc9783a4de3d7c559ca84692fe49403ee03cc5e692e62969453229c770bd43e465acbedd78279c
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'] = {upgrade = 2, custom='mkdir -p '..marker_dir..'\ntouch '..marker_file..'\n'},
494
- ['preun'] = {upgrade = 0, custom=''},
495
- ['postun'] = {upgrade = 0, custom=''}
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
- '# when $1 = 1, this is an install\n'..
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'] = {upgrade = 2, custom='mkdir -p '..marker_dir..'\ntouch '..marker_file..'\n'},
494
- ['preun'] = {upgrade = 0, custom=''},
495
- ['postun'] = {upgrade = 0, custom=''}
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
- '# when $1 = 1, this is an install\n'..
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='..
@@ -2,5 +2,5 @@ module Simp; end
2
2
  module Simp::Rake; end
3
3
 
4
4
  class Simp::Rake::Helpers
5
- VERSION = '5.9.0'
5
+ VERSION = '5.9.1'
6
6
  end
@@ -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 %{_localstatedir}/lib/rpm-state/simp-adapter/rpm_status1.testpackage ] ; then
51
- rm %{_localstatedir}/lib/rpm-state/simp-adapter/rpm_status1.testpackage
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 %{_localstatedir}/lib/rpm-state/simp-adapter/rpm_status2.testpackage ] ; then
56
- rm %{_localstatedir}/lib/rpm-state/simp-adapter/rpm_status2.testpackage
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
- mkdir -p %{_localstatedir}/lib/rpm-state/simp-adapter
152
- touch %{_localstatedir}/lib/rpm-state/simp-adapter/rpm_status$1.testpackage
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'][:bare_content]).to eq( expected.strip )
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'][:bare_content]).to eq( expected.strip )
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'][:bare_content]).to eq( expected.strip )
182
+ expect(scriptlets['postuninstall'][:content]).to eq( expected.strip )
174
183
 
175
184
  comment '...default posttrans scriptlet'
176
185
  expected =<<-EOM
177
- if [ -e %{_localstatedir}/lib/rpm-state/simp-adapter/rpm_status1.testpackage ] ; then
178
- rm %{_localstatedir}/lib/rpm-state/simp-adapter/rpm_status1.testpackage
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 %{_localstatedir}/lib/rpm-state/simp-adapter/rpm_status2.testpackage ] ; then
183
- rm %{_localstatedir}/lib/rpm-state/simp-adapter/rpm_status2.testpackage
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'][:bare_content]).to eq( expected.strip )
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 -v \"~> 1.16\""'
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 -v \"~> 1.16\""'
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
- ../testpackage.spec
1
+ spec/lib/simp/files/build/../testpackage.spec
@@ -1 +1 @@
1
- ../../nodesets
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.0
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-06-12 00:00:00.000000000 Z
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
- rubygems_version: 3.0.3
577
+ rubyforge_project:
578
+ rubygems_version: 2.7.7
578
579
  signing_key:
579
580
  specification_version: 4
580
581
  summary: SIMP rake helpers