packaging 0.99.35 → 0.99.36
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/lib/packaging/deb/repo.rb +14 -13
- data/lib/packaging/util/net.rb +8 -3
- data/spec/lib/packaging/deb/repo_spec.rb +12 -3
- data/spec/lib/packaging/util/net_spec.rb +14 -7
- data/tasks/pe_ship.rake +14 -2
- data/tasks/ship.rake +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90069d4b887fc7918e267ea61f847be27e82531e871d839681a802c148ab00d5
|
4
|
+
data.tar.gz: 41ced9146c0dc64652333d7b574c9ab527bf3e52b7953ce4bd87ccf38497de8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 809e163034d7e756a3d6ddb0e225d05d1fb23c741dad910621ccf90d5f96226653651fbeec0feb1155ffc8ab5204fc3875ccb9c2fb4dc749b0ed1e8291b12ad3
|
7
|
+
data.tar.gz: 303cb33f6f6191bf3c7da7e0c23e490609a86245c8631d81c16a557ce06ccc8a6a284d1ba99461e01043605adab4a9b8efa2cc3ae983aac7d090c9d15aba5742
|
data/lib/packaging/deb/repo.rb
CHANGED
@@ -159,27 +159,28 @@ Description: Apt repository for acceptance testing" >> conf/distributions ; )
|
|
159
159
|
dists = Pkg::Util::File.directories("#{target}/apt")
|
160
160
|
supported_codenames = Pkg::Platforms.codenames
|
161
161
|
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
162
|
+
unless dists
|
163
|
+
warn "No repos found to sign. Maybe you didn't build any debs, or the repo creation failed?"
|
164
|
+
return
|
165
|
+
end
|
166
|
+
|
167
|
+
dists.each do |dist|
|
168
|
+
next unless supported_codenames.include?(dist)
|
169
|
+
arches = Pkg::Platforms.arches_for_codename(dist)
|
170
|
+
Dir.chdir("#{target}/apt/#{dist}") do
|
171
|
+
File.open("conf/distributions", "w") do |f|
|
172
|
+
f.puts "Origin: Puppet Labs
|
169
173
|
Label: Puppet Labs
|
170
174
|
Codename: #{dist}
|
171
175
|
Architectures: #{(DEBIAN_PACKAGING_ARCHES + arches).uniq.join(' ')}
|
172
176
|
Components: #{reprepro_repo_name}
|
173
177
|
Description: #{message} for #{dist}
|
174
178
|
SignWith: #{Pkg::Config.gpg_key}"
|
175
|
-
end
|
176
|
-
|
177
|
-
stdout, _, _ = Pkg::Util::Execution.capture3("#{reprepro} -vvv --confdir ./conf --dbdir ./db --basedir ./ export")
|
178
|
-
stdout
|
179
179
|
end
|
180
|
+
|
181
|
+
stdout, _, _ = Pkg::Util::Execution.capture3("#{reprepro} -vvv --confdir ./conf --dbdir ./db --basedir ./ export")
|
182
|
+
stdout
|
180
183
|
end
|
181
|
-
else
|
182
|
-
warn "No repos found to sign. Maybe you didn't build any debs, or the repo creation failed?"
|
183
184
|
end
|
184
185
|
end
|
185
186
|
|
data/lib/packaging/util/net.rb
CHANGED
@@ -64,13 +64,18 @@ module Pkg::Util::Net
|
|
64
64
|
return errs
|
65
65
|
end
|
66
66
|
|
67
|
-
def remote_ssh_cmd(target, command, capture_output = false, extra_options = '', fail_fast = true)
|
67
|
+
def remote_ssh_cmd(target, command, capture_output = false, extra_options = '', fail_fast = true, trace = false) # rubocop:disable Style/ParameterLists
|
68
|
+
|
68
69
|
ssh = Pkg::Util::Tool.check_tool('ssh')
|
69
70
|
|
70
71
|
# we pass some pretty complicated commands in via ssh. We need this to fail
|
71
72
|
# if any part of the remote ssh command fails.
|
72
|
-
|
73
|
-
|
73
|
+
shell_flags = ''
|
74
|
+
shell_flags += 'set -e;' if fail_fast
|
75
|
+
shell_flags += 'set -x;' if trace
|
76
|
+
shell_commands = "#{shell_flags}#{command}"
|
77
|
+
|
78
|
+
cmd = "#{ssh} #{extra_options} -t #{target} '#{shell_commands.gsub("'", "'\\\\''")}'"
|
74
79
|
|
75
80
|
# This is NOT a good way to support this functionality.
|
76
81
|
# It needs to be refactored into a set of methods that
|
@@ -128,12 +128,21 @@ describe "Pkg::Deb::Repo" do
|
|
128
128
|
end
|
129
129
|
|
130
130
|
it "makes a repo for each dist" do
|
131
|
+
# stub out start_keychain to prevent actual keychain starts.
|
132
|
+
Pkg::Util::Gpg.stub(:start_keychain)
|
133
|
+
|
131
134
|
dists = cows.reject { |cow| cow.empty? }
|
132
135
|
distfiles = {}
|
133
|
-
reprepro = "/bin/reprepro"
|
134
136
|
Pkg::Util::File.should_receive(:directories).with("repos/apt").and_return(dists)
|
135
|
-
|
136
|
-
|
137
|
+
|
138
|
+
# Let the keychain command happen if find_tool('keychain') finds it
|
139
|
+
keychain_command = "/usr/bin/keychain -k mine"
|
140
|
+
allow(Pkg::Util::Execution).to receive(:capture3) { keychain_command }
|
141
|
+
|
142
|
+
# Enforce reprepro
|
143
|
+
reprepro_command = "/bin/reprepro"
|
144
|
+
Pkg::Util::Tool.should_receive(:check_tool).with("reprepro").and_return(reprepro_command)
|
145
|
+
Pkg::Util::Execution.should_receive(:capture3).at_least(1).times.with("#{reprepro_command} -vvv --confdir ./conf --dbdir ./db --basedir ./ export")
|
137
146
|
|
138
147
|
dists.each do |dist|
|
139
148
|
distfiles[dist] = double
|
@@ -65,26 +65,33 @@ describe "Pkg::Util::Net" do
|
|
65
65
|
Kernel.should_receive(:system).with("#{ssh} -t foo 'bar'")
|
66
66
|
Pkg::Util::Execution.should_receive(:success?).and_return(true)
|
67
67
|
Pkg::Util::Net.remote_ssh_cmd("foo", "bar", false, '', false)
|
68
|
-
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should be able to trace output" do
|
71
|
+
Pkg::Util::Tool.should_receive(:check_tool).with("ssh").and_return(ssh)
|
72
|
+
Kernel.should_receive(:system).with("#{ssh} -t foo 'set -x;bar'")
|
73
|
+
Pkg::Util::Execution.should_receive(:success?).and_return(true)
|
74
|
+
Pkg::Util::Net.remote_ssh_cmd("foo", "bar", false, '', false, true)
|
75
|
+
end
|
69
76
|
|
70
77
|
context "without output captured" do
|
71
78
|
it "should execute a command :foo on a host :bar using Kernel" do
|
72
79
|
Pkg::Util::Tool.should_receive(:check_tool).with("ssh").and_return(ssh)
|
73
|
-
Kernel.should_receive(:system).with("#{ssh} -t foo 'set -e;
|
80
|
+
Kernel.should_receive(:system).with("#{ssh} -t foo 'set -e;bar'")
|
74
81
|
Pkg::Util::Execution.should_receive(:success?).and_return(true)
|
75
82
|
Pkg::Util::Net.remote_ssh_cmd("foo", "bar")
|
76
83
|
end
|
77
84
|
|
78
85
|
it "should escape single quotes in the command" do
|
79
86
|
Pkg::Util::Tool.should_receive(:check_tool).with("ssh").and_return(ssh)
|
80
|
-
Kernel.should_receive(:system).with("#{ssh} -t foo 'set -e;
|
87
|
+
Kernel.should_receive(:system).with("#{ssh} -t foo 'set -e;b'\\''ar'")
|
81
88
|
Pkg::Util::Execution.should_receive(:success?).and_return(true)
|
82
89
|
Pkg::Util::Net.remote_ssh_cmd("foo", "b'ar")
|
83
90
|
end
|
84
91
|
|
85
92
|
it "should raise an error if ssh fails" do
|
86
93
|
Pkg::Util::Tool.should_receive(:check_tool).with("ssh").and_return(ssh)
|
87
|
-
Kernel.should_receive(:system).with("#{ssh} -t foo 'set -e;
|
94
|
+
Kernel.should_receive(:system).with("#{ssh} -t foo 'set -e;bar'")
|
88
95
|
Pkg::Util::Execution.should_receive(:success?).and_return(false)
|
89
96
|
expect{ Pkg::Util::Net.remote_ssh_cmd("foo", "bar") }.to raise_error(RuntimeError, /Remote ssh command failed./)
|
90
97
|
end
|
@@ -93,21 +100,21 @@ describe "Pkg::Util::Net" do
|
|
93
100
|
context "with output captured" do
|
94
101
|
it "should execute a command :foo on a host :bar using Pkg::Util::Execution.capture3" do
|
95
102
|
Pkg::Util::Tool.should_receive(:check_tool).with("ssh").and_return(ssh)
|
96
|
-
Pkg::Util::Execution.should_receive(:capture3).with("#{ssh} -t foo 'set -e;
|
103
|
+
Pkg::Util::Execution.should_receive(:capture3).with("#{ssh} -t foo 'set -e;bar'")
|
97
104
|
Pkg::Util::Execution.should_receive(:success?).and_return(true)
|
98
105
|
Pkg::Util::Net.remote_ssh_cmd("foo", "bar", true)
|
99
106
|
end
|
100
107
|
|
101
108
|
it "should escape single quotes in the command" do
|
102
109
|
Pkg::Util::Tool.should_receive(:check_tool).with("ssh").and_return(ssh)
|
103
|
-
Pkg::Util::Execution.should_receive(:capture3).with("#{ssh} -t foo 'set -e;
|
110
|
+
Pkg::Util::Execution.should_receive(:capture3).with("#{ssh} -t foo 'set -e;b'\\''ar'")
|
104
111
|
Pkg::Util::Execution.should_receive(:success?).and_return(true)
|
105
112
|
Pkg::Util::Net.remote_ssh_cmd("foo", "b'ar", true)
|
106
113
|
end
|
107
114
|
|
108
115
|
it "should raise an error if ssh fails" do
|
109
116
|
Pkg::Util::Tool.should_receive(:check_tool).with("ssh").and_return(ssh)
|
110
|
-
Pkg::Util::Execution.should_receive(:capture3).with("#{ssh} -t foo 'set -e;
|
117
|
+
Pkg::Util::Execution.should_receive(:capture3).with("#{ssh} -t foo 'set -e;bar'")
|
111
118
|
Pkg::Util::Execution.should_receive(:success?).and_return(false)
|
112
119
|
expect{ Pkg::Util::Net.remote_ssh_cmd("foo", "bar", true) }.to raise_error(RuntimeError, /Remote ssh command failed./)
|
113
120
|
end
|
data/tasks/pe_ship.rake
CHANGED
@@ -145,11 +145,23 @@ if Pkg::Config.build_pe
|
|
145
145
|
# single line. By breaking it into a series of concatenated strings, we can maintain
|
146
146
|
# a semblance of formatting and structure (nevermind readability).
|
147
147
|
command = %(for dir in #{repo_base_path}/{#{rpm_family_and_version.join(",")}}-*; do)
|
148
|
-
|
148
|
+
|
149
|
+
# For (RE-12463), make this less quiet than it has been.
|
150
|
+
# We're trying to find out why its aborting. Preserve the original
|
151
|
+
# so it can be restored.
|
152
|
+
command += %( sudo createrepo --checksum=sha --checkts --update --delta-workers=0 --database --update $dir; )
|
153
|
+
|
154
|
+
## Original
|
155
|
+
# command += %( sudo createrepo --checksum=sha --checkts --update --delta-workers=0 --quiet --database --update $dir; )
|
156
|
+
##
|
149
157
|
command += %(done; )
|
150
158
|
command += %(sync)
|
151
159
|
|
152
|
-
|
160
|
+
# Again for (RE-12463). Make this more verbose temporarily
|
161
|
+
Pkg::Util::Net.remote_ssh_cmd(Pkg::Config.yum_host, command, false, '', true, true)
|
162
|
+
|
163
|
+
## Original one below
|
164
|
+
# Pkg::Util::Net.remote_ssh_cmd(Pkg::Config.yum_host, command)
|
153
165
|
end
|
154
166
|
|
155
167
|
desc "Remotely add shipped packages to apt repo on #{Pkg::Config.apt_host}"
|
data/tasks/ship.rake
CHANGED
@@ -324,7 +324,9 @@ namespace :pl do
|
|
324
324
|
task :ship_gem_to_downloads => 'pl:fetch' do
|
325
325
|
unless Pkg::Config.gem_host
|
326
326
|
warn 'Value `Pkg::Config.gem_host` not defined; skipping shipping to public Download server'
|
327
|
+
exit
|
327
328
|
end
|
329
|
+
fail 'Value `Pkg::Config.gem_path` not defined; skipping shipping to public Download server' unless Pkg::Config.gem_path
|
328
330
|
|
329
331
|
Pkg::Util::Execution.retry_on_fail(times: 3) do
|
330
332
|
Pkg::Util::Ship.ship_gem('pkg', Pkg::Config.gem_path, platform_independent: true)
|
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.99.
|
4
|
+
version: 0.99.36
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet Labs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-07-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|