[SCM] ci-tooling packaging branch, master, updated. d6ca2167d616458bca21be61be65b9f4b71deb51
Rohan Garg
rohangarg-guest at moszumanska.debian.org
Fri Mar 6 17:59:56 UTC 2015
Gitweb-URL: http://git.debian.org/?p=pkg-kde/ci-tooling.git;a=commitdiff;h=d6ca216
The following commit has been merged in the master branch:
commit d6ca2167d616458bca21be61be65b9f4b71deb51
Author: Rohan Garg <rohan at garg.io>
Date: Fri Mar 6 18:59:25 2015 +0100
Revert "split cmake parsing logit out of builder and give it some testing"
This reverts commit a008f7f1f85cff3ea4a3dfee1061cb86392d7c28.
---
kci/builder.rb | 86 ++++++++++++++++++++++++++++++++++++--------
lib/cmake_parser.rb | 91 -----------------------------------------------
test/test_cmake_parser.rb | 44 -----------------------
3 files changed, 72 insertions(+), 149 deletions(-)
diff --git a/kci/builder.rb b/kci/builder.rb
index fb1029f..be70c23 100755
--- a/kci/builder.rb
+++ b/kci/builder.rb
@@ -4,9 +4,7 @@ require 'date'
require 'fileutils'
require 'json'
require 'timeout'
-
require_relative 'lib/debian/changelog'
-require_relative 'lib/cmake_parser'
=begin
-> build_source
@@ -197,9 +195,13 @@ end
exit 0 unless File.exist?('logs/i386.log.gz')
def segmentify(data, start_marker, end_marker)
- warn 'Compatibility function segmentify called. BuildLogSegmenter should be' \
- ' used instead.'
- BuildLogSegmenter.segmentify(data, start_marker, end_marker)
+ start_index = data.index(start_marker)
+ end_index = data.index(end_marker)
+ return [] unless start_index && end_index
+ data = data.slice(start_index..end_index).split("
")
+ data.shift # Ditch start line
+ data.pop # Ditch end line
+ data
end
def puts_kci(type, str)
@@ -218,12 +220,72 @@ def puts_info(str)
puts_kci('I', str)
end
+def cmake_parse_optional!(data)
+ missing = []
+ start_line = false
+ while not data.empty?
+ line = data.shift
+ if !start_line and line.empty?
+ start_line = true
+ next
+ elsif start_line and not line.empty?
+ next if line.strip.empty?
+ match = line.match(/^ *\* (.*)$/)
+ if match and match.size > 1
+ missing << match[1]
+ end
+ else
+ # Line is empty and the start conditions didn't match.
+ # Either the block is not valid or we have reached the end.
+ # In any case, break here.
+ break
+ end
+ end
+ return missing
+end
+
+def cmake_parse_package(line)
+ _package='Could not find a package configuration file provided by'
+ match = line.match(/^\s+#{_package}\s+"(.+)"/)
+ if match and match.size > 1
+ return [match[1]]
+ end
+ return []
+end
+
+def cmake_parse_warning(line)
+ return [] unless line.include?('CMake Warning')
+ # Lines coming from MacroOptionalFindPackage (from old parsing).
+ return [] if line.include?('CMake Warning at /usr/share/kde4/apps/cmake/modules/MacroOptionalFindPackage.cmake')
+ # Lines coming from find_package (from old parsing).
+ return [] if line.match(/CMake Warning at [^ :]+:\d+ \(find_package\)/)
+ # Lines coming from warnings inside the actual CMakeLists.txt as those can be arbitrary.
+ # ref: "CMake Warning at src/worker/CMakeLists.txt:33 (message):"
+ return [] if line.match(/CMake Warning at [^ :]*CMakeLists.txt:\d+ \(message\)/)
+ return [] if line.start_with?('CMake Warning (dev)')
+ return [] if line.start_with?('CMake Warning:')
+ [line]
+end
+
def puts_cmake(data, source_name)
- # Bit of compat code. Very lovely... NOT
- parser = CMakeParser(data)
- missing = parser.missing
- warnings = parser.warnings
- disabled_features = parser.disabled_features
+ data = segmentify(data, 'dh_auto_configure', 'dh_auto_build')
+ return if data.empty?
+
+ missing = []
+ warnings = []
+ until data.empty?
+ line = data.shift
+ if line.include?('The following OPTIONAL packages have not been found')
+ missing += cmake_parse_optional!(data)
+ elsif line.include?('Could not find a package configuration file provided by')
+ missing += cmake_parse_package(line)
+ elsif line.include?('CMake Warning')
+ warnings += cmake_parse_warning(line)
+ end
+ end
+
+ missing.uniq!
+ warnings.uniq!
puts 'KCI::CMAKE'
@@ -256,10 +318,6 @@ def puts_cmake(data, source_name)
warnings.each do |warning|
puts_warning(warning)
end
-
- disabled_features.each do |disabled_feature|
- puts_warning("Disabled Feature: #{disabled_feature}")
- end
end
def puts_list_missing(data)
diff --git a/lib/cmake_parser.rb b/lib/cmake_parser.rb
deleted file mode 100644
index 2e91510..0000000
--- a/lib/cmake_parser.rb
+++ /dev/null
@@ -1,91 +0,0 @@
-# Split a segment out of a build log by defining a start maker and an end marker
-module BuildLogSegmenter
- module_function
-
- def segmentify(data, start_marker, end_marker)
- start_index = data.index(start_marker)
- end_index = data.index(end_marker)
- return [] unless start_index && end_index
- data = data.slice(start_index..end_index).split("
")
- data.shift # Ditch start line
- data.pop # Ditch end line
- data
- end
-end
-
-# Parses CMake output
-class CMakeParser
- include BuildLogSegmenter
-
- attr_reader :warnings
- attr_reader :missing
- attr_reader :disabled_features
-
- def initialize(data)
- @data = segmentify(data, 'dh_auto_configure', 'dh_auto_build')
- return if @data.empty?
-
- @missing = []
- @warnings = []
- @disabled_features = []
- until @data.empty?
- line = @data.shift
- if line.include?('The following OPTIONAL packages have not been found')
- @missing += cmake_parse_summary(@data)
- elsif line.include?('The following features have been disabled')
- @disabled_features += cmake_parse_summary(@data)
- elsif line.include?('Could not find a package configuration file provided by')
- @missing += cmake_parse_package(line)
- elsif line.include?('CMake Warning')
- @warnings += cmake_parse_warning(line)
- end
- end
- @missing.uniq!
- @warnings.uniq!
- @disabled_features.uniq!
- end
-
- def cmake_parse_summary(data)
- missing = []
- start_line = false
- until data.empty?
- line = data.shift
- if !start_line && line.empty?
- start_line = true
- next
- elsif start_line && !line.empty?
- next if line.strip.empty?
- match = line.match(/^ *\* (.*)$/)
- missing << match[1] if match && match.size > 1
- else
- # Line is empty and the start conditions didn't match.
- # Either the block is not valid or we have reached the end.
- # In any case, break here.
- break
- end
- end
- missing
- end
-
- def cmake_parse_package(line)
- package = 'Could not find a package configuration file provided by'
- match = line.match(/^\s+#{package}\s+"(.+)"/)
- return [] unless match && match.size > 1
- [match[1]]
- end
-
- def cmake_parse_warning(line)
- warn 'CMake Warning Parsing is disabled at this time!'
- return [] unless line.include?('CMake Warning')
- # Lines coming from MacroOptionalFindPackage (from old parsing).
- return [] if line.include?('CMake Warning at /usr/share/kde4/apps/cmake/modules/MacroOptionalFindPackage.cmake')
- # Lines coming from find_package (from old parsing).
- return [] if line.match(/CMake Warning at [^ :]+:\d+ \(find_package\)/)
- # Lines coming from warnings inside the actual CMakeLists.txt as those can
- # be arbitrary.
- # ref: "CMake Warning at src/worker/CMakeLists.txt:33 (message):"
- return [] if line.match(/CMake Warning at [^ :]*CMakeLists.txt:\d+ \(message\)/)
- return [] if line.start_with?('CMake Warning (dev)')
- [] # if line.start_with?('CMake Warning:')] ALWAYS empty, too pointless
- end
-end
diff --git a/test/test_cmake_parser.rb b/test/test_cmake_parser.rb
deleted file mode 100644
index 97a97ec..0000000
--- a/test/test_cmake_parser.rb
+++ /dev/null
@@ -1,44 +0,0 @@
-require 'test/unit'
-
-require_relative '../lib/cmake_parser'
-
-# Test CMakeParser
-class CMakeParserTest < Test::Unit::TestCase
- def setup
- @datadir = "#{File.expand_path(File.dirname(__FILE__))}/data/#{File.basename(__FILE__, '.rb')}"
- end
-
- def data
- index = 0
- caller = ''
- until caller.start_with?('test_')
- caller = caller_locations(index, 1)[0].label
- index += 1
- end
- File.read("#{@datadir}/#{caller}")
- end
-
- def test_init
- CMakeParser.new(data)
- end
-
- def test_missing_package
- parser = CMakeParser.new(data)
- assert_equal(parser.missing, %w(KF5Package))
- end
-
- def test_optional
- parser = CMakeParser.new(data)
- assert_equal(parser.missing, %w(Qt5TextToSpeech))
- end
-
- def test_warning
- parser = CMakeParser.new(data)
- assert_equal(parser.warnings, %w())
- end
-
- def test_disabled_feature
- parser = CMakeParser.new(data)
- assert_equal(parser.disabled_features, ['XCB-CURSOR , Required for XCursor support'])
- end
-end
--
ci-tooling packaging
More information about the pkg-kde-commits
mailing list