[SCM] ci-tooling packaging branch, master, updated. d4ffdf8d84be8873d48ca290dc092fd9a6830873
Rohan Garg
rohangarg-guest at moszumanska.debian.org
Thu Mar 19 16:44:18 UTC 2015
Gitweb-URL: http://git.debian.org/?p=pkg-kde/ci-tooling.git;a=commitdiff;h=d4ffdf8
The following commit has been merged in the master branch:
commit d4ffdf8d84be8873d48ca290dc092fd9a6830873
Author: Rohan Garg <rohan at garg.io>
Date: Thu Mar 19 17:43:41 2015 +0100
Take into account the fact that build-depends can be empty and write a test for it
* Make projects.rb use fetch instead of checking for the key
---
lib/debian/control.rb | 3 +++
lib/projects.rb | 4 +++-
.../test_no_build_deps/debian/control | 25 ++++++++++++++++++++++
test/test_debian_control.rb | 18 ++++++++++++++++
4 files changed, 49 insertions(+), 1 deletion(-)
diff --git a/lib/debian/control.rb b/lib/debian/control.rb
index e8fc128..c060422 100644
--- a/lib/debian/control.rb
+++ b/lib/debian/control.rb
@@ -11,6 +11,9 @@ class CaseHash < Hash
key.respond_to?(:downcase) ? super(key.downcase) : super(key)
end
+ def fetch(key, default)
+ key.respond_to?(:downcase) ? super(key.downcase, default) : super(key, default)
+ end
end
class Relationship
diff --git a/lib/projects.rb b/lib/projects.rb
index d74530e..fc3d74d 100644
--- a/lib/projects.rb
+++ b/lib/projects.rb
@@ -79,9 +79,11 @@ class Project
c = DebianControl.new
# TODO: raise? return?
c.parse!
- c.source['build-depends'].each do |dep|
+
+ c.source.fetch('build-depends', []).each do |dep|
@dependencies << dep.name
end
+
c.binaries.each do |binary|
@provided_binaries << binary['package']
end
diff --git a/test/data/test_debian_control/test_no_build_deps/debian/control b/test/data/test_debian_control/test_no_build_deps/debian/control
new file mode 100644
index 0000000..7ff7e83
--- /dev/null
+++ b/test/data/test_debian_control/test_no_build_deps/debian/control
@@ -0,0 +1,25 @@
+Source: base-files
+Section: admin
+Priority: required
+Maintainer: Leszek Lesner <leszek at zevenos.com>
+Standards-Version: 3.9.1
+
+Package: base-files
+Provides: base
+Architecture: any
+Pre-Depends: awk
+Essential: yes
+Priority: required
+Replaces: base, miscutils, dpkg (<= 1.15.0)
+Breaks: initscripts (<< 2.88dsf-13.3), sendfile (<< 2.1b.20080616-5.2~)
+Description: Debian base system miscellaneous files
+ This package contains the basic filesystem hierarchy of a Debian system, and
+ several important miscellaneous files, such as /etc/debian_version,
+ /etc/host.conf, /etc/issue, /etc/motd, /etc/profile, and others,
+ and the text of several common licenses in use on Debian systems.
+
+Package: lsb-release-udeb
+Section: debian-installer
+Architecture: all
+Priority: extra
+Description: LSB release information
diff --git a/test/test_debian_control.rb b/test/test_debian_control.rb
index c735be6..ddeed0d 100644
--- a/test/test_debian_control.rb
+++ b/test/test_debian_control.rb
@@ -16,6 +16,16 @@ class DebianControlFormatTest < Test::Unit::TestCase
Dir.chdir(@previous_pwd)
end
+ def data(path = nil)
+ index = 0
+ caller = ''
+ until caller.start_with?('test_')
+ caller = caller_locations(index, 1)[0].label
+ index += 1
+ end
+ File.join(*[@datadir, caller, path].compact)
+ end
+
def test_parse
assert_nothing_raised do
c = DebianControl.new
@@ -33,5 +43,13 @@ class DebianControlFormatTest < Test::Unit::TestCase
c = DebianControl.new
c.parse!
assert_equal(1, c.source['build-depends'].size)
+ assert_nil(c.source.fetch('magic', nil))
+ end
+
+ def test_no_build_deps
+ Dir.chdir(data)
+ c = DebianControl.new
+ c.parse!
+ assert_equal(0, c.source.fetch('build-depends', []).size)
end
end
--
ci-tooling packaging
More information about the pkg-kde-commits
mailing list