simp-rake-helpers 5.11.0 → 5.11.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -24
- data/CHANGELOG.md +18 -0
- data/Gemfile +2 -1
- data/lib/simp/componentinfo.rb +23 -3
- data/lib/simp/rake/build/build.rb +43 -27
- data/lib/simp/rake/build/constants.rb +5 -1
- data/lib/simp/rake/build/pkg.rb +14 -2
- data/lib/simp/rake/build/rpmdeps.rb +18 -17
- data/lib/simp/rake/build/tar.rb +1 -1
- data/lib/simp/rake/helpers/assets/rpm_spec/simp6.spec +15 -1
- data/lib/simp/rake/helpers/assets/rpm_spec/simpdefault.spec +15 -1
- data/lib/simp/rake/helpers/version.rb +1 -1
- data/lib/simp/relchecks.rb +1 -1
- data/lib/simp/rpm.rb +5 -0
- data/spec/lib/simp/ci/files/job_broken_link_nodeset/spec/acceptance/suites/default/nodesets +1 -1
- data/spec/lib/simp/ci/files/job_invalid_nodeset/spec/acceptance/suites/default/nodesets +1 -1
- data/spec/lib/simp/ci/files/job_invalid_suite/spec/acceptance/suites/default/nodesets +1 -1
- data/spec/lib/simp/ci/files/job_missing_nodeset/spec/acceptance/suites/default/nodesets +1 -1
- data/spec/lib/simp/ci/files/job_missing_suite_and_nodeset/spec/acceptance/suites/default/nodesets +1 -1
- data/spec/lib/simp/ci/files/multiple_invalid_jobs/spec/acceptance/suites/default/nodesets +1 -1
- data/spec/lib/simp/ci/files/multiple_valid_jobs/spec/acceptance/suites/default/nodesets +1 -1
- data/spec/lib/simp/ci/files/no_gitlab_config_with_tests/spec/acceptance/suites/default/nodesets +1 -1
- data/spec/lib/simp/ci/files/no_gitlab_config_without_tests/spec/acceptance/suites/default/nodesets +1 -1
- data/spec/lib/simp/ci/files/suite_skeleton_only/spec/acceptance/suites/default/nodesets +1 -1
- data/spec/lib/simp/ci/files/valid_job_nodeset_dir_link/spec/acceptance/suites/default/nodesets +1 -1
- data/spec/lib/simp/ci/gitlab_spec.rb +12 -13
- data/spec/lib/simp/componentinfo_spec.rb +35 -41
- data/spec/lib/simp/files/build/testpackage.spec +1 -1
- data/spec/lib/simp/files/componentinfo_spec/module_with_prerelease_dash_in_version/CHANGELOG +14 -0
- data/spec/lib/simp/files/componentinfo_spec/module_with_prerelease_dash_in_version/metadata.json +44 -0
- data/spec/lib/simp/files/testpackage-rc0.spec +32 -0
- data/spec/lib/simp/rake/build/helpers_spec.rb +3 -0
- data/spec/lib/simp/rake/build/rpmdeps_spec.rb +3 -3
- data/spec/lib/simp/rake/pupmod/fixtures/othermod/Gemfile +1 -10
- data/spec/lib/simp/rake/pupmod/fixtures/simpmod/spec/acceptance/suites/default/nodesets +1 -1
- data/spec/lib/simp/rake_spec.rb +2 -1
- data/spec/lib/simp/relchecks_check_rpm_changelog_spec.rb +20 -10
- data/spec/lib/simp/relchecks_compare_latest_tag_spec.rb +18 -18
- data/spec/lib/simp/rpm_spec.rb +6 -1
- data/spec/spec_helper.rb +1 -1
- metadata +8 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b882eab26bdb4e92d2cddac0a080fabc1fb517f4741c61c960553201c71f649
|
4
|
+
data.tar.gz: edb33965a9af173e8e0dd9a65eb016689754b560b1c5d4c986ccb084df1c8627
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7aead3d0b88b982510a872293c77a81d848189b4e4b96ec16fe3d698d7870fa86136a244f98700d1afb2340d7084a8226c7953804eae6eccfcfe4c13d85d8d91
|
7
|
+
data.tar.gz: 319182e049295afa57e8da953980bb33b08c8b1987a7362b4d42a5d10a35c53fe0d969bc548d49719fff7ccb3635845a908e71544116a3fd840305b586f2a353
|
data/.travis.yml
CHANGED
@@ -3,35 +3,16 @@ language: ruby
|
|
3
3
|
cache: bundler
|
4
4
|
sudo: false
|
5
5
|
|
6
|
-
bundler_args: --without development system_tests
|
7
|
-
|
8
6
|
notifications:
|
9
7
|
email: false
|
10
8
|
|
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
9
|
jobs:
|
22
10
|
include:
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
- stage: acceptance
|
29
|
-
sudo: required
|
30
|
-
rvm: 2.5.1
|
31
|
-
services:
|
32
|
-
- docker
|
33
|
-
script:
|
34
|
-
- travis_wait 90 unbuffer bundle exec rake acceptance
|
11
|
+
### Testing on Travis CI is indefinitely disabled
|
12
|
+
###
|
13
|
+
### See:
|
14
|
+
### * https://blog.travis-ci.com/2020-11-02-travis-ci-new-billing
|
15
|
+
### * https://simp-project.atlassian.net/browse/SIMP-8703
|
35
16
|
|
36
17
|
- stage: deploy
|
37
18
|
rvm: 2.5.1
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
### 5.11.5 / 2020-12-02
|
2
|
+
* Add support for Puppet 7
|
3
|
+
* Work around issues with querying RPM spec file changelogs using RPM version 4.15.0+
|
4
|
+
* Switch between 'with_unbundled_env' and 'with_clean_env' based on which one
|
5
|
+
Bundler supports.
|
6
|
+
|
7
|
+
### 5.11.4 / 2020-08-03
|
8
|
+
* Permit *.md files in `rake pkg:compare_latest_tag`
|
9
|
+
|
10
|
+
### 5.11.3 / 2020-05-19
|
11
|
+
* Fix automatically added dependencies for SIMP 6.4+
|
12
|
+
|
13
|
+
### 5.11.2 / 2020-04-08
|
14
|
+
* Version information should not be required on dependencies in metadata.json
|
15
|
+
|
16
|
+
### 5.11.1 / 2020-04-07
|
17
|
+
* Puppet module RPM logic handles `-rc0` suffix in `metadata.json`
|
18
|
+
|
1
19
|
### 5.11.0 / 2020-03-16
|
2
20
|
* Add SIMP optional dependencies to RPM requires list
|
3
21
|
|
data/Gemfile
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
#
|
3
3
|
# SIMP_GEM_SERVERS | a space/comma delimited list of rubygem servers
|
4
4
|
# PUPPET_VERSION | specifies the version of the puppet gem to load
|
5
|
-
puppetversion = ENV.key?('PUPPET_VERSION') ? "#{ENV['PUPPET_VERSION']}" : '~>
|
5
|
+
puppetversion = ENV.key?('PUPPET_VERSION') ? "#{ENV['PUPPET_VERSION']}" : '~> 6'
|
6
6
|
gem_sources = ENV.key?('SIMP_GEM_SERVERS') ? ENV['SIMP_GEM_SERVERS'].split(/[, ]+/) : ['https://rubygems.org']
|
7
7
|
|
8
8
|
gem_sources.each { |gem_source| source gem_source }
|
@@ -12,6 +12,7 @@ gemspec
|
|
12
12
|
gem 'simp-build-helpers'
|
13
13
|
gem 'simp-beaker-helpers'
|
14
14
|
gem 'beaker-puppet_install_helper'
|
15
|
+
gem 'rake', '>= 12.3.3'
|
15
16
|
|
16
17
|
if puppetversion
|
17
18
|
gem 'puppet', puppetversion
|
data/lib/simp/componentinfo.rb
CHANGED
@@ -99,9 +99,12 @@ class Simp::ComponentInfo
|
|
99
99
|
require 'json'
|
100
100
|
metadata_file = File.join(@component_dir, 'metadata.json')
|
101
101
|
metadata = JSON.parse(File.read(metadata_file))
|
102
|
-
|
103
|
-
|
104
|
-
|
102
|
+
fail("ERROR: Version missing from #{metadata_file}") if metadata['version'].nil?
|
103
|
+
|
104
|
+
@version = metadata['version'].split('-').first
|
105
|
+
rel_bits = metadata['version'].split('-')[1..-1]
|
106
|
+
@release = rel_bits.empty? ? nil : rel_bits.join('-')
|
107
|
+
|
105
108
|
|
106
109
|
changelog_file = File.join(component_dir, 'CHANGELOG')
|
107
110
|
unless File.exists?(changelog_file)
|
@@ -136,6 +139,23 @@ class Simp::ComponentInfo
|
|
136
139
|
if $?.exitstatus != 0
|
137
140
|
fail("Could not extract changelog from #{rpm_spec_files[0]}." +
|
138
141
|
" To debug, execute:\n #{changelog_query}")
|
142
|
+
elsif raw_changelog.strip.empty?
|
143
|
+
changelog_lines = []
|
144
|
+
|
145
|
+
in_changelog = false
|
146
|
+
File.read(rpm_spec_files[0]).lines.each do |line|
|
147
|
+
changelog_lines << line if in_changelog
|
148
|
+
|
149
|
+
if line.start_with?('%')
|
150
|
+
if line.start_with?('%changelog')
|
151
|
+
in_changelog = true
|
152
|
+
else
|
153
|
+
in_changelog = false
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
raw_changelog = changelog_lines.join
|
139
159
|
end
|
140
160
|
@changelog = parse_changelog(raw_changelog, latest_version_only, verbose)
|
141
161
|
end
|
@@ -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
|
-
|
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,6 +95,7 @@ module Simp::Rake::Build
|
|
94
95
|
namespace :yum do
|
95
96
|
task :prep do
|
96
97
|
if $simp6
|
98
|
+
# `$simp6_build_dir` is set by the build:auto task
|
97
99
|
@build_dir = $simp6_build_dir
|
98
100
|
|
99
101
|
unless @build_dir
|
@@ -469,10 +471,10 @@ module Simp::Rake::Build
|
|
469
471
|
##############################################################################
|
470
472
|
|
471
473
|
desc <<-EOM
|
472
|
-
Create a
|
474
|
+
Create a new yum directory tree for a new distribution.
|
473
475
|
|
474
|
-
Creates a YUM
|
475
|
-
|
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]
|
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
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
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] => [:
|
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] => [:
|
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] => [:
|
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
|
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
|
|
data/lib/simp/rake/build/pkg.rb
CHANGED
@@ -69,6 +69,7 @@ module Simp::Rake::Build
|
|
69
69
|
:in_processes => get_cpu_limit,
|
70
70
|
:progress => t.name
|
71
71
|
) do |dir|
|
72
|
+
next unless File.directory?(dir)
|
72
73
|
Dir.chdir(dir) do
|
73
74
|
begin
|
74
75
|
rake_flags = Rake.application.options.trace ? '--trace' : ''
|
@@ -98,6 +99,7 @@ module Simp::Rake::Build
|
|
98
99
|
:in_processes => get_cpu_limit,
|
99
100
|
:progress => t.name
|
100
101
|
) do |dir|
|
102
|
+
next unless File.directory?(dir)
|
101
103
|
Dir.chdir(dir) do
|
102
104
|
rake_flags = Rake.application.options.trace ? '--trace' : ''
|
103
105
|
sh %{rake clobber #{rake_flags}}
|
@@ -867,8 +869,18 @@ protect=1
|
|
867
869
|
$stderr.puts("First 'rake pkg:rpm' attempt for #{dir} failed, running bundle and trying again.")
|
868
870
|
end
|
869
871
|
|
870
|
-
|
871
|
-
|
872
|
+
if Bundler.respond_to?(:with_unbundled_env)
|
873
|
+
# Bundler 2.1+
|
874
|
+
clean_env_method = :with_unbundled_env
|
875
|
+
bundle_install_cmd = %{bundle config set with 'development' && bundle install}
|
876
|
+
else
|
877
|
+
# Old Bundler
|
878
|
+
clean_env_method = :with_clean_env
|
879
|
+
bundle_install_cmd = %{bundle install --with development}
|
880
|
+
end
|
881
|
+
|
882
|
+
::Bundler.send(clean_env_method) do
|
883
|
+
%x{#{bundle_install_cmd}}
|
872
884
|
output = %x{#{cmd} 2>&1}
|
873
885
|
|
874
886
|
unless $?.success?
|
@@ -15,28 +15,29 @@ module Simp::Rake::Build::RpmDeps
|
|
15
15
|
# raises SIMPRpmDepVersionException if the dependency version
|
16
16
|
# string cannot be parsed
|
17
17
|
def self.get_version_requires(pkg, dep_version)
|
18
|
+
return ["Requires: #{pkg}"] if dep_version.nil?
|
19
|
+
return ["Requires: #{pkg} = #{$1}"] if dep_version =~ /^\s*(\d+\.\d+\.\d+)\s*$/
|
20
|
+
|
18
21
|
requires = []
|
19
|
-
if dep_version =~ /^\s*(\d+\.\d+\.\d+)\s*$/
|
20
|
-
requires << "Requires: #{pkg} = #{$1}"
|
21
|
-
else
|
22
|
-
if dep_version.include?('x')
|
23
|
-
dep_parts = dep_version.split('.')
|
24
|
-
|
25
|
-
if dep_parts.count == 3
|
26
|
-
dep_version = ">= #{dep_parts[0]}.#{dep_parts[1]}.0 < #{dep_parts[0].to_i + 1}.0.0"
|
27
|
-
else
|
28
|
-
dep_version = ">= #{dep_parts[0]}.0.0 < #{dep_parts[0].to_i + 1}.0.0"
|
29
|
-
end
|
30
|
-
end
|
31
22
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
23
|
+
if dep_version.include?('x')
|
24
|
+
dep_parts = dep_version.split('.')
|
25
|
+
|
26
|
+
if dep_parts.count == 3
|
27
|
+
dep_version = ">= #{dep_parts[0]}.#{dep_parts[1]}.0 < #{dep_parts[0].to_i + 1}.0.0"
|
36
28
|
else
|
37
|
-
|
29
|
+
dep_version = ">= #{dep_parts[0]}.0.0 < #{dep_parts[0].to_i + 1}.0.0"
|
38
30
|
end
|
39
31
|
end
|
32
|
+
|
33
|
+
# metadata.json is a LOT more forgiving than the RPM spec file
|
34
|
+
if dep_version =~ /^\s*(?:(?:([<>]=?)\s*(\d+\.\d+\.\d+))\s*(?:(<)\s*(\d+\.\d+\.\d+))?)\s*$/
|
35
|
+
requires << "Requires: #{pkg} #{$1} #{$2}"
|
36
|
+
requires << "Requires: #{pkg} #{$3} #{$4}" if $3
|
37
|
+
else
|
38
|
+
raise SIMPRpmDepVersionException.new
|
39
|
+
end
|
40
|
+
|
40
41
|
requires
|
41
42
|
end
|
42
43
|
|
data/lib/simp/rake/build/tar.rb
CHANGED
@@ -62,7 +62,7 @@ module Simp::Rake::Build
|
|
62
62
|
else
|
63
63
|
required_rpms['noarch'] << 'simp-rsync-skeleton'
|
64
64
|
required_rpms['noarch'] << 'simp-environment-skeleton'
|
65
|
-
required_rpms['noarch'] << 'simp-
|
65
|
+
required_rpms['noarch'] << 'simp-selinux-policy'
|
66
66
|
end
|
67
67
|
|
68
68
|
rpm_dir = File.join(@build_dir,'SIMP','RPMS')
|
@@ -196,14 +196,28 @@ end
|
|
196
196
|
|
197
197
|
-- Get the Module Version
|
198
198
|
|
199
|
-
|
199
|
+
-- Note on '-rc0' style Release versions in metadata.json:
|
200
|
+
-- Some Puppet orgs (like voxpupuli) append '-rc0' to the module version
|
201
|
+
-- to denote prerelease status and act as a safety check (because the Forge
|
202
|
+
-- only accepts release in SemVer \d+\.\d+\.\d+ release format)
|
203
|
+
--
|
204
|
+
-- This code will remove a '-rc0' style prerelease string from the RPM
|
205
|
+
-- Version, and use it as the default RPM Release (instead of '-0')
|
200
206
|
|
207
|
+
local version_match = metadata:match('"version":%s+"(.-)"%s*,'):gsub('-.*','')
|
201
208
|
if version_match then
|
202
209
|
package_version = version_match
|
203
210
|
else
|
204
211
|
error("Could not find valid package version in 'metadata.json'", 0)
|
205
212
|
end
|
206
213
|
|
214
|
+
-- Get the Module Release (if present)
|
215
|
+
|
216
|
+
local release_match = metadata:match('"version":%s+"[%d.]+-([^"]+)"')
|
217
|
+
|
218
|
+
if release_match then
|
219
|
+
package_release = release_match
|
220
|
+
end
|
207
221
|
}
|
208
222
|
|
209
223
|
%{lua:
|
@@ -196,14 +196,28 @@ end
|
|
196
196
|
|
197
197
|
-- Get the Module Version
|
198
198
|
|
199
|
-
|
199
|
+
-- Note on '-rc0' style Release versions in metadata.json:
|
200
|
+
-- Some Puppet orgs (like voxpupuli) append '-rc0' to the module version
|
201
|
+
-- to denote prerelease status and act as a safety check (because the Forge
|
202
|
+
-- only accepts release in SemVer \d+\.\d+\.\d+ release format)
|
203
|
+
--
|
204
|
+
-- This code will remove a '-rc0' style prerelease string from the RPM
|
205
|
+
-- Version, and use it as the default RPM Release (instead of '-0')
|
200
206
|
|
207
|
+
local version_match = metadata:match('"version":%s+"(.-)"%s*,'):gsub('-.*','')
|
201
208
|
if version_match then
|
202
209
|
package_version = version_match
|
203
210
|
else
|
204
211
|
error("Could not find valid package version in 'metadata.json'", 0)
|
205
212
|
end
|
206
213
|
|
214
|
+
-- Get the Module Release (if present)
|
215
|
+
|
216
|
+
local release_match = metadata:match('"version":%s+"[%d.]+-([^"]+)"')
|
217
|
+
|
218
|
+
if release_match then
|
219
|
+
package_release = release_match
|
220
|
+
end
|
207
221
|
}
|
208
222
|
|
209
223
|
%{lua:
|
data/lib/simp/relchecks.rb
CHANGED
@@ -87,7 +87,7 @@ class Simp::RelChecks
|
|
87
87
|
# determine mission-impacting files that have changed
|
88
88
|
files_changed = `git diff tags/#{last_tag} --name-only`.strip.split("\n")
|
89
89
|
files_changed.delete_if do |file|
|
90
|
-
file[0] == '.' or file == 'Rakefile' or file =~ /^Gemfile|^spec\/|^doc\/|^rakelib
|
90
|
+
file[0] == '.' or file == 'Rakefile' or file =~ /^Gemfile|^spec\/|^doc\/|^rakelib\/|.*\.md\Z/
|
91
91
|
end
|
92
92
|
|
93
93
|
if files_changed.empty?
|
data/lib/simp/rpm.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
../../nodesets
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
../../nodesets
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
../../nodesets
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
../../nodesets
|
data/spec/lib/simp/ci/files/job_missing_suite_and_nodeset/spec/acceptance/suites/default/nodesets
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
../../nodesets
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
../../nodesets
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
../../nodesets
|
data/spec/lib/simp/ci/files/no_gitlab_config_with_tests/spec/acceptance/suites/default/nodesets
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
../../nodesets
|
data/spec/lib/simp/ci/files/no_gitlab_config_without_tests/spec/acceptance/suites/default/nodesets
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
../../nodesets
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
../../nodesets
|
data/spec/lib/simp/ci/files/valid_job_nodeset_dir_link/spec/acceptance/suites/default/nodesets
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
../../nodesets
|
@@ -35,8 +35,7 @@ describe Simp::Ci::Gitlab do
|
|
35
35
|
describe '#validate_config' do
|
36
36
|
it 'succeeds when no .gitlab-ci.yml file exists and no tests exist' do
|
37
37
|
proj_dir = File.join(files_dir, 'no_gitlab_config_without_tests')
|
38
|
-
expect{ Simp::Ci::Gitlab.new(proj_dir).validate_config }.
|
39
|
-
to_not raise_error
|
38
|
+
expect{ Simp::Ci::Gitlab.new(proj_dir).validate_config }.to_not raise_error
|
40
39
|
end
|
41
40
|
|
42
41
|
it 'succeeds but warns when no .gitlab-ci.yml file exists but tests exist' do
|
@@ -56,9 +55,9 @@ describe Simp::Ci::Gitlab do
|
|
56
55
|
proj_dir = File.join(files_dir, 'valid_job_suite_nodeset')
|
57
56
|
validator = Simp::Ci::Gitlab.new(proj_dir)
|
58
57
|
|
59
|
-
validator.
|
58
|
+
expect(validator).to receive(:`).with('which curl').and_return('/usr/bin/curl')
|
60
59
|
gitlab_response = '{"status":"valid","errors":[]}'
|
61
|
-
validator.
|
60
|
+
expect(validator).to receive(:`).with(/(?!which curl).*/).and_return(gitlab_response)
|
62
61
|
|
63
62
|
expect{ validator.validate_config }.
|
64
63
|
to_not raise_error
|
@@ -68,9 +67,9 @@ describe Simp::Ci::Gitlab do
|
|
68
67
|
proj_dir = File.join(files_dir, 'valid_job_suite_nodeset')
|
69
68
|
validator = Simp::Ci::Gitlab.new(proj_dir)
|
70
69
|
|
71
|
-
validator.
|
70
|
+
expect(validator).to receive(:`).with('which curl').and_return('/usr/bin/curl')
|
72
71
|
gitlab_response = '{"status":"invalid","errors":["root config contains unknown keys: pup5.5-unit"]}'
|
73
|
-
validator.
|
72
|
+
expect(validator).to receive(:`).with(/(?!which curl).*/).and_return(gitlab_response)
|
74
73
|
|
75
74
|
expect{ validator.validate_config }.
|
76
75
|
to raise_error(Simp::Ci::Gitlab::LintError,
|
@@ -97,7 +96,7 @@ describe Simp::Ci::Gitlab do
|
|
97
96
|
proj_dir = File.join(files_dir, 'valid_job_suite_nodeset')
|
98
97
|
validator = Simp::Ci::Gitlab.new(proj_dir)
|
99
98
|
|
100
|
-
validator.
|
99
|
+
expect(validator).to receive(:`).and_return('')
|
101
100
|
|
102
101
|
expect{ validator.validate_yaml }.
|
103
102
|
to output(/Could not find 'curl'/).to_stdout
|
@@ -107,8 +106,8 @@ describe Simp::Ci::Gitlab do
|
|
107
106
|
proj_dir = File.join(files_dir, 'valid_job_suite_nodeset')
|
108
107
|
validator = Simp::Ci::Gitlab.new(proj_dir)
|
109
108
|
|
110
|
-
validator.
|
111
|
-
validator.
|
109
|
+
expect(validator).to receive(:`).with('which curl').and_return('/usr/bin/curl')
|
110
|
+
expect(validator).to receive(:`).with(/(?!which curl).*/).and_return('{}')
|
112
111
|
|
113
112
|
expect{ validator.validate_yaml }.
|
114
113
|
to output(/Unable to lint check/).to_stdout
|
@@ -118,9 +117,9 @@ describe Simp::Ci::Gitlab do
|
|
118
117
|
proj_dir = File.join(files_dir, 'valid_job_suite_nodeset')
|
119
118
|
validator = Simp::Ci::Gitlab.new(proj_dir)
|
120
119
|
|
121
|
-
validator.
|
120
|
+
expect(validator).to receive(:`).with('which curl').and_return('/usr/bin/curl')
|
122
121
|
gitlab_response = '{"status":"valid","errors":[]}'
|
123
|
-
validator.
|
122
|
+
expect(validator).to receive(:`).with(/(?!which curl).*/).and_return(gitlab_response)
|
124
123
|
|
125
124
|
expect{ validator.validate_yaml }.
|
126
125
|
to_not raise_error
|
@@ -132,9 +131,9 @@ describe Simp::Ci::Gitlab do
|
|
132
131
|
proj_dir = File.join(files_dir, 'valid_job_suite_nodeset')
|
133
132
|
validator = Simp::Ci::Gitlab.new(proj_dir)
|
134
133
|
|
135
|
-
validator.
|
134
|
+
expect(validator).to receive(:`).with('which curl').and_return('/usr/bin/curl')
|
136
135
|
gitlab_response = '{"status":"invalid","errors":["root config contains unknown keys: pup5.5-unit"]}'
|
137
|
-
validator.
|
136
|
+
expect(validator).to receive(:`).with(/(?!which curl).*/).and_return(gitlab_response)
|
138
137
|
|
139
138
|
expect{ validator.validate_yaml }.
|
140
139
|
to raise_error(Simp::Ci::Gitlab::LintError,
|
@@ -7,14 +7,11 @@ describe Simp::ComponentInfo do
|
|
7
7
|
}
|
8
8
|
|
9
9
|
context 'with valid module input' do
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
expect( info.version ).to eq '3.8.0'
|
16
|
-
expect( info.release ).to be nil
|
17
|
-
expected_changelog = [
|
10
|
+
let(:component_dir){ File.join(files_dir, 'module') }
|
11
|
+
let(:info){ Simp::ComponentInfo.new(component_dir) }
|
12
|
+
let(:expected_release) { nil }
|
13
|
+
let(:expected_changelog) do
|
14
|
+
[
|
18
15
|
{
|
19
16
|
:date => 'Wed Nov 15 2017',
|
20
17
|
:version => '3.8.0',
|
@@ -56,37 +53,28 @@ describe Simp::ComponentInfo do
|
|
56
53
|
]
|
57
54
|
}
|
58
55
|
]
|
59
|
-
expect(info.changelog).to eq expected_changelog
|
60
56
|
end
|
61
57
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
expect( info.
|
66
|
-
expect( info.
|
67
|
-
expect(
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
:release => '0',
|
83
|
-
:content => [
|
84
|
-
'* Mon Nov 06 2017 Tom Smith <tom.smith@simp.com> - 3.8.0-0',
|
85
|
-
'- Fixes split failure when "findmnt" does not exist on Linux'
|
86
|
-
]
|
87
|
-
}
|
88
|
-
]
|
89
|
-
expect(info.changelog).to eq expected_changelog
|
58
|
+
shared_examples 'an instance with expected module data' do
|
59
|
+
it { expect( info.component_dir ).to eq component_dir }
|
60
|
+
it { expect( info.type ).to eq :module }
|
61
|
+
it { expect( info.version ).to eq '3.8.0' }
|
62
|
+
it { expect( info.release ).to eq expected_release }
|
63
|
+
it { expect(info.changelog).to eq expected_changelog }
|
64
|
+
end
|
65
|
+
|
66
|
+
it_behaves_like 'an instance with expected module data'
|
67
|
+
|
68
|
+
context 'with loads version and latest-version-only changelog info' do
|
69
|
+
let(:info){Simp::ComponentInfo.new(component_dir, true)}
|
70
|
+
let(:expected_changelog){ super()[0..1] }
|
71
|
+
it_behaves_like 'an instance with expected module data'
|
72
|
+
end
|
73
|
+
|
74
|
+
context 'with a module version containing a prerelease suffix (3.8.0-rc0)' do
|
75
|
+
let(:component_dir){ File.join(files_dir, 'module_with_prerelease_dash_in_version') }
|
76
|
+
let(:expected_release){ 'rc0' }
|
77
|
+
it_behaves_like 'an instance with expected module data'
|
90
78
|
end
|
91
79
|
end
|
92
80
|
|
@@ -269,10 +257,16 @@ describe Simp::ComponentInfo do
|
|
269
257
|
/Could not extract version and release from /)
|
270
258
|
end
|
271
259
|
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
260
|
+
it 'fails when changelog cannot be read from asset RPM spec file' do
|
261
|
+
skip(
|
262
|
+
<<~SKIP.strip.split("\n").join(' ')
|
263
|
+
This has to be a case in which version and release can be read from
|
264
|
+
spec file but the changelog (which is optional) can't.
|
276
265
|
|
266
|
+
It *could* be mocked, but is probably not worth the LOE unless we
|
267
|
+
encounter a real-world test case."
|
268
|
+
SKIP
|
269
|
+
)
|
270
|
+
end
|
277
271
|
end
|
278
272
|
end
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
../testpackage.spec
|
@@ -0,0 +1,14 @@
|
|
1
|
+
* Wed Nov 15 2017 Mary Jones <mary.jones@simp.com> - 3.8.0-0
|
2
|
+
- Disable deprecation warnings by default
|
3
|
+
|
4
|
+
* Mon Nov 06 2017 Tom Smith <tom.smith@simp.com> - 3.8.0-0
|
5
|
+
- Fixes split failure when "findmnt" does not exist on Linux
|
6
|
+
|
7
|
+
* Thu Oct 26 2017 Mary Jones <mary.jones@simp.com> - 3.7.0-0
|
8
|
+
- Add Mod::Macaddress data type
|
9
|
+
|
10
|
+
* Tue Sep 26 2017 Joe Brown <joe.brown@simp.com> - 3.6.0-0
|
11
|
+
- Convert all 'sysctl' 'kernel.shm*' entries to Strings
|
12
|
+
- shmall and shmmax were causing Facter and newer versions of Puppet to crash
|
13
|
+
- See FACT-1732 for additional information
|
14
|
+
- Add Puppet function `mod::assert_metadata_os()`
|
data/spec/lib/simp/files/componentinfo_spec/module_with_prerelease_dash_in_version/metadata.json
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
{
|
2
|
+
"name": "simp-module",
|
3
|
+
"version": "3.8.0-rc0",
|
4
|
+
"author": "SIMP Team",
|
5
|
+
"summary": "A collection of common SIMP functions, facts, and types",
|
6
|
+
"license": "Apache-2.0",
|
7
|
+
"source": "https://github.com/simp/pupmod-simp-simplib",
|
8
|
+
"project_page": "https://github.com/simp/pupmod-simp-simplib",
|
9
|
+
"issues_url": "https://simp-project.atlassian.net",
|
10
|
+
"tags": [
|
11
|
+
"simp",
|
12
|
+
"functions",
|
13
|
+
"facts",
|
14
|
+
"types",
|
15
|
+
"alias",
|
16
|
+
"library"
|
17
|
+
],
|
18
|
+
"dependencies": [
|
19
|
+
|
20
|
+
],
|
21
|
+
"operatingsystem_support": [
|
22
|
+
{
|
23
|
+
"operatingsystem": "RedHat",
|
24
|
+
"operatingsystemrelease": [
|
25
|
+
"6",
|
26
|
+
"7"
|
27
|
+
]
|
28
|
+
},
|
29
|
+
{
|
30
|
+
"operatingsystem": "CentOS",
|
31
|
+
"operatingsystemrelease": [
|
32
|
+
"6",
|
33
|
+
"7"
|
34
|
+
]
|
35
|
+
}
|
36
|
+
],
|
37
|
+
"requirements": [
|
38
|
+
{
|
39
|
+
"name": "puppet",
|
40
|
+
"version_requirement": ">= 4.7.0 < 6.0.0"
|
41
|
+
}
|
42
|
+
],
|
43
|
+
"package_release_version": "0"
|
44
|
+
}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
Name: testpackage
|
2
|
+
Version: 1.0.0
|
3
|
+
Release: rc0
|
4
|
+
Summary: dummy test package
|
5
|
+
BuildArch: noarch
|
6
|
+
|
7
|
+
License: Apache-2.0
|
8
|
+
URL: http://foo.bar
|
9
|
+
|
10
|
+
%description
|
11
|
+
A dummy package used to test Simp::RPM methods
|
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
|
+
* Wed Jun 10 2015 nobody
|
32
|
+
- some comment
|
@@ -4,7 +4,10 @@ require 'spec_helper'
|
|
4
4
|
describe Simp::Rake::Build::Helpers do
|
5
5
|
before :each do
|
6
6
|
dir = File.expand_path( '../../files/simp_build', File.dirname( __FILE__ ) )
|
7
|
+
env = ENV['SIMP_RPM_dist'].dup
|
8
|
+
ENV['SIMP_RPM_dist'] = '.el7'
|
7
9
|
@obj = Simp::Rake::Build::Helpers.new( dir )
|
10
|
+
ENV['SIMP_RPM_dist'] = env
|
8
11
|
end
|
9
12
|
|
10
13
|
describe "#initialize" do
|
@@ -16,7 +16,8 @@ describe 'Simp::Rake::Build::RpmDeps#get_version_requires' do
|
|
16
16
|
"5.x" => ['Requires: pupmod-foo-bar >= 5.0.0',
|
17
17
|
'Requires: pupmod-foo-bar < 6.0.0'],
|
18
18
|
"6.4.x" => ['Requires: pupmod-foo-bar >= 6.4.0',
|
19
|
-
'Requires: pupmod-foo-bar < 7.0.0']
|
19
|
+
'Requires: pupmod-foo-bar < 7.0.0'],
|
20
|
+
nil => ['Requires: pupmod-foo-bar']
|
20
21
|
}.each do |input, output|
|
21
22
|
it do
|
22
23
|
expect(Simp::Rake::Build::RpmDeps::get_version_requires(pkg, input)).to eq output
|
@@ -31,8 +32,7 @@ describe 'Simp::Rake::Build::RpmDeps#get_version_requires' do
|
|
31
32
|
}.to raise_error(SIMPRpmDepVersionException)
|
32
33
|
end
|
33
34
|
|
34
|
-
|
35
|
-
pending do
|
35
|
+
it( nil, :pending => "FIXME regex doesn't catch this" ) do
|
36
36
|
expect{
|
37
37
|
Simp::Rake::Build::RpmDeps::get_version_requires(pkg, '<= 3.0.0')
|
38
38
|
}.to raise_error(SIMPRpmDepVersionException)
|
@@ -1,18 +1,9 @@
|
|
1
1
|
source ENV['GEM_SOURCE'] || 'https://rubygems.org'
|
2
2
|
|
3
|
-
puppetversion = ENV.key?('PUPPET_VERSION') ? ENV['PUPPET_VERSION'] : ['>=
|
3
|
+
puppetversion = ENV.key?('PUPPET_VERSION') ? ENV['PUPPET_VERSION'] : ['>= 5.5']
|
4
4
|
gem 'metadata-json-lint'
|
5
5
|
gem 'puppet', puppetversion
|
6
6
|
gem 'puppetlabs_spec_helper', '>= 1.0.0'
|
7
7
|
gem 'puppet-lint', '>= 1.0.0'
|
8
8
|
gem 'facter', '>= 1.7.0'
|
9
9
|
gem 'rspec-puppet'
|
10
|
-
|
11
|
-
# rspec must be v2 for ruby 1.8.7
|
12
|
-
if RUBY_VERSION >= '1.8.7' && RUBY_VERSION < '1.9'
|
13
|
-
gem 'rspec', '~> 2.0'
|
14
|
-
gem 'rake', '~> 10.0'
|
15
|
-
else
|
16
|
-
# rubocop requires ruby >= 1.9
|
17
|
-
gem 'rubocop'
|
18
|
-
end
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
../../nodesets
|
data/spec/lib/simp/rake_spec.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'simp/relchecks'
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
|
+
rpm_version = Simp::RPM.version
|
5
|
+
|
4
6
|
describe 'Simp::RelChecks.check_rpm_changelog' do
|
5
7
|
let(:files_dir) {
|
6
8
|
File.join( File.dirname(__FILE__), 'files', File.basename(__FILE__, '.rb'))
|
@@ -31,19 +33,27 @@ describe 'Simp::RelChecks.check_rpm_changelog' do
|
|
31
33
|
|
32
34
|
context 'with changelog errors' do
|
33
35
|
it 'fails for a Puppet module' do
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
if Gem::Version.new(rpm_version) > Gem::Version.new('4.15.0')
|
37
|
+
skip("RPM #{rpm_version} does not properly process changelog entries")
|
38
|
+
else
|
39
|
+
component_dir = File.join(files_dir, 'module_with_misordered_entries')
|
40
|
+
component_spec = File.join(templates_dir, 'simpdefault.spec')
|
41
|
+
|
42
|
+
expect{ Simp::RelChecks.check_rpm_changelog(component_dir, component_spec) }.
|
43
|
+
to raise_error(/ERROR: Invalid changelog for module_with_misordered_entries/)
|
44
|
+
end
|
39
45
|
end
|
40
46
|
|
41
47
|
it 'fails for a non-Puppet asset' do
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
48
|
+
if Gem::Version.new(rpm_version) > Gem::Version.new('4.15.0')
|
49
|
+
skip("RPM #{rpm_version} does not properly process changelog entries")
|
50
|
+
else
|
51
|
+
component_dir = File.join(files_dir, 'asset_with_misordered_entries')
|
52
|
+
component_spec = File.join(component_dir, 'build', 'asset_with_misordered_entries.spec')
|
53
|
+
|
54
|
+
expect{ Simp::RelChecks.check_rpm_changelog(component_dir, component_spec) }.
|
55
|
+
to raise_error(/ERROR: Invalid changelog for asset_with_misordered_entries/)
|
56
|
+
end
|
47
57
|
end
|
48
58
|
end
|
49
59
|
end
|
@@ -10,17 +10,17 @@ describe 'Simp::RelChecks.compare_latest_tag' do
|
|
10
10
|
|
11
11
|
context 'with no project errors' do
|
12
12
|
it 'reports no tags for a project with no tags' do
|
13
|
-
Simp::RelChecks.
|
14
|
-
Simp::RelChecks.
|
13
|
+
expect(Simp::RelChecks).to receive(:`).with('git fetch -t origin 2>/dev/null').and_return("\n")
|
14
|
+
expect(Simp::RelChecks).to receive(:`).with('git tag -l').and_return("\n")
|
15
15
|
|
16
16
|
expect{ Simp::RelChecks.compare_latest_tag(component_dir) }.
|
17
17
|
to output(" No tags exist from origin\n").to_stdout
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'reports no new tag required when no files have changed' do
|
21
|
-
Simp::RelChecks.
|
22
|
-
Simp::RelChecks.
|
23
|
-
Simp::RelChecks.
|
21
|
+
expect(Simp::RelChecks).to receive(:`).with('git fetch -t origin 2>/dev/null').and_return("\n")
|
22
|
+
expect(Simp::RelChecks).to receive(:`).with('git tag -l').and_return("1.0.0-pre\n1.0.0\n1.1.0\n")
|
23
|
+
expect(Simp::RelChecks).to receive(:`).with('git diff tags/1.1.0 --name-only').and_return("\n")
|
24
24
|
|
25
25
|
msg = " No new tag required: No significant files have changed since '1.1.0' tag\n"
|
26
26
|
expect{ Simp::RelChecks.compare_latest_tag(component_dir) }.
|
@@ -28,10 +28,10 @@ describe 'Simp::RelChecks.compare_latest_tag' do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
it 'reports no new tag required when no significant files have changed' do
|
31
|
-
Simp::RelChecks.
|
32
|
-
Simp::RelChecks.
|
33
|
-
Simp::RelChecks.
|
34
|
-
".travis.yml\nRakefile\nGemfile.lock\nspec/some_spec.rb\ndoc/index.html\nrakelib/mytasks.rake\n")
|
31
|
+
expect(Simp::RelChecks).to receive(:`).with('git fetch -t origin 2>/dev/null').and_return("\n")
|
32
|
+
expect(Simp::RelChecks).to receive(:`).with('git tag -l').and_return("1.0.0\nv1.0.1\n1.1.0\n")
|
33
|
+
expect(Simp::RelChecks).to receive(:`).with('git diff tags/1.1.0 --name-only').and_return(
|
34
|
+
".travis.yml\nRakefile\nREFERENCE.md\nGemfile.lock\nspec/some_spec.rb\ndoc/index.html\nrakelib/mytasks.rake\n")
|
35
35
|
|
36
36
|
msg = " No new tag required: No significant files have changed since '1.1.0' tag\n"
|
37
37
|
expect{ Simp::RelChecks.compare_latest_tag(component_dir) }.
|
@@ -39,9 +39,9 @@ describe 'Simp::RelChecks.compare_latest_tag' do
|
|
39
39
|
end
|
40
40
|
|
41
41
|
it 'reports a new tag is required for significant changes with bumped version' do
|
42
|
-
Simp::RelChecks.
|
43
|
-
Simp::RelChecks.
|
44
|
-
Simp::RelChecks.
|
42
|
+
expect(Simp::RelChecks).to receive(:`).with('git fetch -t origin 2>/dev/null').and_return("\n")
|
43
|
+
expect(Simp::RelChecks).to receive(:`).with('git tag -l').and_return("1.0.0\n1.1.0-RC01\n")
|
44
|
+
expect(Simp::RelChecks).to receive(:`).with('git diff tags/1.0.0 --name-only').and_return(
|
45
45
|
"CHANGELOG\nmetadata.json\nmanifest/init.pp\n")
|
46
46
|
|
47
47
|
msg = <<-EOM
|
@@ -58,9 +58,9 @@ NOTICE: New tag of version '1.1.0' is required for 3 changed files:
|
|
58
58
|
|
59
59
|
context 'with project errors' do
|
60
60
|
it 'fails when latest version < latest tag' do
|
61
|
-
Simp::RelChecks.
|
62
|
-
Simp::RelChecks.
|
63
|
-
Simp::RelChecks.
|
61
|
+
expect(Simp::RelChecks).to receive(:`).with('git fetch -t origin 2>/dev/null').and_return("\n")
|
62
|
+
expect(Simp::RelChecks).to receive(:`).with('git tag -l').and_return("1.0.0\n1.2.0\n")
|
63
|
+
expect(Simp::RelChecks).to receive(:`).with('git diff tags/1.2.0 --name-only').and_return(
|
64
64
|
"CHANGELOG\nmetadata.json\nmanifest/init.pp\n")
|
65
65
|
|
66
66
|
expect{ Simp::RelChecks.compare_latest_tag(component_dir) }.
|
@@ -68,9 +68,9 @@ NOTICE: New tag of version '1.1.0' is required for 3 changed files:
|
|
68
68
|
end
|
69
69
|
|
70
70
|
it 'fails when significant file changes need a version bump' do
|
71
|
-
Simp::RelChecks.
|
72
|
-
Simp::RelChecks.
|
73
|
-
Simp::RelChecks.
|
71
|
+
expect(Simp::RelChecks).to receive(:`).with('git fetch -t origin 2>/dev/null').and_return("\n")
|
72
|
+
expect(Simp::RelChecks).to receive(:`).with('git tag -l').and_return("1.0.0\n1.1.0\n")
|
73
|
+
expect(Simp::RelChecks).to receive(:`).with('git diff tags/1.1.0 --name-only').and_return(
|
74
74
|
"manifest/init.pp\n")
|
75
75
|
|
76
76
|
expect{ Simp::RelChecks.compare_latest_tag(component_dir) }.
|
data/spec/lib/simp/rpm_spec.rb
CHANGED
@@ -20,6 +20,9 @@ describe Simp::RPM do
|
|
20
20
|
@d_rpm_file = File.join( dir, 'testpackage-1-0.el7.noarch.rpm' )
|
21
21
|
@d_rpm_obj = Simp::RPM.new( @d_rpm_file )
|
22
22
|
|
23
|
+
@rc0_spec_file = File.join( dir, 'testpackage-rc0.spec' )
|
24
|
+
@rc0_spec_obj = Simp::RPM.new( @rc0_spec_file )
|
25
|
+
|
23
26
|
#FIXME
|
24
27
|
# @signed_rpm_file = File.join( dir, 'testpackage-1-0.noarch.rpm' )
|
25
28
|
# @signed_rpm_obj = Simp::RPM.new( @signed_rpm_file )
|
@@ -85,6 +88,7 @@ describe Simp::RPM do
|
|
85
88
|
expect( @m_spec_obj.version ).to eq '1'
|
86
89
|
expect( @m_spec_obj.version('testpackage') ).to eq '1'
|
87
90
|
expect( @m_spec_obj.version('testpackage-doc') ).to eq '1.0.1'
|
91
|
+
expect( @rc0_spec_obj.version ).to eq '1.0.0'
|
88
92
|
end
|
89
93
|
|
90
94
|
it 'fails when invalid package specified' do
|
@@ -103,6 +107,7 @@ describe Simp::RPM do
|
|
103
107
|
expect( @m_spec_obj.release ).to eq '0'
|
104
108
|
expect( @m_spec_obj.release('testpackage') ).to eq '0'
|
105
109
|
expect( @m_spec_obj.release('testpackage-doc') ).to eq '2'
|
110
|
+
expect( @rc0_spec_obj.release ).to eq 'rc0'
|
106
111
|
end
|
107
112
|
|
108
113
|
it 'fails when invalid package specified' do
|
@@ -232,7 +237,7 @@ describe Simp::RPM do
|
|
232
237
|
ENV['SIMP_RPM_dist'] = @pre_env
|
233
238
|
end
|
234
239
|
it 'returns dist' do
|
235
|
-
Simp::RPM.
|
240
|
+
allow(Simp::RPM).to receive(:system_dist).and_return('.testdist')
|
236
241
|
rpm_obj = Simp::RPM.new( @rpm_file )
|
237
242
|
d_rpm_obj = Simp::RPM.new( @d_rpm_file )
|
238
243
|
spec_obj = Simp::RPM.new( @spec_file )
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simp-rake-helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.11.
|
4
|
+
version: 5.11.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Tessmer
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-12-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: simp-beaker-helpers
|
@@ -74,7 +74,7 @@ dependencies:
|
|
74
74
|
version: '3.0'
|
75
75
|
- - "<"
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version: '
|
77
|
+
version: '8.0'
|
78
78
|
type: :runtime
|
79
79
|
prerelease: false
|
80
80
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -84,7 +84,7 @@ dependencies:
|
|
84
84
|
version: '3.0'
|
85
85
|
- - "<"
|
86
86
|
- !ruby/object:Gem::Version
|
87
|
-
version: '
|
87
|
+
version: '8.0'
|
88
88
|
- !ruby/object:Gem::Dependency
|
89
89
|
name: puppet-lint
|
90
90
|
requirement: !ruby/object:Gem::Requirement
|
@@ -534,6 +534,8 @@ files:
|
|
534
534
|
- spec/lib/simp/files/componentinfo_spec/module_with_invalid_weekday_entry/metadata.json
|
535
535
|
- spec/lib/simp/files/componentinfo_spec/module_with_malformed_metadata/CHANGELOG
|
536
536
|
- spec/lib/simp/files/componentinfo_spec/module_with_malformed_metadata/metadata.json
|
537
|
+
- spec/lib/simp/files/componentinfo_spec/module_with_prerelease_dash_in_version/CHANGELOG
|
538
|
+
- spec/lib/simp/files/componentinfo_spec/module_with_prerelease_dash_in_version/metadata.json
|
537
539
|
- spec/lib/simp/files/componentinfo_spec/module_with_version_misordered_entries/CHANGELOG
|
538
540
|
- spec/lib/simp/files/componentinfo_spec/module_with_version_misordered_entries/metadata.json
|
539
541
|
- spec/lib/simp/files/componentinfo_spec/module_without_changelog/metadata.json
|
@@ -568,6 +570,7 @@ files:
|
|
568
570
|
- spec/lib/simp/files/testpackage-1-0.noarch.rpm
|
569
571
|
- spec/lib/simp/files/testpackage-dist.spec
|
570
572
|
- spec/lib/simp/files/testpackage-multi.spec
|
573
|
+
- spec/lib/simp/files/testpackage-rc0.spec
|
571
574
|
- spec/lib/simp/files/testpackage.spec
|
572
575
|
- spec/lib/simp/local_gpg_signing_key_spec.rb.beaker-only
|
573
576
|
- spec/lib/simp/packer/iso_vars_json_spec.rb
|
@@ -647,8 +650,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
647
650
|
- !ruby/object:Gem::Version
|
648
651
|
version: '0'
|
649
652
|
requirements: []
|
650
|
-
|
651
|
-
rubygems_version: 2.7.7
|
653
|
+
rubygems_version: 3.0.8
|
652
654
|
signing_key:
|
653
655
|
specification_version: 4
|
654
656
|
summary: SIMP rake helpers
|