simp-rake-helpers 5.3.0 → 5.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +8 -2
  3. data/.travis.yml +54 -37
  4. data/CHANGELOG.md +40 -2
  5. data/Gemfile +1 -0
  6. data/README.md +70 -82
  7. data/lib/simp/rake/build/auto.rb +6 -0
  8. data/lib/simp/rake/build/pkg.rb +2 -2
  9. data/lib/simp/rake/build/rpmdeps.rb +6 -3
  10. data/lib/simp/rake/helpers/assets/rpm_spec/simpdefault.spec +284 -71
  11. data/lib/simp/rake/helpers/version.rb +1 -1
  12. data/lib/simp/rake/pkg.rb +38 -18
  13. data/lib/simp/rake/rubygem.rb +1 -1
  14. data/lib/simp/rpm.rb +49 -6
  15. data/spec/acceptance/00_pkg_rpm_custom_scriptlets_spec.rb +117 -0
  16. data/spec/acceptance/10_pkg_rpm_spec.rb +153 -0
  17. data/spec/acceptance/20_pkg_rpm_safely_upgrading_obsolete_modules_spec.rb +175 -0
  18. data/spec/acceptance/development/docker_env.sh +29 -0
  19. data/spec/acceptance/development/rerun_acceptance_tests.sh +15 -0
  20. data/spec/acceptance/development/vagrant_rsync.sh +23 -0
  21. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-2.1/CHANGELOG +2 -0
  22. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-2.1/Rakefile +3 -0
  23. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-2.1/build/rpm_metadata/custom/overrides +14 -0
  24. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-2.1/build/rpm_metadata/requires +1 -0
  25. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-2.1/metadata.json +33 -0
  26. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-3.0/CHANGELOG +2 -0
  27. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-3.0/Rakefile +3 -0
  28. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-3.0/build/rpm_metadata/custom/overrides +14 -0
  29. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-3.0/build/rpm_metadata/requires +1 -0
  30. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-3.0/metadata.json +33 -0
  31. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-1.0/CHANGELOG +2 -0
  32. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-1.0/Rakefile +3 -0
  33. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-1.0/build/rpm_metadata/requires +1 -0
  34. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-1.0/metadata.json +33 -0
  35. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-2.0/CHANGELOG +2 -0
  36. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-2.0/Rakefile +3 -0
  37. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-2.0/build/rpm_metadata/requires +1 -0
  38. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-2.0/metadata.json +33 -0
  39. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-2.2/CHANGELOG +2 -0
  40. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-2.2/Rakefile +3 -0
  41. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-2.2/build/rpm_metadata/custom/overrides +14 -0
  42. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-2.2/build/rpm_metadata/requires +1 -0
  43. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-2.2/metadata.json +33 -0
  44. data/spec/acceptance/files/mock_packages/pupmod-puppetlabs-stdlib.spec +32 -0
  45. data/spec/acceptance/files/mock_packages/pupmod-simp-foo.spec +32 -0
  46. data/spec/acceptance/files/mock_packages/pupmod-simp-simplib.spec +32 -0
  47. data/spec/acceptance/files/mock_packages/rpmbuild.sh +25 -0
  48. data/spec/acceptance/files/mock_packages/simp-adapter/etc/simp/adapter_config.yaml +3 -0
  49. data/spec/acceptance/files/mock_packages/simp-adapter/usr/local/sbin/simp_rpm_helper +406 -0
  50. data/spec/acceptance/files/mock_packages/simp-adapter.spec +43 -0
  51. data/spec/acceptance/files/testpackage_custom_scriptlet/CHANGELOG +2 -0
  52. data/spec/acceptance/files/testpackage_custom_scriptlet/Rakefile +3 -0
  53. data/spec/acceptance/files/testpackage_custom_scriptlet/build/rpm_metadata/custom/overrides +18 -0
  54. data/spec/acceptance/files/testpackage_custom_scriptlet/build/rpm_metadata/requires +1 -0
  55. data/spec/acceptance/files/testpackage_custom_scriptlet/metadata.json +33 -0
  56. data/spec/acceptance/nodesets/default.yml +2 -4
  57. data/spec/acceptance/support/pkg_rpm_helpers.rb +81 -0
  58. data/spec/lib/simp/rake/build/files/unmanaged_mod/build/rpm_metadata/requires +2 -1
  59. data/spec/lib/simp/rake/build/rpmdeps_spec.rb +2 -1
  60. data/spec/spec_helper_acceptance.rb +20 -1
  61. metadata +44 -17
  62. data/spec/acceptance/pkg_rpm_spec.rb +0 -164
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cd72175666f147fd150435496fed0093586b507af569c4682afa713f12fb251f
4
- data.tar.gz: 21b5c168ec65c56a9081d3b5a53d80f53fe96ec9b8e48b988c47f025d8476f29
3
+ metadata.gz: 939e5af4addd43fd7426e30482fa751d4998d8f537d63174dcb9a8ab5130b6a0
4
+ data.tar.gz: c923022ca6e164757b00a8d87a02648277fbe4c50c912520f09211420d35ccad
5
5
  SHA512:
6
- metadata.gz: 50fc2bed131761ed25041f17ed4455bfe270d96d9c9e42e456ebf3ad870cf2cdb9c936af6ece47cbb98aea65d7ee9bc12429eab9e40f9c4017bcd396564ee68b
7
- data.tar.gz: 08206ff2084e66f5544751d3bc6f9430437c6b2fee09d3df4665878d1c7dd97b847e075dc86eabe30f02189d0549b9acadab6bdede251c0996af4f4f46fdfdef
6
+ metadata.gz: 36fa3a75405f59e9ea37e133ab6bdc4810d68382d51332a6495e8155dba3f3aedb2109fb1431e5bab78656fd28d9cca10e079ba3f66e15f685702e594ca19ff3
7
+ data.tar.gz: 1f3db5d207c48657ba5dc46a17d8a4b1225d671df47c8ba9e2d426cfd192bb2537fc52914c31ae2f2168247bd4852c3e2e25bc4f35125b9368812918ffb6149b
data/.gitignore CHANGED
@@ -1,4 +1,10 @@
1
- *.sw[pnoqst]
2
- Gemfile.lock
1
+ .bundle/
3
2
  dist/
3
+ *.gem
4
+ Gemfile.lock
4
5
  /log/
6
+ *.old
7
+ /spec/fixtures
8
+ *.swp
9
+ *.sw[pnoqst]
10
+ .vagrant
data/.travis.yml CHANGED
@@ -1,42 +1,59 @@
1
+ ---
1
2
  language: ruby
2
- sudo: required
3
- dist: trusty
4
- before_install:
5
- - sudo apt-get update -qq
6
- - sudo apt-get install -y rpm
7
- - rm Gemfile.lock || true
8
- bundler_args: "--without development --path .vendor"
3
+ cache: bundler
4
+ sudo: false
5
+
6
+ bundler_args: --without development system_tests
7
+
9
8
  notifications:
10
9
  email: false
11
- rvm:
12
- - 2.1.9
13
- - 2.3.3
14
- - 2.4.1
15
- script:
16
- - 'bundle exec rake spec'
17
- matrix:
18
- fast_finish: true
19
- allow_failures:
20
- - rvm: 2.3.3
21
- - rvm: 2.4.1
22
- before_deploy:
23
- - 'bundle exec rake clobber'
24
- - "export GEM_VERSION=`ruby -r ./lib/simp/rake/helpers/version.rb -e 'puts Simp::Rake::Helpers::VERSION'`"
25
- - '[[ $TRAVIS_TAG =~ ^${GEM_VERSION}$ ]]'
26
- deploy:
27
- - provider: rubygems
28
- gemspec: simp-rake-helpers.gemspec
29
- gem: simp-rake-helpers
30
- api_key:
31
- secure: "aoPmOZ3WgjNJ56UXmamKxaRv37iUaxKekAeS8n2fPk78X/nU2qGjdDHFH+SBrfl33PyzsGnS3WAANMKaIkAgssvKoaII/sAC+Sl6q1eyVUprZqloXrG+cHlnHY4GnziWEH3JrkHDChW0xoJq7hhpj7qTRKrEIp6nA25MjozjveoL+HH4kKy/ACJhiEdsYTFaDLYYFY50gGUL9KjIkwN6g9d+dIzG9JqcYoDbneQlO6/23yr4GiAHQ8HM1j5tUoBqJad+CWjWhSY7pbfYBy2ziwVhFy1qoOS4/bhlasRCsLTtz0AjjR0YWOhJap1vJqYhrSxtvhmVuzScmDkueAem/PfWS3XCQvbmjdmFMzPOxo0aRRJMlaeVWRsZ/aVFC7ngpRzokq1duZEKI47xZC27vJSOp3RZMmYl/7GsykoYkqHHsTvzSALEQiVtQq8sIOtN0JOTFI8H4LSMirXuqGq+SgCJiAQ3mQzSgh50TXiZaA2UPPcQaw4AzY36BRKs1cgw3cEWuL38O2cWUTAzEE4SUh499wrU5x+N0PsYL0AvMFONsRaq5epOYrlIL9UPSL/qZRLmzpcEWZRfOX4Ni5N6Aa9ZR8juenR6UmE79S2dupBxQeinkdfXuWznUZH7BcnUDoz8rErABpJGHNVY60dUO/s055WCr7Y95Gi+H75X9/I="
32
- on:
33
- tags: true
10
+
11
+ addons:
12
+ apt:
13
+ packages:
14
+ - rpm
15
+ # provides unbuffer
16
+ - expect-dev
17
+
18
+ before_install:
19
+ - rm -f Gemfile.lock
20
+
21
+ jobs:
22
+ include:
23
+ - stage: spec
24
+ rvm: 2.1.9
25
+ script:
26
+ - bundle exec rake spec
27
+
28
+ - stage: acceptance
29
+ sudo: required
34
30
  rvm: 2.1.9
35
- condition: '($SKIP_PUBLISH != true)'
36
- - provider: releases
37
- api_key:
38
- secure: "QKvAL4yAk8u9prJT6dFzKvszJfoo5/R9jIJ/WEUwdH17jij9Q/XhNrUzJZnrdVtqq4yCK6UqGqkRMMn2YLOKthoJycLEXzH+ZeCxBwzyN6uQkLmK5Mx43H+NNCsRkYTmcOdi4wJraWaWVq7XBxz6XdNRUkV99WyIh93wVnTwZuJxvF9koDFq+lRR4qRPh5Xn8HjKEZNPY7QHaecqsyWjgdEILWaQk/32IU20dLCT7U3jDdSuk92p24gWlkvTJ/gP+IYKWEPhgMMpx+WAtGGC+djMyZUrkaKEa/ennkOcFgqJ6UtDEInEtTBFWScGL70dwHORbEVExp9AKcLP3TmMyQ/36ybu7yrgcp6L995tM4Huez3GBM6NJ8xl/hYG3D1QwwoXGnWfUjQW2we7h8gcvl2yUSx59pb2V5QW3nCbD8rAiF/kpAcgwWyBT3iLpMer2j0Ux05NCBGqsltl9J944M+pLtO+YKldUw7uGDWMQQzq8/2m5+MoE4fvTgnaJ0rv0eRLWfNH2RQ565mE95nyJC/wXz/XB2v/KKHrf8FQZRIavH4Nuo4E2+tU8u2APU/n+gP8iQrtd86Nlo5RrBTu+NoDPDrM5OBnVYTT/AUAEUggXTPgZsqwZrSDSBEt0VbExnwQ5QMGIB9ZX+ZunrEZ6NeH8hV5hm67WYZ+qRFOPvI="
39
- on:
40
- tags: true
31
+ services:
32
+ - docker
33
+ script:
34
+ - bundle exec rake acceptance
35
+
36
+ - stage: deploy
41
37
  rvm: 2.1.9
42
- condition: '($SKIP_PUBLISH != true)'
38
+ script:
39
+ - true
40
+ before_deploy:
41
+ - "export GEM_VERSION=`ruby -r ./lib/simp/rake/helpers/version.rb -e 'puts Simp::Rake::Helpers::VERSION'`"
42
+ - '[[ $TRAVIS_TAG =~ ^${GEM_VERSION}$ ]]'
43
+ deploy:
44
+ - provider: rubygems
45
+ gemspec: simp-rake-helpers.gemspec
46
+ gem: simp-rake-helpers
47
+ api_key:
48
+ secure: "aoPmOZ3WgjNJ56UXmamKxaRv37iUaxKekAeS8n2fPk78X/nU2qGjdDHFH+SBrfl33PyzsGnS3WAANMKaIkAgssvKoaII/sAC+Sl6q1eyVUprZqloXrG+cHlnHY4GnziWEH3JrkHDChW0xoJq7hhpj7qTRKrEIp6nA25MjozjveoL+HH4kKy/ACJhiEdsYTFaDLYYFY50gGUL9KjIkwN6g9d+dIzG9JqcYoDbneQlO6/23yr4GiAHQ8HM1j5tUoBqJad+CWjWhSY7pbfYBy2ziwVhFy1qoOS4/bhlasRCsLTtz0AjjR0YWOhJap1vJqYhrSxtvhmVuzScmDkueAem/PfWS3XCQvbmjdmFMzPOxo0aRRJMlaeVWRsZ/aVFC7ngpRzokq1duZEKI47xZC27vJSOp3RZMmYl/7GsykoYkqHHsTvzSALEQiVtQq8sIOtN0JOTFI8H4LSMirXuqGq+SgCJiAQ3mQzSgh50TXiZaA2UPPcQaw4AzY36BRKs1cgw3cEWuL38O2cWUTAzEE4SUh499wrU5x+N0PsYL0AvMFONsRaq5epOYrlIL9UPSL/qZRLmzpcEWZRfOX4Ni5N6Aa9ZR8juenR6UmE79S2dupBxQeinkdfXuWznUZH7BcnUDoz8rErABpJGHNVY60dUO/s055WCr7Y95Gi+H75X9/I="
49
+ on:
50
+ tags: true
51
+ rvm: 2.1.9
52
+ condition: '($SKIP_PUBLISH != true)'
53
+ - provider: releases
54
+ api_key:
55
+ secure: "QKvAL4yAk8u9prJT6dFzKvszJfoo5/R9jIJ/WEUwdH17jij9Q/XhNrUzJZnrdVtqq4yCK6UqGqkRMMn2YLOKthoJycLEXzH+ZeCxBwzyN6uQkLmK5Mx43H+NNCsRkYTmcOdi4wJraWaWVq7XBxz6XdNRUkV99WyIh93wVnTwZuJxvF9koDFq+lRR4qRPh5Xn8HjKEZNPY7QHaecqsyWjgdEILWaQk/32IU20dLCT7U3jDdSuk92p24gWlkvTJ/gP+IYKWEPhgMMpx+WAtGGC+djMyZUrkaKEa/ennkOcFgqJ6UtDEInEtTBFWScGL70dwHORbEVExp9AKcLP3TmMyQ/36ybu7yrgcp6L995tM4Huez3GBM6NJ8xl/hYG3D1QwwoXGnWfUjQW2we7h8gcvl2yUSx59pb2V5QW3nCbD8rAiF/kpAcgwWyBT3iLpMer2j0Ux05NCBGqsltl9J944M+pLtO+YKldUw7uGDWMQQzq8/2m5+MoE4fvTgnaJ0rv0eRLWfNH2RQ565mE95nyJC/wXz/XB2v/KKHrf8FQZRIavH4Nuo4E2+tU8u2APU/n+gP8iQrtd86Nlo5RrBTu+NoDPDrM5OBnVYTT/AUAEUggXTPgZsqwZrSDSBEt0VbExnwQ5QMGIB9ZX+ZunrEZ6NeH8hV5hm67WYZ+qRFOPvI="
56
+ on:
57
+ tags: true
58
+ rvm: 2.1.9
59
+ condition: '($SKIP_PUBLISH != true)'
data/CHANGELOG.md CHANGED
@@ -1,3 +1,41 @@
1
+ ### 5.4.1 / 2018-03-04
2
+ * Fix Travis CI deployment script
3
+
4
+ ### 5.4.0 / 2018-02-12
5
+ * Add support for RPM customization (e.g., scriptlets, triggers)
6
+ - Scans new location `build/rpm_metadata/custom/` to find new content to
7
+ inject into the RPM spec (e.g., scriptlets, triggers).
8
+ - There is logic to permit overriding the `%pre`/`%post`/`%preun`/`%postun`
9
+ default scriptlets.
10
+ * Enable `%triggerpostun` fix for SIMP-3895
11
+ - The custom scriptlet feature provides a means for module RPMs that obsolete
12
+ the same module name to introduce a `%triggerpostun -- <obsoleted-package>`
13
+ scriptlet as a workaround to prevent `simp_rpm_helpers` from deleting
14
+ everything.
15
+ - The acceptance tests specifically demonstrate this type of trigger
16
+ * Improve RPM build troubleshooting:
17
+ - New env var: `SIMP_RPM_verbose=yes`
18
+ - New env var: `SIMP_RAKE_PKG_verbose=yes`
19
+ * Improve `simpdefault.spec` RPM Lua code troubleshooting:
20
+ - Cleaned up header documentation
21
+ - Added optional stderr warnings
22
+ - Refactored (some) code into functions
23
+ - Improved error messages
24
+ * Improve acceptance test / development workflow
25
+ - Add `Vagrantfile` to provide a quick & pristine beaker/docker setup
26
+ * Refactor acceptance test structure
27
+ - Code formerly embedded in the `pkg_rpm` tests have been refactored into
28
+ common helpers that other tests can use.
29
+ - There are mock prereq RPMs to test installation of newly-built RPMs
30
+ - A `simp_rpm_helper` (a copy of the script in simp-adapter) for scenarios
31
+ * Update README.md
32
+ - Removed obsolete references to `mock`-based development
33
+ - Clarified RPM Generation documentation
34
+
35
+ ### 5.3.1 / 2018-02-18
36
+ * Add a conditional check so simp-core can build an ISO with a
37
+ pre-existing tarball with no user input
38
+
1
39
  ### 5.3.0 / 2018-02-02
2
40
  * Add ability to specify external, non-module, RPM dependencies for
3
41
  a checked-out repo from `simp-core/build/rpm/dependencies.yaml`
@@ -10,13 +48,13 @@
10
48
  - Provides more extensive validation of date strings and changelog
11
49
  entry ordering.
12
50
  - Stops processing at the first invalid changelog entry, to minimize
13
- non-catestrophic errors from old changelog entries.
51
+ non-catastrophic errors from old changelog entries.
14
52
  * Create pkg:compare_latest_tag, which is a more general replacement
15
53
  for the Simp::Rake::Pupmod::Helpers compare_latest_tag task.
16
54
  - Now supports non-Puppet SIMP assets for which version and changelog
17
55
  information is specified in an RPM spec files.
18
56
  - Does the same validation as the new pkg:create_tag_changelog task.
19
- * Fix broken acceptance tests
57
+ * Fix broken acceptance tests
20
58
  - Remove logic to build SIMP 4 and SIMP 5 RPMs.
21
59
  - Remove mock logic
22
60
 
data/Gemfile CHANGED
@@ -12,6 +12,7 @@ gemspec
12
12
  gem 'ruby-progressbar'
13
13
  gem 'simp-build-helpers'
14
14
  gem 'simp-beaker-helpers'
15
+ gem 'beaker-puppet_install_helper'
15
16
 
16
17
  if puppetversion
17
18
  gem 'puppet', puppetversion
data/README.md CHANGED
@@ -7,36 +7,30 @@
7
7
 
8
8
  #### Table of Contents
9
9
 
10
- <!-- START doctoc generated TOC please keep comment here to allow auto update -->
11
- <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
12
-
13
- - [Overview](#overview)
14
- - [This gem is part of SIMP](#this-gem-is-part-of-simp)
15
- - [Features](#features)
16
- - [Setup](#setup)
17
- - [Gemfile](#gemfile)
18
- - [Usage](#usage)
19
- - [In a Puppet module](#in-a-puppet-module)
20
- - [In a Ruby Gem](#in-a-ruby-gem)
21
- - [RPM Generation](#rpm-generation)
22
- - [RPM Changelog](#rpm-changelog)
23
- - [RPM Dependencies](#rpm-dependencies)
24
- - [Reference](#reference)
25
- - [simp/rake/rpm](#simprakerpm)
26
- - [rake pkg:rpm[chroot,unique,snapshot_release]](#rake-pkgrpmchrootuniquesnapshot_release)
27
- - [Parameters](#parameters)
28
- - [rake pkg:scrub[chroot,unique]](#rake-pkgscrubchrootunique)
29
- - [rake pkg:srpm[chroot,unique,snapshot_release]](#rake-pkgsrpmchrootuniquesnapshot_release)
30
- - [Parameters](#parameters-1)
31
- - [rake pkg:tar[snapshot_release]](#rake-pkgtarsnapshot_release)
32
- - [Parameters](#parameters-2)
33
- - [Limitations](#limitations)
34
- - [FIPS Enabled Systems](#fips-enabled-systems)
35
- - [Development](#development)
36
- - [License](#license)
37
- - [History](#history)
38
-
39
- <!-- END doctoc generated TOC please keep comment here to allow auto update -->
10
+ <!-- vim-markdown-toc GFM -->
11
+
12
+ * [Overview](#overview)
13
+ * [This gem is part of SIMP](#this-gem-is-part-of-simp)
14
+ * [Features](#features)
15
+ * [Setup](#setup)
16
+ * [Gemfile](#gemfile)
17
+ * [Usage](#usage)
18
+ * [In a Puppet module](#in-a-puppet-module)
19
+ * [In a Ruby Gem](#in-a-ruby-gem)
20
+ * [Generating RPMs](#generating-rpms)
21
+ * [RPM Changelog](#rpm-changelog)
22
+ * [RPM Dependencies](#rpm-dependencies)
23
+ * [Reference](#reference)
24
+ * [simp/rake/rpm](#simprakerpm)
25
+ * [`rake pkg:rpm`](#rake-pkgrpm)
26
+ * [`rake pkg:tar`](#rake-pkgtar)
27
+ * [Limitations](#limitations)
28
+ * [Some versions of bundler fail on FIPS-enabled Systems](#some-versions-of-bundler-fail-on-fips-enabled-systems)
29
+ * [Development](#development)
30
+ * [License](#license)
31
+ * [History](#history)
32
+
33
+ <!-- vim-markdown-toc -->
40
34
 
41
35
  ## Overview
42
36
 
@@ -49,8 +43,8 @@ This gem is part of (the build tooling for) the [System Integrity Management Pla
49
43
 
50
44
  ### Features
51
45
 
52
- * Supports multithreaded mock operations
53
- * RPM packaging and signing
46
+ * Customizable RPM packaging based on a Puppet module's [`metadata.json`][metadata.json]
47
+ * RPM signing
54
48
  * Rubygem packaging
55
49
 
56
50
  ## Setup
@@ -124,87 +118,81 @@ To see the extra rake tasks:
124
118
  bunde exec rake -T
125
119
  ```
126
120
 
127
- ### RPM Generation
121
+ ### Generating RPMs
128
122
 
129
- This Gem provides the ability to generate an RPM from *any* Puppet module.
123
+ The task [`rake pkg:rpm`](#simprakerpm)) provides the ability to package an RPM
124
+ from *any* Puppet module (regardless of whether it is a SIMP module or not).
125
+ The only requirement is that the Puppet module MUST include a valid
126
+ [`metadata.json`][metadata.json] file with entries for `name`,
127
+ `version`, `license`, `summary`, and `source`.
130
128
 
131
- By default, the information for the RPM will be pulled from the Forge
132
- compatible [metadata.json](https://docs.puppet.com/puppet/latest/reference/modules_metadata.html).
129
+ [metadata.json]: https://docs.puppet.com/puppet/latest/reference/modules_metadata.html
133
130
 
134
- The `name` and `version` fields *must* be present and well formatted. The
135
- `license` field is also used if present.
131
+ The RPM package may be configured by other (optional) files under the project
132
+ directory . The full list of files considered are:
133
+
134
+ ```
135
+ ./
136
+ ├── metadata.json # REQUIRED keys: name, version, license, summary, source
137
+ ├── CHANGELOG # OPTIONAL written in RPM's CHANGELOG format
138
+ └── build/ # OPTIONAL
139
+    └── rpm_metadata/ # OPTIONAL
140
+ ├── release # OPTIONAL defines the RPM's "-0" release number
141
+ ├── requires # OPTIONAL supplementary 'Requires','Provides','Obsoletes'
142
+ └── custom/ # OPTIONAL
143
+ └── * # OPTIONAL custom snippets in RPM .spec format
144
+ ```
136
145
 
137
146
  *NOTE*: The dependencies in `metadata.json` are *not* used to generate RPM
138
147
  dependencies!
139
148
 
149
+
140
150
  #### RPM Changelog
141
151
 
142
- The Changelog is pulled from a file called `CHANGELOG` at the top level of the
143
- project. If this file does not start with a well formatted RPM changelog
144
- string, it will be ignored.
152
+ The RPM Changelog will be derived from a `CHANGELOG` file at the top
153
+ level of the project, if it exists.
154
+
155
+ * The file is expected to conform to the [RPM Changelog][RPM CHANGELOG]
156
+ format described in the Fedora packaging guidelines
157
+ * The file MUST start with a well-formatted RPM changelog string, or it will
158
+ be ignored.
159
+ * The format is *not* fully checked before attempting to build the RPM―the
160
+ RPM build will fail if the Changelog entries are not valid.
161
+
162
+ [RPM CHANGELOG]: https://fedoraproject.org/wiki/Packaging:Guidelines#Changelogs
145
163
 
146
- The Changelog is *not* fully checked before attempting to build the RPM. Your
147
- RPM build will fail if the Changelog entries are not valid per the RPM
148
- specification.
149
164
 
150
165
  #### RPM Dependencies
151
166
 
152
167
  It is likely that you will want to declare your dependencies in your RPM. To do
153
- this, you can create a `build/rpm_metadata` directory at the root of your
154
- project. A file named `requires` in the `build/rpm_metadata` directory will be
168
+ this, create a `build/rpm_metadata` directory at the root of the project.
169
+ A `requires` file in the `build/rpm_metadata` directory will be
155
170
  used to declare the dependencies of the RPM. A file named `release` in the
156
171
  `build/rpm_metadata` directory will be used to declare the RPM release
157
172
  number.
158
173
 
159
174
  The following directives may be declared in the `requires` file:
160
- * Provides
161
- * Requires
162
- * Obsoletes
175
+ * `Provides:`
176
+ * `Requires:`
177
+ * `Obsoletes:`
163
178
 
164
179
  ## Reference
165
180
 
166
181
  ### simp/rake/rpm
167
182
 
168
- #### rake pkg:rpm[chroot,unique,snapshot_release]
169
- Builds an RPM to package the current SIMP project.
170
-
171
- **NOTE**: Building RPMs requires a working Mock setup (http://fedoraproject.org/wiki/Projects/Mock)
172
-
173
- ##### Parameters
174
-
175
- * **:chroot** - The Mock chroot configuration to use. See the '--root' option in mock(1)."
176
- * **:unique** - Whether or not to build the RPM in a unique Mock environment. This can be very useful for parallel builds of all modules.
177
- * **:snapshot_release** - Add snapshot_release (date and time) to rpm version. Rpm spec file must have macro for this to work.
178
-
179
-
180
- #### rake pkg:scrub[chroot,unique]
181
-
182
- Scrub the current SIMP project's mock build directory.
183
-
184
-
185
- #### rake pkg:srpm[chroot,unique,snapshot_release]
186
- Build the pupmod-simp-iptables SRPM. Building RPMs requires a working Mock setup (http://fedoraproject.org/wiki/Projects/Mock)
187
-
188
- **NOTE**: Building RPMs requires a working Mock setup (http://fedoraproject.org/wiki/Projects/Mock)
189
-
190
- ##### Parameters
191
-
192
- * **:chroot** - The Mock chroot configuration to use. See the '--root' option in mock(1)."
193
- * **:unique** - Whether or not to build the SRPM in a unique Mock environment. This can be very useful for parallel builds of all modules.
194
- * **:snapshot_release** - Add snapshot_release (date and time) to rpm version. The RPM spec file must support macros for this to work.
183
+ #### `rake pkg:rpm`
195
184
 
196
- #### rake pkg:tar[snapshot_release]
185
+ Packages the current SIMP project as an RPM
197
186
 
198
- ##### Parameters
187
+ #### `rake pkg:tar`
199
188
 
200
- Build the pupmod-simp-iptables tar package
201
- * :snapshot_release - Add snapshot_release (date and time) to rpm version, rpm spec file must have macro for this to work.
189
+ Build the tar package for the current SIMP project
202
190
 
203
191
  ## Limitations
204
192
 
205
- ### FIPS Enabled Systems
193
+ ### Some versions of bundler fail on FIPS-enabled Systems
206
194
 
207
- This is not a limitation of the module, but of Bundler.
195
+ This is a limitation of Bundler, not the gem.
208
196
 
209
197
  If you are running on a FIPS-enabled system, you will need to use `bundler '~> 1.14.0'`
210
198
  until the FIPS support can be corrected.
@@ -102,6 +102,7 @@ module Simp::Rake::Build
102
102
  - SIMP_BUILD_staging_dir => Path to stage big build assets
103
103
  [Default: './SIMP_ISO_STAGING']
104
104
  - SIMP_BUILD_rm_staging_dir => 'no' do not forcibly remove the staging dir before starting
105
+ - SIMP_BUILD_overlay => 'no' uses an existing DVD overlay if found
105
106
  - SIMP_BUILD_force_dirty => 'yes' tries to checks out subrepos even if dirty
106
107
  - SIMP_BUILD_docs => 'yes' builds & includes documentation
107
108
  - SIMP_BUILD_checkout => 'no' will skip the git repo checkouts
@@ -143,6 +144,7 @@ module Simp::Rake::Build
143
144
  prompt = ENV.fetch('SIMP_BUILD_prompt', 'yes') != 'no'
144
145
  method = ENV.fetch('SIMP_BUILD_puppetfile','tracking')
145
146
  do_rm_staging = ENV.fetch('SIMP_BUILD_rm_staging_dir', 'yes') == 'yes'
147
+ build_overlay = ENV.fetch('SIMP_BUILD_overlay', "yes") == 'yes'
146
148
  do_docs = ENV['SIMP_BUILD_docs'] == 'yes' ? 'true' : 'false'
147
149
  do_merge = ENV['SIMP_BUILD_unpack_merge'] != 'no'
148
150
  do_prune = ENV['SIMP_BUILD_prune'] != 'no' ? 'true' : 'false'
@@ -212,6 +214,10 @@ module Simp::Rake::Build
212
214
  puts("Invalid input: '#{resp}', please try again")
213
215
  end
214
216
  end
217
+ else
218
+ unless (build_overlay)
219
+ tarball = tar_file
220
+ end
215
221
  end
216
222
  end
217
223
 
@@ -861,8 +861,8 @@ protect=1
861
861
  $stderr.puts e if opts[:verbose]
862
862
  end
863
863
  end
864
- elsif opts[:verbose]
865
- $stderr.puts '>>Issue creating YUM configuration. Packages will be locally generated.'
864
+ else
865
+ $stderr.puts '>>Issue creating YUM configuration. Packages will be locally generated.' if opts[:verbose]
866
866
 
867
867
  result = true
868
868
  end
@@ -57,10 +57,13 @@ module Simp::Rake::Build::RpmDeps
57
57
 
58
58
  # We don't want to add this if we're building an older
59
59
  # version or the RPM will be malformed
60
- if Gem::Version.new(module_version) >
61
- Gem::Version.new(version.split('-').first)
60
+ main_version, release = version.split('-')
61
+ release = '0' unless release
62
+ release = release.to_i
62
63
 
63
- rpm_metadata_content << "Obsoletes: #{pkg} >= #{version}"
64
+ if Gem::Version.new(module_version) > Gem::Version.new(main_version)
65
+ rpm_metadata_content << "Obsoletes: #{pkg} < #{main_version}-#{release}.obsolete"
66
+ rpm_metadata_content << "Provides: #{pkg} = #{main_version}-#{release}.obsolete"
64
67
  else
65
68
  puts "Ignoring 'obsoletes' for #{pkg}: module version" +
66
69
  " #{module_version} from metadata.json is not >" +