[SCM] ci-tooling packaging branch, master, updated. 0353ebf6c50ebcfe3ca743e3ba06b04139b4ba11
Harald Sitter
apachelogger-guest at moszumanska.debian.org
Fri May 15 14:01:17 UTC 2015
Gitweb-URL: http://git.debian.org/?p=pkg-kde/ci-tooling.git;a=commitdiff;h=0353ebf
The following commit has been merged in the master branch:
commit 0353ebf6c50ebcfe3ca743e3ba06b04139b4ba11
Author: Harald Sitter <sitter at kde.org>
Date: Fri May 15 16:01:10 2015 +0200
make builder shit itself when there is no symbols file...
---
kci/builder.rb | 2 ++
lib/lint/symbols.rb | 38 ++++++++++++++++++++++
.../test_arch_good/libkf5fuckthis5.install} | 0
.../test_arch_good/libkf5fuckthis5.symbols.amd64} | 0
.../test_good/libkf5fuckthis5.install} | 0
.../test_good/libkf5fuckthis5.symbols} | 0
.../test_missing/libkf5fuckthis5.install} | 0
.../test_nolib_good/kittens.install} | 0
.../test_nolib_good/libkittens.install} | 0
test/test_lint_symbols.rb | 37 +++++++++++++++++++++
10 files changed, 77 insertions(+)
diff --git a/kci/builder.rb b/kci/builder.rb
index b73532d..af3d368 100755
--- a/kci/builder.rb
+++ b/kci/builder.rb
@@ -12,6 +12,7 @@ require_relative 'lib/kci'
require_relative 'lib/lint/control'
require_relative 'lib/lint/result'
require_relative 'lib/lint/series'
+require_relative 'lib/lint/symbols'
=begin
-> build_source
@@ -405,6 +406,7 @@ puts_lintian(log_data, updated_symbols: updated_symbols)
results = []
results << Lint::Control.new('packaging').lint
results << Lint::Series.new('packaging').lint
+results << Lint::Symbols.new('packaging').lint
Lint::ResultLogger.new(results).log
diff --git a/lib/lint/symbols.rb b/lib/lint/symbols.rb
new file mode 100644
index 0000000..bd0e7fb
--- /dev/null
+++ b/lib/lint/symbols.rb
@@ -0,0 +1,38 @@
+require_relative 'result'
+
+module Lint
+ # Lints the presence of symbols files
+ class Symbols
+ attr_reader :package_directory
+
+ def initialize(package_directory = Dir.pwd)
+ @package_directory = package_directory
+ end
+
+ # @return [Result]
+ def lint
+ result = Result.new
+ result.valid = true
+ Dir.glob("#{@package_directory}/lib*.install").each do |install_file|
+ lint_install_file(result, install_file)
+ end
+ result
+ end
+
+ private
+
+ def lint_install_file(result, file)
+ dir = File.dirname(file)
+ basename = File.basename(file, '.install')
+ return unless int?(basename[-1]) # No number at the end = no public lib.
+ return if File.exist?("#{dir}/#{basename}.symbols") ||
+ File.exist?("#{dir}/#{basename}.symbols.amd64")
+ result.errors << "Public library without symbols file: #{basename}"
+ result
+ end
+
+ def int?(char)
+ !Integer(char).nil? rescue false
+ end
+ end
+end
diff --git a/test/data/test_cmake_parser/test_init b/test/data/test_lint_symbols/test_arch_good/libkf5fuckthis5.install
similarity index 100%
copy from test/data/test_cmake_parser/test_init
copy to test/data/test_lint_symbols/test_arch_good/libkf5fuckthis5.install
diff --git a/test/data/test_cmake_parser/test_init b/test/data/test_lint_symbols/test_arch_good/libkf5fuckthis5.symbols.amd64
similarity index 100%
copy from test/data/test_cmake_parser/test_init
copy to test/data/test_lint_symbols/test_arch_good/libkf5fuckthis5.symbols.amd64
diff --git a/test/data/test_cmake_parser/test_init b/test/data/test_lint_symbols/test_good/libkf5fuckthis5.install
similarity index 100%
copy from test/data/test_cmake_parser/test_init
copy to test/data/test_lint_symbols/test_good/libkf5fuckthis5.install
diff --git a/test/data/test_cmake_parser/test_init b/test/data/test_lint_symbols/test_good/libkf5fuckthis5.symbols
similarity index 100%
copy from test/data/test_cmake_parser/test_init
copy to test/data/test_lint_symbols/test_good/libkf5fuckthis5.symbols
diff --git a/test/data/test_cmake_parser/test_init b/test/data/test_lint_symbols/test_missing/libkf5fuckthis5.install
similarity index 100%
copy from test/data/test_cmake_parser/test_init
copy to test/data/test_lint_symbols/test_missing/libkf5fuckthis5.install
diff --git a/test/data/test_cmake_parser/test_init b/test/data/test_lint_symbols/test_nolib_good/kittens.install
similarity index 100%
copy from test/data/test_cmake_parser/test_init
copy to test/data/test_lint_symbols/test_nolib_good/kittens.install
diff --git a/test/data/test_cmake_parser/test_init b/test/data/test_lint_symbols/test_nolib_good/libkittens.install
similarity index 100%
copy from test/data/test_cmake_parser/test_init
copy to test/data/test_lint_symbols/test_nolib_good/libkittens.install
diff --git a/test/test_lint_symbols.rb b/test/test_lint_symbols.rb
new file mode 100644
index 0000000..8460ee3
--- /dev/null
+++ b/test/test_lint_symbols.rb
@@ -0,0 +1,37 @@
+require_relative '../lib/lint/symbols'
+require_relative 'lib/testcase'
+
+# Test lint symbols
+# Because Jonathan doesn't know that we need them.
+class LintSymbolsTest < TestCase
+ def test_init
+ c = Lint::Symbols.new
+ assert_equal(Dir.pwd, c.package_directory)
+ c = Lint::Symbols.new('/tmp')
+ assert_equal('/tmp', c.package_directory)
+ end
+
+ def test_good
+ s = Lint::Symbols.new(data).lint
+ assert(s.valid)
+ assert_equal([], s.errors)
+ assert_equal([], s.warnings)
+ assert_equal([], s.informations)
+ end
+
+ def test_arch_good
+ s = Lint::Symbols.new(data).lint
+ assert(s.valid)
+ assert_equal([], s.errors)
+ assert_equal([], s.warnings)
+ assert_equal([], s.informations)
+ end
+
+ def test_missing
+ s = Lint::Symbols.new(data).lint
+ assert(s.valid)
+ assert_equal(1, s.errors.size)
+ assert_equal([], s.warnings)
+ assert_equal([], s.informations)
+ end
+end
--
ci-tooling packaging
More information about the pkg-kde-commits
mailing list