simp-rake-helpers 5.12.6 → 5.13.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 +19 -0
- data/lib/simp/rake/build/auto.rb +3 -2
- data/lib/simp/rake/build/deps.rb +1 -1
- data/lib/simp/rake/build/iso.rb +62 -44
- data/lib/simp/rake/build/pkg.rb +168 -148
- data/lib/simp/rake/build/rpmdeps.rb +7 -1
- data/lib/simp/rake/build/tar.rb +7 -3
- data/lib/simp/rake/helpers/version.rb +1 -1
- data/spec/acceptance/suites/default/55_build_pkg_signing_spec.rb +2 -2
- data/spec/lib/simp/rake/build/helpers_spec.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6f0550abc4ac7ec968a8590bbc7003d0de2753ae072909396fce25c01a7edd3
|
4
|
+
data.tar.gz: 4eb8efa7f00322290a3a45a6e304ac6b1798e3d47283e1ad525184ae95f9560f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6eef279b4061c054908d69ab0408e5e850149bc92689db7b64f167d9815186af793a07c905bbf47d71763107088cdd4059da6f31e95f775410ab03803428b68
|
7
|
+
data.tar.gz: 4bf2a7cfedbd8a9a711f9ba19e62ad16c0dcd593511ab21d249eda819b1ac67ba7ed0285a085057e7b68e31a700fdb185d57736a773734512821781096bad478
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,22 @@
|
|
1
|
+
### 5.13.1 / 2022-05-01
|
2
|
+
- Fixed:
|
3
|
+
- Aligned wtih an API change in the `dirty?` method in `r10k`
|
4
|
+
|
5
|
+
### 5.13.0 / 2021-11-14
|
6
|
+
- Added:
|
7
|
+
- Output the full `mkisofs` command when building an ISO
|
8
|
+
|
9
|
+
### 5.12.7 / 2021-10-26
|
10
|
+
- Added:
|
11
|
+
- Env var `SIMP_PKG_progress_bar=no` to turn off pkg RPM build progress bars
|
12
|
+
- Env var `SIMP_PKG_fetch_published_rpm=no` to prevent downloading a
|
13
|
+
published package
|
14
|
+
- Fixed:
|
15
|
+
- RPM builds no longer fail with leftover generated
|
16
|
+
`build/rpm_metadata/releases` files
|
17
|
+
- Removed unused code, tidied up some confusing bits to make structure more
|
18
|
+
obvious
|
19
|
+
|
1
20
|
### 5.12.6 / 2021-10-19
|
2
21
|
- Ensure that the `Updates` directory does not link to files in itself
|
3
22
|
|
data/lib/simp/rake/build/auto.rb
CHANGED
@@ -110,14 +110,15 @@ module Simp::Rake::Build
|
|
110
110
|
- SIMP_BUILD_docs => 'yes' builds & includes documentation
|
111
111
|
- SIMP_BUILD_checkout => 'no' will skip the git repo checkouts
|
112
112
|
- SIMP_BUILD_bundle => 'no' skips running bundle in each subrepo
|
113
|
-
- SIMP_BUILD_unpack => 'no'
|
114
|
-
- SIMP_BUILD_unpack_merge => 'no' prevents auto-merging the unpacked
|
113
|
+
- SIMP_BUILD_unpack => 'no' prevents unpacking the source ISO
|
114
|
+
- SIMP_BUILD_unpack_merge => 'no' prevents auto-merging the unpacked ISO
|
115
115
|
- SIMP_BUILD_prune => 'no' passes :prune=>false to iso:build
|
116
116
|
- SIMP_BUILD_iso_name => Renames the output ISO filename [Default: false]
|
117
117
|
- SIMP_BUILD_iso_tag => Appended to the output ISO's filename [Default: false]
|
118
118
|
- SIMP_BUILD_update_packages => Automatically update any necessary packages in the packages.yaml file [Default: false]
|
119
119
|
- SIMP_BUILD_verbose => 'yes' enables verbose reporting. [Default: 'no']
|
120
120
|
- SIMP_BUILD_signing_key => The name of the GPG key to use to sign packages. [Default: 'dev']
|
121
|
+
- SIMP_BUILD_reposync_only => 'yes' skips unpacking the locally-build tarball so that you only get items from the reposync directory (if present)
|
121
122
|
EOM
|
122
123
|
|
123
124
|
task :auto, [:iso_paths,
|
data/lib/simp/rake/build/deps.rb
CHANGED
data/lib/simp/rake/build/iso.rb
CHANGED
@@ -252,61 +252,77 @@ module Simp::Rake::Build
|
|
252
252
|
end
|
253
253
|
end
|
254
254
|
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
# Pop the SIMP directory from the tarball into the correct spot
|
259
|
-
# FIXME: This is a hack
|
260
|
-
unless dir == repo_target_dir
|
261
|
-
simpdir = File.join(dir,'SIMP')
|
262
|
-
|
263
|
-
if File.directory?(simpdir)
|
264
|
-
cp_r(simpdir, repo_target_dir, :verbose => verbose)
|
265
|
-
rm_rf(simpdir, :verbose => verbose)
|
266
|
-
end
|
255
|
+
reposync_only = (ENV.fetch('SIMP_BUILD_reposync_only', 'no') == 'yes')
|
256
|
+
if reposync_only && !reposync_active
|
257
|
+
fail("ERROR: Reposync-only requested, but no reposync content found")
|
267
258
|
end
|
268
259
|
|
269
|
-
|
270
|
-
|
271
|
-
|
260
|
+
if reposync_only
|
261
|
+
puts
|
262
|
+
puts '-'*80
|
263
|
+
puts '### Reposync-Only Mode ###'
|
264
|
+
puts
|
265
|
+
puts ' Locally built packages will not be added'
|
266
|
+
puts
|
267
|
+
puts '-'*80
|
268
|
+
puts
|
269
|
+
else
|
270
|
+
# Add the SIMP code
|
271
|
+
system("tar --no-same-permissions -C #{dir} -xzf #{tball}")
|
272
272
|
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
273
|
+
# Pop the SIMP directory from the tarball into the correct spot
|
274
|
+
# FIXME: This is a hack
|
275
|
+
unless dir == repo_target_dir
|
276
|
+
simpdir = File.join(dir,'SIMP')
|
277
|
+
|
278
|
+
if File.directory?(simpdir)
|
279
|
+
cp_r(simpdir, repo_target_dir, :verbose => verbose)
|
280
|
+
rm_rf(simpdir, :verbose => verbose)
|
281
|
+
end
|
278
282
|
end
|
279
283
|
|
280
|
-
|
284
|
+
Dir.chdir("#{repo_target_dir}/SIMP") do
|
285
|
+
# Add the SIMP Dependencies
|
286
|
+
simp_base_ver = simpver.split('-').first
|
281
287
|
|
282
|
-
|
283
|
-
|
284
|
-
|
288
|
+
if $simp6
|
289
|
+
yum_dep_location = File.join(@build_dir,'yum_data','packages')
|
290
|
+
else
|
291
|
+
simp_dep_src = %(SIMP#{simp_base_ver}_#{baseos}#{baseosver}_#{arch})
|
292
|
+
yum_dep_location = File.join(@build_dir,'yum_data',simp_dep_src,'packages')
|
293
|
+
end
|
285
294
|
|
286
|
-
|
287
|
-
fail("Could not find any dependency RPMs at #{yum_dep_location}") unless reposync_active
|
288
|
-
end
|
295
|
+
yum_dep_rpms = Dir.glob(File.join(yum_dep_location,'*.rpm'))
|
289
296
|
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
aux_packages = File.join(File.dirname(yum_dep_location),'aux_packages')
|
294
|
-
if File.directory?(aux_packages)
|
295
|
-
yum_dep_rpms += Dir.glob(File.join(aux_packages,'*.rpm'))
|
296
|
-
end
|
297
|
+
unless File.directory?(yum_dep_location)
|
298
|
+
fail("Could not find dependency directory at #{yum_dep_location}") unless reposync_active
|
299
|
+
end
|
297
300
|
|
298
|
-
|
299
|
-
|
301
|
+
if yum_dep_rpms.empty?
|
302
|
+
fail("Could not find any dependency RPMs at #{yum_dep_location}") unless reposync_active
|
303
|
+
end
|
300
304
|
|
301
|
-
|
302
|
-
|
305
|
+
# Add any one-off RPMs that you might want to add to your own build
|
306
|
+
# These are *not* checked to make sure that they actually match your
|
307
|
+
# environment
|
308
|
+
aux_packages = File.join(File.dirname(yum_dep_location),'aux_packages')
|
309
|
+
if File.directory?(aux_packages)
|
310
|
+
yum_dep_rpms += Dir.glob(File.join(aux_packages,'*.rpm'))
|
303
311
|
end
|
304
312
|
|
305
|
-
|
306
|
-
|
307
|
-
|
313
|
+
yum_dep_rpms.each do |rpm|
|
314
|
+
rpm_arch = rpm.split('.')[-2]
|
315
|
+
|
316
|
+
unless File.directory?(rpm_arch)
|
317
|
+
mkdir(rpm_arch)
|
318
|
+
end
|
319
|
+
|
320
|
+
# Just in case this is a symlink, broken, or some other nonsense.
|
321
|
+
target_file = File.join(rpm_arch,File.basename(rpm))
|
322
|
+
rm_f(target_file) if File.exist?(target_file)
|
308
323
|
|
309
|
-
|
324
|
+
cp(rpm,rpm_arch, :verbose => verbose)
|
325
|
+
end
|
310
326
|
end
|
311
327
|
|
312
328
|
if reposync_active
|
@@ -421,9 +437,11 @@ module Simp::Rake::Build
|
|
421
437
|
'-x ./lost+found',
|
422
438
|
"-o #{@simp_output_iso}",
|
423
439
|
dir
|
424
|
-
]
|
440
|
+
].join(' ')
|
441
|
+
|
442
|
+
$stdout.puts "Running: #{mkisofs_cmd}"
|
425
443
|
|
426
|
-
system(mkisofs_cmd
|
444
|
+
system(mkisofs_cmd)
|
427
445
|
end
|
428
446
|
end # End of tarfiles loop
|
429
447
|
|
data/lib/simp/rake/build/pkg.rb
CHANGED
@@ -21,13 +21,17 @@ module Simp::Rake::Build
|
|
21
21
|
@rpm_build_metadata = 'last_rpm_build_metadata.yaml'
|
22
22
|
@rpm_dependency_file = File.join(@base_dir, 'build', 'rpm', 'dependencies.yaml')
|
23
23
|
@build_keys_dir = ENV.fetch('SIMP_PKG_build_keys_dir', File.join(@base_dir, '.dev_gpgkeys'))
|
24
|
-
@long_gpg_socket_err_msg = <<~
|
24
|
+
@long_gpg_socket_err_msg = <<~MSG
|
25
25
|
If the problem is 'socket name <xxx> is too long', use SIMP_PKG_build_keys_dir
|
26
26
|
to override
|
27
27
|
#{@build_keys_dir}
|
28
28
|
with a shorter path. The socket name must be < 108 characters.
|
29
29
|
|
30
|
-
|
30
|
+
MSG
|
31
|
+
# nil = default not set; use local preference
|
32
|
+
@fetch_published_rpm_default = ENV['SIMP_PKG_fetch_published_rpm'] ? (
|
33
|
+
ENV['SIMP_PKG_fetch_published_rpm'] =~ /\A(yes|true)\Z/i ? true : false
|
34
|
+
) : nil
|
31
35
|
|
32
36
|
define_tasks
|
33
37
|
end
|
@@ -114,7 +118,7 @@ module Simp::Rake::Build
|
|
114
118
|
end
|
115
119
|
end
|
116
120
|
|
117
|
-
desc
|
121
|
+
desc <<~DESC
|
118
122
|
Prepare a GPG signing key to sign build packages
|
119
123
|
|
120
124
|
* :key - the name of the build keys subdirectory to prepare
|
@@ -142,7 +146,7 @@ module Simp::Rake::Build
|
|
142
146
|
ENV vars:
|
143
147
|
- Set `SIMP_PKG_verbose=yes` to report file operations as they happen.
|
144
148
|
- Set `SIMP_PKG_build_keys_dir` to override the default build keys path.
|
145
|
-
|
149
|
+
DESC
|
146
150
|
task :key_prep,[:key] => [:prep] do |t,args|
|
147
151
|
args.with_defaults(:key => 'dev')
|
148
152
|
key = args.key
|
@@ -251,7 +255,7 @@ module Simp::Rake::Build
|
|
251
255
|
|
252
256
|
|
253
257
|
=begin
|
254
|
-
desc
|
258
|
+
desc <<~DESC
|
255
259
|
Build the entire SIMP release.
|
256
260
|
|
257
261
|
* :docs - Build the docs. Set this to false if you wish to skip building the docs.
|
@@ -261,7 +265,7 @@ module Simp::Rake::Build
|
|
261
265
|
- Set `SIMP_PKG_verbose=yes` to report file operations as they happen.
|
262
266
|
- Set `SIMP_YUM_makecache=no` if you do NOT want to rebuild the
|
263
267
|
build-specific YUM cache
|
264
|
-
|
268
|
+
DESC
|
265
269
|
=end
|
266
270
|
task :build,[:docs,:key] => [:prep,:key_prep] do |t,args|
|
267
271
|
args.with_defaults(:key => 'dev')
|
@@ -269,12 +273,7 @@ module Simp::Rake::Build
|
|
269
273
|
|
270
274
|
check_dvd_env
|
271
275
|
|
272
|
-
|
273
|
-
yum_helper = Simp::YUM.new(
|
274
|
-
Simp::YUM.generate_yum_conf(File.join(@distro_build_dir, 'yum_data')),
|
275
|
-
ENV.fetch('SIMP_YUM_makecache','yes') == 'yes')
|
276
|
-
rescue Simp::YUM::Error
|
277
|
-
end
|
276
|
+
get_yum_helper
|
278
277
|
|
279
278
|
Rake::Task['pkg:aux'].invoke
|
280
279
|
if "#{args.docs}" == 'true'
|
@@ -287,7 +286,7 @@ module Simp::Rake::Build
|
|
287
286
|
Rake::Task['pkg:signrpms'].invoke(args[:key])
|
288
287
|
end
|
289
288
|
|
290
|
-
desc
|
289
|
+
desc <<~DESC
|
291
290
|
Build the Puppet module RPMs.
|
292
291
|
|
293
292
|
* :method - The Puppetfile from which the repository information
|
@@ -295,12 +294,12 @@ module Simp::Rake::Build
|
|
295
294
|
|
296
295
|
ENV vars:
|
297
296
|
- Set `SIMP_PKG_verbose=yes` to report file operations as they happen.
|
298
|
-
|
297
|
+
DESC
|
299
298
|
task :modules,[:method] => [:prep] do |t,args|
|
300
299
|
build(@build_dirs[:modules],t)
|
301
300
|
end
|
302
301
|
|
303
|
-
desc
|
302
|
+
desc <<~DESC
|
304
303
|
Build a single Puppet Module RPM.
|
305
304
|
|
306
305
|
* :name - The path, or name, of the module to build. If a name is
|
@@ -314,11 +313,12 @@ module Simp::Rake::Build
|
|
314
313
|
- Set `SIMP_PKG_verbose=yes` to report file operations as they happen.
|
315
314
|
- Set `SIMP_YUM_makecache=no` if you do NOT want to rebuild the
|
316
315
|
build-specific YUM cache
|
317
|
-
|
316
|
+
DESC
|
318
317
|
task :single,[:name,:method] => [:prep] do |t,args|
|
319
318
|
fail("You must pass :name to '#{t.name}'") unless args[:name]
|
320
319
|
|
321
320
|
mod_path = File.absolute_path(args[:name])
|
321
|
+
get_yum_helper
|
322
322
|
|
323
323
|
if args[:name].include?('/')
|
324
324
|
fail("'#{args[:name]}' does not exist!") unless File.directory?(mod_path)
|
@@ -333,35 +333,27 @@ module Simp::Rake::Build
|
|
333
333
|
mod_path = local_module[:path]
|
334
334
|
end
|
335
335
|
|
336
|
-
begin
|
337
|
-
yum_helper = Simp::YUM.new(
|
338
|
-
Simp::YUM.generate_yum_conf(File.join(@distro_build_dir, 'yum_data')),
|
339
|
-
ENV.fetch('SIMP_YUM_makecache','yes') == 'yes')
|
340
|
-
rescue Simp::YUM::Error
|
341
|
-
end
|
342
|
-
|
343
|
-
ENV['SIMP_PKG_rand_name'] = 'yes'
|
344
336
|
build(Array(mod_path), t)
|
345
337
|
|
346
338
|
puts("Your packages can be found in '#{mod_path}/dist'")
|
347
339
|
end
|
348
340
|
|
349
|
-
desc
|
341
|
+
desc <<~DESC
|
350
342
|
Build the SIMP non-module RPMs.
|
351
343
|
|
352
344
|
ENV vars:
|
353
345
|
- Set `SIMP_PKG_verbose=yes` to report file operations as they happen.
|
354
|
-
|
346
|
+
DESC
|
355
347
|
task :aux => [:prep] do |t,args|
|
356
348
|
build(@build_dirs[:aux],t)
|
357
349
|
end
|
358
350
|
|
359
|
-
desc
|
351
|
+
desc <<~DESC
|
360
352
|
Build the SIMP documentation.
|
361
353
|
|
362
354
|
ENV vars:
|
363
355
|
- Set `SIMP_PKG_verbose=yes` to report file operations as they happen.
|
364
|
-
|
356
|
+
DESC
|
365
357
|
task :doc => [:prep] do |t,args|
|
366
358
|
# Need to make sure that the docs have the version updated
|
367
359
|
# appropriately prior to building
|
@@ -373,7 +365,7 @@ module Simp::Rake::Build
|
|
373
365
|
build(@build_dirs[:doc],t)
|
374
366
|
end
|
375
367
|
|
376
|
-
desc
|
368
|
+
desc <<~DESC
|
377
369
|
Sign a set of RPMs.
|
378
370
|
|
379
371
|
Signs any unsigned RPMs in the specified directory
|
@@ -394,7 +386,7 @@ module Simp::Rake::Build
|
|
394
386
|
* Set `SIMP_PKG_rpmsign_timeout` to override the maximum time in seconds
|
395
387
|
to wait for an individual RPM signing operation to complete.
|
396
388
|
- Defaults to 60 seconds.
|
397
|
-
|
389
|
+
DESC
|
398
390
|
task :signrpms,[:key,:rpm_dir,:force,:digest_algo] => [:prep,:key_prep] do |t,args|
|
399
391
|
require 'simp/rpm_signer'
|
400
392
|
|
@@ -455,13 +447,13 @@ module Simp::Rake::Build
|
|
455
447
|
end
|
456
448
|
|
457
449
|
=begin
|
458
|
-
desc
|
450
|
+
desc <<~DESC
|
459
451
|
Check that RPMs are signed.
|
460
452
|
|
461
453
|
Checks all RPM files in a directory to see if they are trusted.
|
462
454
|
* :rpm_dir - A directory containing RPM files to check. Default #{@build_dir}/SIMP
|
463
455
|
* :key_dir - The path to the GPG keys you want to check the packages against. Default #{@src_dir}/assets/gpgkeys/
|
464
|
-
|
456
|
+
DESC
|
465
457
|
=end
|
466
458
|
task :checksig,[:rpm_dir,:key_dir] => [:prep] do |t,args|
|
467
459
|
begin
|
@@ -547,7 +539,7 @@ module Simp::Rake::Build
|
|
547
539
|
end
|
548
540
|
end
|
549
541
|
|
550
|
-
desc
|
542
|
+
desc <<~DESC
|
551
543
|
Run repoclosure on RPM files.
|
552
544
|
|
553
545
|
Finds all rpm files in the target dir and all of its subdirectories, then
|
@@ -561,7 +553,7 @@ module Simp::Rake::Build
|
|
561
553
|
- Set `SIMP_PKG_verbose=yes` to report file operations as they happen.
|
562
554
|
- Set `SIMP_PKG_repoclose_pe=yes` to enable repoclosure on PE-related RPMs.
|
563
555
|
|
564
|
-
|
556
|
+
DESC
|
565
557
|
task :repoclosure,[:target_dir,:aux_dir] => [:prep] do |t,args|
|
566
558
|
default_target = @pkg_dirs[:simp]
|
567
559
|
args.with_defaults(:target_dir => File.expand_path(default_target))
|
@@ -572,31 +564,31 @@ module Simp::Rake::Build
|
|
572
564
|
|
573
565
|
_repoclose_pe = ENV.fetch('SIMP_PKG_repoclose_pe','no') == 'yes'
|
574
566
|
|
575
|
-
yum_conf_template =
|
576
|
-
[main]
|
577
|
-
keepcache=0
|
578
|
-
exactarch=1
|
579
|
-
obsoletes=1
|
580
|
-
gpgcheck=0
|
581
|
-
plugins=1
|
582
|
-
installonly_limit=5
|
583
|
-
<% unless #{_repoclose_pe} -%>
|
584
|
-
exclude=*-pe-*
|
585
|
-
<% end -%>
|
586
|
-
|
587
|
-
<% repo_files.each do |repo| -%>
|
588
|
-
include=file://<%= repo %>
|
589
|
-
<% end -%>
|
590
|
-
|
591
|
-
|
592
|
-
yum_repo_template =
|
593
|
-
[<%= repo_name %>]
|
594
|
-
name=<%= repo_name %>
|
595
|
-
baseurl=file://<%= repo_path %>
|
596
|
-
enabled=1
|
597
|
-
gpgcheck=0
|
598
|
-
protect=1
|
599
|
-
|
567
|
+
yum_conf_template = <<~YUM_CONF
|
568
|
+
[main]
|
569
|
+
keepcache=0
|
570
|
+
exactarch=1
|
571
|
+
obsoletes=1
|
572
|
+
gpgcheck=0
|
573
|
+
plugins=1
|
574
|
+
installonly_limit=5
|
575
|
+
<% unless #{_repoclose_pe} -%>
|
576
|
+
exclude=*-pe-*
|
577
|
+
<% end -%>
|
578
|
+
|
579
|
+
<% repo_files.each do |repo| -%>
|
580
|
+
include=file://<%= repo %>
|
581
|
+
<% end -%>
|
582
|
+
YUM_CONF
|
583
|
+
|
584
|
+
yum_repo_template = <<~YUM_REPO
|
585
|
+
[<%= repo_name %>]
|
586
|
+
name=<%= repo_name %>
|
587
|
+
baseurl=file://<%= repo_path %>
|
588
|
+
enabled=1
|
589
|
+
gpgcheck=0
|
590
|
+
protect=1
|
591
|
+
YUM_REPO
|
600
592
|
|
601
593
|
fail("#{args[:target_dir]} does not exist!") unless File.directory?(args[:target_dir])
|
602
594
|
|
@@ -677,9 +669,9 @@ protect=1
|
|
677
669
|
end
|
678
670
|
end
|
679
671
|
|
680
|
-
desc
|
672
|
+
desc <<~DESC
|
681
673
|
Print published status of all project RPMs
|
682
|
-
|
674
|
+
DESC
|
683
675
|
task :check_published => [:prep] do |t,args|
|
684
676
|
begin
|
685
677
|
yum_helper = Simp::YUM.new(
|
@@ -697,7 +689,12 @@ protect=1
|
|
697
689
|
|
698
690
|
if Dir.exist?(dir)
|
699
691
|
begin
|
700
|
-
require_rebuild?(dir, yum_helper, {
|
692
|
+
require_rebuild?(dir, yum_helper, {
|
693
|
+
fetch: false,
|
694
|
+
verbose: true,
|
695
|
+
check_git: true,
|
696
|
+
prefix: ''
|
697
|
+
})
|
701
698
|
rescue => e
|
702
699
|
_errmsg = "Error: require_rebuild?(): Status check failed on '#{dir}' => #{e}"
|
703
700
|
end
|
@@ -724,9 +721,24 @@ protect=1
|
|
724
721
|
return (0...24).map{ (65 + rand(26)).chr }.join.downcase
|
725
722
|
end
|
726
723
|
|
724
|
+
# Return a SIMP::YUM object configured for the local build dir or nil
|
725
|
+
#
|
726
|
+
# ENV vars:
|
727
|
+
# - Set `SIMP_PKG_verbose=yes` to report file operations as they happen.
|
728
|
+
# - Set `SIMP_YUM_makecache=no` if you do NOT want to rebuild the
|
729
|
+
# build-specific YUM cache
|
730
|
+
def get_yum_helper( makecache = (ENV.fetch('SIMP_YUM_makecache','yes') == 'yes') )
|
731
|
+
begin
|
732
|
+
build_yum_data = File.join(@distro_build_dir, 'yum_data')
|
733
|
+
return Simp::YUM.new(Simp::YUM.generate_yum_conf(build_yum_data), makecache)
|
734
|
+
rescue Simp::YUM::Error => e
|
735
|
+
$stderr.puts "Simp::YUM::Error: #{e}" if @verbose
|
736
|
+
end
|
737
|
+
end
|
738
|
+
|
727
739
|
# Check and see if 'dir' requires a rebuild based on published packages
|
728
740
|
#
|
729
|
-
# If 'fetch' is true => Download the RPM
|
741
|
+
# If 'fetch' is true => Download the published RPM
|
730
742
|
# If 'verbose' is true => Print helpful information to stderr
|
731
743
|
# If 'check_git' is true => Print the git tag status if 'verbose' is true
|
732
744
|
# 'prefix' is used to prepend verbose messages
|
@@ -735,7 +747,13 @@ protect=1
|
|
735
747
|
# - Method is too long
|
736
748
|
# - Method needs to be passed in class variables (@xxx) so that it
|
737
749
|
# can be pulled out into a library that is easily unit-testable
|
738
|
-
def require_rebuild?(dir, yum_helper, opts={
|
750
|
+
def require_rebuild?(dir, yum_helper, opts={
|
751
|
+
unique_namespace: generate_namespace,
|
752
|
+
fetch: false,
|
753
|
+
verbose: @verbose,
|
754
|
+
check_git: false,
|
755
|
+
prefix: ''
|
756
|
+
})
|
739
757
|
result = false
|
740
758
|
rpm_metadata = File.exist?(@rpm_dependency_file) ? YAML.load(File.read(@rpm_dependency_file)) : {}
|
741
759
|
dir_relpath = Pathname.new(dir).relative_path_from(Pathname.new(Dir.pwd)).to_path
|
@@ -870,7 +888,8 @@ protect=1
|
|
870
888
|
else
|
871
889
|
$stderr.puts "#{opts[:prefix]}Found Existing Remote RPM: #{published_rpm}" if opts[:verbose]
|
872
890
|
if opts[:fetch]
|
873
|
-
# Download
|
891
|
+
# Download published RPM, unless it's already been downloaded.
|
892
|
+
# TODO Unhandled edge case: Validate that downloaded RPM is valid
|
874
893
|
if File.exist?(File.join('dist', published_rpm))
|
875
894
|
$stderr.puts "#{opts[:prefix]}#{published_rpm} previously downloaded" if opts[:verbose]
|
876
895
|
else
|
@@ -914,101 +933,107 @@ protect=1
|
|
914
933
|
return result
|
915
934
|
end
|
916
935
|
|
936
|
+
def build_pupmod_rpm(dir, yum_helper, dbg_prefix = ' ')
|
937
|
+
unique_namespace = generate_namespace
|
938
|
+
if require_rebuild?(dir, yum_helper, {
|
939
|
+
unique_namespace: unique_namespace,
|
940
|
+
fetch: @fetch_published_rpm.nil? ? true : @fetch_published_rpm,
|
941
|
+
verbose: @verbose,
|
942
|
+
prefix: dbg_prefix,
|
943
|
+
})
|
944
|
+
$stderr.puts("#{dbg_prefix}Running 'rake pkg:rpm' on #{File.basename(dir)}") if @verbose
|
945
|
+
Rake::Task["#{unique_namespace}:pkg:rpm"].invoke
|
946
|
+
else
|
947
|
+
# Record metadata for the downloaded RPM
|
948
|
+
Simp::RPM::create_rpm_build_metadata(File.expand_path(dir))
|
949
|
+
end
|
950
|
+
true
|
951
|
+
end
|
952
|
+
|
953
|
+
|
954
|
+
def build_rakefile_rpm(dir, yum_helper, dbg_prefix = ' ')
|
955
|
+
if require_rebuild?(dir, yum_helper, {
|
956
|
+
fetch: @fetch_published_rpm.nil? ? true : @fetch_published_rpm,
|
957
|
+
verbose: @verbose,
|
958
|
+
prefix: dbg_prefix
|
959
|
+
})
|
960
|
+
$stderr.puts("#{dbg_prefix}Running 'rake pkg:rpm' in #{File.basename(dir)}") if @verbose
|
961
|
+
rake_flags = Rake.application.options.trace ? '--trace' : ''
|
962
|
+
cmd = %{SIMP_BUILD_version=#{@simp_version} rake pkg:rpm #{rake_flags} 2>&1}
|
963
|
+
|
964
|
+
build_success = true
|
965
|
+
begin
|
966
|
+
%x{#{cmd}}
|
967
|
+
build_success = $?.success?
|
968
|
+
|
969
|
+
built_rpm = true
|
970
|
+
rescue
|
971
|
+
build_success = false
|
972
|
+
end
|
973
|
+
|
974
|
+
unless build_success
|
975
|
+
if @verbose
|
976
|
+
$stderr.puts("First 'rake pkg:rpm' attempt for #{dir} failed, running bundle and trying again.")
|
977
|
+
end
|
978
|
+
|
979
|
+
if Bundler.respond_to?(:with_unbundled_env)
|
980
|
+
# Bundler 2.1+
|
981
|
+
clean_env_method = :with_unbundled_env
|
982
|
+
bundle_install_cmd = %{bundle config set with 'development' && bundle install}
|
983
|
+
else
|
984
|
+
# Old Bundler
|
985
|
+
clean_env_method = :with_clean_env
|
986
|
+
bundle_install_cmd = %{bundle install --with development}
|
987
|
+
end
|
988
|
+
|
989
|
+
::Bundler.send(clean_env_method) do
|
990
|
+
%x{#{bundle_install_cmd}}
|
991
|
+
|
992
|
+
output = %x{#{cmd} 2>&1}
|
993
|
+
|
994
|
+
unless $?.success?
|
995
|
+
raise("Error in #{dir} running #{cmd}\n#{output}")
|
996
|
+
end
|
997
|
+
end
|
998
|
+
end
|
999
|
+
else
|
1000
|
+
# Record metadata for the downloaded RPM
|
1001
|
+
Simp::RPM::create_rpm_build_metadata(File.expand_path(dir))
|
1002
|
+
built_rpm = true
|
1003
|
+
end
|
1004
|
+
end
|
1005
|
+
|
1006
|
+
|
917
1007
|
# Takes a list of directories to hop into and perform builds within
|
918
1008
|
#
|
919
1009
|
# The task must be passed so that we can output the calling name in the
|
920
1010
|
# status bar.
|
921
1011
|
def build(dirs, task, rebuild_for_arch=false, remake_yum_cache = false)
|
922
|
-
_verbose = ENV.fetch('SIMP_PKG_verbose','no') == 'yes'
|
923
|
-
dbg_prefix = ' ' # prefix for debug messages
|
924
|
-
|
925
1012
|
fail("Could not find RPM dependency file '#{@rpm_dependency_file}'") unless File.exist?(@rpm_dependency_file)
|
926
|
-
|
927
|
-
begin
|
928
|
-
yum_helper = Simp::YUM.new(
|
929
|
-
Simp::YUM.generate_yum_conf(File.join(@distro_build_dir, 'yum_data'))
|
930
|
-
)
|
931
|
-
rescue Simp::YUM::Error
|
932
|
-
end
|
1013
|
+
yum_helper = get_yum_helper( remake_yum_cache )
|
933
1014
|
|
934
1015
|
Parallel.map(
|
935
1016
|
# Allow for shell globs
|
936
|
-
Array(dirs),
|
937
|
-
|
938
|
-
|
1017
|
+
Array(dirs), {
|
1018
|
+
in_processes: @cpu_limit,
|
1019
|
+
progress: (ENV.fetch('SIMP_PKG_progress_bar','yes') == 'yes') ? task.name : nil,
|
1020
|
+
}
|
939
1021
|
) do |dir|
|
940
1022
|
fail("Could not find directory #{dir}") unless Dir.exist?(dir)
|
941
1023
|
|
942
1024
|
Dir.chdir(dir) do
|
943
1025
|
built_rpm = false
|
1026
|
+
$stderr.puts("\nPackaging #{File.basename(dir)}") if @verbose
|
944
1027
|
|
945
|
-
if @verbose
|
946
|
-
$stderr.puts("\nPackaging #{File.basename(dir)}")
|
947
|
-
end
|
948
|
-
|
949
|
-
# We're building a module, override anything down there
|
950
1028
|
if File.exist?('metadata.json')
|
951
|
-
|
952
|
-
|
953
|
-
$stderr.puts("#{dbg_prefix}Running 'rake pkg:rpm' on #{File.basename(dir)}") if @verbose
|
954
|
-
Rake::Task["#{unique_namespace}:pkg:rpm"].invoke
|
955
|
-
else
|
956
|
-
# Record metadata for the downloaded RPM
|
957
|
-
Simp::RPM::create_rpm_build_metadata(File.expand_path(dir))
|
958
|
-
end
|
959
|
-
|
960
|
-
built_rpm = true
|
961
|
-
|
962
|
-
# We're building one of the extra assets and should honor its Rakefile
|
963
|
-
# and RPM spec file.
|
1029
|
+
# We're building a module, override anything down there
|
1030
|
+
built_rpm = build_pupmod_rpm(dir, yum_helper)
|
964
1031
|
elsif File.exist?('Rakefile')
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
cmd = %{SIMP_BUILD_version=#{@simp_version} rake pkg:rpm #{rake_flags} 2>&1}
|
969
|
-
|
970
|
-
build_success = true
|
971
|
-
begin
|
972
|
-
%x{#{cmd}}
|
973
|
-
build_success = $?.success?
|
974
|
-
|
975
|
-
built_rpm = true
|
976
|
-
rescue
|
977
|
-
build_success = false
|
978
|
-
end
|
979
|
-
|
980
|
-
unless build_success
|
981
|
-
if @verbose
|
982
|
-
$stderr.puts("First 'rake pkg:rpm' attempt for #{dir} failed, running bundle and trying again.")
|
983
|
-
end
|
984
|
-
|
985
|
-
if Bundler.respond_to?(:with_unbundled_env)
|
986
|
-
# Bundler 2.1+
|
987
|
-
clean_env_method = :with_unbundled_env
|
988
|
-
bundle_install_cmd = %{bundle config set with 'development' && bundle install}
|
989
|
-
else
|
990
|
-
# Old Bundler
|
991
|
-
clean_env_method = :with_clean_env
|
992
|
-
bundle_install_cmd = %{bundle install --with development}
|
993
|
-
end
|
994
|
-
|
995
|
-
::Bundler.send(clean_env_method) do
|
996
|
-
%x{#{bundle_install_cmd}}
|
997
|
-
|
998
|
-
output = %x{#{cmd} 2>&1}
|
999
|
-
|
1000
|
-
unless $?.success?
|
1001
|
-
raise("Error in #{dir} running #{cmd}\n#{output}")
|
1002
|
-
end
|
1003
|
-
end
|
1004
|
-
end
|
1005
|
-
else
|
1006
|
-
# Record metadata for the downloaded RPM
|
1007
|
-
Simp::RPM::create_rpm_build_metadata(File.expand_path(dir))
|
1008
|
-
built_rpm = true
|
1009
|
-
end
|
1032
|
+
# We're building one of the extra assets and should honor its Rakefile
|
1033
|
+
# and RPM spec file.
|
1034
|
+
built_rpm = build_rakefile_rpm(dir, yum_helper)
|
1010
1035
|
else
|
1011
|
-
puts "Warning: '#{dir}' could not be built
|
1036
|
+
puts "Warning: '#{dir}' could not be built (not a pupmod & no Rakefile!)"
|
1012
1037
|
end
|
1013
1038
|
|
1014
1039
|
if built_rpm
|
@@ -1024,12 +1049,7 @@ protect=1
|
|
1024
1049
|
|
1025
1050
|
raise("No RPMs generated for #{dir}") if rpms.empty?
|
1026
1051
|
end
|
1027
|
-
|
1028
|
-
if @verbose
|
1029
|
-
rpms = Dir.glob('dist/*.rpm')
|
1030
|
-
# $stderr.puts("#{dbg_prefix}RPMS: #{rpms.join("\n#{dbg_prefix} ")}")
|
1031
|
-
$stderr.puts("Finished #{File.basename(dir)}")
|
1032
|
-
end
|
1052
|
+
$stderr.puts("Finished #{File.basename(dir)}") if @verbose
|
1033
1053
|
end
|
1034
1054
|
end
|
1035
1055
|
end
|
@@ -267,7 +267,13 @@ module Simp::Rake::Build::RpmDeps
|
|
267
267
|
def self.release_file_up_to_date?(new_release_info, rpm_release_file)
|
268
268
|
return false unless File.exist?(rpm_release_file)
|
269
269
|
|
270
|
-
|
270
|
+
# remove comments like "# release set by simp-core dependencies.yaml"
|
271
|
+
release_file_content = File.readlines(rpm_release_file).reject{|x| x =~ /^ *#/}.join("\n").strip
|
272
|
+
|
273
|
+
# sanitize numerics, etc.
|
274
|
+
new_release_content = "#{new_release_info}".strip
|
275
|
+
|
276
|
+
return release_file_content == new_release_content
|
271
277
|
end
|
272
278
|
|
273
279
|
# Generate 'build/rpm_metadata/release' file containing release qualifier
|
data/lib/simp/rake/build/tar.rb
CHANGED
@@ -51,7 +51,8 @@ module Simp::Rake::Build
|
|
51
51
|
'rubygem-simp-cli',
|
52
52
|
'simp',
|
53
53
|
'simp-gpgkeys',
|
54
|
-
'simp-utils'
|
54
|
+
'simp-utils',
|
55
|
+
'simp-vendored-r10k'
|
55
56
|
]
|
56
57
|
}
|
57
58
|
|
@@ -83,8 +84,11 @@ module Simp::Rake::Build
|
|
83
84
|
end
|
84
85
|
|
85
86
|
unless failures.empty?
|
86
|
-
msg = ['Error: Could not find the following packages:']
|
87
|
-
|
87
|
+
msg = ['Error: Could not find the following packages:'] +
|
88
|
+
failures +
|
89
|
+
['Did "dist/logs/last_rpm_build_metadata.yaml" get generated in the build directory?']
|
90
|
+
|
91
|
+
fail(msg.join("\n"))
|
88
92
|
end
|
89
93
|
end
|
90
94
|
end
|
@@ -342,7 +342,7 @@ describe 'rake pkg:signrpms and pkg:checksig' do
|
|
342
342
|
end
|
343
343
|
|
344
344
|
hosts.each do |host|
|
345
|
-
os_major = fact_on(host,'
|
345
|
+
os_major = fact_on(host,'os.release.major')
|
346
346
|
if os_major > '7'
|
347
347
|
# this problem only happens on EL > 7 in a docker container
|
348
348
|
describe "when gpg-agent's socket path is too long on #{host}" do
|
@@ -378,7 +378,7 @@ describe 'rake pkg:signrpms and pkg:checksig' do
|
|
378
378
|
:acceptable_exit_codes => [1]
|
379
379
|
)
|
380
380
|
|
381
|
-
err_msg = %r(Failed to sign
|
381
|
+
err_msg = %r(Failed to sign)
|
382
382
|
expect(result.stderr).to match(err_msg)
|
383
383
|
|
384
384
|
signature_check = on(host, "rpm -qip '#{test_rpm}' | grep ^Signature", run_opts)
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
|
4
4
|
describe Simp::Rake::Build::Helpers do
|
5
5
|
before :each do
|
6
|
-
dir
|
6
|
+
dir = File.expand_path( '../../files/simp_build', File.dirname( __FILE__ ) )
|
7
7
|
env = ENV['SIMP_RPM_dist'].dup
|
8
8
|
ENV['SIMP_RPM_dist'] = '.el7'
|
9
9
|
@obj = Simp::Rake::Build::Helpers.new( dir )
|
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.
|
4
|
+
version: 5.13.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:
|
12
|
+
date: 2022-05-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: simp-beaker-helpers
|
@@ -592,8 +592,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
592
592
|
- !ruby/object:Gem::Version
|
593
593
|
version: '0'
|
594
594
|
requirements: []
|
595
|
-
|
596
|
-
rubygems_version: 2.7.6.3
|
595
|
+
rubygems_version: 3.0.9
|
597
596
|
signing_key:
|
598
597
|
specification_version: 4
|
599
598
|
summary: SIMP rake helpers
|