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
@@ -1,33 +0,0 @@
1
- {
2
- "name": "new-package",
3
- "version": "3.0.0",
4
- "author": "simp",
5
- "summary": "A SIMP test module for upgrading obsoleted packages",
6
- "license": "Apache-2.0",
7
- "source": "https://github.com/simp/rubygem-simp-rake-helpers",
8
- "project_page": "https://github.com/simp/rubygem-simp-rake-helpers",
9
- "issues_url": "https://simp/project.atlassian.net",
10
- "tags": [ "simp", "test", "package"],
11
- "dependencies": [
12
- {
13
- "name": "simp/simplib",
14
- "version_requirement": ">= 1.1.0"
15
- }
16
- ],
17
- "operatingsystem_support": [
18
- {
19
- "operatingsystem": "CentOS",
20
- "operatingsystemrelease": [
21
- "6",
22
- "7"
23
- ]
24
- },
25
- {
26
- "operatingsystem": "RedHat",
27
- "operatingsystemrelease": [
28
- "6",
29
- "7"
30
- ]
31
- }
32
- ]
33
- }
@@ -1,33 +0,0 @@
1
- {
2
- "name": "old-package",
3
- "version": "1.0.0",
4
- "author": "simp",
5
- "summary": "A SIMP test module for upgrading obsoleted packages",
6
- "license": "Apache-2.0",
7
- "source": "https://github.com/simp/rubygem-simp-rake-helpers",
8
- "project_page": "https://github.com/simp/rubygem-simp-rake-helpers",
9
- "issues_url": "https://simp/project.atlassian.net",
10
- "tags": [ "simp", "test", "package"],
11
- "dependencies": [
12
- {
13
- "name": "simp/simplib",
14
- "version_requirement": ">= 1.1.0"
15
- }
16
- ],
17
- "operatingsystem_support": [
18
- {
19
- "operatingsystem": "CentOS",
20
- "operatingsystemrelease": [
21
- "6",
22
- "7"
23
- ]
24
- },
25
- {
26
- "operatingsystem": "RedHat",
27
- "operatingsystemrelease": [
28
- "6",
29
- "7"
30
- ]
31
- }
32
- ]
33
- }
@@ -1,33 +0,0 @@
1
- {
2
- "name": "old-package",
3
- "version": "2.0.0",
4
- "author": "simp",
5
- "summary": "A SIMP test module for upgrading obsoleted packages",
6
- "license": "Apache-2.0",
7
- "source": "https://github.com/simp/rubygem-simp-rake-helpers",
8
- "project_page": "https://github.com/simp/rubygem-simp-rake-helpers",
9
- "issues_url": "https://simp/project.atlassian.net",
10
- "tags": [ "simp", "test", "package"],
11
- "dependencies": [
12
- {
13
- "name": "simp/simplib",
14
- "version_requirement": ">= 1.1.0"
15
- }
16
- ],
17
- "operatingsystem_support": [
18
- {
19
- "operatingsystem": "CentOS",
20
- "operatingsystemrelease": [
21
- "6",
22
- "7"
23
- ]
24
- },
25
- {
26
- "operatingsystem": "RedHat",
27
- "operatingsystemrelease": [
28
- "6",
29
- "7"
30
- ]
31
- }
32
- ]
33
- }
@@ -1,14 +0,0 @@
1
- %triggerpostun -- pupmod-new-package
2
-
3
- echo
4
- echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
5
- echo "@@@@@@ Executing SIMP-3895 workaround @@@@@@"
6
- echo "@@@@@@ @@@@@@"
7
- echo "@@@@@@ upgrading from obsoleted pkg @@@@@@"
8
- echo "@@@@@@ 'pupmod-new-package' @@@@@@"
9
- echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
10
- echo
11
- echo "pupmod-old-package: post 1=2 (triggered by: %triggerpostun -- pupmod-new-package)"
12
-
13
- # re-send the 'post' message
14
- /usr/local/sbin/simp_rpm_helper --rpm_dir=/usr/share/simp/modules/package --rpm_section='post' --rpm_status=2
@@ -1,33 +0,0 @@
1
- {
2
- "name": "old-package",
3
- "version": "2.2.0",
4
- "author": "simp",
5
- "summary": "A SIMP test module for upgrading obsoleted packages",
6
- "license": "Apache-2.0",
7
- "source": "https://github.com/simp/rubygem-simp-rake-helpers",
8
- "project_page": "https://github.com/simp/rubygem-simp-rake-helpers",
9
- "issues_url": "https://simp/project.atlassian.net",
10
- "tags": [ "simp", "test", "package"],
11
- "dependencies": [
12
- {
13
- "name": "simp/simplib",
14
- "version_requirement": ">= 1.1.0"
15
- }
16
- ],
17
- "operatingsystem_support": [
18
- {
19
- "operatingsystem": "CentOS",
20
- "operatingsystemrelease": [
21
- "6",
22
- "7"
23
- ]
24
- },
25
- {
26
- "operatingsystem": "RedHat",
27
- "operatingsystemrelease": [
28
- "6",
29
- "7"
30
- ]
31
- }
32
- ]
33
- }
@@ -1,32 +0,0 @@
1
- Name: pupmod-puppetlabs-stdlib
2
- Version: 5.9.9
3
- Release: 9
4
- Summary: mock simplib test package
5
- BuildArch: noarch
6
-
7
- License: Apache-2.0
8
- URL: http://foo.bar
9
-
10
- %description
11
- A mock RPM package used for acceptance tests
12
-
13
- %prep
14
- exit 0
15
-
16
- %build
17
- exit 0
18
-
19
-
20
- %install
21
- exit 0
22
-
23
- %clean
24
- exit 0
25
-
26
- %files
27
- %doc
28
-
29
-
30
- %changelog
31
- * Fri Feb 23 2018 nobody
32
- - some comment
@@ -1,32 +0,0 @@
1
- Name: pupmod-simp-foo
2
- Version: 1.9.9
3
- Release: 9
4
- Summary: mock foo test package
5
- BuildArch: noarch
6
-
7
- License: Apache-2.0
8
- URL: http://foo.bar
9
-
10
- %description
11
- A mock RPM package used for acceptance tests
12
-
13
- %prep
14
- exit 0
15
-
16
- %build
17
- exit 0
18
-
19
-
20
- %install
21
- exit 0
22
-
23
- %clean
24
- exit 0
25
-
26
- %files
27
- %doc
28
-
29
-
30
- %changelog
31
- * Fri Feb 23 2018 nobody
32
- - some comment
@@ -1,32 +0,0 @@
1
- Name: pupmod-simp-simplib
2
- Version: 1.9.9
3
- Release: 9
4
- Summary: mock simplib test package
5
- BuildArch: noarch
6
-
7
- License: Apache-2.0
8
- URL: http://foo.bar
9
-
10
- %description
11
- A mock RPM package used for acceptance tests
12
-
13
- %prep
14
- exit 0
15
-
16
- %build
17
- exit 0
18
-
19
-
20
- %install
21
- exit 0
22
-
23
- %clean
24
- exit 0
25
-
26
- %files
27
- %doc
28
-
29
-
30
- %changelog
31
- * Fri Feb 23 2018 nobody
32
- - some comment
@@ -1,25 +0,0 @@
1
- spec_file=$1
2
-
3
- FAKE_RPM_SRC_DIR=${FAKE_RPM_SRC_DIR:-${PWD}/pkg}
4
- FAKE_RPM_BUILD_DIR=${FAKE_RPM_BUILD_DIR:-${FAKE_RPM_SRC_DIR}/rpmbuild}
5
-
6
- # clean up old builds
7
- rm -rf "${FAKE_RPM_BUILD_DIR}"/{BUILDROOT,BUILD,SOURCES}/** &> /dev/null :
8
- mkdir -p "${FAKE_RPM_BUILD_DIR}"/{BUILDROOT,BUILD,SOURCES}
9
-
10
-
11
- # if there is a directory with the same name as the spec file, build a tar ball
12
- # from it and stage it under SOURCES
13
- source_dir=`echo ${spec_file}| sed -e 's/.spec$//'`
14
- if [ -d "${source_dir}" ]; then
15
- echo "Found a directory named '${source_dir}'; building tarball"
16
- pushd "${source_dir}" > /dev/null
17
- tar -zcv --exclude=.*.swp -f "${FAKE_RPM_BUILD_DIR}/SOURCES/files.tar.gz" *
18
- popd > /dev/null
19
- else
20
- echo "NOTE: no source directory ar '${source_dir}'"
21
- fi
22
-
23
-
24
- # rpmbuild
25
- rpmbuild -D "buildroot ${FAKE_RPM_BUILD_DIR}/BUILDROOT" -D "builddir ${FAKE_RPM_BUILD_DIR}/BUILD" -D "_sourcedir ${FAKE_RPM_BUILD_DIR}/SOURCES" -D "_rpmdir ${FAKE_RPM_SRC_DIR}/dist" -D "_srcrpmdir ${FAKE_RPM_SRC_DIR}/dist" -D "_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm" -ba $@ "${spec_file}"
@@ -1,43 +0,0 @@
1
- Name: simp-adapter
2
- Version: 0.9.9
3
- Release: 9
4
- Summary: mock simplib test package
5
- BuildArch: noarch
6
-
7
- License: Apache-2.0
8
- URL: http://foo.bar
9
-
10
- Source0: files.tar.gz
11
-
12
- %description
13
- A mock RPM package used for acceptance tests
14
-
15
- %prep
16
- echo ================ PWD: $PWD
17
- %setup -c
18
-
19
- %build
20
-
21
-
22
- %install
23
- [ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
24
- mkdir -p %{buildroot}/opt/test/puppet/code
25
- cp -r $PWD/* %{buildroot}/
26
- rm -rf %{buildroot}/**/.*.swp
27
- rm -rf %{buildroot}/opt/puppetlabs
28
-
29
- %clean
30
-
31
- %files
32
- %defattr(0640,root,root,0755)
33
-
34
- %attr(0750,root,root)/usr/local/sbin/simp_rpm_helper
35
- #%attr(0755,root,root)/opt/puppetlabs/puppet/bin/ruby
36
- #%attr(0755,root,root)/opt/puppetlabs/bin/puppet
37
- %attr(0644,root,root)/etc/simp/adapter_config.yaml
38
- %dir /opt/test/puppet/code
39
-
40
-
41
- %changelog
42
- * Fri Feb 23 2018 nobody
43
- - some comment
@@ -1,3 +0,0 @@
1
- ---
2
- copy_rpm_data: true
3
- target_directory: /opt/test/puppet/code
@@ -1,495 +0,0 @@
1
- #!/opt/puppetlabs/puppet/bin/ruby
2
- #
3
- # Purpose
4
- # -------
5
- #
6
- # This script is meant to be called by the %preun and %postttrans sections of
7
- # the various SIMP Puppet module RPMs.
8
- #
9
- # The purpose of the script is to provide helper methods that correctly
10
- # scaffold the system in such a way that all SIMP Puppet Modules can be
11
- # installed via RPM to a single location and subsequently can be copied into
12
- # the standard SIMP installation location based on the version of Puppet that
13
- # is installed.
14
- #
15
- # Care is taken that, should the target directory be managed via 'git', this
16
- # script will do nothing to harm the managed installation in any way. This
17
- # ensures that the SIMP modules have maximum compatibility with the widest
18
- # possible range of Puppet module best practices for management while ensuring
19
- # that the RPM installations and upgrades can proceed in a seamless fashion
20
- # over time.
21
- #
22
- # Should the 'simp' environment not be found, the script will simply exit
23
- # without copying any files.
24
- #
25
- # Configuration
26
- # -------------
27
- #
28
- # A configuration file may be placed at /etc/simp/adapter_config.yaml. The
29
- # file must consist of proper YAML as demonstrated in the example below which
30
- # lists the default options.
31
- #
32
- # Any configuration options that are not understood will be ignored.
33
- #
34
- # ```yaml
35
- # ---
36
- # # Target directory
37
- # # May be set to a fully qualified path or 'auto'
38
- # # If set to 'auto', the directory will be determined from puppet itself
39
- #
40
- # target_directory : 'auto'
41
- #
42
- # # Copy the RPM data to the target directory
43
- #
44
- # copy_rpm_data : false
45
- #
46
- # ```
47
- #
48
-
49
- require 'facter'
50
- require 'fileutils'
51
- require 'yaml'
52
- require 'optparse'
53
- require 'ostruct'
54
- require 'find'
55
-
56
- # Make sure we can find the Puppet executables
57
- ENV['PATH'] += ':/opt/puppetlabs/bin'
58
-
59
- class SimpRpmHelper
60
- def initialize
61
- @program_name = File.basename(__FILE__)
62
-
63
- # A list of modules that should never be touched once installed
64
- @safe_modules = ['site']
65
- end
66
-
67
- def debug(msg)
68
- # SIMP RPMs do not enable debug when they call this script. So, if
69
- # you want to debug an RPM problem with this script, comment out
70
- # the line below.
71
- return unless @options.debug
72
- msg.split("\n").each do |line|
73
- puts ">>>#{@program_name} DEBUG: #{line}"
74
- end
75
- end
76
-
77
- def info(msg)
78
- # When these messages get written out in an RPM upgrade, name of program
79
- # is helpful to end user
80
- puts "#{@program_name}: #{msg}"
81
- end
82
-
83
- # Get the Puppet configuration parameters currently in use
84
- def get_puppet_config
85
- system_config = %x{puppet config --section master print}
86
-
87
- config_hash = Hash.new
88
-
89
- system_config.each_line do |line|
90
- k,v = line.split('=')
91
- config_hash[k.strip] = v.strip
92
- end
93
-
94
- return config_hash
95
- end
96
-
97
- # Determine whether the passed path is under management by git or svn
98
- def is_managed?(path)
99
- # Short circuit if the directory is not present
100
- return false unless File.directory?(path)
101
-
102
- git = Facter::Core::Execution.which('git')
103
- svn = Facter::Core::Execution.which('svn')
104
-
105
- Dir.chdir(path) do
106
- if git
107
- %x{#{git} ls-files . --error-unmatch &> /dev/null}
108
-
109
- return true if $?.success?
110
- end
111
-
112
- if svn
113
- %x{#{svn} info &> /dev/null}
114
-
115
- return true if $?.success?
116
- end
117
- end
118
-
119
- return false
120
- end
121
-
122
- def parse_options(args)
123
-
124
- @options = OpenStruct.new
125
- @options.config_file = '/etc/simp/adapter_config.yaml'
126
- @options.preserve = false
127
-
128
- all_opts = OptionParser.new do |opts|
129
- opts.banner = "Usage: #{@program_name} [options]"
130
-
131
- opts.separator ''
132
-
133
- opts.on(
134
- '--rpm_dir PATH',
135
- 'The directory into which the RPM source material is installed'
136
- ) do |arg|
137
- @options.rpm_dir = arg.strip
138
- @options.module_name = File.basename(@options.rpm_dir)
139
- end
140
-
141
- opts.on(
142
- '--rpm_section SECTION',
143
- 'The section of the RPM from which the script is being called.',
144
- " Must be one of 'pre', 'preun', 'postun', 'posttrans'"
145
- ) do |arg|
146
- @options.rpm_section = arg.strip
147
- end
148
-
149
- opts.on(
150
- '--rpm_status STATUS',
151
- 'The status code passed to the RPM section'
152
- ) do |arg|
153
- @options.rpm_status = arg.strip
154
- end
155
-
156
- opts.on(
157
- '-f CONFIG_FILE',
158
- '--config CONFIG_FILE',
159
- 'The configuration file to use.',
160
- " Default: #{@options.config_file}"
161
- ) do |arg|
162
- @options.config_file = arg.strip
163
- end
164
-
165
- opts.on(
166
- '-p',
167
- '--preserve',
168
- "Preserve material in 'target_dir' that is not in 'rpm_dir'"
169
- ) do |arg|
170
- @options.preserve = true
171
- end
172
-
173
- opts.on(
174
- '-e',
175
- '--enforce',
176
- 'If set, enforce the copy, regardless of the setting in the config file',
177
- ' Default: false'
178
- ) do |arg|
179
- @options.copy_rpm_data = true
180
- end
181
-
182
- opts.on(
183
- '-t DIR',
184
- '--target_dir DIR',
185
- "The subdirectory of #{simp_target_dir('')}",
186
- 'into which to copy the materials.',
187
- " Default: #{simp_target_dir.gsub(/#{simp_target_dir('')}/,'')}"
188
- ) do |arg|
189
- @options.target_dir = simp_target_dir(arg.strip)
190
- end
191
-
192
- opts.on(
193
- '-v',
194
- '--verbose',
195
- 'Print out debug info when processing.'
196
- ) do
197
- @options.debug = true
198
- end
199
-
200
- opts.on(
201
- '-h',
202
- '--help',
203
- 'Help Message'
204
- ) do
205
- puts opts
206
- @options.help_requested = true
207
- end
208
- end
209
-
210
- begin
211
- all_opts.parse!(args)
212
- rescue OptionParser::ParseError => e
213
- msg = "Error: #{e}\n\n#{all_opts}"
214
- raise(msg)
215
- end
216
-
217
- validate_options(all_opts.to_s)
218
- end
219
-
220
- # Process the config, validate the entries and do some munging
221
- # Sets @options hash.
222
- def process_config
223
- # Defaults
224
- config = {
225
- 'target_directory' => 'auto',
226
- 'copy_rpm_data' => false
227
- }
228
-
229
- if File.exist?(@options.config_file)
230
- begin
231
- system_config = YAML.load_file(@options.config_file)
232
- if system_config
233
- config.merge!(system_config)
234
- end
235
- rescue
236
- raise("Error: Config file '#{@options.config_file}' could not be processed")
237
- end
238
- end
239
-
240
- if @options.copy_rpm_data.nil?
241
- @options.copy_rpm_data = (config['copy_rpm_data'].to_s == 'true')
242
- end
243
-
244
- if @options.target_dir.nil? && config['target_directory']
245
- if config['target_directory'] == 'auto'
246
- @options.target_dir = simp_target_dir
247
- else
248
- unless config['target_directory'][0].chr == '/'
249
- raise("Error: 'target_directory' in '#{@options.config_file}' must be an absolute path")
250
- end
251
-
252
- @options.target_dir = config['target_directory'].strip
253
- end
254
- end
255
- end
256
-
257
- def puppet_codedir
258
- # Figure out where the Puppet code should go
259
- # Puppet 4+
260
- code_dir = puppet_config['codedir']
261
- if !code_dir || code_dir.empty?
262
- code_dir = puppet_config['confdir']
263
- end
264
-
265
- return code_dir
266
- end
267
-
268
- def puppet_config
269
- unless @puppet_config
270
- @puppet_config = get_puppet_config
271
- end
272
- @puppet_config
273
- end
274
-
275
-
276
- def puppet_group
277
- puppet_config['group']
278
- end
279
-
280
- # Return the target installation directory
281
- def simp_target_dir(subdir=File.join('simp','modules'))
282
- install_target = puppet_codedir
283
-
284
- if install_target.empty?
285
- raise('Error: Could not find a Puppet code directory for installation')
286
- end
287
-
288
- install_target = File.join(install_target,'environments', subdir)
289
-
290
- return install_target
291
- end
292
-
293
- # Input Validation
294
- def validate_options(usage)
295
- return if @options.help_requested
296
-
297
- unless @options.rpm_dir
298
- raise("Error: 'rpm_dir' is required\n#{usage}")
299
- end
300
-
301
- unless @options.rpm_status
302
- raise("Error: 'rpm_status' is required\n#{usage}")
303
- end
304
-
305
- unless @options.rpm_section
306
- raise("Error: 'rpm_section' is required\n#{usage}")
307
- end
308
-
309
- # We allow 'post' for backward compatibility with SIMP RPMs that use
310
- # this, but copying over files in the 'post' during an upgrade is
311
- # problematic. If the old package has files that are not in the new
312
- # package, these files will not be removed in the destination directory.
313
- # This is because during %post, the old package files have not yet
314
- # been removed from the source directory by RPM. So, the 'rsync'
315
- # operation copies over the OBE files from the old package.
316
- valid_rpm_sections = ['pre','post','preun','postun', 'posttrans']
317
-
318
- unless valid_rpm_sections.include?(@options.rpm_section)
319
- raise("Error: 'rpm_section' must be one of '#{valid_rpm_sections.join("', '")}'\n#{usage}")
320
- end
321
-
322
- if (@options.rpm_section == 'posttrans') || (@options.rpm_section == 'preun') || (@options.rpm_section == 'post')
323
- unless File.directory?(@options.rpm_dir)
324
- raise("Error: Could not find 'rpm_dir': '#{@options.rpm_dir}'")
325
- end
326
- end
327
-
328
- unless @options.rpm_status =~ /^\d+$/
329
- raise("Error: 'rpm_status' must be an integer\n#{usage}")
330
- end
331
-
332
- end
333
-
334
- def handle_install
335
- debug("Processing install, upgrade, or downgrade of #{@options.module_name}")
336
- if @safe_modules.include?(@options.module_name)
337
- # Make sure that we preserve anything in the safe modules on installation
338
- @options.preserve = true
339
-
340
- if @options.rpm_status == '2'
341
- # Short circuit on upgrading safe modules, just don't touch them!
342
- target_module_dir = File.join(@options.target_dir, @options.module_name)
343
- if File.directory?(target_module_dir)
344
- debug("Skipping upgrade of 'safe' module directory #{target_module_dir}")
345
- return
346
- end
347
- end
348
- end
349
-
350
- raise('Error: Could not determine puppet group') if puppet_group.empty?
351
- rsync = Facter::Core::Execution.which('rsync')
352
- raise("Error: Could not find 'rsync' command!") unless rsync
353
-
354
- # Create the directories, with the proper mode, all the way down
355
- dir_paths = @options.target_dir.split(File::SEPARATOR).reject(&:empty?)
356
- top_dir = File::SEPARATOR + dir_paths.shift
357
- unless File.directory?(top_dir)
358
- FileUtils.mkdir(top_dir, :mode => 0750)
359
- FileUtils.chown('root', puppet_group, top_dir)
360
- end
361
-
362
- orig_dir = Dir.pwd
363
- Dir.chdir(top_dir)
364
- dir_paths.each do |dir|
365
- unless File.directory?(dir)
366
- FileUtils.mkdir(dir, :mode => 0750)
367
- FileUtils.chown('root', puppet_group, dir)
368
- end
369
-
370
- Dir.chdir(dir)
371
- end
372
- Dir.chdir(orig_dir)
373
-
374
- cmd = %(#{rsync} -a --force)
375
-
376
- if @options.preserve
377
- cmd += %( --ignore-existing)
378
- else
379
- cmd += %( --delete)
380
- end
381
-
382
- cmd += %( --verbose) if @options.debug
383
-
384
- cmd += %( #{@options.rpm_dir} #{@options.target_dir})
385
- cmd += %( 2>&1)
386
-
387
- info("Copying '#{@options.module_name}' files into '#{@options.target_dir}'")
388
- debug("Executing: #{cmd}")
389
- output = %x{#{cmd}}
390
- debug("Output:\n#{output}")
391
- unless $?.success?
392
- raise(%(Error: Copy of '#{@options.module_name}' into '#{@options.target_dir}' using '#{cmd}' failed with the following error:\n #{output.gsub("\n","\n ")}))
393
- end
394
-
395
- FileUtils.chown_R(nil, "#{puppet_group}", @options.target_dir)
396
- end
397
-
398
- def handle_uninstall
399
- debug("Processing uninstall of #{@options.module_name}")
400
- # Play it safe, this needs to have at least 'environments/simp' in it!
401
- if @options.target_dir.split(File::SEPARATOR).reject(&:empty?).size < 3
402
- raise("Error: Not removing directory '#{@options.target_dir}' for safety")
403
- end
404
-
405
- if @safe_modules.include?(@options.module_name)
406
- target_module_dir = File.join(@options.target_dir, @options.module_name)
407
- debug("Skipping removal of 'safe' module directory #{target_module_dir}")
408
- return
409
- end
410
-
411
- info("Removing '#{@options.module_name}' files from '#{@options.target_dir}'")
412
-
413
- # Find out what we have
414
- ref_list = []
415
- Dir.chdir(@options.rpm_dir) do
416
- Find.find('.').each do |file|
417
- if File.symlink?(file)
418
- ref_list << file
419
- Find.prune
420
- end
421
-
422
- ref_list << file
423
- end
424
- end
425
-
426
- # Delete from the bottom up to clear out the directories first
427
- # before removing them
428
- ref_list.reverse!
429
- ref_list.map{|x| x.sub!(/^./, @options.module_name)}
430
-
431
- # Only delete items that are in the reference repo
432
- Dir.chdir(@options.target_dir) do
433
- ref_list.each do |to_rm|
434
- if File.symlink?(to_rm)
435
- debug("Removing symlink #{to_rm}")
436
- FileUtils.rm_f(to_rm)
437
- elsif File.directory?(to_rm) && (Dir.entries(to_rm).delete_if {|dir|
438
- dir == '.' || dir == '..'}.size == 0)
439
- debug("Removing directory #{to_rm}")
440
- FileUtils.rmdir(to_rm)
441
- elsif File.exist?(to_rm)
442
- debug("Removing file #{to_rm}")
443
- FileUtils.rm_f(to_rm)
444
- end
445
- end
446
- end
447
- end
448
-
449
- def run(args)
450
- parse_options(args)
451
- return 0 if @options.help_requested
452
-
453
- process_config
454
- debug("Running with config=#{@options.to_s}")
455
-
456
- # If the target directory is managed, we're done
457
- target_module_dir = File.join(@options.target_dir, @options.module_name)
458
- unless is_managed?(target_module_dir) || !@options.copy_rpm_data
459
-
460
- debug("Processing unmanaged target directory #{target_module_dir}")
461
-
462
- if (@options.rpm_section == 'posttrans') || (@options.rpm_section == 'post')
463
- # A regular installation, upgrade or downgrade
464
- # This *should* happen in the RPM %posttrans, but we allow this to
465
- # occur in the %post for backward compatibility with SIMP RPMs that
466
- # erroneously try to affect a copy in the %post. (Copying over the
467
- # files in the RPM %post during an upgrade/downgrade is problematic.
468
- # If the old package has files that are not in the new package,
469
- # these files will not yet have been removed in the source
470
- # directory, and thus end up in the target directory.)
471
- handle_install
472
- elsif @options.rpm_section == 'preun' && @options.rpm_status == '0'
473
- # A regular uninstall
474
- # This needs to happen *before* RPM removes the files (%preun with
475
- # status 0), since we need to compare with what's on disk to undo
476
- # the copy done during the RPM install via handle_install()
477
- handle_uninstall
478
- end
479
- end
480
- return 0
481
- rescue RuntimeError => e
482
- $stderr.puts(e)
483
- return 1
484
- rescue Exception => e
485
- $stderr.puts(e)
486
- e.backtrace.first(10).each{|l| $stderr.puts l }
487
- return 1
488
- end
489
- end
490
-
491
- if __FILE__ == $0
492
- helper = SimpRpmHelper.new
493
- exit helper.run(ARGV)
494
- end
495
-