[SCM] ci-tooling packaging branch, master, updated. 8fe5785fd2e67dd6583216e9c0f1d930731cb587

Harald Sitter apachelogger-guest at moszumanska.debian.org
Tue May 12 08:29:49 UTC 2015


Gitweb-URL: http://git.debian.org/?p=pkg-kde/ci-tooling.git;a=commitdiff;h=b64a87c

The following commit has been merged in the master branch:
commit b64a87c57aa04205431aa0cc5e256ed663a8bd6f
Author: Harald Sitter <sitter at kde.org>
Date:   Tue May 12 10:14:49 2015 +0200

    flatten apt arguments before calling system to avoid nested arrays
    
    this allows Apt.install(['a', 'b']) to work as expected which is
    programatically useful when building package lists where otherwise one
    would have to do Apt.install(*['a', 'b']) to get it to work which is
    awkward.
    for manual use Apt.install('a', 'b') is more convenient so we now support
    both ways of calling
    
    hooray
---
 lib/apt.rb       | 4 +++-
 test/test_apt.rb | 8 ++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/lib/apt.rb b/lib/apt.rb
index 816cbee..d4362ac 100644
--- a/lib/apt.rb
+++ b/lib/apt.rb
@@ -63,7 +63,9 @@ module Apt
       args += default_args
       args += injection_args
       args << operation
-      args += [*caller_args]
+      # Flatten args. system doesn't support nested arrays anyway, so flattening
+      # is probably what the caller had in mind (e.g. install(['a', 'b']))
+      args += [*caller_args].flatten
       @log.warn "APT run (#{cmd}, #{args})"
       system(cmd, *args)
     end
diff --git a/test/test_apt.rb b/test/test_apt.rb
index 33a2d69..156e67d 100644
--- a/test/test_apt.rb
+++ b/test/test_apt.rb
@@ -50,4 +50,12 @@ class AptTest < TestCase
       Apt.dist_upgrade
     end
   end
+
+  def test_apt_install_array
+    # Make sure we can pass an array as argument as this is often times more
+    # convenient than manually converting it to a *.
+    assert_system_default(%w(install abc def)) do
+      Apt.install(%w(abc def))
+    end
+  end
 end

-- 
ci-tooling packaging



More information about the pkg-kde-commits mailing list