packaging 0.114.0 → 0.115.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 872132e3dcf2718b739c196a7c91f520592fb6888139d95ac69ff851de817d3c
4
- data.tar.gz: fcc2351b89fb1c6bce455cb3ae93d8b3b372d3e70875eeda8d442e485d8332b5
3
+ metadata.gz: 369be5ff2b204e9d0982da001c49688c08fedf383e91157dcb7285be5af1740f
4
+ data.tar.gz: af6c7ab5542d0dedbfee18645bba699ee9bcc2fc8563b970c00461c56b216500
5
5
  SHA512:
6
- metadata.gz: 15fd7bc9ac1134f59a6c28c0e6ce1a151b56ab3f9e35b971d847b3eed1f9f9e80b1dbe35c0de03e2e2919d06b4e7a5dc03817db5783aa482aa7439a17b8ba449
7
- data.tar.gz: 8edaf1970e42b5ed438b3c999b8f2fd57b9a6aae183e722cdb3670c6ec69bb3ae89a1a8cd2fd8bde4812be80441ed16d205f670337fa5ccd22a2010166f50117
6
+ metadata.gz: 640dbd3c34a6c2abbd550b732a15148957755c9c5b0211ab7d2b459489af92ae12051e479fc8d48c0844956883d663eb7c2f773bed529578d983d2ab3ae0f484
7
+ data.tar.gz: efc90b7c5185f406bd0bc6f7cdceb85456c1bb1d403fbbf705e2351a320af91f908cd3271f58c1d5a8f1629ae588918cbe2b806145e750204e22ee6fcd3625dc
@@ -40,7 +40,25 @@ module Pkg::Rpm::Repo
40
40
  end
41
41
  end
42
42
 
43
+ ##
44
+ ## Let a wrapper script handle lock setting and pathing for the createrepo command
45
+ ##
43
46
  def repo_creation_command(repo_directory, artifact_paths = nil)
47
+ artifact_paths_argument = if artifact_paths
48
+ artifact_paths.join(' ')
49
+ else
50
+ ''
51
+ end
52
+ "/usr/local/bin/packaging-createrepo-wrapper #{repo_directory} #{artifact_paths_argument}"
53
+ end
54
+
55
+
56
+ ##
57
+ ## Deprecated
58
+ ## This was a slightly tortous way of going about this. Instead, see above.
59
+ ## Instead of constructing loop, let a wrapper script handle the details.
60
+ ##
61
+ def deprecated_repo_creation_command(repo_directory, artifact_paths = nil)
44
62
  cmd = "[ -d #{repo_directory} ] || exit 1 ; "
45
63
  cmd << "pushd #{repo_directory} > /dev/null && "
46
64
  cmd << 'echo "Checking for running repo creation. Will wait if detected." && '
@@ -131,14 +149,19 @@ module Pkg::Rpm::Repo
131
149
  end
132
150
 
133
151
  def retrieve_repo_configs(target = "repo_configs")
134
- wget = Pkg::Util::Tool.check_tool("wget")
152
+ wget = Pkg::Util::Tool.check_tool('wget')
135
153
  FileUtils.mkdir_p("pkg/#{target}")
136
154
  config_url = "#{base_url}/#{target}/rpm/"
155
+
156
+ config_fetch_command = <<~CONFIG_FETCH_COMMAND.gsub(%r{\n}, ' ')
157
+ #{wget} --recursive --no-parent --no-host-directories --cut-dirs=3
158
+ "--directory-prefix=pkg/#{target} --reject='index' #{config_url}"
159
+ CONFIG_FETCH_COMMAND
160
+
137
161
  begin
138
- stdout, = Pkg::Util::Execution.capture3("#{wget} -r -np -nH --cut-dirs 3 -P pkg/#{target} --reject 'index*' #{config_url}")
139
- stdout
162
+ Pkg::Util::Execution.capture3(config_fetch_command)[0]
140
163
  rescue StandardError => e
141
- fail "Couldn't retrieve rpm yum repo configs.\n#{e}"
164
+ fail "\"#{config_fetch_command} failed.\n#{e}"
142
165
  end
143
166
  end
144
167
 
@@ -152,27 +175,21 @@ module Pkg::Rpm::Repo
152
175
  def generate_repo_configs(source = "repos", target = "repo_configs", signed = false)
153
176
  # We have a hard requirement on wget because of all the download magicks
154
177
  # we have to do
155
- #
156
178
  wget = Pkg::Util::Tool.check_tool("wget")
157
179
 
158
180
  # This is the standard path to all build artifacts on the distribution
159
181
  # server for this commit
160
- #
161
182
  repo_base = "#{base_url}/#{source}/"
162
183
 
163
- # First check if the artifacts directory exists
164
- #
165
-
166
184
  # We have to do two checks here - first that there are directories with
167
185
  # repodata folders in them, and second that those same directories also
168
186
  # contain rpms
169
- #
170
187
  stdout, = Pkg::Util::Execution.capture3("#{wget} --spider -r -l 5 --no-parent #{repo_base} 2>&1")
171
- stdout = stdout.split.uniq.reject { |x| x =~ /\?|index/ }.select { |x| x =~ /http:.*repodata\/$/ }
188
+ stdout = stdout.split.uniq.reject { |x| x =~ /\?|index/ }
189
+ .select { |x| x =~ /http:.*repodata\/$/ }
172
190
 
173
191
  # RPMs will always exist at the same directory level as the repodata
174
192
  # folder, which means if we go up a level we should find rpms
175
- #
176
193
  yum_repos = []
177
194
  stdout.map { |x| x.chomp('repodata/') }.each do |url|
178
195
  output, = Pkg::Util::Execution.capture3("#{wget} --spider -r -l 1 --no-parent #{url} 2>&1")
@@ -98,10 +98,10 @@ describe 'Pkg::Rpm::Repo' do
98
98
  expect(FileUtils).to receive(:mkdir_p).with('pkg/repo_configs').and_return(true)
99
99
  expect(Pkg::Util::Execution)
100
100
  .to receive(:capture3)
101
- .with("#{wget} -r -np -nH --cut-dirs 3 -P pkg/repo_configs --reject 'index*' #{base_url}/repo_configs/rpm/")
101
+ .with(%r{#{wget}.*/repo_configs/rpm})
102
102
  .and_raise(RuntimeError)
103
103
  expect { Pkg::Rpm::Repo.retrieve_repo_configs }
104
- .to raise_error(RuntimeError, /Couldn't retrieve rpm yum repo configs/)
104
+ .to raise_error(RuntimeError, %r{failed\.$})
105
105
  end
106
106
  end
107
107
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: packaging
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.114.0
4
+ version: 0.115.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet By Perforce
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-07 00:00:00.000000000 Z
11
+ date: 2024-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: debug
@@ -307,28 +307,28 @@ signing_key:
307
307
  specification_version: 4
308
308
  summary: Puppet by Perforce packaging automation
309
309
  test_files:
310
- - spec/lib/packaging/config_spec.rb
311
- - spec/lib/packaging/repo_spec.rb
312
- - spec/lib/packaging/deb_spec.rb
313
- - spec/lib/packaging/util/gpg_spec.rb
310
+ - spec/lib/packaging/gem_spec.rb
311
+ - spec/lib/packaging/tar_spec.rb
312
+ - spec/lib/packaging/platforms_spec.rb
313
+ - spec/lib/packaging/retrieve_spec.rb
314
+ - spec/lib/packaging/rpm/repo_spec.rb
315
+ - spec/lib/packaging/artifactory_spec.rb
316
+ - spec/lib/packaging/deb/repo_spec.rb
317
+ - spec/lib/packaging/sign_spec.rb
318
+ - spec/lib/packaging/paths_spec.rb
314
319
  - spec/lib/packaging/util/ship_spec.rb
315
- - spec/lib/packaging/util/os_spec.rb
316
- - spec/lib/packaging/util/git_spec.rb
317
- - spec/lib/packaging/util/git_tag_spec.rb
318
320
  - spec/lib/packaging/util/jenkins_spec.rb
319
- - spec/lib/packaging/util/net_spec.rb
321
+ - spec/lib/packaging/util/git_tag_spec.rb
322
+ - spec/lib/packaging/util/gpg_spec.rb
320
323
  - spec/lib/packaging/util/rake_utils_spec.rb
324
+ - spec/lib/packaging/util/net_spec.rb
325
+ - spec/lib/packaging/util/os_spec.rb
321
326
  - spec/lib/packaging/util/execution_spec.rb
322
327
  - spec/lib/packaging/util/misc_spec.rb
323
328
  - spec/lib/packaging/util/file_spec.rb
324
329
  - spec/lib/packaging/util/version_spec.rb
325
- - spec/lib/packaging/gem_spec.rb
326
- - spec/lib/packaging/deb/repo_spec.rb
327
- - spec/lib/packaging/retrieve_spec.rb
328
- - spec/lib/packaging/paths_spec.rb
329
- - spec/lib/packaging/platforms_spec.rb
330
- - spec/lib/packaging/tar_spec.rb
331
- - spec/lib/packaging/sign_spec.rb
332
- - spec/lib/packaging/artifactory_spec.rb
333
- - spec/lib/packaging/rpm/repo_spec.rb
330
+ - spec/lib/packaging/util/git_spec.rb
331
+ - spec/lib/packaging/config_spec.rb
332
+ - spec/lib/packaging/deb_spec.rb
333
+ - spec/lib/packaging/repo_spec.rb
334
334
  - spec/lib/packaging_spec.rb