[SCM] ci-tooling packaging branch, master, updated. 3e0962e5ec74a4adcfa544277378176c3f5307b1

Harald Sitter apachelogger-guest at moszumanska.debian.org
Tue May 12 09:28:19 UTC 2015


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

The following commit has been merged in the master branch:
commit 3e0962e5ec74a4adcfa544277378176c3f5307b1
Author: Harald Sitter <sitter at kde.org>
Date:   Tue May 12 11:28:13 2015 +0200

    cach Apt::Repository's install of add-apt-repo to only run once
    
    cached in a class instance variable. no behavior difference to before
---
 lib/apt.rb | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/lib/apt.rb b/lib/apt.rb
index f2a3d58..8874693 100644
--- a/lib/apt.rb
+++ b/lib/apt.rb
@@ -16,8 +16,7 @@ module Apt
   class Repository
     def initialize(name)
       @name = name
-      # FIXME: maybe should be moved into module scope and cached there
-      Apt.install('software-properties-common')
+      self.class.send(:install_add_apt_repository)
     end
 
     def add
@@ -34,6 +33,16 @@ module Apt
       args << @name
       system('add-apt-repository', *args)
     end
+
+    class << self
+      private
+
+      def install_add_apt_repository
+        return if defined?(@add_apt_repository_installed)
+        Apt.install('software-properties-common')
+        @add_apt_repository_installed = true
+      end
+    end
   end
 
   def self.method_missing(name, *caller_args)

-- 
ci-tooling packaging



More information about the pkg-kde-commits mailing list