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
data/lib/simp/rake/build/deps.rb
CHANGED
|
@@ -1,62 +1,60 @@
|
|
|
1
1
|
#!/usr/bin/rake -T
|
|
2
|
+
# frozen_string_literal: true
|
|
2
3
|
|
|
4
|
+
require 'English'
|
|
3
5
|
require 'yaml'
|
|
4
6
|
|
|
5
7
|
class R10KHelper
|
|
6
|
-
attr_accessor :puppetfile
|
|
7
|
-
attr_accessor :modules
|
|
8
|
-
attr_accessor :basedir
|
|
8
|
+
attr_accessor :puppetfile, :modules, :basedir
|
|
9
9
|
|
|
10
10
|
require 'r10k/puppetfile'
|
|
11
11
|
|
|
12
12
|
# Horrible, but we need to be able to manipulate the cache
|
|
13
13
|
class R10K::Git::ShellGit::ThinRepository
|
|
14
|
-
|
|
15
|
-
@cache_repo
|
|
16
|
-
end
|
|
14
|
+
attr_reader :cache_repo
|
|
17
15
|
|
|
18
16
|
# Return true if the repository has local modifications, false otherwise.
|
|
19
|
-
def dirty?(
|
|
17
|
+
def dirty?(_exclude_spec = false)
|
|
20
18
|
repo_status = false
|
|
21
19
|
|
|
22
20
|
return repo_status unless File.directory?(path)
|
|
23
21
|
|
|
24
22
|
Dir.chdir(path) do
|
|
25
|
-
|
|
26
|
-
repo_status = "Could not update git index for '#{path}'" unless
|
|
23
|
+
`git update-index -q --ignore-submodules --refresh`
|
|
24
|
+
repo_status = "Could not update git index for '#{path}'" unless $CHILD_STATUS.success?
|
|
27
25
|
|
|
28
26
|
unless repo_status
|
|
29
|
-
|
|
30
|
-
repo_status = "'#{path}' has unstaged changes" unless
|
|
27
|
+
`git diff-files --quiet --ignore-submodules --`
|
|
28
|
+
repo_status = "'#{path}' has unstaged changes" unless $CHILD_STATUS.success?
|
|
31
29
|
end
|
|
32
30
|
|
|
33
31
|
unless repo_status
|
|
34
|
-
|
|
35
|
-
repo_status = "'#{path}' has uncommitted changes" unless
|
|
32
|
+
`git diff-index --cached --quiet HEAD --ignore-submodules --`
|
|
33
|
+
repo_status = "'#{path}' has uncommitted changes" unless $CHILD_STATUS.success?
|
|
36
34
|
end
|
|
37
35
|
|
|
38
36
|
unless repo_status
|
|
39
37
|
# Things that may be out of date but which should stop the updating
|
|
40
38
|
# of the git repo
|
|
41
|
-
our_exclusions=[
|
|
39
|
+
our_exclusions = [
|
|
42
40
|
'build/rpm_metadata',
|
|
43
|
-
'dist/'
|
|
41
|
+
'dist/',
|
|
44
42
|
]
|
|
45
43
|
|
|
46
|
-
untracked_files =
|
|
44
|
+
untracked_files = `git ls-files -o -d --exclude-standard --exclude=#{our_exclusions.join(' --exclude=')}`
|
|
47
45
|
|
|
48
|
-
|
|
49
|
-
unless untracked_files.empty?
|
|
50
|
-
untracked_files.strip!
|
|
46
|
+
raise Error, "Failure running 'git ls-files -o -d --exclude-standard' at '#{path}'" unless $CHILD_STATUS.success?
|
|
51
47
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
48
|
+
unless untracked_files.empty?
|
|
49
|
+
untracked_files.strip!
|
|
50
|
+
|
|
51
|
+
if untracked_files.lines.any?
|
|
52
|
+
repo_status = "'#{path}' has untracked files"
|
|
55
53
|
end
|
|
56
|
-
else
|
|
57
|
-
# We should never get here
|
|
58
|
-
raise Error, "Failure running 'git ls-files -o -d --exclude-standard' at '#{path}'"
|
|
59
54
|
end
|
|
55
|
+
|
|
56
|
+
# We should never get here
|
|
57
|
+
|
|
60
58
|
end
|
|
61
59
|
end
|
|
62
60
|
|
|
@@ -69,8 +67,7 @@ class R10KHelper
|
|
|
69
67
|
@basedir = File.dirname(File.expand_path(puppetfile))
|
|
70
68
|
|
|
71
69
|
Dir.chdir(@basedir) do
|
|
72
|
-
|
|
73
|
-
R10K::Git::Cache.settings[:cache_root] = File.join(@basedir,'.r10k_cache')
|
|
70
|
+
R10K::Git::Cache.settings[:cache_root] = File.join(@basedir, '.r10k_cache')
|
|
74
71
|
|
|
75
72
|
unless File.directory?(R10K::Git::Cache.settings[:cache_root])
|
|
76
73
|
FileUtils.mkdir_p(R10K::Git::Cache.settings[:cache_root])
|
|
@@ -79,26 +76,26 @@ class R10KHelper
|
|
|
79
76
|
r10k = R10K::Puppetfile.new(Dir.pwd, nil, puppetfile)
|
|
80
77
|
r10k.load!
|
|
81
78
|
|
|
82
|
-
@modules = r10k.modules.
|
|
79
|
+
@modules = r10k.modules.map do |mod|
|
|
83
80
|
mod_status = mod.repo.repo.dirty?
|
|
84
81
|
|
|
85
|
-
|
|
86
|
-
:name
|
|
87
|
-
:path
|
|
88
|
-
:remote
|
|
82
|
+
{
|
|
83
|
+
:name => mod.name,
|
|
84
|
+
:path => mod.path.to_s,
|
|
85
|
+
:remote => mod.repo.instance_variable_get(:@remote),
|
|
89
86
|
:desired_ref => mod.desired_ref,
|
|
90
|
-
:git_source
|
|
91
|
-
:git_ref
|
|
92
|
-
:module_dir
|
|
93
|
-
:status
|
|
87
|
+
:git_source => mod.repo.repo.origin,
|
|
88
|
+
:git_ref => mod.repo.head,
|
|
89
|
+
:module_dir => mod.basedir,
|
|
90
|
+
:status => mod_status || :known,
|
|
94
91
|
:r10k_module => mod,
|
|
95
|
-
:r10k_cache
|
|
92
|
+
:r10k_cache => mod.repo.repo.cache_repo
|
|
96
93
|
}
|
|
97
94
|
end
|
|
98
95
|
end
|
|
99
96
|
|
|
100
|
-
module_dirs = @modules.
|
|
101
|
-
mod
|
|
97
|
+
module_dirs = @modules.map do |mod|
|
|
98
|
+
mod[:module_dir]
|
|
102
99
|
end
|
|
103
100
|
|
|
104
101
|
module_dirs.uniq!
|
|
@@ -109,30 +106,30 @@ class R10KHelper
|
|
|
109
106
|
end
|
|
110
107
|
|
|
111
108
|
known_modules.map! do |mod|
|
|
112
|
-
mod
|
|
109
|
+
mod[:name]
|
|
113
110
|
end
|
|
114
111
|
|
|
115
|
-
current_modules = Dir.glob(File.join(module_dir,'*')).map do |mod|
|
|
116
|
-
|
|
112
|
+
current_modules = Dir.glob(File.join(module_dir, '*')).map do |mod|
|
|
113
|
+
File.basename(mod)
|
|
117
114
|
end
|
|
118
115
|
|
|
119
116
|
(current_modules - known_modules).each do |mod|
|
|
120
117
|
# Did we find random git repos in our module spaces?
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
118
|
+
next unless File.exist?(File.join(module_dir, mod, '.git'))
|
|
119
|
+
|
|
120
|
+
@modules << {
|
|
121
|
+
:name => mod,
|
|
122
|
+
:path => File.join(module_dir, mod),
|
|
123
|
+
:module_dir => module_dir,
|
|
124
|
+
:status => :unknown
|
|
125
|
+
}
|
|
129
126
|
end
|
|
130
127
|
end
|
|
131
128
|
end
|
|
132
129
|
|
|
133
130
|
def puppetfile
|
|
134
131
|
last_module_dir = nil
|
|
135
|
-
pupfile =
|
|
132
|
+
pupfile = []
|
|
136
133
|
|
|
137
134
|
@modules.each do |mod|
|
|
138
135
|
module_dir = mod[:path].split(@basedir.to_s).last.split('/')[1..-2].join('/')
|
|
@@ -156,40 +153,35 @@ class R10KHelper
|
|
|
156
153
|
|
|
157
154
|
def each_module(&block)
|
|
158
155
|
Dir.chdir(@basedir) do
|
|
159
|
-
@modules.each
|
|
160
|
-
# This works for Puppet Modules
|
|
161
|
-
|
|
162
|
-
block.call(mod)
|
|
163
|
-
end
|
|
156
|
+
@modules.each(&block)
|
|
164
157
|
end
|
|
165
158
|
end
|
|
166
159
|
|
|
167
160
|
def unknown_modules
|
|
168
|
-
@modules.select
|
|
161
|
+
@modules.select { |mod|
|
|
169
162
|
mod[:status] == :unknown
|
|
170
|
-
|
|
171
|
-
mod
|
|
163
|
+
}.map do |mod|
|
|
164
|
+
mod[:name]
|
|
172
165
|
end
|
|
173
166
|
end
|
|
174
167
|
end
|
|
175
168
|
|
|
176
169
|
module Simp; end
|
|
177
170
|
module Simp::Rake; end
|
|
178
|
-
module Simp::Rake::Build
|
|
179
171
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
172
|
+
class Simp::Rake::Build::Deps < Rake::TaskLib
|
|
173
|
+
require 'pager'
|
|
174
|
+
include Pager
|
|
183
175
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
176
|
+
def initialize(base_dir)
|
|
177
|
+
@base_dir = base_dir
|
|
178
|
+
@verbose = ENV.fetch('SIMP_PKG_verbose', 'no') == 'yes'
|
|
179
|
+
define_tasks
|
|
180
|
+
end
|
|
189
181
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
182
|
+
def define_tasks
|
|
183
|
+
namespace :deps do
|
|
184
|
+
desc <<-EOM
|
|
193
185
|
Checks out all dependency repos.
|
|
194
186
|
|
|
195
187
|
This task used R10k to update all dependencies.
|
|
@@ -198,196 +190,193 @@ module Simp::Rake::Build
|
|
|
198
190
|
* :method => The update method to use (Default => 'tracking')
|
|
199
191
|
tracking => checks out each dep (by branch) according to Puppetfile.tracking
|
|
200
192
|
stable => checks out each dep (by ref) according to in Puppetfile.stable
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
r10k_issues = Parallel.map(
|
|
208
|
-
Array(r10k_helper.modules),
|
|
209
|
-
:in_processes => get_cpu_limit,
|
|
210
|
-
:progress => 'Submodule Checkout'
|
|
211
|
-
) do |mod|
|
|
212
|
-
issues = []
|
|
213
|
-
|
|
214
|
-
Dir.chdir(@base_dir) do
|
|
215
|
-
unless File.directory?(mod[:path])
|
|
216
|
-
FileUtils.mkdir_p(mod[:path])
|
|
217
|
-
end
|
|
193
|
+
EOM
|
|
194
|
+
task :checkout, [:method] do |_t, args|
|
|
195
|
+
args.with_defaults(:method => 'tracking')
|
|
196
|
+
|
|
197
|
+
r10k_helper = R10KHelper.new("Puppetfile.#{args[:method]}")
|
|
218
198
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
199
|
+
r10k_issues = Parallel.map(
|
|
200
|
+
Array(r10k_helper.modules),
|
|
201
|
+
:in_processes => get_cpu_limit,
|
|
202
|
+
:progress => 'Submodule Checkout',
|
|
203
|
+
) do |mod|
|
|
204
|
+
issues = []
|
|
205
|
+
|
|
206
|
+
Dir.chdir(@base_dir) do
|
|
207
|
+
unless File.directory?(mod[:path])
|
|
208
|
+
FileUtils.mkdir_p(mod[:path])
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
# Only for known modules...
|
|
212
|
+
unless mod[:status] == :unknown
|
|
213
|
+
# Since r10k is destructive, we're enumerating all valid states
|
|
214
|
+
if [
|
|
215
|
+
:absent,
|
|
216
|
+
:mismatched,
|
|
217
|
+
:outdated,
|
|
218
|
+
:insync,
|
|
219
|
+
:dirty,
|
|
220
|
+
].include?(mod[:r10k_module].status)
|
|
221
|
+
unless mod[:r10k_cache].synced?
|
|
222
|
+
mod[:r10k_cache].sync
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
if mod[:status] == :known
|
|
226
|
+
mod[:r10k_module].sync
|
|
240
227
|
else
|
|
241
|
-
|
|
228
|
+
# If we get here, the module was dirty and should be skipped
|
|
229
|
+
issues << "#{mod[:name]}: Skipped - #{mod[:status]}"
|
|
230
|
+
next
|
|
242
231
|
end
|
|
232
|
+
else
|
|
233
|
+
issues << "#{mod[:name]}: Skipped - Unknown status type #{mod[:r10k_module].status}"
|
|
243
234
|
end
|
|
244
235
|
end
|
|
245
|
-
|
|
246
|
-
issues
|
|
247
236
|
end
|
|
248
237
|
|
|
249
|
-
|
|
238
|
+
issues
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
r10k_issues.flatten!
|
|
250
242
|
|
|
251
|
-
|
|
252
|
-
|
|
243
|
+
unless r10k_issues.empty?
|
|
244
|
+
warn('=' * 80)
|
|
253
245
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
$stderr.puts(' * Run with SIMP_PKG_verbose=yes for full details')
|
|
259
|
-
else
|
|
260
|
-
$stderr.puts("R10k Checkout Issues:")
|
|
261
|
-
r10k_issues.each do |issue|
|
|
262
|
-
$stderr.puts(" * #{issue}")
|
|
263
|
-
end
|
|
246
|
+
if @verbose
|
|
247
|
+
warn('R10k Checkout Issues:')
|
|
248
|
+
r10k_issues.each do |issue|
|
|
249
|
+
warn(" * #{issue}")
|
|
264
250
|
end
|
|
265
|
-
|
|
266
|
-
|
|
251
|
+
else
|
|
252
|
+
warn('Warning: Some repositories were skipped!')
|
|
253
|
+
warn(' * If this is a fresh build, this could be an issue')
|
|
254
|
+
warn(' * This is expected if re-running a build')
|
|
255
|
+
warn(' * Run with SIMP_PKG_verbose=yes for full details')
|
|
267
256
|
end
|
|
257
|
+
|
|
258
|
+
warn('=' * 80)
|
|
268
259
|
end
|
|
260
|
+
end
|
|
269
261
|
|
|
270
|
-
|
|
262
|
+
desc <<-EOM
|
|
271
263
|
Get the status of the project Git repositories
|
|
272
264
|
|
|
273
265
|
Arguments:
|
|
274
266
|
* :method => The update method to use (Default => 'tracking')
|
|
275
267
|
tracking => checks out each dep (by branch) according to Puppetfile.tracking
|
|
276
268
|
stable => checks out each dep (by ref) according to in Puppetfile.stable
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
269
|
+
EOM
|
|
270
|
+
task :status, [:method] do |_t, args|
|
|
271
|
+
args.with_defaults(:method => 'tracking')
|
|
272
|
+
@dirty_repos = nil
|
|
281
273
|
|
|
282
|
-
|
|
274
|
+
r10k_helper = R10KHelper.new("Puppetfile.#{args[:method]}")
|
|
283
275
|
|
|
284
|
-
|
|
276
|
+
mods_with_changes = {}
|
|
285
277
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
278
|
+
r10k_helper.each_module do |mod|
|
|
279
|
+
unless File.directory?(mod[:path])
|
|
280
|
+
warn("Warning: '#{mod[:path]}' is not a module...skipping") if File.exist?(mod[:path])
|
|
281
|
+
next
|
|
282
|
+
end
|
|
291
283
|
|
|
292
|
-
|
|
293
|
-
# Clean up the path a bit for printing
|
|
294
|
-
dirty_path = mod[:path].split(r10k_helper.basedir.to_s).last
|
|
295
|
-
if dirty_path[0].chr == File::SEPARATOR
|
|
296
|
-
dirty_path[0] = ''
|
|
297
|
-
end
|
|
284
|
+
next unless mod[:status] != :known
|
|
298
285
|
|
|
299
|
-
|
|
300
|
-
|
|
286
|
+
# Clean up the path a bit for printing
|
|
287
|
+
dirty_path = mod[:path].split(r10k_helper.basedir.to_s).last
|
|
288
|
+
if dirty_path[0].chr == File::SEPARATOR
|
|
289
|
+
dirty_path[0] = ''
|
|
301
290
|
end
|
|
302
291
|
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
@dirty_repos = false
|
|
306
|
-
else
|
|
307
|
-
puts "The following repositories have changes:"
|
|
308
|
-
puts mods_with_changes.map{|k,v| " + #{k} => #{v}"}.join("\n")
|
|
292
|
+
mods_with_changes[mod[:name]] = dirty_path
|
|
293
|
+
end
|
|
309
294
|
|
|
310
|
-
|
|
311
|
-
|
|
295
|
+
if mods_with_changes.empty?
|
|
296
|
+
puts 'No repositories have changes.'
|
|
297
|
+
@dirty_repos = false
|
|
298
|
+
else
|
|
299
|
+
puts 'The following repositories have changes:'
|
|
300
|
+
puts mods_with_changes.map { |k, v| " + #{k} => #{v}" }.join("\n")
|
|
312
301
|
|
|
313
|
-
|
|
314
|
-
unless unknown_mods.empty?
|
|
315
|
-
puts "The following modules were unknown:"
|
|
316
|
-
puts unknown_mods.map{|k,v| " ? #{k}"}.join("\n")
|
|
317
|
-
end
|
|
302
|
+
@dirty_repos = true
|
|
318
303
|
end
|
|
319
304
|
|
|
320
|
-
|
|
305
|
+
unknown_mods = r10k_helper.unknown_modules
|
|
306
|
+
unless unknown_mods.empty?
|
|
307
|
+
puts 'The following modules were unknown:'
|
|
308
|
+
puts unknown_mods.map { |k, _v| " ? #{k}" }.join("\n")
|
|
309
|
+
end
|
|
310
|
+
end
|
|
311
|
+
|
|
312
|
+
desc <<-EOM
|
|
321
313
|
Records the current dependencies into Puppetfile.stable.
|
|
322
314
|
|
|
323
315
|
Arguments:
|
|
324
316
|
* :method => Save to Puppetfile.[method] (Default => 'stable')
|
|
325
317
|
* :reference => Use Puppetfile.[reference] to reference which repos
|
|
326
318
|
should be recorded (Default => 'tracking')
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
319
|
+
EOM
|
|
320
|
+
task :record, [:method, :reference] do |_t, args|
|
|
321
|
+
args.with_defaults(:method => 'stable')
|
|
322
|
+
args.with_defaults(:reference => 'tracking')
|
|
331
323
|
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
324
|
+
r10k_helper = R10KHelper.new("Puppetfile.#{args[:reference]}")
|
|
325
|
+
File.open("Puppetfile.#{args[:method]}", 'w') { |f| f.puts r10k_helper.puppetfile }
|
|
326
|
+
end
|
|
335
327
|
|
|
336
|
-
|
|
328
|
+
desc <<-EOM
|
|
337
329
|
Provide a log of changes to all modules from the given top level Git reference.
|
|
338
330
|
|
|
339
331
|
Arguments:
|
|
340
332
|
* :ref => The top level git ref to use as the oldest point for all logs.
|
|
341
333
|
* :source => The source Puppetfile to use (Default => 'tracking')
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
334
|
+
EOM
|
|
335
|
+
task :changelog, [:ref] do |_t, args|
|
|
336
|
+
args.with_defaults(:source => 'tracking')
|
|
337
|
+
|
|
338
|
+
r10k_helper = R10KHelper.new("Puppetfile.#{args[:source]}")
|
|
339
|
+
|
|
340
|
+
git_logs = {}
|
|
341
|
+
|
|
342
|
+
Dir.chdir(r10k_helper.basedir) do
|
|
343
|
+
ref = args[:ref]
|
|
344
|
+
refdate = nil
|
|
345
|
+
begin
|
|
346
|
+
refdate = `git log -1 --format=%ai '#{ref}'`
|
|
347
|
+
refdate = nil unless $CHILD_STATUS.success?
|
|
348
|
+
rescue Exception
|
|
349
|
+
# noop
|
|
350
|
+
end
|
|
359
351
|
|
|
360
|
-
|
|
361
|
-
|
|
352
|
+
raise('You must specify a valid reference') unless ref
|
|
353
|
+
raise("Could not find a Git log for #{ref}") unless refdate
|
|
362
354
|
|
|
363
|
-
|
|
355
|
+
log_output = `git log --since='#{refdate}' --stat --reverse`.chomp
|
|
356
|
+
git_logs['__SIMP CORE__'] = log_output unless log_output.strip.empty?
|
|
364
357
|
|
|
365
|
-
|
|
366
|
-
|
|
358
|
+
r10k_helper.each_module do |mod|
|
|
359
|
+
next unless File.directory?(mod[:path])
|
|
367
360
|
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
log_output = %x(git log --since='#{refdate}' --stat --reverse).chomp
|
|
372
|
-
git_logs[mod[:name]] = log_output unless log_output.strip.empty?
|
|
373
|
-
end
|
|
374
|
-
end
|
|
361
|
+
Dir.chdir(mod[:path]) do
|
|
362
|
+
log_output = `git log --since='#{refdate}' --stat --reverse`.chomp
|
|
363
|
+
git_logs[mod[:name]] = log_output unless log_output.strip.empty?
|
|
375
364
|
end
|
|
365
|
+
end
|
|
376
366
|
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
367
|
+
if git_logs.empty?
|
|
368
|
+
puts("No changes found for any components since #{refdate}")
|
|
369
|
+
else
|
|
370
|
+
page
|
|
381
371
|
|
|
382
|
-
|
|
383
|
-
|
|
372
|
+
git_logs.keys.sort.each do |mod_name|
|
|
373
|
+
puts <<-EOM
|
|
384
374
|
========
|
|
385
375
|
#{mod_name}:
|
|
386
376
|
|
|
387
|
-
#{git_logs[mod_name].gsub(
|
|
377
|
+
#{git_logs[mod_name].gsub(%r{^}, ' ')}
|
|
388
378
|
|
|
389
|
-
|
|
390
|
-
end
|
|
379
|
+
EOM
|
|
391
380
|
end
|
|
392
381
|
end
|
|
393
382
|
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'rake/tasklib'
|
|
2
4
|
require 'ruby-progressbar'
|
|
3
5
|
require 'rake/clean'
|
|
@@ -5,22 +7,24 @@ require 'rake/clean'
|
|
|
5
7
|
module Simp; end
|
|
6
8
|
module Simp::Rake; end
|
|
7
9
|
module Simp::Rake::Build; end
|
|
10
|
+
|
|
8
11
|
class Simp::Rake::Build::Helpers
|
|
9
|
-
def initialize(
|
|
10
|
-
Dir[
|
|
12
|
+
def initialize(dir = Dir.pwd)
|
|
13
|
+
Dir[File.join(File.dirname(__FILE__), '*.rb')].sort.each do |rake_file|
|
|
11
14
|
next if rake_file == __FILE__
|
|
15
|
+
|
|
12
16
|
require rake_file
|
|
13
17
|
end
|
|
14
|
-
Simp::Rake::Build::Auto.new(
|
|
15
|
-
Simp::Rake::Build::Build.new(
|
|
16
|
-
Simp::Rake::Build::Code.new(
|
|
17
|
-
Simp::Rake::Build::Deps.new(
|
|
18
|
-
Simp::Rake::Build::Iso.new(
|
|
19
|
-
Simp::Rake::Build::Pkg.new(
|
|
20
|
-
Simp::Rake::Build::Spec.new(
|
|
21
|
-
Simp::Rake::Build::Tar.new(
|
|
22
|
-
Simp::Rake::Build::Upload.new(
|
|
23
|
-
Simp::Rake::Build::Unpack.new(
|
|
24
|
-
Simp::Rake::Build::Clean.new(
|
|
18
|
+
Simp::Rake::Build::Auto.new(dir)
|
|
19
|
+
Simp::Rake::Build::Build.new(dir)
|
|
20
|
+
Simp::Rake::Build::Code.new(dir)
|
|
21
|
+
Simp::Rake::Build::Deps.new(dir)
|
|
22
|
+
Simp::Rake::Build::Iso.new(dir)
|
|
23
|
+
Simp::Rake::Build::Pkg.new(dir)
|
|
24
|
+
Simp::Rake::Build::Spec.new(dir)
|
|
25
|
+
Simp::Rake::Build::Tar.new(dir)
|
|
26
|
+
Simp::Rake::Build::Upload.new(dir)
|
|
27
|
+
Simp::Rake::Build::Unpack.new(dir)
|
|
28
|
+
Simp::Rake::Build::Clean.new(dir)
|
|
25
29
|
end
|
|
26
30
|
end
|