simp-rake-helpers 5.12.0 → 5.12.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +26 -0
  3. data/Gemfile +0 -3
  4. data/README.md +2 -37
  5. data/Rakefile +2 -3
  6. data/lib/simp/rake/build/auto.rb +4 -2
  7. data/lib/simp/rake/build/build.rb +5 -4
  8. data/lib/simp/rake/build/iso.rb +101 -45
  9. data/lib/simp/rake/build/pkg.rb +16 -16
  10. data/lib/simp/rake/build/spec.rb +1 -1
  11. data/lib/simp/rake/build/tar.rb +1 -1
  12. data/lib/simp/rake/build/unpack.rb +1 -1
  13. data/lib/simp/rake/build/upload.rb +1 -1
  14. data/lib/simp/rake/build/vermap.yaml +1 -1
  15. data/lib/simp/rake/helpers/assets/rpm_spec/simp6.spec +5 -5
  16. data/lib/simp/rake/helpers/assets/rpm_spec/simpdefault.spec +5 -5
  17. data/lib/simp/rake/helpers/version.rb +1 -1
  18. data/lib/simp/rake/helpers.rb +2 -2
  19. data/spec/acceptance/nodesets/default.yml +0 -16
  20. data/spec/acceptance/{00_pkg_rpm_custom_scriptlets_spec.rb → suites/default/00_pkg_rpm_custom_scriptlets_spec.rb} +4 -3
  21. data/spec/acceptance/{10_pkg_rpm_spec.rb → suites/default/10_pkg_rpm_spec.rb} +6 -6
  22. data/spec/acceptance/{30_pkg_misc_spec.rb → suites/default/30_pkg_misc_spec.rb} +1 -1
  23. data/spec/acceptance/{50_local_gpg_signing_key_spec.rb → suites/default/50_local_gpg_signing_key_spec.rb} +0 -0
  24. data/spec/acceptance/{55_build_pkg_signing_spec.rb → suites/default/55_build_pkg_signing_spec.rb} +2 -2
  25. data/spec/acceptance/{development → suites/default/development}/docker_env.sh +0 -0
  26. data/spec/acceptance/{development → suites/default/development}/rerun_acceptance_tests.sh +0 -0
  27. data/spec/acceptance/{development → suites/default/development}/vagrant_rsync.sh +0 -0
  28. data/spec/acceptance/{files → suites/default/files}/asset/Rakefile +0 -0
  29. data/spec/acceptance/{files → suites/default/files}/asset/build/asset.spec +0 -0
  30. data/spec/acceptance/{files → suites/default/files}/asset_with_misordered_entries/Rakefile +0 -0
  31. data/spec/acceptance/{files → suites/default/files}/asset_with_misordered_entries/build/asset_with_misordered_entries.spec +0 -0
  32. data/spec/acceptance/{files → suites/default/files}/build/pkg/gpg-keydir.expired.2018-04-06/RPM-GPG-KEY-SIMP-Dev +0 -0
  33. data/spec/acceptance/{files → suites/default/files}/build/pkg/gpg-keydir.expired.2018-04-06/gengpgkey +0 -0
  34. data/spec/acceptance/{files → suites/default/files}/build/pkg/gpg-keydir.expired.2018-04-06/pubring.gpg +0 -0
  35. data/spec/acceptance/{files → suites/default/files}/build/pkg/gpg-keydir.expired.2018-04-06/random_seed +0 -0
  36. data/spec/acceptance/{files → suites/default/files}/build/pkg/gpg-keydir.expired.2018-04-06/run_gpg_agent +0 -0
  37. data/spec/acceptance/{files → suites/default/files}/build/pkg/gpg-keydir.expired.2018-04-06/secring.gpg +0 -0
  38. data/spec/acceptance/{files → suites/default/files}/build/pkg/gpg-keydir.expired.2018-04-06/trustdb.gpg +0 -0
  39. data/spec/acceptance/{files → suites/default/files}/build/project_skeleton/Puppetfile.tracking +0 -0
  40. data/spec/acceptance/{files → suites/default/files}/build/project_skeleton/README.md +0 -0
  41. data/spec/acceptance/{files → suites/default/files}/build/project_skeleton/Rakefile +0 -0
  42. data/spec/acceptance/{files → suites/default/files}/build/project_skeleton/src/assets/simp/build/simp.spec +0 -0
  43. data/spec/acceptance/{files → suites/default/files}/module/CHANGELOG +0 -0
  44. data/spec/acceptance/{files → suites/default/files}/module/Rakefile +0 -0
  45. data/spec/acceptance/{files → suites/default/files}/module/metadata.json +0 -0
  46. data/spec/acceptance/{files → suites/default/files}/module_with_misordered_entries/CHANGELOG +0 -0
  47. data/spec/acceptance/{files → suites/default/files}/module_with_misordered_entries/Rakefile +0 -0
  48. data/spec/acceptance/{files → suites/default/files}/module_with_misordered_entries/metadata.json +0 -0
  49. data/spec/acceptance/{files → suites/default/files}/simplib/CHANGELOG +0 -0
  50. data/spec/acceptance/{files → suites/default/files}/simplib/Rakefile +0 -0
  51. data/spec/acceptance/{files → suites/default/files}/simplib/build/rpm_metadata/requires +0 -0
  52. data/spec/acceptance/{files → suites/default/files}/simplib/metadata.json +0 -0
  53. data/spec/acceptance/{files → suites/default/files}/testpackage/CHANGELOG +0 -0
  54. data/spec/acceptance/{files → suites/default/files}/testpackage/README +0 -0
  55. data/spec/acceptance/{files → suites/default/files}/testpackage/Rakefile +0 -0
  56. data/spec/acceptance/{files → suites/default/files}/testpackage/build/rpm_metadata/requires +0 -0
  57. data/spec/acceptance/{files → suites/default/files}/testpackage/metadata.json +0 -0
  58. data/spec/acceptance/{files → suites/default/files}/testpackage/spec/classes/init_spec.rb +0 -0
  59. data/spec/acceptance/{files → suites/default/files}/testpackage/spec/files/mock_something.rb +0 -0
  60. data/spec/acceptance/{files → suites/default/files}/testpackage/utils/convert_v1_to_v2.rb +0 -0
  61. data/spec/acceptance/{files → suites/default/files}/testpackage_custom_scriptlet/CHANGELOG +0 -0
  62. data/spec/acceptance/{files → suites/default/files}/testpackage_custom_scriptlet/Rakefile +0 -0
  63. data/spec/acceptance/{files → suites/default/files}/testpackage_custom_scriptlet/build/rpm_metadata/custom/overrides +0 -0
  64. data/spec/acceptance/{files → suites/default/files}/testpackage_custom_scriptlet/build/rpm_metadata/requires +0 -0
  65. data/spec/acceptance/{files → suites/default/files}/testpackage_custom_scriptlet/metadata.json +0 -0
  66. data/spec/acceptance/{files → suites/default/files}/testpackage_missing_license/CHANGELOG +0 -0
  67. data/spec/acceptance/{files → suites/default/files}/testpackage_missing_license/Rakefile +0 -0
  68. data/spec/acceptance/{files → suites/default/files}/testpackage_missing_license/build/rpm_metadata/requires +0 -0
  69. data/spec/acceptance/{files → suites/default/files}/testpackage_missing_license/metadata.json +0 -0
  70. data/spec/acceptance/{files → suites/default/files}/testpackage_missing_metadata_file/CHANGELOG +0 -0
  71. data/spec/acceptance/{files → suites/default/files}/testpackage_missing_metadata_file/Rakefile +0 -0
  72. data/spec/acceptance/{files → suites/default/files}/testpackage_missing_metadata_file/build/rpm_metadata/requires +0 -0
  73. data/spec/acceptance/{files → suites/default/files}/testpackage_missing_name/CHANGELOG +0 -0
  74. data/spec/acceptance/{files → suites/default/files}/testpackage_missing_name/Rakefile +0 -0
  75. data/spec/acceptance/{files → suites/default/files}/testpackage_missing_name/build/rpm_metadata/requires +0 -0
  76. data/spec/acceptance/{files → suites/default/files}/testpackage_missing_name/metadata.json +0 -0
  77. data/spec/acceptance/{files → suites/default/files}/testpackage_missing_source/CHANGELOG +0 -0
  78. data/spec/acceptance/{files → suites/default/files}/testpackage_missing_source/Rakefile +0 -0
  79. data/spec/acceptance/{files → suites/default/files}/testpackage_missing_source/build/rpm_metadata/requires +0 -0
  80. data/spec/acceptance/{files → suites/default/files}/testpackage_missing_source/metadata.json +0 -0
  81. data/spec/acceptance/{files → suites/default/files}/testpackage_missing_summary/CHANGELOG +0 -0
  82. data/spec/acceptance/{files → suites/default/files}/testpackage_missing_summary/Rakefile +0 -0
  83. data/spec/acceptance/{files → suites/default/files}/testpackage_missing_summary/build/rpm_metadata/requires +0 -0
  84. data/spec/acceptance/{files → suites/default/files}/testpackage_missing_summary/metadata.json +0 -0
  85. data/spec/acceptance/{files → suites/default/files}/testpackage_missing_version/CHANGELOG +0 -0
  86. data/spec/acceptance/{files → suites/default/files}/testpackage_missing_version/Rakefile +0 -0
  87. data/spec/acceptance/{files → suites/default/files}/testpackage_missing_version/build/rpm_metadata/requires +0 -0
  88. data/spec/acceptance/{files → suites/default/files}/testpackage_missing_version/metadata.json +0 -0
  89. data/spec/acceptance/{files → suites/default/files}/testpackage_with_bad_changelog_date/CHANGELOG +0 -0
  90. data/spec/acceptance/{files → suites/default/files}/testpackage_with_bad_changelog_date/Rakefile +0 -0
  91. data/spec/acceptance/{files → suites/default/files}/testpackage_with_bad_changelog_date/build/rpm_metadata/requires +0 -0
  92. data/spec/acceptance/{files → suites/default/files}/testpackage_with_bad_changelog_date/metadata.json +0 -0
  93. data/spec/acceptance/{files → suites/default/files}/testpackage_with_release/CHANGELOG +0 -0
  94. data/spec/acceptance/{files → suites/default/files}/testpackage_with_release/Rakefile +0 -0
  95. data/spec/acceptance/{files → suites/default/files}/testpackage_with_release/build/rpm_metadata/release +0 -0
  96. data/spec/acceptance/{files → suites/default/files}/testpackage_with_release/build/rpm_metadata/requires +0 -0
  97. data/spec/acceptance/{files → suites/default/files}/testpackage_with_release/metadata.json +0 -0
  98. data/spec/acceptance/{files → suites/default/files}/testpackage_without_changelog/Rakefile +0 -0
  99. data/spec/acceptance/{files → suites/default/files}/testpackage_without_changelog/build/rpm_metadata/requires +0 -0
  100. data/spec/acceptance/{files → suites/default/files}/testpackage_without_changelog/metadata.json +0 -0
  101. data/spec/acceptance/{support → suites/default/support}/build_project_helpers.rb +1 -1
  102. data/spec/acceptance/{support → suites/default/support}/build_user_helpers.rb +0 -0
  103. data/spec/acceptance/{support → suites/default/support}/pkg_rpm_helpers.rb +0 -0
  104. data/spec/spec_helper_acceptance.rb +4 -0
  105. metadata +86 -88
  106. data/lib/simp/rake/helpers/assets/rpm_spec/simp4.spec +0 -388
  107. data/lib/simp/rake/helpers/assets/rpm_spec/simp5.spec +0 -388
@@ -1,388 +0,0 @@
1
- %{lua:
2
-
3
- --
4
- -- When you build you must to pass this along so that we know how
5
- -- to get the preliminary information.
6
- -- This directory should hold the following items:
7
- -- * 'build/rpm_metadata/requires' <- optional list of 'Requires', 'Provides',
8
- -- and 'Obsoletes' to supplement those auto-generated in this spec file
9
- -- * 'build/rpm_metadata/release' <- optional RPM release number to use in
10
- -- lieu of number hard-coded in this spec file
11
- -- * 'CHANGELOG' <- optional RPM formatted Changelog to use in lieu of minimal,
12
- -- changelog entry auto-generated in this spec file
13
- -- * 'metadata.json' <- required file that must contain the following metadata:
14
- -- - 'name' - package name
15
- -- - 'version' - package version
16
- -- - 'license' - package license
17
- -- - 'summary' - package summary
18
- -- - 'source' - package source
19
- --
20
- -- Example:
21
- -- rpmbuild -D 'pup_module_info_dir /home/user/project/puppet_module' -ba SPECS/specfile.spec
22
- --
23
- -- If this is not found, we will look in %{_sourcedir} for the files and fall
24
- -- back to the current directory
25
- --
26
-
27
- src_dir = rpm.expand('%{pup_module_info_dir}')
28
-
29
- if string.match(src_dir, '^%%') or (posix.stat(src_dir, 'type') ~= 'directory') then
30
- src_dir = rpm.expand('%{_sourcedir}')
31
-
32
- if (posix.stat((src_dir .. "/metadata.json"), 'type') ~= 'regular') then
33
- src_dir = './'
34
- end
35
- end
36
-
37
- -- These UNKNOWN entries should break the build if something bad happens
38
-
39
- package_name = "UNKNOWN"
40
- package_version = "UNKNOWN"
41
- module_license = "UNKNOWN"
42
-
43
- --
44
- -- Default to 0
45
- --
46
-
47
- package_release = 0
48
-
49
- }
50
-
51
- %{lua:
52
- -- Pull the Relevant Metadata out of the Puppet module metadata.json.
53
-
54
- metadata = ''
55
- metadata_file = io.open(src_dir .. "/metadata.json","r")
56
- if metadata_file then
57
- metadata = metadata_file:read("*all")
58
-
59
- -- Ignore the first curly brace
60
- metadata = metadata:gsub("{}?", '|', 1)
61
-
62
- -- Ignore all keys that are below the first level
63
- metadata = metadata:gsub("{.-}", '')
64
- metadata = metadata:gsub("%[.-%]", '')
65
- else
66
- error("Could not open 'metadata.json'", 0)
67
- end
68
-
69
- -- This starts as an empty string so that we can build it later
70
- module_requires = ''
71
-
72
- }
73
-
74
- %{lua:
75
-
76
- -- Get the Module Name and put it in the correct format
77
-
78
- local name_match = string.match(metadata, '"name":%s+"(.-)"%s*,')
79
-
80
- module_author = ''
81
- module_name = ''
82
-
83
- if name_match then
84
- package_name = ('pupmod-' .. name_match)
85
-
86
- local i = 0
87
- for str in string.gmatch(name_match,'[^-]+') do
88
- if i == 0 then
89
- module_author = str
90
- else
91
- if module_name == '' then
92
- module_name = str
93
- else
94
- module_name = (module_name .. '-' .. str)
95
- end
96
- end
97
-
98
- i = i+1
99
- end
100
- else
101
- error("Could not find valid package name in 'metadata.json'", 0)
102
- end
103
-
104
- }
105
-
106
- %{lua:
107
-
108
- -- Get the Module Version
109
-
110
- local version_match = string.match(metadata, '"version":%s+"(.-)"%s*,')
111
-
112
- if version_match then
113
- package_version = version_match
114
- else
115
- error("Could not find valid package version in 'metadata.json'", 0)
116
- end
117
-
118
- }
119
-
120
- %{lua:
121
-
122
- -- Get the Module License
123
-
124
- local license_match = string.match(metadata, '"license":%s+"(.-)"%s*,')
125
-
126
- if license_match then
127
- module_license = license_match
128
- else
129
- error("Could not find valid package license in 'metadata.json'", 0)
130
- end
131
-
132
- }
133
-
134
- %{lua:
135
-
136
- -- Get the Module Summary
137
-
138
- local summary_match = string.match(metadata, '"summary":%s+"(.-)"%s*,')
139
-
140
- if summary_match then
141
- module_summary = summary_match
142
- else
143
- error("Could not find valid package summary in 'metadata.json'", 0)
144
- end
145
-
146
- }
147
-
148
- %{lua:
149
-
150
- -- Get the Module Source line for the URL string
151
-
152
- local source_match = string.match(metadata, '"source":%s+"(.-)"%s*,')
153
-
154
- if source_match then
155
- module_source = source_match
156
- else
157
- error("Could not find valid package source in 'metadata.json'", 0)
158
- end
159
-
160
- }
161
-
162
- %{lua:
163
-
164
- -- Snag the RPM-specific items out of the 'build/rpm_metadata' directory
165
-
166
- -- First, the Release Number
167
-
168
- rel_file = io.open(src_dir .. "/build/rpm_metadata/release", "r")
169
-
170
- if not rel_file then
171
- -- Need this for the SRPM case
172
- rel_file = io.open(src_dir .. "/release", "r")
173
- end
174
-
175
-
176
- if rel_file then
177
- for line in rel_file:lines() do
178
- is_comment = string.match(line, "^%s*#")
179
- is_blank = string.match(line, "^%s*$")
180
-
181
- if not (is_comment or is_blank) then
182
- package_release = line
183
- break
184
- end
185
- end
186
- end
187
-
188
- }
189
-
190
- %{lua:
191
-
192
- -- Next, the Requirements
193
- req_file = io.open(src_dir .. "/build/rpm_metadata/requires", "r")
194
-
195
- if not req_file then
196
- -- Need this for the SRPM case
197
- req_file = io.open(src_dir .. "/requires", "r")
198
- end
199
-
200
- if req_file then
201
- for line in req_file:lines() do
202
- valid_line = (string.match(line, "^Requires: ") or string.match(line, "^Obsoletes: ") or string.match(line, "^Provides: "))
203
-
204
- if valid_line then
205
- module_requires = (module_requires .. "\n" .. line)
206
- end
207
- end
208
- end
209
- }
210
-
211
- %define module_name %{lua: print(module_name)}
212
- %define base_name %{lua: print(package_name)}
213
-
214
- %{lua:
215
- -- Determine which Variant we are going to build
216
-
217
- local variant = rpm.expand("%{_variant}")
218
- local variant_version = nil
219
-
220
- local foo = ""
221
-
222
- local i = 0
223
- for str in string.gmatch(variant,'[^-]+') do
224
- if i == 0 then
225
- variant = str
226
- elseif i == 1 then
227
- variant_version = str
228
- else
229
- break
230
- end
231
-
232
- i = i+1
233
- end
234
-
235
- rpm.define("variant " .. variant)
236
-
237
- if variant == "pe" then
238
- rpm.define("puppet_user pe-puppet")
239
- else
240
- rpm.define("puppet_user puppet")
241
- end
242
-
243
- if variant == "pe" then
244
- if variant_version and ( rpm.vercmp(variant_version,'4') >= 0 ) then
245
- rpm.define("_sysconfdir /etc/puppetlabs/code")
246
- else
247
- rpm.define("_sysconfdir /etc/puppetlabs/puppet")
248
- end
249
- elseif variant == "p4" then
250
- rpm.define("_sysconfdir /etc/puppetlabs/code")
251
- else
252
- rpm.define("_sysconfdir /etc/puppet")
253
- end
254
- }
255
-
256
- Summary: %{module_name} Puppet Module
257
- %if 0%{?_variant:1}
258
- Name: %{base_name}-%{_variant}
259
- %else
260
- Name: %{base_name}
261
- %endif
262
-
263
- Version: %{lua: print(package_version)}
264
- Release: %{lua: print(package_release)}
265
- License: %{lua: print(module_license)}
266
- Group: Applications/System
267
- Source0: %{base_name}-%{version}-%{release}.tar.gz
268
- Source1: %{lua: print("metadata.json")}
269
- %{lua:
270
- -- Include our sources as appropriate
271
- changelog = io.open(src_dir .. "/CHANGELOG","r")
272
- if changelog then
273
- print("Source2: " .. "CHANGELOG\n")
274
- end
275
-
276
- if rel_file then
277
- print("Source3: " .. "release\n")
278
- end
279
- if req_file then
280
- print("Source4: " .. "requires\n")
281
- end
282
- }
283
- URL: %{lua: print(module_source)}
284
- BuildRoot: %{_tmppath}/%{base_name}-%{version}-%{release}-buildroot
285
- BuildArch: noarch
286
-
287
- %if "%{variant}" == "pe"
288
- Requires: pe-puppet >= 3.8.6
289
- %else
290
- Requires: puppet >= 3.8.6
291
- %endif
292
-
293
- %if ("%{base_name}" != "pupmod-simp-simplib") && ("%{base_name}" != "pupmod-puppetlabs-stdlib")
294
- Requires: pupmod-simp-simplib >= 1.2.6
295
- %endif
296
-
297
- %if "%{base_name}" != "pupmod-puppetlabs-stdlib"
298
- Requires: pupmod-puppetlabs-stdlib >= 4.9.0
299
- Requires: pupmod-puppetlabs-stdlib < 6.0.0
300
- %endif
301
-
302
- %{lua: print(module_requires)}
303
-
304
- Provides: pupmod-%{lua: print(module_name)} = %{lua: print(package_version .. "-" .. package_release)}
305
- Obsoletes: pupmod-%{lua: print(module_name)} < %{lua: print(package_version .. "-" .. package_release)}
306
-
307
- %{lua:
308
-
309
- -- This is a workaround for the 'simp-rsync' real RPM conflict but is
310
- -- required by some external modules.
311
- -- This should be removed when SIMP 6 is stable
312
-
313
- author_rpm_name = module_author .. "-" .. module_name
314
-
315
- if author_rpm_name ~= 'simp-rsync' then
316
- print("Provides: " .. author_rpm_name .. " = " .. package_version .. "-" .. package_release .. "\n")
317
- print("Obsoletes: " .. author_rpm_name .. " < " .. package_version .. "-" .. package_release .. "\n")
318
- end
319
- }
320
-
321
- Prefix: %{_sysconfdir}/environments/simp/modules
322
-
323
- %description
324
- %{lua: print(module_summary)}
325
-
326
- %prep
327
- %setup -q -n %{base_name}-%{version}
328
-
329
- %build
330
-
331
- %install
332
- [ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
333
-
334
- mkdir -p %{buildroot}/%{prefix}
335
-
336
- curdir=`pwd`
337
- dirname=`basename $curdir`
338
- cp -r ../$dirname %{buildroot}/%{prefix}/%{module_name}
339
- cd %{buildroot}%{prefix}/%{module_name}
340
-
341
- # Remove unnecessary assets
342
- rm -rf %{buildroot}/%{prefix}/%{module_name}/.git
343
- rm -f %{buildroot}/%{prefix}/%{module_name}/*.lock
344
- rm -rf %{buildroot}/%{prefix}/%{module_name}/spec/fixtures/modules
345
- rm -rf %{buildroot}/%{prefix}/%{module_name}/dist
346
- rm -rf %{buildroot}/%{prefix}/%{module_name}/junit
347
- rm -rf %{buildroot}/%{prefix}/%{module_name}/log
348
-
349
- %clean
350
- [ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
351
-
352
- mkdir -p %{buildroot}/%{prefix}
353
-
354
- %files
355
- %defattr(0640,root,%{puppet_user},0750)
356
- %{prefix}/%{module_name}
357
-
358
- %changelog
359
- %{lua:
360
- -- Finally, the CHANGELOG
361
-
362
- -- A default CHANGELOG in case we cannot find a real one
363
-
364
- default_changelog = [===[
365
- * $date Auto Changelog <auto@no.body> - $version-$release
366
- - Latest release of $name
367
- ]===]
368
-
369
- default_lookup_table = {
370
- date = os.date("%a %b %d %Y"),
371
- version = package_version,
372
- release = package_release,
373
- name = package_name
374
- }
375
-
376
- changelog = io.open(src_dir .. "/CHANGELOG","r")
377
- if changelog then
378
- first_line = changelog:read()
379
- if string.match(first_line, "^*%s+%a%a%a%s+%a%a%a%s+%d%d?%s+%d%d%d%d%s+.+") then
380
- changelog:seek("set",0)
381
- print(changelog:read("*all"))
382
- else
383
- print((default_changelog:gsub('$(%w+)', default_lookup_table)))
384
- end
385
- else
386
- print((default_changelog:gsub('$(%w+)', default_lookup_table)))
387
- end
388
- }