simp-rake-helpers 5.11.4 → 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 +6 -0
- data/Gemfile +1 -1
- data/lib/simp/componentinfo.rb +17 -0
- 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/helpers/version.rb +1 -1
- data/lib/simp/rpm.rb +5 -0
- data/spec/lib/simp/ci/gitlab_spec.rb +12 -13
- data/spec/lib/simp/componentinfo_spec.rb +10 -4
- data/spec/lib/simp/rake/build/helpers_spec.rb +3 -0
- data/spec/lib/simp/rake/build/rpmdeps_spec.rb +1 -2
- data/spec/lib/simp/rake/pupmod/fixtures/othermod/Gemfile +1 -10
- 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 +17 -17
- data/spec/lib/simp/rpm_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +4 -4
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,9 @@
|
|
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
|
+
|
1
7
|
### 5.11.4 / 2020-08-03
|
2
8
|
* Permit *.md files in `rake pkg:compare_latest_tag`
|
3
9
|
|
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 }
|
data/lib/simp/componentinfo.rb
CHANGED
@@ -139,6 +139,23 @@ class Simp::ComponentInfo
|
|
139
139
|
if $?.exitstatus != 0
|
140
140
|
fail("Could not extract changelog from #{rpm_spec_files[0]}." +
|
141
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
|
142
159
|
end
|
143
160
|
@changelog = parse_changelog(raw_changelog, latest_version_only, verbose)
|
144
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?
|
data/lib/simp/rpm.rb
CHANGED
@@ -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,
|
@@ -257,10 +257,16 @@ describe Simp::ComponentInfo do
|
|
257
257
|
/Could not extract version and release from /)
|
258
258
|
end
|
259
259
|
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
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.
|
264
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
|
265
271
|
end
|
266
272
|
end
|
@@ -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
|
@@ -32,8 +32,7 @@ describe 'Simp::Rake::Build::RpmDeps#get_version_requires' do
|
|
32
32
|
}.to raise_error(SIMPRpmDepVersionException)
|
33
33
|
end
|
34
34
|
|
35
|
-
|
36
|
-
pending do
|
35
|
+
it( nil, :pending => "FIXME regex doesn't catch this" ) do
|
37
36
|
expect{
|
38
37
|
Simp::Rake::Build::RpmDeps::get_version_requires(pkg, '<= 3.0.0')
|
39
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
|
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,9 +28,9 @@ 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.
|
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
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"
|
@@ -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
@@ -237,7 +237,7 @@ describe Simp::RPM do
|
|
237
237
|
ENV['SIMP_RPM_dist'] = @pre_env
|
238
238
|
end
|
239
239
|
it 'returns dist' do
|
240
|
-
Simp::RPM.
|
240
|
+
allow(Simp::RPM).to receive(:system_dist).and_return('.testdist')
|
241
241
|
rpm_obj = Simp::RPM.new( @rpm_file )
|
242
242
|
d_rpm_obj = Simp::RPM.new( @d_rpm_file )
|
243
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
|