simp-rake-helpers 5.24.0 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +20 -1
- data/CHANGELOG.md +33 -0
- data/Gemfile +14 -6
- data/lib/simp/command_utils.rb +6 -3
- data/lib/simp/componentinfo.rb +47 -33
- data/lib/simp/local_gpg_signing_key.rb +302 -303
- data/lib/simp/packer/iso_vars_json.rb +17 -15
- data/lib/simp/rake/build/auto.rb +415 -432
- data/lib/simp/rake/build/build.rb +119 -124
- data/lib/simp/rake/build/clean.rb +39 -39
- data/lib/simp/rake/build/code.rb +125 -128
- data/lib/simp/rake/build/constants.rb +7 -4
- data/lib/simp/rake/build/deps.rb +196 -207
- data/lib/simp/rake/build/helpers.rb +17 -13
- data/lib/simp/rake/build/iso.rb +404 -411
- data/lib/simp/rake/build/pkg.rb +752 -759
- data/lib/simp/rake/build/rpmdeps.rb +70 -70
- data/lib/simp/rake/build/spec.rb +44 -46
- data/lib/simp/rake/build/tar.rb +169 -173
- data/lib/simp/rake/build/unpack.rb +105 -107
- data/lib/simp/rake/build/upload.rb +93 -102
- data/lib/simp/rake/fixtures.rb +69 -66
- data/lib/simp/rake/helpers/rpm_spec.rb +10 -7
- data/lib/simp/rake/helpers/version.rb +3 -1
- data/lib/simp/rake/helpers.rb +12 -10
- data/lib/simp/rake/pkg.rb +417 -440
- data/lib/simp/rake/pupmod/helpers.rb +100 -87
- data/lib/simp/rake/pupmod/module_build.rb +39 -0
- data/lib/simp/rake/rubygem.rb +57 -56
- data/lib/simp/rake.rb +34 -29
- data/lib/simp/relchecks.rb +52 -43
- data/lib/simp/rpm.rb +123 -127
- data/lib/simp/rpm_signer.rb +57 -55
- data/lib/simp/yum.rb +54 -53
- data/spec/acceptance/nodesets/{default_ruby3_1.yml → almalinux10.yml} +4 -4
- data/spec/acceptance/nodesets/{default.yml → almalinux8.yml} +2 -2
- data/spec/acceptance/nodesets/almalinux9.yml +25 -0
- data/spec/acceptance/suites/default/00_pkg_rpm_custom_scriptlets_spec.rb +23 -28
- data/spec/acceptance/suites/default/10_pkg_rpm_spec.rb +54 -56
- data/spec/acceptance/suites/default/30_pkg_misc_spec.rb +17 -19
- data/spec/acceptance/suites/default/50_local_gpg_signing_key_spec.rb +5 -5
- data/spec/acceptance/suites/default/55_build_pkg_signing_spec.rb +109 -101
- data/spec/acceptance/suites/default/files/testpackage/spec/classes/init_spec.rb +1 -0
- data/spec/acceptance/suites/default/files/testpackage/spec/files/mock_something.rb +3 -1
- data/spec/acceptance/suites/default/files/testpackage/utils/convert_v1_to_v2.rb +2 -0
- data/spec/acceptance/suites/default/support/build_project_helpers.rb +20 -17
- data/spec/acceptance/suites/default/support/build_user_helpers.rb +4 -2
- data/spec/acceptance/suites/default/support/pkg_rpm_helpers.rb +30 -31
- data/spec/acceptance/support/simp_rake_helpers.rb +3 -1
- data/spec/lib/simp/command_utils_spec.rb +13 -10
- data/spec/lib/simp/componentinfo_changelog_regex_spec.rb +33 -33
- data/spec/lib/simp/componentinfo_spec.rb +99 -86
- data/spec/lib/simp/packer/iso_vars_json_spec.rb +16 -14
- data/spec/lib/simp/rake/build/helpers_spec.rb +7 -7
- data/spec/lib/simp/rake/build/rpmdeps_spec.rb +48 -46
- data/spec/lib/simp/rake/helpers_spec.rb +6 -5
- data/spec/lib/simp/rake/pkg_spec.rb +7 -5
- data/spec/lib/simp/rake/pupmod/fixtures/othermod/spec/classes/init_spec.rb +3 -1
- data/spec/lib/simp/rake/pupmod/fixtures/othermod/spec/spec_helper.rb +2 -0
- data/spec/lib/simp/rake/pupmod/fixtures/simpmod/spec/acceptance/suites/default/class_spec.rb +6 -5
- data/spec/lib/simp/rake/pupmod/fixtures/simpmod/spec/classes/init_spec.rb +51 -33
- data/spec/lib/simp/rake/pupmod/fixtures/simpmod/spec/spec_helper.rb +15 -16
- data/spec/lib/simp/rake/pupmod/fixtures/simpmod/spec/spec_helper_acceptance.rb +9 -9
- data/spec/lib/simp/rake/pupmod/helpers_spec.rb +20 -19
- data/spec/lib/simp/rake/pupmod/module_build_spec.rb +87 -0
- data/spec/lib/simp/rake_spec.rb +7 -6
- data/spec/lib/simp/relchecks_check_rpm_changelog_spec.rb +26 -31
- data/spec/lib/simp/relchecks_compare_latest_tag_spec.rb +32 -26
- data/spec/lib/simp/relchecks_create_tag_changelog_spec.rb +27 -19
- data/spec/lib/simp/rpm_signer_spec.rb +45 -39
- data/spec/lib/simp/rpm_spec.rb +190 -194
- data/spec/spec_helper.rb +4 -2
- data/spec/spec_helper_acceptance.rb +3 -5
- metadata +47 -76
- data/bin/simp_rake_helpers +0 -3
- data/lib/simp/ci/gitlab.rb +0 -226
- data/lib/simp/rake/ci.rb +0 -31
- data/spec/lib/simp/ci/files/global_nodesets_only/spec/acceptance/nodesets/default.yml +0 -41
- data/spec/lib/simp/ci/files/global_nodesets_only/spec/acceptance/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/job_broken_link_nodeset/spec/acceptance/nodesets/centos.yml +0 -41
- data/spec/lib/simp/ci/files/job_broken_link_nodeset/spec/acceptance/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/job_broken_link_nodeset/spec/acceptance/suites/default/class_spec.rb +0 -0
- data/spec/lib/simp/ci/files/job_invalid_nodeset/spec/acceptance/nodesets/default.yml +0 -41
- data/spec/lib/simp/ci/files/job_invalid_nodeset/spec/acceptance/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/job_invalid_nodeset/spec/acceptance/suites/default/class_spec.rb +0 -0
- data/spec/lib/simp/ci/files/job_invalid_suite/spec/acceptance/nodesets/default.yml +0 -41
- data/spec/lib/simp/ci/files/job_invalid_suite/spec/acceptance/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/job_invalid_suite/spec/acceptance/suites/default/class_spec.rb +0 -0
- data/spec/lib/simp/ci/files/job_missing_nodeset/spec/acceptance/nodesets/default.yml +0 -41
- data/spec/lib/simp/ci/files/job_missing_nodeset/spec/acceptance/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/job_missing_nodeset/spec/acceptance/suites/default/class_spec.rb +0 -0
- data/spec/lib/simp/ci/files/job_missing_suite_and_nodeset/spec/acceptance/nodesets/default.yml +0 -41
- data/spec/lib/simp/ci/files/job_missing_suite_and_nodeset/spec/acceptance/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/job_missing_suite_and_nodeset/spec/acceptance/suites/default/class_spec.rb +0 -0
- data/spec/lib/simp/ci/files/multiple_invalid_jobs/spec/acceptance/nodesets/default.yml +0 -41
- data/spec/lib/simp/ci/files/multiple_invalid_jobs/spec/acceptance/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/multiple_invalid_jobs/spec/acceptance/suites/default/class_spec.rb +0 -0
- data/spec/lib/simp/ci/files/multiple_invalid_jobs/spec/acceptance/suites/feature-1/feature-1_spec.rb +0 -0
- data/spec/lib/simp/ci/files/multiple_invalid_jobs/spec/acceptance/suites/feature_2/feature_2_spec.rb +0 -0
- data/spec/lib/simp/ci/files/multiple_invalid_jobs/spec/acceptance/suites/feature_2/nodesets/default.yml +0 -35
- data/spec/lib/simp/ci/files/multiple_invalid_jobs/spec/acceptance/suites/feature_2/nodesets/oel.yml +0 -35
- data/spec/lib/simp/ci/files/multiple_valid_jobs/spec/acceptance/nodesets/default.yml +0 -41
- data/spec/lib/simp/ci/files/multiple_valid_jobs/spec/acceptance/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/multiple_valid_jobs/spec/acceptance/suites/default/class_spec.rb +0 -0
- data/spec/lib/simp/ci/files/multiple_valid_jobs/spec/acceptance/suites/feature-1/feature-1_spec.rb +0 -0
- data/spec/lib/simp/ci/files/multiple_valid_jobs/spec/acceptance/suites/feature_2/feature_2_spec.rb +0 -0
- data/spec/lib/simp/ci/files/multiple_valid_jobs/spec/acceptance/suites/feature_2/nodesets/default.yml +0 -35
- data/spec/lib/simp/ci/files/multiple_valid_jobs/spec/acceptance/suites/feature_2/nodesets/oel.yml +0 -35
- data/spec/lib/simp/ci/files/no_acceptance_tests/spec/spec_helper.rb +0 -0
- data/spec/lib/simp/ci/files/no_gitlab_config_with_tests/spec/acceptance/nodesets/default.yml +0 -41
- data/spec/lib/simp/ci/files/no_gitlab_config_with_tests/spec/acceptance/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/no_gitlab_config_with_tests/spec/acceptance/suites/default/class_spec.rb +0 -0
- data/spec/lib/simp/ci/files/no_gitlab_config_without_tests/spec/acceptance/nodesets/default.yml +0 -41
- data/spec/lib/simp/ci/files/no_gitlab_config_without_tests/spec/acceptance/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/suite_skeleton_only/spec/acceptance/nodesets/centos.yml +0 -41
- data/spec/lib/simp/ci/files/suite_skeleton_only/spec/acceptance/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/valid_job_global_nodeset/spec/acceptance/nodesets/default.yml +0 -41
- data/spec/lib/simp/ci/files/valid_job_global_nodeset/spec/acceptance/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/valid_job_global_nodeset/spec/acceptance/suites/default/class_spec.rb +0 -0
- data/spec/lib/simp/ci/files/valid_job_nodeset_dir_link/spec/acceptance/nodesets/default.yml +0 -41
- data/spec/lib/simp/ci/files/valid_job_nodeset_dir_link/spec/acceptance/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/valid_job_nodeset_dir_link/spec/acceptance/suites/default/class_spec.rb +0 -0
- data/spec/lib/simp/ci/files/valid_job_nodeset_link/spec/acceptance/suites/default/class_spec.rb +0 -0
- data/spec/lib/simp/ci/files/valid_job_nodeset_link/spec/acceptance/suites/default/nodesets/centos.yml +0 -41
- data/spec/lib/simp/ci/files/valid_job_nodeset_link/spec/acceptance/suites/default/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/files/valid_job_suite_nodeset/spec/acceptance/suites/default/class_spec.rb +0 -0
- data/spec/lib/simp/ci/files/valid_job_suite_nodeset/spec/acceptance/suites/default/nodesets/default.yml +0 -41
- data/spec/lib/simp/ci/files/valid_job_suite_nodeset/spec/acceptance/suites/default/nodesets/oel.yml +0 -41
- data/spec/lib/simp/ci/gitlab_spec.rb +0 -245
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a5c6dcd39818c575a5e55c997ea3425895952a3913e743f8472f1368c86324c5
|
|
4
|
+
data.tar.gz: 562f3641c404e562a1d64cec2fa4b11f4e3206d9a0c4c1605c2f60651f87a0b0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 365f2731d24ee8ea5d830a6d055ecd024bf2a1bf448bfffdb259a88126244ae81ea3fbd4704d2b92241380a7ba45ce3962beb2d58bc2213a3dd537820604b5eb
|
|
7
|
+
data.tar.gz: c2f1258d8ee380d03667c852f48222e4f4b2de2865d49abf9ee5a95d523c3c4a36f972e1edf8562a590c254e493e0d6edb798213e2f21914f3b90017eb919764
|
data/.gitignore
CHANGED
|
@@ -8,4 +8,23 @@ Gemfile.lock
|
|
|
8
8
|
*.swp
|
|
9
9
|
*.sw[pnoqst]
|
|
10
10
|
.vagrant
|
|
11
|
-
|
|
11
|
+
/.vendor
|
|
12
|
+
/vendor
|
|
13
|
+
|
|
14
|
+
## AI coding assistant-specific configuration
|
|
15
|
+
## The standard is AGENTS.md
|
|
16
|
+
# Claude Code
|
|
17
|
+
/CLAUDE.md
|
|
18
|
+
/.claude/
|
|
19
|
+
# GitHub Copilot
|
|
20
|
+
/.github/copilot-instructions.md
|
|
21
|
+
# Cursor
|
|
22
|
+
/.cursor/
|
|
23
|
+
/.cursorrules
|
|
24
|
+
# Windsurf
|
|
25
|
+
/.windsurf/
|
|
26
|
+
/.windsurfrules
|
|
27
|
+
# Gemini CLI
|
|
28
|
+
/GEMINI.md
|
|
29
|
+
# Cline
|
|
30
|
+
/.clinerules/
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,36 @@
|
|
|
1
|
+
### 6.0.0 / 2026-06-25
|
|
2
|
+
- Added
|
|
3
|
+
- `pupmod:build` rake task using `puppet-modulebuilder`, replacing `pdk build`
|
|
4
|
+
- Honours `.pdkignore` (dropped by puppet-modulebuilder 2.x)
|
|
5
|
+
- `puppet-modulebuilder` runtime dependency
|
|
6
|
+
- Changed (**Breaking**)
|
|
7
|
+
- Dropped support for Puppet/OpenVox 7
|
|
8
|
+
- Narrowed `openvox` dependency to `>= 8.0, < 9.0`
|
|
9
|
+
- Raised the default `puppet`/`openvox` gem floor to `>= 8, < 9`
|
|
10
|
+
- Replaced `puppetlabs_spec_helper` with `voxpupuli-test`, enabling Ruby 4.0
|
|
11
|
+
support. `puppetlabs_spec_helper` caps `puppet-syntax` at < 5, which depends
|
|
12
|
+
on the `puppet` gem and its Ruby-4-incompatible `facter` dependency;
|
|
13
|
+
`voxpupuli-test` uses `puppet-syntax` >= 6 (which depends on `openvox`) and
|
|
14
|
+
`puppet_fixtures`/`openfact`, all of which support Ruby 4.0.
|
|
15
|
+
- Require `simp-beaker-helpers` ~> 3.0 (for its `puppet_fixtures` migration)
|
|
16
|
+
- Changed
|
|
17
|
+
- `helpers.rb` now loads rake tasks via `voxpupuli/test/rake` +
|
|
18
|
+
`puppet_fixtures`. The puppetlabs_spec_helper task names are preserved as
|
|
19
|
+
aliases (`spec_prep` -> `fixtures:prep`, `spec_clean` -> `fixtures:clean`,
|
|
20
|
+
`spec_standalone` -> `spec:standalone`) for backwards compatibility.
|
|
21
|
+
- `voxpupuli-test` manages the `rubocop`, `rubocop-rake`, and `rubocop-rspec`
|
|
22
|
+
versions instead of pinning them in the Gemfile (its constraints would
|
|
23
|
+
otherwise conflict); `rubocop-performance` stays explicit
|
|
24
|
+
- CI now tests OpenVox 8 on Ruby 3.2 and 3.4, plus a Ruby 4.0 / OpenVox 9
|
|
25
|
+
preview (OpenVox 8 gem on Ruby 4.0)
|
|
26
|
+
|
|
27
|
+
### 5.25.0 / 2026-04-23
|
|
28
|
+
- Fixed
|
|
29
|
+
- Update bundler dependency constraint to allow < 5.0 (latest: 4.x)
|
|
30
|
+
- Update parallel dependency constraint to allow 2.x
|
|
31
|
+
- Changed
|
|
32
|
+
- Removed GitLab CI configuration (managed by puppetsync)
|
|
33
|
+
|
|
1
34
|
### 5.24.0 / 2025-10-20
|
|
2
35
|
- Fixed
|
|
3
36
|
- Update gem dependencies to allow simp-rspec-puppet-facts 4.x
|
data/Gemfile
CHANGED
|
@@ -1,21 +1,29 @@
|
|
|
1
1
|
# Variables:
|
|
2
2
|
#
|
|
3
3
|
# SIMP_GEM_SERVERS | a space/comma delimited list of rubygem servers
|
|
4
|
-
# PUPPET_VERSION | specifies the version of the puppet
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
# PUPPET_VERSION | specifies the version of the puppet/openvox gems to load
|
|
5
|
+
# OPENVOX_VERSION | overrides the openvox gem version (defaults to PUPPET_VERSION)
|
|
6
|
+
puppet_version = ENV.fetch('PUPPET_VERSION', ['>= 8', '< 9'])
|
|
7
|
+
openvox_version = ENV.fetch('OPENVOX_VERSION', puppet_version)
|
|
8
|
+
gem_sources = ENV.key?('SIMP_GEM_SERVERS') ? ENV['SIMP_GEM_SERVERS'].split(/[, ]+/) : ['https://rubygems.org']
|
|
7
9
|
|
|
8
10
|
gem_sources.each { |gem_source| source gem_source }
|
|
9
11
|
|
|
10
12
|
gemspec
|
|
11
13
|
|
|
12
14
|
gem 'simp-build-helpers'
|
|
13
|
-
|
|
15
|
+
# renovate: datasource=rubygems versioning=ruby
|
|
16
|
+
gem 'simp-beaker-helpers', ENV.fetch('SIMP_BEAKER_HELPERS_VERSION', '~> 3.0')
|
|
14
17
|
gem 'beaker_puppet_helpers'
|
|
15
18
|
gem 'rake', '>= 12.3.3'
|
|
16
19
|
gem 'beaker-docker'
|
|
17
20
|
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
gem 'openvox', openvox_version
|
|
22
|
+
|
|
23
|
+
group :test do
|
|
24
|
+
# rubocop, rubocop-rake, and rubocop-rspec are pulled in and version-pinned by
|
|
25
|
+
# voxpupuli-test; pinning them here conflicts with its constraints.
|
|
26
|
+
# rubocop-performance is not a voxpupuli-test dependency, so it stays explicit.
|
|
27
|
+
gem 'rubocop-performance', '~> 1.26.0'
|
|
20
28
|
end
|
|
21
29
|
|
data/lib/simp/command_utils.rb
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Simp; end
|
|
4
|
+
|
|
2
5
|
module Simp::CommandUtils
|
|
3
6
|
require 'facter'
|
|
4
7
|
|
|
5
|
-
def which(cmd, fail=false)
|
|
8
|
+
def which(cmd, fail = false)
|
|
6
9
|
@which_cache ||= {}
|
|
7
10
|
|
|
8
|
-
if @which_cache.
|
|
11
|
+
if @which_cache.key?(cmd)
|
|
9
12
|
command = @which_cache[cmd]
|
|
10
13
|
else
|
|
11
14
|
command = Facter::Core::Execution.which(cmd)
|
|
@@ -14,7 +17,7 @@ module Simp::CommandUtils
|
|
|
14
17
|
|
|
15
18
|
msg = "Warning: Command #{cmd} not found on the system."
|
|
16
19
|
|
|
17
|
-
(
|
|
20
|
+
(fail ? raise(msg) : warn(msg)) unless command
|
|
18
21
|
|
|
19
22
|
command
|
|
20
23
|
end
|
data/lib/simp/componentinfo.rb
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'English'
|
|
1
4
|
require 'date'
|
|
2
5
|
|
|
3
6
|
module Simp; end
|
|
@@ -8,7 +11,7 @@ class Simp::ComponentInfo
|
|
|
8
11
|
attr_accessor :component_dir, :type, :version, :release, :changelog
|
|
9
12
|
|
|
10
13
|
# A helpful method for ensuring that the errors can be easily seen
|
|
11
|
-
ERR_MARKER =
|
|
14
|
+
ERR_MARKER = 'WARNING: !!! '
|
|
12
15
|
|
|
13
16
|
# See https://fedoraproject.org/wiki/Packaging:Guidelines?rd=Packaging/Guidelines#Changelogs
|
|
14
17
|
# When matched against this regex
|
|
@@ -16,7 +19,7 @@ class Simp::ComponentInfo
|
|
|
16
19
|
# match 2 = author of the form {name} <{email}>
|
|
17
20
|
# match 3 = version
|
|
18
21
|
# match 4 = optional release qualifier; nil when absent
|
|
19
|
-
CHANGELOG_ENTRY_REGEX =
|
|
22
|
+
CHANGELOG_ENTRY_REGEX = %r{^\*\s+((?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) [0-3]{1}[0-9]{1} \d{4})\s+(.+<.+>)(?:\s+|\s*-\s*)(\d+\.\d+\.\d+)(?:-(\S+))?\s*$}.freeze # rubocop:disable Layout/LineLength
|
|
20
23
|
|
|
21
24
|
# Load component information from appropriate component files
|
|
22
25
|
#
|
|
@@ -95,50 +98,52 @@ class Simp::ComponentInfo
|
|
|
95
98
|
end
|
|
96
99
|
|
|
97
100
|
private
|
|
101
|
+
|
|
98
102
|
def load_module_info(latest_version_only, verbose)
|
|
99
103
|
require 'json'
|
|
100
104
|
metadata_file = File.join(@component_dir, 'metadata.json')
|
|
101
105
|
metadata = JSON.parse(File.read(metadata_file))
|
|
102
|
-
|
|
106
|
+
raise("ERROR: Version missing from #{metadata_file}") if metadata['version'].nil?
|
|
103
107
|
|
|
104
108
|
@version = metadata['version'].split('-').first
|
|
105
|
-
rel_bits = metadata['version'].split('-')[1
|
|
109
|
+
rel_bits = metadata['version'].split('-')[1..]
|
|
106
110
|
@release = rel_bits.empty? ? nil : rel_bits.join('-')
|
|
107
111
|
|
|
108
|
-
|
|
109
112
|
changelog_file = File.join(component_dir, 'CHANGELOG')
|
|
110
113
|
unless File.exist?(changelog_file)
|
|
111
|
-
|
|
114
|
+
raise("ERROR: No CHANGELOG file found in #{component_dir}")
|
|
112
115
|
end
|
|
113
|
-
|
|
116
|
+
|
|
117
|
+
@changelog = parse_changelog(File.read(changelog_file), latest_version_only, verbose)
|
|
114
118
|
end
|
|
115
119
|
|
|
116
120
|
def load_asset_info(latest_version_only, verbose)
|
|
117
121
|
rpm_spec_files = Dir.glob(File.join(@component_dir, 'build', '*.spec'))
|
|
118
122
|
if rpm_spec_files.empty?
|
|
119
|
-
|
|
123
|
+
raise("No RPM spec file found in #{File.join(@component_dir, 'build')}")
|
|
120
124
|
elsif rpm_spec_files.size > 1
|
|
121
|
-
|
|
125
|
+
raise("More than 1 RPM spec file found: #{rpm_spec_files.join(' ')}")
|
|
122
126
|
end
|
|
123
127
|
|
|
124
128
|
# Determine asset version, which we will ASSUME to be the main
|
|
125
129
|
# package version. The RPM query, below, will return the main
|
|
126
130
|
# package followed by subpackages.
|
|
127
|
-
version_query = "rpm -q --queryformat '%{VERSION} %{RELEASE}\\n'"
|
|
128
|
-
|
|
131
|
+
version_query = "rpm -q --queryformat '%{VERSION} %{RELEASE}\\n' " \
|
|
132
|
+
"--specfile #{rpm_spec_files[0]}"
|
|
129
133
|
|
|
130
134
|
rpm_version_list = `#{version_query} 2> /dev/null`
|
|
131
|
-
if
|
|
132
|
-
|
|
133
|
-
|
|
135
|
+
if $CHILD_STATUS.exitstatus != 0
|
|
136
|
+
raise("Could not extract version and release from #{rpm_spec_files[0]}. " \
|
|
137
|
+
"To debug, execute:\n #{version_query}")
|
|
134
138
|
end
|
|
139
|
+
num_packages = rpm_version_list.strip.split("\n").length
|
|
135
140
|
@version, @release = rpm_version_list.split("\n")[0].split
|
|
136
141
|
|
|
137
142
|
changelog_query = "rpm -q --changelog --specfile #{rpm_spec_files[0]}"
|
|
138
143
|
raw_changelog = `#{changelog_query} 2> /dev/null`
|
|
139
|
-
if
|
|
140
|
-
|
|
141
|
-
|
|
144
|
+
if $CHILD_STATUS.exitstatus != 0
|
|
145
|
+
raise("Could not extract changelog from #{rpm_spec_files[0]}. " \
|
|
146
|
+
"To debug, execute:\n #{changelog_query}")
|
|
142
147
|
elsif raw_changelog.strip.empty?
|
|
143
148
|
changelog_lines = []
|
|
144
149
|
|
|
@@ -146,17 +151,27 @@ class Simp::ComponentInfo
|
|
|
146
151
|
File.read(rpm_spec_files[0]).lines.each do |line|
|
|
147
152
|
changelog_lines << line if in_changelog
|
|
148
153
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
else
|
|
153
|
-
in_changelog = false
|
|
154
|
-
end
|
|
155
|
-
end
|
|
154
|
+
next unless line.start_with?('%')
|
|
155
|
+
|
|
156
|
+
in_changelog = line.start_with?('%changelog') || false
|
|
156
157
|
end
|
|
157
158
|
|
|
158
159
|
raw_changelog = changelog_lines.join
|
|
159
160
|
end
|
|
161
|
+
|
|
162
|
+
# RPM 6+ outputs the changelog once per subpackage when querying a spec
|
|
163
|
+
# file. Strip the duplicate sections so only the first copy is parsed.
|
|
164
|
+
if num_packages > 1 && !raw_changelog.strip.empty?
|
|
165
|
+
first_entry = raw_changelog.match(%r{^\*.+$})
|
|
166
|
+
if first_entry
|
|
167
|
+
second_start = raw_changelog.index(
|
|
168
|
+
%r{^#{Regexp.escape(first_entry[0])}$},
|
|
169
|
+
first_entry.begin(0) + 1,
|
|
170
|
+
)
|
|
171
|
+
raw_changelog = raw_changelog[0, second_start].rstrip + "\n" if second_start
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
|
|
160
175
|
@changelog = parse_changelog(raw_changelog, latest_version_only, verbose)
|
|
161
176
|
end
|
|
162
177
|
|
|
@@ -169,7 +184,7 @@ class Simp::ComponentInfo
|
|
|
169
184
|
#
|
|
170
185
|
def parse_changelog(changelog, latest_version_only, verbose)
|
|
171
186
|
# split on the entry-separating lines
|
|
172
|
-
changelog_entries = changelog.split(
|
|
187
|
+
changelog_entries = changelog.split(%r{\n\n+})
|
|
173
188
|
latest_version = nil # 1st version found is latest version
|
|
174
189
|
prev_entry_date = nil
|
|
175
190
|
changelogs = []
|
|
@@ -191,21 +206,21 @@ class Simp::ComponentInfo
|
|
|
191
206
|
current_version = Gem::Version.new(full_version)
|
|
192
207
|
latest_version = current_version if latest_version.nil?
|
|
193
208
|
if current_version > latest_version
|
|
194
|
-
|
|
209
|
+
raise('ERROR: Changelog entries are not properly version ordered')
|
|
195
210
|
end
|
|
196
211
|
|
|
197
|
-
break if latest_version_only
|
|
212
|
+
break if latest_version_only && (current_version < latest_version)
|
|
198
213
|
|
|
199
214
|
# verify dates are appropriately ordered (newest to oldest)
|
|
200
215
|
current_entry_date = Date.strptime(match[1], '%a %b %d %Y')
|
|
201
216
|
prev_entry_date = current_entry_date if prev_entry_date.nil?
|
|
202
217
|
if current_entry_date > prev_entry_date
|
|
203
|
-
|
|
218
|
+
raise('ERROR: Changelog entries are not properly date ordered')
|
|
204
219
|
end
|
|
205
220
|
|
|
206
221
|
if valid_date_weekday?(match[1], verbose)
|
|
207
222
|
entry = {
|
|
208
|
-
:date
|
|
223
|
+
:date => match[1],
|
|
209
224
|
:version => match[3],
|
|
210
225
|
:release => match[4],
|
|
211
226
|
:content => changelog_lines
|
|
@@ -235,12 +250,11 @@ class Simp::ComponentInfo
|
|
|
235
250
|
|
|
236
251
|
valid = true
|
|
237
252
|
if actual_weekday != expected_weekday
|
|
238
|
-
err_msg = ERR_MARKER + "'#{actual_weekday}' should be '#{expected_weekday}' for"
|
|
239
|
-
|
|
253
|
+
err_msg = ERR_MARKER + "'#{actual_weekday}' should be '#{expected_weekday}' for " \
|
|
254
|
+
"changelog timestamp '#{changelog_date}'"
|
|
240
255
|
warn err_msg if verbose
|
|
241
256
|
valid = false
|
|
242
257
|
end
|
|
243
|
-
|
|
258
|
+
valid
|
|
244
259
|
end
|
|
245
|
-
|
|
246
260
|
end
|