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

Harald Sitter apachelogger-guest at moszumanska.debian.org
Mon Oct 12 09:09:11 UTC 2015


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

The following commit has been merged in the master branch:
commit b7c8e411ae6be6c305dec187825cf6b88e3a0934
Author: Harald Sitter <sitter at kde.org>
Date:   Mon Oct 12 11:08:27 2015 +0200

    reimplement ignores handling in kcibuilder through patterning
---
 kci/builder.rb                                     | 33 ++++++++++++++++------
 lib/lint/log/cmake.rb                              |  6 +++-
 lib/lint/log/lintian.rb                            |  4 +++
 .../results/cmake/test_disabled_feature            | 16 +++++++++++
 .../test_puts_log/results/cmake/test_init          | 16 +++++++++++
 .../results/cmake/test_missing_package             | 17 +++++++++++
 .../test_puts_log/results/cmake/test_optional      | 16 +++++++++++
 .../test_puts_log/results/cmake/test_warning       | 16 +++++++++++
 .../test_puts_log/results/lintian/test_invalid     | 16 +++++++++++
 .../test_puts_log/results/lintian/test_lint        | 21 ++++++++++++++
 .../results/list_missing/test_invalid              | 16 +++++++++++
 .../test_puts_log/results/list_missing/test_lint   | 23 +++++++++++++++
 test/test_kci_builder.rb                           | 17 +++++++++++
 13 files changed, 207 insertions(+), 10 deletions(-)

diff --git a/kci/builder.rb b/kci/builder.rb
index 2f3d62b..b8b0837 100755
--- a/kci/builder.rb
+++ b/kci/builder.rb
@@ -305,16 +305,31 @@ class KCIBuilder
     updated_symbols
   end
 
-  def self.lint_logs(log_data, updated_symbols:)
-    results = Lint::Log.new(log_data).lint
-    if updated_symbols # Drop symbols error if we applied an update.
-      results.each do |result|
-        lintian = 'symbols-file-contains-current-version-with-debian-revision'
-        result.errors.reject! { |s| s.include?(lintian) }
-        result.warnings.reject! { |s| s.include?(lintian) }
-        result.informations.reject! { |s| s.include?(lintian) }
-      end
+  def self.lint_cmake(data)
+    cmake = Lint::Log::CMake.new
+    cmake.load_include_ignores('packaging/debian/meta/cmake-ignore')
+    cmake.ignores << CI::IncludePattern.new('Qt5TextToSpeech')
+    cmake.lint(data.clone)
+  end
+
+  def self.lint_lintian(data, updated_symbols)
+    lintian = Lint::Log::Lintian.new
+    if updated_symbols
+      label = 'symbols-file-contains-current-version-with-debian-revision'
+      lintian.ignores << CI::IncludePattern.new(label)
     end
+    lintian.lint(data.clone)
+  end
+
+  def self.lint_list_missing(data)
+    Lint::Log::ListMissing.new.lint(data.clone)
+  end
+
+  def self.lint_logs(log_data, updated_symbols:)
+    results = []
+    results << lint_cmake(log_data)
+    results << lint_lintian(log_data, updated_symbols)
+    results << lint_list_missing(log_data)
     results
   end
 end
diff --git a/lib/lint/log/cmake.rb b/lib/lint/log/cmake.rb
index 93e8861..3a28221 100644
--- a/lib/lint/log/cmake.rb
+++ b/lib/lint/log/cmake.rb
@@ -39,7 +39,11 @@ module Lint
           line = data.shift
           METHS.each do |id, meth|
             next unless line.include?(id)
-            result.warnings += send(meth, line, data)
+            ret = send(meth, line, data)
+            @ignores.each do |ignore|
+              ret.reject! { |d| ignore.match?(d) }
+            end
+            result.warnings += ret
             break
           end
         end
diff --git a/lib/lint/log/lintian.rb b/lib/lint/log/lintian.rb
index 8934632..4056597 100644
--- a/lib/lint/log/lintian.rb
+++ b/lib/lint/log/lintian.rb
@@ -46,6 +46,10 @@ module Lint
           next unless line.include?(e)
           return true
         end
+        @ignores.each do |i|
+          next unless i.match?(line)
+          return true
+        end
         false
       end
 
diff --git a/test/data/test_kci_builder/test_puts_log/results/cmake/test_disabled_feature b/test/data/test_kci_builder/test_puts_log/results/cmake/test_disabled_feature
new file mode 100644
index 0000000..0b4c482
--- /dev/null
+++ b/test/data/test_kci_builder/test_puts_log/results/cmake/test_disabled_feature
@@ -0,0 +1,16 @@
+---
+- !ruby/object:Lint::Result
+  valid: true
+  errors: []
+  warnings: []
+  informations: []
+- !ruby/object:Lint::Result
+  valid: false
+  errors: []
+  warnings: []
+  informations: []
+- !ruby/object:Lint::Result
+  valid: false
+  errors: []
+  warnings: []
+  informations: []
diff --git a/test/data/test_kci_builder/test_puts_log/results/cmake/test_init b/test/data/test_kci_builder/test_puts_log/results/cmake/test_init
new file mode 100644
index 0000000..a3074b9
--- /dev/null
+++ b/test/data/test_kci_builder/test_puts_log/results/cmake/test_init
@@ -0,0 +1,16 @@
+---
+- !ruby/object:Lint::Result
+  valid: false
+  errors: []
+  warnings: []
+  informations: []
+- !ruby/object:Lint::Result
+  valid: false
+  errors: []
+  warnings: []
+  informations: []
+- !ruby/object:Lint::Result
+  valid: false
+  errors: []
+  warnings: []
+  informations: []
diff --git a/test/data/test_kci_builder/test_puts_log/results/cmake/test_missing_package b/test/data/test_kci_builder/test_puts_log/results/cmake/test_missing_package
new file mode 100644
index 0000000..7426942
--- /dev/null
+++ b/test/data/test_kci_builder/test_puts_log/results/cmake/test_missing_package
@@ -0,0 +1,17 @@
+---
+- !ruby/object:Lint::Result
+  valid: true
+  errors: []
+  warnings:
+    - KF5Package
+  informations: []
+- !ruby/object:Lint::Result
+  valid: false
+  errors: []
+  warnings: []
+  informations: []
+- !ruby/object:Lint::Result
+  valid: false
+  errors: []
+  warnings: []
+  informations: []
diff --git a/test/data/test_kci_builder/test_puts_log/results/cmake/test_optional b/test/data/test_kci_builder/test_puts_log/results/cmake/test_optional
new file mode 100644
index 0000000..0b4c482
--- /dev/null
+++ b/test/data/test_kci_builder/test_puts_log/results/cmake/test_optional
@@ -0,0 +1,16 @@
+---
+- !ruby/object:Lint::Result
+  valid: true
+  errors: []
+  warnings: []
+  informations: []
+- !ruby/object:Lint::Result
+  valid: false
+  errors: []
+  warnings: []
+  informations: []
+- !ruby/object:Lint::Result
+  valid: false
+  errors: []
+  warnings: []
+  informations: []
diff --git a/test/data/test_kci_builder/test_puts_log/results/cmake/test_warning b/test/data/test_kci_builder/test_puts_log/results/cmake/test_warning
new file mode 100644
index 0000000..0b4c482
--- /dev/null
+++ b/test/data/test_kci_builder/test_puts_log/results/cmake/test_warning
@@ -0,0 +1,16 @@
+---
+- !ruby/object:Lint::Result
+  valid: true
+  errors: []
+  warnings: []
+  informations: []
+- !ruby/object:Lint::Result
+  valid: false
+  errors: []
+  warnings: []
+  informations: []
+- !ruby/object:Lint::Result
+  valid: false
+  errors: []
+  warnings: []
+  informations: []
diff --git a/test/data/test_kci_builder/test_puts_log/results/lintian/test_invalid b/test/data/test_kci_builder/test_puts_log/results/lintian/test_invalid
new file mode 100644
index 0000000..a3074b9
--- /dev/null
+++ b/test/data/test_kci_builder/test_puts_log/results/lintian/test_invalid
@@ -0,0 +1,16 @@
+---
+- !ruby/object:Lint::Result
+  valid: false
+  errors: []
+  warnings: []
+  informations: []
+- !ruby/object:Lint::Result
+  valid: false
+  errors: []
+  warnings: []
+  informations: []
+- !ruby/object:Lint::Result
+  valid: false
+  errors: []
+  warnings: []
+  informations: []
diff --git a/test/data/test_kci_builder/test_puts_log/results/lintian/test_lint b/test/data/test_kci_builder/test_puts_log/results/lintian/test_lint
new file mode 100644
index 0000000..d912cc9
--- /dev/null
+++ b/test/data/test_kci_builder/test_puts_log/results/lintian/test_lint
@@ -0,0 +1,21 @@
+---
+- !ruby/object:Lint::Result
+  valid: false
+  errors: []
+  warnings: []
+  informations: []
+- !ruby/object:Lint::Result
+  valid: true
+  errors:
+  - 'E: foo'
+  warnings:
+  - 'W: cantor: desktop-mime-but-no-exec-code usr/share/applications/org.kde.cantor.desktop'
+  - 'W: cantor: desktop-mime-but-no-exec-code usr/share/applications/org.kde.cantor.desktop1'
+  informations:
+  - 'I: bar'
+  - 'N: 2 tags overridden (1 error, 1 warning)'
+- !ruby/object:Lint::Result
+  valid: false
+  errors: []
+  warnings: []
+  informations: []
diff --git a/test/data/test_kci_builder/test_puts_log/results/list_missing/test_invalid b/test/data/test_kci_builder/test_puts_log/results/list_missing/test_invalid
new file mode 100644
index 0000000..a3074b9
--- /dev/null
+++ b/test/data/test_kci_builder/test_puts_log/results/list_missing/test_invalid
@@ -0,0 +1,16 @@
+---
+- !ruby/object:Lint::Result
+  valid: false
+  errors: []
+  warnings: []
+  informations: []
+- !ruby/object:Lint::Result
+  valid: false
+  errors: []
+  warnings: []
+  informations: []
+- !ruby/object:Lint::Result
+  valid: false
+  errors: []
+  warnings: []
+  informations: []
diff --git a/test/data/test_kci_builder/test_puts_log/results/list_missing/test_lint b/test/data/test_kci_builder/test_puts_log/results/list_missing/test_lint
new file mode 100644
index 0000000..9414839
--- /dev/null
+++ b/test/data/test_kci_builder/test_puts_log/results/list_missing/test_lint
@@ -0,0 +1,23 @@
+---
+- !ruby/object:Lint::Result
+  valid: false
+  errors: []
+  warnings: []
+  informations: []
+- !ruby/object:Lint::Result
+  valid: true
+  errors:
+  - 'E: foo'
+  warnings:
+  - 'W: cantor: desktop-mime-but-no-exec-code usr/share/applications/org.kde.cantor.desktop'
+  - 'W: cantor: desktop-mime-but-no-exec-code usr/share/applications/org.kde.cantor.desktop1'
+  informations:
+  - 'I: bar'
+  - 'N: 2 tags overridden (1 error, 1 warning)'
+- !ruby/object:Lint::Result
+  valid: true
+  errors:
+  - "-./etc"
+  - "-./usr/lib"
+  warnings: []
+  informations: []
diff --git a/test/test_kci_builder.rb b/test/test_kci_builder.rb
index 4620a99..924e133 100644
--- a/test/test_kci_builder.rb
+++ b/test/test_kci_builder.rb
@@ -1,3 +1,5 @@
+require 'yaml'
+
 require_relative 'lib/testcase'
 
 require_relative '../kci/builder.rb'
@@ -125,10 +127,25 @@ class KCIBuilderTest < TestCase
   end
 
   def test_puts_log
+    FileUtils.mkpath('packaging/debian/meta')
+    File.write('packaging/debian/meta/cmake-ignore', 'XCB-CURSOR')
     Dir.glob("#{data}/*/*").each do |f|
       next if File.directory?(f)
       results = KCIBuilder.lint_logs(File.read(f), updated_symbols: true)
       assert_false(results.empty?)
+      if false # recording
+        results_dir = "#{@datadir}/#{@method_name}/results"
+        dir = File.basename(File.dirname(f))
+        file = File.basename(f)
+        FileUtils.mkpath("#{results_dir}/#{dir}")
+        File.write("#{results_dir}/#{dir}/#{file}", results.to_yaml)
+      else # verification
+        results_dir = "#{@datadir}/#{@method_name}/results"
+        dir = File.basename(File.dirname(f))
+        file = File.basename(f)
+        ref = YAML.load(File.read("#{results_dir}/#{dir}/#{file}"))
+        assert_equal(ref, results)
+      end
       results.each do |result|
         result.all.each do |message|
           assert_false(message.include?('symbols-file-contains-current-version-with-debian-revision'),

-- 
ci-tooling packaging



More information about the pkg-kde-commits mailing list