|
26 | 26 | end
|
27 | 27 |
|
28 | 28 | it "should call pacman to install the right package quietly when yaourt is not installed" do
|
29 |
| - args = ['--noconfirm', '--needed', '--noprogressbar', '-S', resource[:name]] |
| 29 | + args = ['--noconfirm', '--needed', '--noprogressbar', '--sync', resource[:name]] |
30 | 30 | expect(provider).to receive(:pacman).at_least(:once).with(*args).and_return('')
|
31 | 31 | provider.install
|
32 | 32 | end
|
33 | 33 |
|
34 | 34 | it "should call yaourt to install the right package quietly when yaourt is installed" do
|
35 | 35 | without_partial_double_verification do
|
36 | 36 | allow(described_class).to receive(:yaourt?).and_return(true)
|
37 |
| - args = ['--noconfirm', '--needed', '--noprogressbar', '-S', resource[:name]] |
| 37 | + args = ['--noconfirm', '--needed', '--noprogressbar', '--sync', resource[:name]] |
38 | 38 | expect(provider).to receive(:yaourt).at_least(:once).with(*args).and_return('')
|
39 | 39 | provider.install
|
40 | 40 | end
|
|
70 | 70 | end
|
71 | 71 |
|
72 | 72 | it "should call pacman to install the right package quietly when yaourt is not installed" do
|
73 |
| - args = ['--noconfirm', '--needed', '--noprogressbar', '-x', '--arg=value', '-S', resource[:name]] |
| 73 | + args = ['--noconfirm', '--needed', '--noprogressbar', '-x', '--arg=value', '--sync', resource[:name]] |
74 | 74 | expect(provider).to receive(:pacman).at_least(:once).with(*args).and_return('')
|
75 | 75 | provider.install
|
76 | 76 | end
|
77 | 77 |
|
78 | 78 | it "should call yaourt to install the right package quietly when yaourt is installed" do
|
79 | 79 | without_partial_double_verification do
|
80 | 80 | expect(described_class).to receive(:yaourt?).and_return(true)
|
81 |
| - args = ['--noconfirm', '--needed', '--noprogressbar', '-x', '--arg=value', '-S', resource[:name]] |
| 81 | + args = ['--noconfirm', '--needed', '--noprogressbar', '-x', '--arg=value', '--sync', resource[:name]] |
82 | 82 | expect(provider).to receive(:yaourt).at_least(:once).with(*args).and_return('')
|
83 | 83 | provider.install
|
84 | 84 | end
|
|
98 | 98 | resource[:source] = source
|
99 | 99 |
|
100 | 100 | expect(executor).to receive(:execute).
|
101 |
| - with(include("-S") & include("--noprogressbar"), no_extra_options). |
102 |
| - ordered. |
103 |
| - and_return("") |
104 |
| - |
105 |
| - expect(executor).to receive(:execute). |
106 |
| - with(include("-U") & include(source), no_extra_options). |
| 101 | + with(include("--update") & include(source), no_extra_options). |
107 | 102 | ordered.
|
108 | 103 | and_return("")
|
109 | 104 |
|
|
121 | 116 |
|
122 | 117 | it "should install from the path segment of the URL" do
|
123 | 118 | expect(executor).to receive(:execute).
|
124 |
| - with(include("-S") & include("--noprogressbar") & include("--noconfirm"), |
125 |
| - no_extra_options). |
126 |
| - ordered. |
127 |
| - and_return("") |
128 |
| - |
129 |
| - expect(executor).to receive(:execute). |
130 |
| - with(include("-U") & include(actual_file_path), no_extra_options). |
| 119 | + with(include("--update") & include(actual_file_path), no_extra_options). |
131 | 120 | ordered.
|
132 | 121 | and_return("")
|
133 | 122 |
|
|
170 | 159 |
|
171 | 160 | describe "when purging" do
|
172 | 161 | it "should call pacman to remove the right package and configs quietly" do
|
173 |
| - args = ["/usr/bin/pacman", "--noconfirm", "--noprogressbar", "-R", "--nosave", resource[:name]] |
| 162 | + args = ["/usr/bin/pacman", "--noconfirm", "--noprogressbar", "--remove", "--nosave", resource[:name]] |
174 | 163 | expect(executor).to receive(:execute).with(args, no_extra_options).and_return("")
|
175 | 164 | provider.purge
|
176 | 165 | end
|
177 | 166 | end
|
178 | 167 |
|
179 | 168 | describe "when uninstalling" do
|
180 | 169 | it "should call pacman to remove the right package quietly" do
|
181 |
| - args = ["/usr/bin/pacman", "--noconfirm", "--noprogressbar", "-R", resource[:name]] |
| 170 | + args = ["/usr/bin/pacman", "--noconfirm", "--noprogressbar", "--remove", resource[:name]] |
182 | 171 | expect(executor).to receive(:execute).with(args, no_extra_options).and_return("")
|
183 | 172 | provider.uninstall
|
184 | 173 | end
|
185 | 174 |
|
186 | 175 | it "should call yaourt to remove the right package quietly" do
|
187 | 176 | without_partial_double_verification do
|
188 | 177 | allow(described_class).to receive(:yaourt?).and_return(true)
|
189 |
| - args = ["--noconfirm", "--noprogressbar", "-R", resource[:name]] |
| 178 | + args = ["--noconfirm", "--noprogressbar", "--remove", resource[:name]] |
190 | 179 | expect(provider).to receive(:yaourt).with(*args)
|
191 | 180 | provider.uninstall
|
192 | 181 | end
|
193 | 182 | end
|
194 | 183 |
|
195 | 184 | it "adds any uninstall_options" do
|
196 | 185 | resource[:uninstall_options] = ['-x', {'--arg' => 'value'}]
|
197 |
| - args = ["/usr/bin/pacman", "--noconfirm", "--noprogressbar", "-x", "--arg=value", "-R", resource[:name]] |
| 186 | + args = ["/usr/bin/pacman", "--noconfirm", "--noprogressbar", "-x", "--arg=value", "--remove", resource[:name]] |
198 | 187 | expect(executor).to receive(:execute).with(args, no_extra_options).and_return("")
|
199 | 188 | provider.uninstall
|
200 | 189 | end
|
201 | 190 |
|
202 | 191 | it "should recursively remove packages when given a package group" do
|
203 | 192 | allow(described_class).to receive(:group?).and_return(true)
|
204 |
| - args = ["/usr/bin/pacman", "--noconfirm", "--noprogressbar", "-R", "-s", resource[:name]] |
| 193 | + args = ["/usr/bin/pacman", "--noconfirm", "--noprogressbar", "--remove", "--recursive", resource[:name]] |
205 | 194 | expect(executor).to receive(:execute).with(args, no_extra_options).and_return("")
|
206 | 195 | provider.uninstall
|
207 | 196 | end
|
208 | 197 | end
|
209 | 198 |
|
210 | 199 | describe "when querying" do
|
211 | 200 | it "should query pacman" do
|
212 |
| - expect(executor).to receive(:execpipe).with(["/usr/bin/pacman", '-Q']) |
213 |
| - expect(executor).to receive(:execpipe).with(["/usr/bin/pacman", '-Sgg', 'package']) |
| 201 | + expect(executor).to receive(:execpipe).with(["/usr/bin/pacman", '--query']) |
| 202 | + expect(executor).to receive(:execpipe).with(["/usr/bin/pacman", '--sync', '-gg', 'package']) |
214 | 203 | provider.query
|
215 | 204 | end
|
216 | 205 |
|
217 | 206 | it "should return the version" do
|
218 | 207 | expect(executor).to receive(:execpipe).
|
219 |
| - with(["/usr/bin/pacman", "-Q"]).and_yield(<<EOF) |
| 208 | + with(["/usr/bin/pacman", "--query"]).and_yield(<<EOF) |
220 | 209 | otherpackage 1.2.3.4
|
221 | 210 | package 1.01.3-2
|
222 | 211 | yetanotherpackage 1.2.3.4
|
223 | 212 | EOF
|
224 |
| - expect(executor).to receive(:execpipe).with(['/usr/bin/pacman', '-Sgg', 'package']).and_yield('') |
| 213 | + expect(executor).to receive(:execpipe).with(['/usr/bin/pacman', '--sync', '-gg', 'package']).and_yield('') |
225 | 214 |
|
226 | 215 | expect(provider.query).to eq({ :name => 'package', :ensure => '1.01.3-2', :provider => :pacman, })
|
227 | 216 | end
|
|
239 | 228 |
|
240 | 229 | describe 'when querying a group' do
|
241 | 230 | before :each do
|
242 |
| - expect(executor).to receive(:execpipe).with(['/usr/bin/pacman', '-Q']).and_yield('foo 1.2.3') |
243 |
| - expect(executor).to receive(:execpipe).with(['/usr/bin/pacman', '-Sgg', 'package']).and_yield('package foo') |
| 231 | + expect(executor).to receive(:execpipe).with(['/usr/bin/pacman', '--query']).and_yield('foo 1.2.3') |
| 232 | + expect(executor).to receive(:execpipe).with(['/usr/bin/pacman', '--sync', '-gg', 'package']).and_yield('package foo') |
244 | 233 | end
|
245 | 234 |
|
246 | 235 | it 'should warn when allow_virtual is false' do
|
|
259 | 248 |
|
260 | 249 | describe "when determining instances" do
|
261 | 250 | it "should retrieve installed packages and groups" do
|
262 |
| - expect(described_class).to receive(:execpipe).with(["/usr/bin/pacman", '-Q']) |
263 |
| - expect(described_class).to receive(:execpipe).with(["/usr/bin/pacman", '-Sgg']) |
| 251 | + expect(described_class).to receive(:execpipe).with(["/usr/bin/pacman", '--query']) |
| 252 | + expect(described_class).to receive(:execpipe).with(["/usr/bin/pacman", '--sync', '-gg']) |
264 | 253 | described_class.instances
|
265 | 254 | end
|
266 | 255 |
|
267 | 256 | it "should return installed packages" do
|
268 |
| - expect(described_class).to receive(:execpipe).with(["/usr/bin/pacman", '-Q']).and_yield(StringIO.new("package1 1.23-4\npackage2 2.00\n")) |
269 |
| - expect(described_class).to receive(:execpipe).with(["/usr/bin/pacman", '-Sgg']).and_yield("") |
| 257 | + expect(described_class).to receive(:execpipe).with(["/usr/bin/pacman", '--query']).and_yield(StringIO.new("package1 1.23-4\npackage2 2.00\n")) |
| 258 | + expect(described_class).to receive(:execpipe).with(["/usr/bin/pacman", '--sync', '-gg']).and_yield("") |
270 | 259 | instances = described_class.instances
|
271 | 260 |
|
272 | 261 | expect(instances.length).to eq(2)
|
|
285 | 274 | end
|
286 | 275 |
|
287 | 276 | it "should return completely installed groups with a virtual version together with packages" do
|
288 |
| - expect(described_class).to receive(:execpipe).with(["/usr/bin/pacman", '-Q']).and_yield(<<EOF) |
| 277 | + expect(described_class).to receive(:execpipe).with(["/usr/bin/pacman", '--query']).and_yield(<<EOF) |
289 | 278 | package1 1.00
|
290 | 279 | package2 1.00
|
291 | 280 | EOF
|
292 |
| - expect(described_class).to receive(:execpipe).with(["/usr/bin/pacman", '-Sgg']).and_yield(<<EOF) |
| 281 | + expect(described_class).to receive(:execpipe).with(["/usr/bin/pacman", '--sync', '-gg']).and_yield(<<EOF) |
293 | 282 | group1 package1
|
294 | 283 | group1 package2
|
295 | 284 | EOF
|
|
315 | 304 | end
|
316 | 305 |
|
317 | 306 | it "should not return partially installed packages" do
|
318 |
| - expect(described_class).to receive(:execpipe).with(["/usr/bin/pacman", '-Q']).and_yield(<<EOF) |
| 307 | + expect(described_class).to receive(:execpipe).with(["/usr/bin/pacman", '--query']).and_yield(<<EOF) |
319 | 308 | package1 1.00
|
320 | 309 | EOF
|
321 |
| - expect(described_class).to receive(:execpipe).with(["/usr/bin/pacman", '-Sgg']).and_yield(<<EOF) |
| 310 | + expect(described_class).to receive(:execpipe).with(["/usr/bin/pacman", '--sync', '-gg']).and_yield(<<EOF) |
322 | 311 | group1 package1
|
323 | 312 | group1 package2
|
324 | 313 | EOF
|
|
334 | 323 | end
|
335 | 324 |
|
336 | 325 | it 'should sort package names for installed groups' do
|
337 |
| - expect(described_class).to receive(:execpipe).with(['/usr/bin/pacman', '-Sgg', 'group1']).and_yield(<<EOF) |
| 326 | + expect(described_class).to receive(:execpipe).with(['/usr/bin/pacman', '--sync', '-gg', 'group1']).and_yield(<<EOF) |
338 | 327 | group1 aa
|
339 | 328 | group1 b
|
340 | 329 | group1 a
|
|
365 | 354 | it "should get query pacman for the latest version" do
|
366 | 355 | expect(executor).to receive(:execute).
|
367 | 356 | ordered.
|
368 |
| - with(['/usr/bin/pacman', '-Sp', '--print-format', '%v', resource[:name]], no_extra_options). |
| 357 | + with(['/usr/bin/pacman', '--sync', '--print', '--print-format', '%v', resource[:name]], no_extra_options). |
369 | 358 | and_return("")
|
370 | 359 |
|
371 | 360 | provider.latest
|
|
379 | 368 |
|
380 | 369 | it "should return a virtual group version when resource is a package group" do
|
381 | 370 | allow(described_class).to receive(:group?).and_return(true)
|
382 |
| - expect(executor).to receive(:execute).with(['/usr/bin/pacman', '-Sp', '--print-format', '%n %v', resource[:name]], no_extra_options).ordered. |
| 371 | + expect(executor).to receive(:execute).with(['/usr/bin/pacman', '--sync', '--print', '--print-format', '%n %v', resource[:name]], no_extra_options).ordered. |
383 | 372 | and_return(<<EOF)
|
384 | 373 | package2 1.0.1
|
385 | 374 | package1 1.0.0
|
|
394 | 383 | end
|
395 | 384 |
|
396 | 385 | it 'should return false on non-zero pacman exit' do
|
397 |
| - allow(executor).to receive(:execute).with(['/usr/bin/pacman', '-Sg', 'git'], {:failonfail => true, :combine => true, :custom_environment => {}}).and_raise(Puppet::ExecutionFailure, 'error') |
| 386 | + allow(executor).to receive(:execute).with(['/usr/bin/pacman', '--sync', '--groups', 'git'], {:failonfail => true, :combine => true, :custom_environment => {}}).and_raise(Puppet::ExecutionFailure, 'error') |
398 | 387 | expect(described_class.group?('git')).to eq(false)
|
399 | 388 | end
|
400 | 389 |
|
401 | 390 | it 'should return false on empty pacman output' do
|
402 |
| - allow(executor).to receive(:execute).with(['/usr/bin/pacman', '-Sg', 'git'], {:failonfail => true, :combine => true, :custom_environment => {}}).and_return('') |
| 391 | + allow(executor).to receive(:execute).with(['/usr/bin/pacman', '--sync', '--groups', 'git'], {:failonfail => true, :combine => true, :custom_environment => {}}).and_return('') |
403 | 392 | expect(described_class.group?('git')).to eq(false)
|
404 | 393 | end
|
405 | 394 |
|
406 | 395 | it 'should return true on non-empty pacman output' do
|
407 |
| - allow(executor).to receive(:execute).with(['/usr/bin/pacman', '-Sg', 'vim-plugins'], {:failonfail => true, :combine => true, :custom_environment => {}}).and_return('vim-plugins vim-a') |
| 396 | + allow(executor).to receive(:execute).with(['/usr/bin/pacman', '--sync', '--groups', 'vim-plugins'], {:failonfail => true, :combine => true, :custom_environment => {}}).and_return('vim-plugins vim-a') |
408 | 397 | expect(described_class.group?('vim-plugins')).to eq(true)
|
409 | 398 | end
|
410 | 399 | end
|
|
414 | 403 | let(:groups) { [['foo package1'], ['foo package2'], ['bar package3'], ['bar package4'], ['baz package5']] }
|
415 | 404 |
|
416 | 405 | it 'should raise an error on non-zero pacman exit without a filter' do
|
417 |
| - expect(executor).to receive(:open).with('| /usr/bin/pacman -Sgg 2>&1').and_return('error!') |
| 406 | + expect(executor).to receive(:open).with('| /usr/bin/pacman --sync -gg 2>&1').and_return('error!') |
418 | 407 | expect(Puppet::Util::Execution).to receive(:exitstatus).and_return(1)
|
419 | 408 | expect { described_class.get_installed_groups(installed_packages) }.to raise_error(Puppet::ExecutionFailure, 'error!')
|
420 | 409 | end
|
421 | 410 |
|
422 | 411 | it 'should return empty groups on non-zero pacman exit with a filter' do
|
423 |
| - expect(executor).to receive(:open).with('| /usr/bin/pacman -Sgg git 2>&1').and_return('') |
| 412 | + expect(executor).to receive(:open).with('| /usr/bin/pacman --sync -gg git 2>&1').and_return('') |
424 | 413 | expect(Puppet::Util::Execution).to receive(:exitstatus).and_return(1)
|
425 | 414 | expect(described_class.get_installed_groups(installed_packages, 'git')).to eq({})
|
426 | 415 | end
|
427 | 416 |
|
428 | 417 | it 'should return empty groups on empty pacman output' do
|
429 | 418 | pipe = double()
|
430 | 419 | expect(pipe).to receive(:each_line)
|
431 |
| - expect(executor).to receive(:open).with('| /usr/bin/pacman -Sgg 2>&1').and_yield(pipe).and_return('') |
| 420 | + expect(executor).to receive(:open).with('| /usr/bin/pacman --sync -gg 2>&1').and_yield(pipe).and_return('') |
432 | 421 | expect(Puppet::Util::Execution).to receive(:exitstatus).and_return(0)
|
433 | 422 | expect(described_class.get_installed_groups(installed_packages)).to eq({})
|
434 | 423 | end
|
|
438 | 427 | pipe_expectation = receive(:each_line)
|
439 | 428 | groups.each { |group| pipe_expectation = pipe_expectation.and_yield(*group) }
|
440 | 429 | expect(pipe).to pipe_expectation
|
441 |
| - expect(executor).to receive(:open).with('| /usr/bin/pacman -Sgg 2>&1').and_yield(pipe).and_return('') |
| 430 | + expect(executor).to receive(:open).with('| /usr/bin/pacman --sync -gg 2>&1').and_yield(pipe).and_return('') |
442 | 431 | expect(Puppet::Util::Execution).to receive(:exitstatus).and_return(0)
|
443 | 432 | expect(described_class.get_installed_groups(installed_packages)).to eq({'foo' => 'package1 1.0, package2 2.0'})
|
444 | 433 | end
|
|
0 commit comments