[SCM] ci-tooling packaging branch, master, updated. 0ddea031e5294406d4f21618e377a70854b24041
Harald Sitter
apachelogger-guest at moszumanska.debian.org
Thu Oct 29 12:01:02 UTC 2015
Gitweb-URL: http://git.debian.org/?p=pkg-kde/ci-tooling.git;a=commitdiff;h=0ddea03
The following commit has been merged in the master branch:
commit 0ddea031e5294406d4f21618e377a70854b24041
Author: Harald Sitter <sitter at kde.org>
Date: Thu Oct 29 13:00:30 2015 +0100
add static helpers for apt::repo to slightly improve readability
---
kci/binarier.rb | 4 ++--
lib/apt.rb | 12 ++++++++++++
test/test_apt.rb | 19 ++++++++++++-------
3 files changed, 26 insertions(+), 9 deletions(-)
diff --git a/kci/binarier.rb b/kci/binarier.rb
index 23a99ba..b9ad2d3 100755
--- a/kci/binarier.rb
+++ b/kci/binarier.rb
@@ -62,8 +62,8 @@ Dir.chdir(dir) do
end
end
Apt::Key.add('/tmp/key')
- Apt::Repository.new('ppa:plasma-phone/ppa').add
- Apt::Repository.new('ppa:ci-train-ppa-service/landing-012').add
+ Apt::Repository.add('ppa:plasma-phone/ppa')
+ Apt::Repository.add('ppa:ci-train-ppa-service/landing-012')
Apt.update
Apt.install('pbuilder')
File.write('/etc/apt/apt.conf.d/debug', 'Debug::pkgProblemResolver "true";')
diff --git a/lib/apt.rb b/lib/apt.rb
index f88365d..2b4a022 100644
--- a/lib/apt.rb
+++ b/lib/apt.rb
@@ -19,6 +19,12 @@ module Apt
self.class.send(:install_add_apt_repository)
end
+ # (see #add)
+ def self.add(name)
+ new(name).add
+ end
+
+ # Add Repository to sources.list
def add
args = []
args << '-y'
@@ -26,6 +32,12 @@ module Apt
system('add-apt-repository', *args)
end
+ # (see #remove)
+ def self.remove(name)
+ new(name).remove
+ end
+
+ # Remove Repository from sources.list
def remove
args = []
args << '-y'
diff --git a/test/test_apt.rb b/test/test_apt.rb
index 136de37..bc82f50 100644
--- a/test/test_apt.rb
+++ b/test/test_apt.rb
@@ -14,17 +14,22 @@ class AptTest < TestCase
def test_repo
repo = nil
+ name = 'ppa:yolo'
+
+ # This will be cached and not repated for static use later.
assert_system_default(%w(install software-properties-common)) do
- repo = Apt::Repository.new('ppa:yolo')
+ repo = Apt::Repository.new(name)
end
- assert_system(['add-apt-repository', '-y', 'ppa:yolo']) do
- repo.add
- end
+ cmd = ['add-apt-repository', '-y', 'ppa:yolo']
+ assert_system(cmd) { repo.add }
+ # Static
+ assert_system(cmd) { Apt::Repository.add(name) }
- assert_system(['add-apt-repository', '-y', '-r', 'ppa:yolo']) do
- repo.remove
- end
+ cmd = ['add-apt-repository', '-y', '-r', 'ppa:yolo']
+ assert_system(cmd) { repo.remove }
+ # Static
+ assert_system(cmd) { Apt::Repository.remove(name) }
end
def default_args(cmd = 'apt-get')
--
ci-tooling packaging
More information about the pkg-kde-commits
mailing list