simp-rake-helpers 5.11.4 → 5.12.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (194) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +46 -0
  3. data/CONTRIBUTING.md +1 -1
  4. data/Gemfile +2 -1
  5. data/README.md +3 -38
  6. data/Rakefile +2 -3
  7. data/lib/simp/command_utils.rb +21 -0
  8. data/lib/simp/componentinfo.rb +17 -0
  9. data/lib/simp/local_gpg_signing_key.rb +184 -81
  10. data/lib/simp/rake.rb +3 -10
  11. data/lib/simp/rake/build/build.rb +45 -29
  12. data/lib/simp/rake/build/constants.rb +5 -1
  13. data/lib/simp/rake/build/iso.rb +1 -1
  14. data/lib/simp/rake/build/pkg.rb +168 -52
  15. data/lib/simp/rake/build/spec.rb +1 -1
  16. data/lib/simp/rake/build/tar.rb +1 -1
  17. data/lib/simp/rake/build/unpack.rb +1 -1
  18. data/lib/simp/rake/build/upload.rb +1 -1
  19. data/lib/simp/rake/helpers/assets/rpm_spec/simp6.spec +3 -3
  20. data/lib/simp/rake/helpers/assets/rpm_spec/simpdefault.spec +3 -3
  21. data/lib/simp/rake/helpers/version.rb +1 -1
  22. data/lib/simp/rake/pkg.rb +5 -1
  23. data/lib/simp/rake/pupmod/helpers.rb +2 -0
  24. data/lib/simp/rake/rubygem.rb +5 -1
  25. data/lib/simp/rpm.rb +13 -125
  26. data/lib/simp/rpm_signer.rb +321 -0
  27. data/spec/acceptance/nodesets/default.yml +18 -109
  28. data/spec/acceptance/{00_pkg_rpm_custom_scriptlets_spec.rb → suites/default/00_pkg_rpm_custom_scriptlets_spec.rb} +21 -22
  29. data/spec/acceptance/{10_pkg_rpm_spec.rb → suites/default/10_pkg_rpm_spec.rb} +50 -52
  30. data/spec/acceptance/{30_pkg_misc_spec.rb → suites/default/30_pkg_misc_spec.rb} +1 -1
  31. data/spec/acceptance/{50_local_gpg_signing_key_spec.rb → suites/default/50_local_gpg_signing_key_spec.rb} +7 -3
  32. data/spec/acceptance/suites/default/55_build_pkg_signing_spec.rb +391 -0
  33. data/spec/acceptance/{development → suites/default/development}/docker_env.sh +0 -0
  34. data/spec/acceptance/{development → suites/default/development}/rerun_acceptance_tests.sh +0 -0
  35. data/spec/acceptance/{development → suites/default/development}/vagrant_rsync.sh +0 -0
  36. data/spec/acceptance/{files → suites/default/files}/asset/Rakefile +0 -0
  37. data/spec/acceptance/{files → suites/default/files}/asset/build/asset.spec +0 -0
  38. data/spec/acceptance/{files → suites/default/files}/asset_with_misordered_entries/Rakefile +0 -0
  39. data/spec/acceptance/{files → suites/default/files}/asset_with_misordered_entries/build/asset_with_misordered_entries.spec +0 -0
  40. data/spec/acceptance/{files → suites/default/files}/build/pkg/gpg-keydir.expired.2018-04-06/RPM-GPG-KEY-SIMP-Dev +0 -0
  41. data/spec/acceptance/{files → suites/default/files}/build/pkg/gpg-keydir.expired.2018-04-06/gengpgkey +0 -0
  42. data/spec/acceptance/{files → suites/default/files}/build/pkg/gpg-keydir.expired.2018-04-06/pubring.gpg +0 -0
  43. data/spec/acceptance/{files → suites/default/files}/build/pkg/gpg-keydir.expired.2018-04-06/random_seed +0 -0
  44. data/spec/acceptance/{files → suites/default/files}/build/pkg/gpg-keydir.expired.2018-04-06/run_gpg_agent +0 -0
  45. data/spec/acceptance/{files → suites/default/files}/build/pkg/gpg-keydir.expired.2018-04-06/secring.gpg +0 -0
  46. data/spec/acceptance/{files → suites/default/files}/build/pkg/gpg-keydir.expired.2018-04-06/trustdb.gpg +0 -0
  47. data/spec/acceptance/{files → suites/default/files}/build/project_skeleton/Puppetfile.tracking +0 -0
  48. data/spec/acceptance/{files → suites/default/files}/build/project_skeleton/README.md +0 -0
  49. data/spec/acceptance/{files → suites/default/files}/build/project_skeleton/Rakefile +0 -0
  50. data/spec/acceptance/{files → suites/default/files}/build/project_skeleton/src/assets/simp/build/simp.spec +0 -0
  51. data/spec/acceptance/{files → suites/default/files}/module/CHANGELOG +0 -0
  52. data/spec/acceptance/{files/custom_scriptlet_triggers/pupmod-new-package-2.1 → suites/default/files/module}/Rakefile +0 -0
  53. data/spec/acceptance/{files → suites/default/files}/module/metadata.json +0 -0
  54. data/spec/acceptance/{files → suites/default/files}/module_with_misordered_entries/CHANGELOG +0 -0
  55. data/spec/acceptance/{files/custom_scriptlet_triggers/pupmod-new-package-3.0 → suites/default/files/module_with_misordered_entries}/Rakefile +0 -0
  56. data/spec/acceptance/{files → suites/default/files}/module_with_misordered_entries/metadata.json +0 -0
  57. data/spec/acceptance/{files/custom_scriptlet_triggers/pupmod-new-package-2.1 → suites/default/files/simplib}/CHANGELOG +0 -0
  58. data/spec/acceptance/{files/custom_scriptlet_triggers/pupmod-old-package-1.0 → suites/default/files/simplib}/Rakefile +0 -0
  59. data/spec/acceptance/{files/custom_scriptlet_triggers/pupmod-old-package-1.0 → suites/default/files/simplib}/build/rpm_metadata/requires +0 -0
  60. data/spec/acceptance/{files → suites/default/files}/simplib/metadata.json +0 -0
  61. data/spec/acceptance/{files/custom_scriptlet_triggers/pupmod-new-package-3.0 → suites/default/files/testpackage}/CHANGELOG +0 -0
  62. data/spec/acceptance/suites/default/files/testpackage/README +8 -0
  63. data/spec/acceptance/{files/custom_scriptlet_triggers/pupmod-old-package-2.0 → suites/default/files/testpackage}/Rakefile +0 -0
  64. data/spec/acceptance/{files/package_upgrades/pupmod-simp-testpackage-1.0 → suites/default/files/testpackage}/build/rpm_metadata/requires +0 -0
  65. data/spec/acceptance/{files → suites/default/files}/testpackage/metadata.json +0 -0
  66. data/spec/acceptance/suites/default/files/testpackage/spec/classes/init_spec.rb +1 -0
  67. data/spec/acceptance/suites/default/files/testpackage/spec/files/mock_something.rb +3 -0
  68. data/spec/acceptance/suites/default/files/testpackage/utils/convert_v1_to_v2.rb +3 -0
  69. data/spec/acceptance/{files/custom_scriptlet_triggers/pupmod-old-package-1.0 → suites/default/files/testpackage_custom_scriptlet}/CHANGELOG +0 -0
  70. data/spec/acceptance/{files/custom_scriptlet_triggers/pupmod-old-package-2.2 → suites/default/files/testpackage_custom_scriptlet}/Rakefile +0 -0
  71. data/spec/acceptance/{files → suites/default/files}/testpackage_custom_scriptlet/build/rpm_metadata/custom/overrides +0 -0
  72. data/spec/acceptance/{files/custom_scriptlet_triggers/pupmod-old-package-2.0 → suites/default/files/testpackage_custom_scriptlet}/build/rpm_metadata/requires +0 -0
  73. data/spec/acceptance/{files → suites/default/files}/testpackage_custom_scriptlet/metadata.json +0 -0
  74. data/spec/acceptance/{files/custom_scriptlet_triggers/pupmod-old-package-2.0 → suites/default/files/testpackage_missing_license}/CHANGELOG +0 -0
  75. data/spec/acceptance/{files/module → suites/default/files/testpackage_missing_license}/Rakefile +0 -0
  76. data/spec/acceptance/{files/simplib → suites/default/files/testpackage_missing_license}/build/rpm_metadata/requires +0 -0
  77. data/spec/acceptance/{files → suites/default/files}/testpackage_missing_license/metadata.json +0 -0
  78. data/spec/acceptance/{files/custom_scriptlet_triggers/pupmod-old-package-2.2 → suites/default/files/testpackage_missing_metadata_file}/CHANGELOG +0 -0
  79. data/spec/acceptance/{files/module_with_misordered_entries → suites/default/files/testpackage_missing_metadata_file}/Rakefile +0 -0
  80. data/spec/acceptance/{files/testpackage_custom_scriptlet → suites/default/files/testpackage_missing_metadata_file}/build/rpm_metadata/requires +0 -0
  81. data/spec/acceptance/{files/simplib → suites/default/files/testpackage_missing_name}/CHANGELOG +0 -0
  82. data/spec/acceptance/{files/package_upgrades/pupmod-simp-testpackage-1.0 → suites/default/files/testpackage_missing_name}/Rakefile +0 -0
  83. data/spec/acceptance/{files/testpackage_missing_license → suites/default/files/testpackage_missing_name}/build/rpm_metadata/requires +0 -0
  84. data/spec/acceptance/{files → suites/default/files}/testpackage_missing_name/metadata.json +0 -0
  85. data/spec/acceptance/{files/testpackage → suites/default/files/testpackage_missing_source}/CHANGELOG +0 -0
  86. data/spec/acceptance/{files/package_upgrades/pupmod-simp-testpackage-2.0 → suites/default/files/testpackage_missing_source}/Rakefile +0 -0
  87. data/spec/acceptance/{files/testpackage_missing_metadata_file → suites/default/files/testpackage_missing_source}/build/rpm_metadata/requires +0 -0
  88. data/spec/acceptance/{files → suites/default/files}/testpackage_missing_source/metadata.json +0 -0
  89. data/spec/acceptance/{files/testpackage_custom_scriptlet → suites/default/files/testpackage_missing_summary}/CHANGELOG +0 -0
  90. data/spec/acceptance/{files/simplib → suites/default/files/testpackage_missing_summary}/Rakefile +0 -0
  91. data/spec/acceptance/{files/testpackage_missing_name → suites/default/files/testpackage_missing_summary}/build/rpm_metadata/requires +0 -0
  92. data/spec/acceptance/{files → suites/default/files}/testpackage_missing_summary/metadata.json +0 -0
  93. data/spec/acceptance/{files/testpackage_missing_license → suites/default/files/testpackage_missing_version}/CHANGELOG +0 -0
  94. data/spec/acceptance/{files/testpackage → suites/default/files/testpackage_missing_version}/Rakefile +0 -0
  95. data/spec/acceptance/{files/testpackage_missing_source → suites/default/files/testpackage_missing_version}/build/rpm_metadata/requires +0 -0
  96. data/spec/acceptance/{files → suites/default/files}/testpackage_missing_version/metadata.json +0 -0
  97. data/spec/acceptance/{files → suites/default/files}/testpackage_with_bad_changelog_date/CHANGELOG +0 -0
  98. data/spec/acceptance/{files/testpackage_custom_scriptlet → suites/default/files/testpackage_with_bad_changelog_date}/Rakefile +0 -0
  99. data/spec/acceptance/{files/testpackage_missing_summary → suites/default/files/testpackage_with_bad_changelog_date}/build/rpm_metadata/requires +0 -0
  100. data/spec/acceptance/{files → suites/default/files}/testpackage_with_bad_changelog_date/metadata.json +0 -0
  101. data/spec/acceptance/{files/testpackage_missing_metadata_file → suites/default/files/testpackage_with_release}/CHANGELOG +0 -0
  102. data/spec/acceptance/{files/testpackage_missing_license → suites/default/files/testpackage_with_release}/Rakefile +0 -0
  103. data/spec/acceptance/{files → suites/default/files}/testpackage_with_release/build/rpm_metadata/release +0 -0
  104. data/spec/acceptance/{files/testpackage_missing_version → suites/default/files/testpackage_with_release}/build/rpm_metadata/requires +0 -0
  105. data/spec/acceptance/{files → suites/default/files}/testpackage_with_release/metadata.json +0 -0
  106. data/spec/acceptance/{files/testpackage_missing_metadata_file → suites/default/files/testpackage_without_changelog}/Rakefile +0 -0
  107. data/spec/acceptance/{files/testpackage_with_bad_changelog_date → suites/default/files/testpackage_without_changelog}/build/rpm_metadata/requires +0 -0
  108. data/spec/acceptance/{files → suites/default/files}/testpackage_without_changelog/metadata.json +0 -0
  109. data/spec/acceptance/{support → suites/default/support}/build_project_helpers.rb +33 -9
  110. data/spec/acceptance/{support → suites/default/support}/build_user_helpers.rb +0 -0
  111. data/spec/acceptance/{support → suites/default/support}/pkg_rpm_helpers.rb +0 -0
  112. data/spec/lib/simp/ci/gitlab_spec.rb +12 -13
  113. data/spec/lib/simp/command_utils_spec.rb +29 -0
  114. data/spec/lib/simp/componentinfo_spec.rb +10 -4
  115. data/spec/lib/simp/local_gpg_signing_key_spec.rb.beaker-only +115 -18
  116. data/spec/lib/simp/rake/build/helpers_spec.rb +3 -0
  117. data/spec/lib/simp/rake/build/rpmdeps_spec.rb +1 -2
  118. data/spec/lib/simp/rake/pupmod/fixtures/othermod/Gemfile +1 -10
  119. data/spec/lib/simp/rake/pupmod/fixtures/simpmod/README.md +2 -2
  120. data/spec/lib/simp/rake_spec.rb +2 -1
  121. data/spec/lib/simp/relchecks_check_rpm_changelog_spec.rb +20 -10
  122. data/spec/lib/simp/relchecks_compare_latest_tag_spec.rb +17 -17
  123. data/spec/lib/simp/rpm_signer_spec.rb +98 -0
  124. data/spec/lib/simp/rpm_spec.rb +1 -7
  125. data/spec/spec_helper.rb +1 -1
  126. data/spec/spec_helper_acceptance.rb +20 -3
  127. metadata +94 -151
  128. data/.travis.yml +0 -60
  129. data/lib/simp/rake/helpers/assets/rpm_spec/simp4.spec +0 -388
  130. data/lib/simp/rake/helpers/assets/rpm_spec/simp5.spec +0 -388
  131. data/spec/acceptance/20_pkg_rpm_upgrade_spec.rb +0 -236
  132. data/spec/acceptance/55_build_pkg_signing_spec.rb +0 -140
  133. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-2.1/build/rpm_metadata/custom/overrides +0 -14
  134. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-2.1/build/rpm_metadata/requires +0 -1
  135. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-2.1/metadata.json +0 -33
  136. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-3.0/build/rpm_metadata/custom/overrides +0 -14
  137. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-3.0/build/rpm_metadata/requires +0 -1
  138. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-3.0/metadata.json +0 -33
  139. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-1.0/metadata.json +0 -33
  140. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-2.0/metadata.json +0 -33
  141. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-2.2/build/rpm_metadata/custom/overrides +0 -14
  142. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-2.2/build/rpm_metadata/requires +0 -1
  143. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-2.2/metadata.json +0 -33
  144. data/spec/acceptance/files/mock_packages/pupmod-puppetlabs-stdlib.spec +0 -32
  145. data/spec/acceptance/files/mock_packages/pupmod-simp-foo.spec +0 -32
  146. data/spec/acceptance/files/mock_packages/pupmod-simp-simplib.spec +0 -32
  147. data/spec/acceptance/files/mock_packages/rpmbuild.sh +0 -25
  148. data/spec/acceptance/files/mock_packages/simp-adapter.spec +0 -43
  149. data/spec/acceptance/files/mock_packages/simp-adapter/etc/simp/adapter_config.yaml +0 -3
  150. data/spec/acceptance/files/mock_packages/simp-adapter/usr/local/sbin/simp_rpm_helper +0 -495
  151. data/spec/acceptance/files/package_upgrades/pupmod-simp-testpackage-1.0/CHANGELOG +0 -2
  152. data/spec/acceptance/files/package_upgrades/pupmod-simp-testpackage-1.0/data/os/CentOS.yaml +0 -2
  153. data/spec/acceptance/files/package_upgrades/pupmod-simp-testpackage-1.0/data/os/RedHat.yaml +0 -2
  154. data/spec/acceptance/files/package_upgrades/pupmod-simp-testpackage-1.0/hiera.yaml +0 -14
  155. data/spec/acceptance/files/package_upgrades/pupmod-simp-testpackage-1.0/manifests/init.pp +0 -2
  156. data/spec/acceptance/files/package_upgrades/pupmod-simp-testpackage-1.0/metadata.json +0 -37
  157. data/spec/acceptance/files/package_upgrades/pupmod-simp-testpackage-2.0/CHANGELOG +0 -5
  158. data/spec/acceptance/files/package_upgrades/pupmod-simp-testpackage-2.0/build/rpm_metadata/requires +0 -2
  159. data/spec/acceptance/files/package_upgrades/pupmod-simp-testpackage-2.0/data/os/CentOS.yaml +0 -2
  160. data/spec/acceptance/files/package_upgrades/pupmod-simp-testpackage-2.0/data/os/RedHat.yaml +0 -2
  161. data/spec/acceptance/files/package_upgrades/pupmod-simp-testpackage-2.0/hiera.yaml +0 -14
  162. data/spec/acceptance/files/package_upgrades/pupmod-simp-testpackage-2.0/manifests/init.pp +0 -3
  163. data/spec/acceptance/files/package_upgrades/pupmod-simp-testpackage-2.0/metadata.json +0 -37
  164. data/spec/acceptance/files/testpackage/build/rpm_metadata/requires +0 -2
  165. data/spec/acceptance/files/testpackage_missing_name/CHANGELOG +0 -2
  166. data/spec/acceptance/files/testpackage_missing_name/Rakefile +0 -3
  167. data/spec/acceptance/files/testpackage_missing_source/CHANGELOG +0 -2
  168. data/spec/acceptance/files/testpackage_missing_source/Rakefile +0 -3
  169. data/spec/acceptance/files/testpackage_missing_summary/CHANGELOG +0 -2
  170. data/spec/acceptance/files/testpackage_missing_summary/Rakefile +0 -3
  171. data/spec/acceptance/files/testpackage_missing_version/CHANGELOG +0 -2
  172. data/spec/acceptance/files/testpackage_missing_version/Rakefile +0 -3
  173. data/spec/acceptance/files/testpackage_with_bad_changelog_date/Rakefile +0 -3
  174. data/spec/acceptance/files/testpackage_with_release/CHANGELOG +0 -2
  175. data/spec/acceptance/files/testpackage_with_release/Rakefile +0 -3
  176. data/spec/acceptance/files/testpackage_with_release/build/rpm_metadata/requires +0 -1
  177. data/spec/acceptance/files/testpackage_without_changelog/Rakefile +0 -3
  178. data/spec/acceptance/files/testpackage_without_changelog/build/rpm_metadata/requires +0 -1
  179. data/spec/lib/simp/ci/files/job_broken_link_nodeset/spec/acceptance/suites/default/nodesets +0 -1
  180. data/spec/lib/simp/ci/files/job_invalid_nodeset/spec/acceptance/suites/default/nodesets +0 -1
  181. data/spec/lib/simp/ci/files/job_invalid_suite/spec/acceptance/suites/default/nodesets +0 -1
  182. data/spec/lib/simp/ci/files/job_missing_nodeset/spec/acceptance/suites/default/nodesets +0 -1
  183. data/spec/lib/simp/ci/files/job_missing_suite_and_nodeset/spec/acceptance/suites/default/nodesets +0 -1
  184. data/spec/lib/simp/ci/files/multiple_invalid_jobs/spec/acceptance/suites/default/nodesets +0 -1
  185. data/spec/lib/simp/ci/files/multiple_valid_jobs/spec/acceptance/suites/default/nodesets +0 -1
  186. data/spec/lib/simp/ci/files/no_gitlab_config_with_tests/spec/acceptance/suites/default/nodesets +0 -1
  187. data/spec/lib/simp/ci/files/no_gitlab_config_without_tests/spec/acceptance/suites/default/nodesets +0 -1
  188. data/spec/lib/simp/ci/files/suite_skeleton_only/spec/acceptance/nodesets/default.yml +0 -1
  189. data/spec/lib/simp/ci/files/suite_skeleton_only/spec/acceptance/suites/default/nodesets +0 -1
  190. data/spec/lib/simp/ci/files/valid_job_nodeset_dir_link/spec/acceptance/suites/default/nodesets +0 -1
  191. data/spec/lib/simp/ci/files/valid_job_nodeset_link/spec/acceptance/suites/default/nodesets/default.yml +0 -1
  192. data/spec/lib/simp/files/build/testpackage.spec +0 -1
  193. data/spec/lib/simp/rake/pupmod/fixtures/simpmod/spec/acceptance/nodesets/default.yml +0 -1
  194. data/spec/lib/simp/rake/pupmod/fixtures/simpmod/spec/acceptance/suites/default/nodesets +0 -1
data/lib/simp/rake.rb CHANGED
@@ -9,9 +9,12 @@ module Simp::Rake
9
9
  require 'parallel'
10
10
  require 'tempfile'
11
11
  require 'facter'
12
+ require 'simp/command_utils'
12
13
  require 'simp/rpm'
13
14
  require 'simp/rake/pkg'
14
15
 
16
+ include Simp::CommandUtils
17
+
15
18
  attr_reader(:puppetfile)
16
19
  attr_reader(:module_paths)
17
20
 
@@ -96,16 +99,6 @@ module Simp::Rake
96
99
  exec pager rescue exec "/bin/sh", "-c", pager
97
100
  end
98
101
 
99
- # Originally snarfed from
100
- # http://stackoverflow.com/questions/2108727/which-in-ruby-checking-if-program-exists-in-path-from-ruby
101
- def which(cmd)
102
- command = Facter::Core::Execution.which(cmd)
103
-
104
- warn "Warning: Command #{cmd} not found on the system." unless command
105
-
106
- return command
107
- end
108
-
109
102
  def help
110
103
  run_pager
111
104
 
@@ -25,7 +25,7 @@ module Simp::Rake::Build
25
25
  namespace :build do
26
26
  task :prep do
27
27
  if $simp6
28
- @build_dir = $simp6_build_dir
28
+ @build_dir = $simp6_build_dir || @distro_build_dir
29
29
  end
30
30
  end
31
31
 
@@ -76,7 +76,8 @@ module Simp::Rake::Build
76
76
  #
77
77
  # Clean env will give bundler the environment present before
78
78
  # Bundler is activated.
79
- ::Bundler.with_clean_env do
79
+ clean_env_method = Bundler.respond_to?(:with_unbundled_env) ? :with_unbundled_env : :with_clean_env
80
+ ::Bundler.send(clean_env_method) do
80
81
  out = %x(bundle #{args[:action]} 2>&1)
81
82
  status = $?.success?
82
83
  puts out if verbose
@@ -94,7 +95,8 @@ module Simp::Rake::Build
94
95
  namespace :yum do
95
96
  task :prep do
96
97
  if $simp6
97
- @build_dir = $simp6_build_dir
98
+ # `$simp6_build_dir` is set by the build:auto task
99
+ @build_dir = $simp6_build_dir || @distro_build_dir
98
100
 
99
101
  unless @build_dir
100
102
  if ENV['SIMP_BUILD_yum_dir'] && File.exist?(File.join(ENV['SIMP_BUILD_yum_dir'], 'yum_data'))
@@ -469,10 +471,10 @@ module Simp::Rake::Build
469
471
  ##############################################################################
470
472
 
471
473
  desc <<-EOM
472
- Create a workspace for a new distribution.
474
+ Create a new yum directory tree for a new distribution.
473
475
 
474
- Creates a YUM scaffold under
475
- #{@build_dir}/yum_data/SIMP{:simp_version}_{:os}{:os_version}_{:arch}.
476
+ Creates a YUM directory tree under
477
+ {dist_build_dir}/yum_data/SIMP{:simp_version}_{:os}{:os_version}_{:arch}.
476
478
 
477
479
  * :os - The Operating System that you wish to use.
478
480
  Supported OSs: #{@target_dists}.join(', ')
@@ -482,31 +484,45 @@ module Simp::Rake::Build
482
484
  Default: Auto
483
485
 
484
486
  * :arch - The architecture that you support. Default: x86_64
487
+
488
+ Set ENV['SIMP_BUILD_yum_dir'] to override the path of {dist_build_dir}
489
+
490
+ Will not overwrite existing directories or package.yaml files
485
491
  EOM
486
- task :scaffold,[:os,:os_version,:simp_version,:arch] => [:prep] do |t,args|
492
+ task :scaffold,[:os,:os_version,:simp_version,:arch] do |t,args|
487
493
  # @simp_version is set in the main Rakefile
488
494
  args.with_defaults(:simp_version => @simp_version.split('-').first)
489
495
  args.with_defaults(:arch => @build_arch)
490
496
 
491
- target_dir = get_target_dir(args)
492
-
493
- unless File.exist?(target_dir)
494
- mkdir_p(target_dir)
495
- puts("Created #{target_dir}")
496
- end
497
-
498
- # Put together the rest of the scaffold directories
499
- Dir.chdir(@build_base_dir) do
500
- if $simp6
501
- mkdir('../my_repos') unless File.exist?('../my_repos')
502
- else
503
- mkdir('my_repos') unless File.exist?('my_repos')
504
- end
505
- end
506
-
507
- Dir.chdir(target_dir) do
508
- mkdir('repos') unless File.exist?('repos')
509
- mkdir('packages') unless File.exist?('packages')
497
+ major_os_ver = args[:os_version].split('.').first
498
+ build_dir = distro_build_dir(
499
+ File.join(@base_dir,'build'), args[:os], major_os_ver, args[:arch]
500
+ )
501
+ build_dir = ENV['SIMP_BUILD_yum_dir'] if File.directory?(ENV['SIMP_BUILD_yum_dir'].to_s)
502
+ ENV['SIMP_BUILD_yum_dir'] ||= build_dir # <-- for hacky :prep task
503
+
504
+ target_dir = File.join(build_dir,'yum_data')
505
+
506
+ # Create directories
507
+ my_repos = $simp6 ? '../my_repos' : 'my_repos'
508
+ [
509
+ target_dir,
510
+ File.join(target_dir,'repos'),
511
+ File.join(target_dir,'packages'),
512
+ File.expand_path(my_repos,target_dir)
513
+ ].each { |dir| mkdir_p(dir, verbose: false) }
514
+
515
+ # Create example packages.yaml
516
+ packages_yaml_path = File.join(target_dir, 'packages.yaml')
517
+ unless File.exists? packages_yaml_path
518
+ pkg = 'example-package-name'
519
+ pkg_file = "#{pkg}-1.0.0-1.el#{major_os_ver}.#{args[:arch]}.rpm"
520
+ yum_url = "https://yum.server/#{args[:os]}/#{major_os_ver}/#{args[:arch]}"
521
+ pkg_url = "#{yum_url}/#{pkg_file}"
522
+ yaml = { pkg => { rpm_name: pkg_file, source: pkg_url } }.to_yaml
523
+ File.open(packages_yaml_path,'w'){|f| f.puts yaml.gsub(/^/,'# ') }
524
+ puts "Created #{target_dir}"
525
+ puts "Created example file at #{packages_yaml_path}"
510
526
  end
511
527
  end
512
528
 
@@ -525,7 +541,7 @@ module Simp::Rake::Build
525
541
 
526
542
  * :arch - The architecture that you support. Default: x86_64
527
543
  EOM
528
- task :sync,[:os,:os_version,:simp_version,:arch] => [:prep, :scaffold] do |t,args|
544
+ task :sync,[:os,:os_version,:simp_version,:arch] => [:scaffold, :prep] do |t,args|
529
545
  # @simp_version is set in the main Rakefile
530
546
  args.with_defaults(:simp_version => @simp_version.split('-').first)
531
547
  args.with_defaults(:arch => @build_arch)
@@ -550,7 +566,7 @@ module Simp::Rake::Build
550
566
 
551
567
  * :arch - The architecture that you support. Default: x86_64
552
568
  EOM
553
- task :diff,[:os,:os_version,:simp_version,:arch] => [:prep, :scaffold] do |t,args|
569
+ task :diff,[:os,:os_version,:simp_version,:arch] => [:scaffold, :prep] do |t,args|
554
570
  args.with_defaults(:simp_version => @simp_version.split('-').first)
555
571
  args.with_defaults(:arch => @build_arch)
556
572
 
@@ -616,7 +632,7 @@ module Simp::Rake::Build
616
632
 
617
633
  * :arch - The architecture that you support. Default: x86_64
618
634
  EOM
619
- task :fetch,[:pkg,:os,:os_version,:simp_version,:arch] => [:prep, :scaffold] do |t,args|
635
+ task :fetch,[:pkg,:os,:os_version,:simp_version,:arch] => [:scaffold, :prep] do |t,args|
620
636
  args.with_defaults(:simp_version => @simp_version.split('-').first)
621
637
  args.with_defaults(:arch => @build_arch)
622
638
 
@@ -3,6 +3,10 @@ require 'rake/tasklib'
3
3
  module Simp::Rake; end
4
4
  module Simp::Rake::Build; end
5
5
  module Simp::Rake::Build::Constants
6
+ def distro_build_dir(build_dir, build_distro, build_version, build_arch)
7
+ File.join(build_dir, 'distributions', build_distro, build_version, build_arch)
8
+ end
9
+
6
10
  def init_member_vars( base_dir )
7
11
  return if @member_vars_initialized
8
12
 
@@ -36,7 +40,7 @@ module Simp::Rake::Build::Constants
36
40
  @simp_dvd_dirs = ["SIMP","ks","Config"]
37
41
  @member_vars_initialized = true
38
42
 
39
- @distro_build_dir = File.join(@build_dir, 'distributions', @build_distro, @build_version, @build_arch)
43
+ @distro_build_dir = distro_build_dir(@build_dir, @build_distro, @build_version, @build_arch)
40
44
  @dvd_src = File.join(@distro_build_dir, 'DVD')
41
45
  @dvd_dir = File.join(@distro_build_dir, 'DVD_Overlay')
42
46
 
@@ -26,7 +26,7 @@ module Simp::Rake::Build
26
26
  namespace :iso do
27
27
  task :prep do
28
28
  if $simp6
29
- @build_dir = $simp6_build_dir
29
+ @build_dir = $simp6_build_dir || @distro_build_dir
30
30
  end
31
31
  end
32
32
 
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/rake -T
2
2
 
3
3
  require 'simp/yum'
4
- require 'simp/local_gpg_signing_key.rb'
5
4
  require 'simp/rake/pkg'
6
5
  require 'simp/rake/build/constants'
7
6
  require 'simp/rake/build/rpmdeps'
@@ -17,9 +16,18 @@ module Simp::Rake::Build
17
16
  def initialize( base_dir )
18
17
  init_member_vars( base_dir )
19
18
 
19
+ @cpu_limit = get_cpu_limit
20
20
  @verbose = ENV.fetch('SIMP_PKG_verbose','no') == 'yes'
21
21
  @rpm_build_metadata = 'last_rpm_build_metadata.yaml'
22
22
  @rpm_dependency_file = File.join(@base_dir, 'build', 'rpm', 'dependencies.yaml')
23
+ @build_keys_dir = ENV.fetch('SIMP_PKG_build_keys_dir', File.join(@base_dir, '.dev_gpgkeys'))
24
+ @long_gpg_socket_err_msg = <<~EOM
25
+ If the problem is 'socket name <xxx> is too long', use SIMP_PKG_build_keys_dir
26
+ to override
27
+ #{@build_keys_dir}
28
+ with a shorter path. The socket name must be < 108 characters.
29
+
30
+ EOM
23
31
 
24
32
  define_tasks
25
33
  end
@@ -35,7 +43,7 @@ module Simp::Rake::Build
35
43
 
36
44
  # This doesn't get caught for things like 'rake clean'
37
45
  if $simp6 && $simp6_build_dir
38
- @build_dir = $simp6_build_dir
46
+ @build_dir = $simp6_build_dir || @distro_build_dir
39
47
  @dvd_src = File.join(@build_dir, File.basename(@dvd_src))
40
48
  end
41
49
 
@@ -66,7 +74,7 @@ module Simp::Rake::Build
66
74
  @build_dirs.each_pair do |k,dirs|
67
75
  Parallel.map(
68
76
  Array(dirs),
69
- :in_processes => get_cpu_limit,
77
+ :in_processes => @cpu_limit,
70
78
  :progress => t.name
71
79
  ) do |dir|
72
80
  Dir.chdir(dir) do
@@ -95,7 +103,7 @@ module Simp::Rake::Build
95
103
  @build_dirs.each_pair do |k,dirs|
96
104
  Parallel.map(
97
105
  Array(dirs),
98
- :in_processes => get_cpu_limit,
106
+ :in_processes => @cpu_limit,
99
107
  :progress => t.name
100
108
  ) do |dir|
101
109
  Dir.chdir(dir) do
@@ -109,36 +117,49 @@ module Simp::Rake::Build
109
117
  desc <<-EOM
110
118
  Prepare a GPG signing key to sign build packages
111
119
 
112
- * :key - the name of the directory under build/build_keys to
113
- prepare (defaults to 'dev')
120
+ * :key - the name of the build keys subdirectory to prepare
121
+ (defaults to 'dev')
122
+
123
+ - The default build keys directory is
124
+ `#{@build_keys_dir}`
125
+
114
126
 
115
127
  When :key is `dev`, a temporary signing key is created, if needed:
116
128
 
117
- - A 14-day `dev` key will be created if none exists, including:
118
- - The `<build_dir>/build_keys/dev/` dir
119
- - gpgagent assets to create/update the key
129
+ * A 14-day `dev` key will be created if none exists or the existing
130
+ key has expired. This includes creating
131
+ - A `dev` directory in the build keys directory
132
+ - gpg-agent assets to create/update the key within that `dev`
133
+ directory
120
134
 
121
135
  When :key is *not* `dev`, the logic is much stricter:
122
136
 
123
- - You must already have create `<build_dir>/build_keys/<:key>/`
124
- directoy, and placed a valid GPG signing key inside
137
+ - You must already have created the `<:key>` subdirectory within
138
+ the build keys directory and placed a valid GPG signing key and
139
+ requisite gpg-agent assets to access the key within the directory.
125
140
  - If the directory or key are missing, the task will fail.
126
141
 
127
142
  ENV vars:
128
143
  - Set `SIMP_PKG_verbose=yes` to report file operations as they happen.
144
+ - Set `SIMP_PKG_build_keys_dir` to override the default build keys path.
129
145
  EOM
130
146
  task :key_prep,[:key] => [:prep] do |t,args|
131
147
  args.with_defaults(:key => 'dev')
132
148
  key = args.key
133
- build_keys_dir = File.join(@build_dir, 'build_keys')
134
- key_dir = File.join(build_keys_dir,key)
149
+ key_dir = File.join(@build_keys_dir,key)
135
150
  dvd_dir = @dvd_src
136
151
 
137
- FileUtils.mkdir_p build_keys_dir
152
+ FileUtils.mkdir_p @build_keys_dir
138
153
 
139
- Dir.chdir(build_keys_dir) do
154
+ Dir.chdir(@build_keys_dir) do
140
155
  if key == 'dev'
141
- Simp::LocalGpgSigningKey.new(key_dir,{verbose: @verbose}).ensure_key
156
+ require 'simp/local_gpg_signing_key'
157
+
158
+ begin
159
+ Simp::LocalGpgSigningKey.new(key_dir,{verbose: @verbose}).ensure_key
160
+ rescue Exception => e
161
+ raise("#{e.message}\n\n#{@long_gpg_socket_err_msg}")
162
+ end
142
163
  else
143
164
  unless File.directory?(key_dir)
144
165
  fail("Could not find GPG keydir '#{key_dir}' in '#{Dir.pwd}'")
@@ -356,41 +377,79 @@ module Simp::Rake::Build
356
377
  Sign a set of RPMs.
357
378
 
358
379
  Signs any unsigned RPMs in the specified directory
359
- * :key - The key directory to use under #{@build_dir}/build_keys
360
- * Defaults to #{File.join(File.dirname(@rpm_dir), '*RPMS')}
380
+ * :key - The key directory to use under the build keys directory
381
+ * key defaults to 'dev'
382
+ * build keys directory defaults to
383
+ `#{@build_keys_dir}`
361
384
  * :rpm_dir - A directory containing RPM files to sign. Will recurse!
362
- * Defaults to 'dev'
385
+ * Defaults to #{File.join(File.dirname(@rpm_dir), '*RPMS')}
363
386
  * :force - Force rpms that are already signed to be resigned
364
387
  * Defaults to 'false', can be enabled with 'true'
388
+ * :digest_algo - Digest algorithm to be used when signing the RPMs
389
+ * Defaults to 'sha256'
390
+
391
+ ENV vars:
392
+ * Set `SIMP_RPM_verbose=yes` to report RPM operations as they happen.
393
+ * Set `SIMP_PKG_build_keys_dir` to override the default build keys path.
394
+ * Set `SIMP_PKG_rpmsign_timeout` to override the maximum time in seconds
395
+ to wait for an individual RPM signing operation to complete.
396
+ - Defaults to 60 seconds.
365
397
  EOM
366
- task :signrpms,[:key,:rpm_dir,:force] => [:prep,:key_prep] do |t,args|
367
- which('rpmsign') || raise(StandardError, 'Could not find rpmsign on your system. Exiting.')
398
+ task :signrpms,[:key,:rpm_dir,:force,:digest_algo] => [:prep,:key_prep] do |t,args|
399
+ require 'simp/rpm_signer'
368
400
 
369
401
  args.with_defaults(:key => 'dev')
370
402
  args.with_defaults(:rpm_dir => File.join(File.dirname(@rpm_dir), '*RPMS'))
371
403
  args.with_defaults(:force => 'false')
404
+ args.with_defaults(:digest_algo => 'sha256')
372
405
 
373
406
  force = (args[:force].to_s == 'false' ? false : true)
407
+ timeout = ENV['SIMP_PKG_rpmsign_timeout'] ? ENV['SIMP_PKG_rpmsign_timeout'].to_i : 60
408
+
409
+ opts = {
410
+ :digest_algo => args[:digest_algo],
411
+ :force => force,
412
+ :max_concurrent => @cpu_limit,
413
+ :progress_bar_title => t.name,
414
+ :timeout_seconds => timeout,
415
+ :verbose => @verbose
416
+ }
374
417
 
375
- rpm_dirs = Dir.glob(args[:rpm_dir])
376
- to_sign = []
418
+ results = nil
419
+ begin
420
+ results = Simp::RpmSigner.sign_rpms(
421
+ args[:rpm_dir],
422
+ File.join(@build_keys_dir, args[:key]),
423
+ opts
424
+ )
425
+ rescue Exception => e
426
+ raise("#{e.message}\n\n#{@long_gpg_socket_err_msg}")
427
+ end
377
428
 
378
- rpm_dirs.each do |rpm_dir|
379
- Find.find(rpm_dir) do |rpm|
380
- next unless File.readable?(rpm)
381
- to_sign << rpm if rpm =~ /\.rpm$/
429
+ if results
430
+ successes = results.select { |rpm,status| status == :signed }
431
+ failures = results.select { |rpm,status| status == :unsigned }
432
+ already_signed = results.select { |rpm,status| status == :skipped_already_signed }
433
+
434
+ if opts[:verbose]
435
+ puts
436
+ puts 'Summary'
437
+ puts '======='
438
+ puts "# RPMs already signed: #{already_signed.size}"
439
+ puts "# RPMs successfully signed: #{successes.size}"
440
+ puts "# RPM signing failures: #{failures.size}"
441
+ puts
382
442
  end
383
- end
384
443
 
385
- Parallel.map(
386
- to_sign,
387
- :in_processes => get_cpu_limit,
388
- :progress => t.name
389
- ) do |rpm|
390
- rpm_info = Simp::RPM.new(rpm)
391
-
392
- if force || !rpm_info.signature
393
- Simp::RPM.signrpm(rpm, "#{@build_dir}/build_keys/#{args[:key]}")
444
+ if !failures.empty?
445
+ if ((results.size - already_signed.size) == (failures.size))
446
+ detail = already_signed.empty? ? '' : 'unsigned '
447
+ raise("ERROR: Failed to sign all #{detail}RPMs in #{args[:rpm_dir]}")
448
+ else
449
+ err_msg = "ERROR: Failed to sign some RPMs in #{args[:rpm_dir]}:\n"
450
+ err_msg += " #{failures.keys.join("\n ")}"
451
+ raise(err_msg)
452
+ end
394
453
  end
395
454
  end
396
455
  end
@@ -446,7 +505,9 @@ module Simp::Rake::Build
446
505
  $stderr.puts "pkg:checksig: Warning no GPG keys found in #{key_dirs_tried}"
447
506
  end
448
507
  end
449
- public_keys += Dir.glob(File.join(@build_dir, 'build_keys', '*', 'RPM-GPG-KEY*'))
508
+
509
+ # be sure to include any development keys packaged with the DVD
510
+ public_keys += Dir.glob(File.join(@dvd_src, 'RPM-GPG-KEY*'))
450
511
 
451
512
  # Only import thngs that look like GPG keys...
452
513
  public_keys.each do |key|
@@ -464,8 +525,9 @@ module Simp::Rake::Build
464
525
  rpm_dirs.each do |rpm_dir|
465
526
  Find.find(rpm_dir) do |path|
466
527
  if (path =~ /.*\.rpm$/)
467
- result = %x{#{rpm_cmd} --checksig #{path}}.strip
468
- if result !~ /:.*\(\S+\).* OK$/
528
+ %x{#{rpm_cmd} --checksig #{path}}.strip
529
+ result = $?
530
+ unless result && (result.exitstatus == 0)
469
531
  bad_rpms << path.split(/\s/).first
470
532
  end
471
533
  end
@@ -665,9 +727,9 @@ protect=1
665
727
  # can be pulled out into a library that is easily unit-testable
666
728
  def require_rebuild?(dir, yum_helper, opts={ :unique_namespace => generate_namespace, :fetch => false, :verbose => @verbose, :check_git => false, :prefix => '' })
667
729
  result = false
668
-
669
-
670
730
  rpm_metadata = File.exist?(@rpm_dependency_file) ? YAML.load(File.read(@rpm_dependency_file)) : {}
731
+ dir_relpath = Pathname.new(dir).relative_path_from(Pathname.new(Dir.pwd)).to_path
732
+ $stderr.puts "\n require_rebuild? (#{dir_relpath}):" if @verbose
671
733
 
672
734
  Dir.chdir(dir) do
673
735
  if File.exist?('metadata.json')
@@ -687,10 +749,23 @@ protect=1
687
749
  else
688
750
  spec_file = Dir.glob(File.join('build', '*.spec'))
689
751
  fail("No spec file found in #{dir}/build") if spec_file.empty?
752
+ $stderr.puts " Found spec file: #{File.expand_path(spec_file.first)}" if @verbose
690
753
  new_rpm_info = Simp::RPM.new(spec_file.first)
691
754
  end
692
755
 
756
+ if @verbose
757
+ $stderr.puts ' Details:'
758
+ $stderr.puts " Puppetfile name: #{File.basename(dir)}"
759
+ $stderr.puts " RPM name: #{new_rpm_info.name}"
760
+ $stderr.puts " Local directory: #{dir}"
761
+ end
762
+
693
763
  if opts[:check_git]
764
+ git_origin_url = nil
765
+ ['origin','upstream'].each do |r|
766
+ git_origin_url = %x(git config --get remote.#{r}.url).strip if git_origin_url.to_s.empty?
767
+ end
768
+ $stderr.puts " Git origin URL: #{git_origin_url}" if @verbose
694
769
  require_tag = false
695
770
 
696
771
  #FIXME The check below is insufficient. See logic in compare_latest_tag,
@@ -709,28 +784,59 @@ protect=1
709
784
 
710
785
  begin
711
786
  rpm_version = Gem::Version.new(new_rpm_info.version)
787
+ rpm_release = new_rpm_info.release.match(/^(\d+)[.-_]?/) ? new_rpm_info.release.match(/^(\d+)[.-_]?/)[1] : nil
788
+ if @verbose
789
+ $stderr.puts ' ' + [
790
+ "RPM version-rel: #{ "#{rpm_version}-#{rpm_release}".ljust(10) } ",
791
+ "(semver: #{rpm_version}, relver: #{rpm_release})",
792
+ ].join
793
+ end
712
794
  rescue ArgumentError
713
- $stderr.puts ">>#{new_rpm_info.basename}: Could not determine RPM version"
795
+ $stderr.puts ">>#{new_rpm_info.basename}: Could not determine RPM version from '#{new_rpm_info.version}'"
714
796
  end
715
797
 
716
798
  begin
717
799
  if latest_tag.empty?
718
800
  require_tag = true
801
+ $stderr.puts " Latest Git tag semver: (none)" if @verbose
719
802
  else
720
- latest_tag_version = Gem::Version.new(latest_tag)
803
+ # Gem::Version interprets an RPM-style release suffix like
804
+ # `1.2.3-4` as `1.2.3.pre.4`, which is *less* than `1.2.3`.
805
+ # So we compare SemVer first, then relver numbers if needed
806
+ latest_tag_version = Gem::Version.new(latest_tag.sub(/-\d+$/,''))
807
+ latest_tag_release = latest_tag.match(/-(\d+)$/) ? latest_tag.match(/-(\d+)$/)[1].to_i : nil
808
+ if @verbose
809
+ $stderr.puts ' ' + [
810
+ "Latest Git tag: #{latest_tag.ljust(10)} ",
811
+ "(semver: #{latest_tag_version}#{latest_tag_release ? ", relver: #{latest_tag_release}" : nil})",
812
+ ].join
813
+ end
721
814
  end
722
815
  rescue ArgumentError
723
- $stderr.puts ">>#{new_rpm_info.basename}: Invalid git tag version '#{latest_tag}' "
816
+ $stderr.puts ">>#{git_origin_url}: Invalid git tag version '#{latest_tag}' "
724
817
  end
725
818
 
726
819
  if rpm_version && latest_tag_version
727
- if rpm_version > latest_tag_version
820
+ # undefined behavior, so far (this current logic skips it):
821
+ # what to do if rpm_release is set and latest_tag_release is nil?
822
+ if latest_tag_release &&
823
+ rpm_release &&
824
+ (rpm_version == latest_tag_version) &&
825
+ (rpm_release > latest_tag_release)
826
+ require_tag = true
827
+ elsif rpm_version > latest_tag_version
728
828
  require_tag = true
729
829
  end
730
830
  end
731
831
 
732
832
  if opts[:verbose] && require_tag
733
- $stderr.puts "#{opts[:prefix]}Git Release Tag Required: #{new_rpm_info.basename} #{latest_tag} => #{new_rpm_info.version}"
833
+ $stderr.puts [
834
+ "#{opts[:prefix]}Git Release Tag Required: ",
835
+ "[#{git_origin_url || dir_relpath }] ",
836
+ "tag: #{latest_tag} => ",
837
+ "rpm: #{new_rpm_info.version}#{latest_tag_release ? "-#{rpm_release}" : nil} ",
838
+ "[#{new_rpm_info.basename}]",
839
+ ].join
734
840
  end
735
841
  end
736
842
 
@@ -749,7 +855,6 @@ protect=1
749
855
  if new_rpm_info.package_newer?(package, published_rpm)
750
856
  if opts[:verbose]
751
857
  $stderr.puts "#{opts[:prefix]}RPM Publish Required: #{published_rpm} => #{new_rpm_info.rpm_name(package)}"
752
-
753
858
  end
754
859
  result = true
755
860
  else
@@ -781,7 +886,7 @@ protect=1
781
886
  end
782
887
  else
783
888
  if opts[:verbose]
784
- $stderr.puts "#{opts[:prefix]}RPM Publish Required: #{new_rpm_info.rpm_name(package)}"
889
+ $stderr.puts "#{opts[:prefix]}RPM Publish Required (new RPM): #{new_rpm_info.rpm_name(package)}"
785
890
  end
786
891
  result = true
787
892
  end
@@ -819,7 +924,7 @@ protect=1
819
924
  Parallel.map(
820
925
  # Allow for shell globs
821
926
  Array(dirs),
822
- :in_processes => get_cpu_limit,
927
+ :in_processes => @cpu_limit,
823
928
  :progress => task.name
824
929
  ) do |dir|
825
930
  fail("Could not find directory #{dir}") unless Dir.exist?(dir)
@@ -867,8 +972,19 @@ protect=1
867
972
  $stderr.puts("First 'rake pkg:rpm' attempt for #{dir} failed, running bundle and trying again.")
868
973
  end
869
974
 
870
- ::Bundler.with_clean_env do
871
- %x{bundle install --with development}
975
+ if Bundler.respond_to?(:with_unbundled_env)
976
+ # Bundler 2.1+
977
+ clean_env_method = :with_unbundled_env
978
+ bundle_install_cmd = %{bundle config set with 'development' && bundle install}
979
+ else
980
+ # Old Bundler
981
+ clean_env_method = :with_clean_env
982
+ bundle_install_cmd = %{bundle install --with development}
983
+ end
984
+
985
+ ::Bundler.send(clean_env_method) do
986
+ %x{#{bundle_install_cmd}}
987
+
872
988
  output = %x{#{cmd} 2>&1}
873
989
 
874
990
  unless $?.success?