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

Harald Sitter apachelogger-guest at moszumanska.debian.org
Mon Mar 9 08:50:14 UTC 2015


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

The following commit has been merged in the master branch:
commit d214f41a58d285394b87f798225c9c392f5333f7
Author: Harald Sitter <sitter at kde.org>
Date:   Mon Mar 9 09:50:00 2015 +0100

    split cmake parsing logit out of builder and give it some testing
    
    This reverts commit d6ca2167d616458bca21be61be65b9f4b71deb51.
    As well as commit 84680c39320d9a270e1fd3e3a2aad9e592503b97.
---
 kci/builder.rb                                    |  86 ++--------
 lib/cmake_parser.rb                               |  91 +++++++++++
 test/data/test_cmake_parser/test_disabled_feature | 187 ++++++++++++++++++++++
 test/data/test_cmake_parser/test_init             |   1 +
 test/data/test_cmake_parser/test_missing_package  |  75 +++++++++
 test/data/test_cmake_parser/test_optional         |  19 +++
 test/data/test_cmake_parser/test_warning          |  60 +++++++
 test/test_cmake_parser.rb                         |  44 +++++
 8 files changed, 491 insertions(+), 72 deletions(-)

diff --git a/kci/builder.rb b/kci/builder.rb
index be70c23..9f8c6db 100755
--- a/kci/builder.rb
+++ b/kci/builder.rb
@@ -4,7 +4,9 @@ require 'date'
 require 'fileutils'
 require 'json'
 require 'timeout'
+
 require_relative 'lib/debian/changelog'
+require_relative 'lib/cmake_parser'
 
 =begin
 -> build_source
@@ -195,13 +197,9 @@ end
 exit 0 unless File.exist?('logs/i386.log.gz')
 
 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
+  warn 'Compatibility function segmentify called. BuildLogSegmenter should be' \
+       ' used instead.'
+  BuildLogSegmenter.segmentify(data, start_marker, end_marker)
 end
 
 def puts_kci(type, str)
@@ -220,72 +218,12 @@ 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)
-  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!
+  # Bit of compat code. Very lovely... NOT
+  parser = CMakeParser.new(data)
+  missing = parser.missing
+  warnings = parser.warnings
+  disabled_features = parser.disabled_features
 
   puts 'KCI::CMAKE'
 
@@ -318,6 +256,10 @@ 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
new file mode 100644
index 0000000..2e91510
--- /dev/null
+++ b/lib/cmake_parser.rb
@@ -0,0 +1,91 @@
+# 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/data/test_cmake_parser/test_disabled_feature b/test/data/test_cmake_parser/test_disabled_feature
new file mode 100644
index 0000000..99c82fe
--- /dev/null
+++ b/test/data/test_cmake_parser/test_disabled_feature
@@ -0,0 +1,187 @@
+ 
+dh_auto_configure '--buildsystem=kf5' --parallel  
+-- The C compiler identification is GNU 4.9.2
+-- The CXX compiler identification is GNU 4.9.2
+-- Check for working C compiler: /usr/bin/x86_64-linux-gnu-gcc
+-- Check for working C compiler: /usr/bin/x86_64-linux-gnu-gcc -- works
+-- Detecting C compiler ABI info
+-- Detecting C compiler ABI info - done
+-- Check for working CXX compiler: /usr/bin/x86_64-linux-gnu-g++
+-- Check for working CXX compiler: /usr/bin/x86_64-linux-gnu-g++ -- works
+-- Detecting CXX compiler ABI info
+-- Detecting CXX compiler ABI info - done
+-- Looking for __GLIBC__
+-- Looking for __GLIBC__ - found
+-- Performing Test _OFFT_IS_64BIT
+-- Performing Test _OFFT_IS_64BIT - Success
+-- Found KF5Config: /usr/lib/x86_64-linux-gnu/cmake/KF5Config/KF5ConfigConfig.cmake (found version "5.8.0") 
+-- Found Gettext: /usr/bin/msgmerge (found version "0.19.2") 
+-- Found PythonInterp: /usr/bin/python (found version "2.7.9") 
+-- Found KF5ConfigWidgets: /usr/lib/x86_64-linux-gnu/cmake/KF5ConfigWidgets/KF5ConfigWidgetsConfig.cmake (found version "5.8.0") 
+-- Found KF5CoreAddons: /usr/lib/x86_64-linux-gnu/cmake/KF5CoreAddons/KF5CoreAddonsConfig.cmake (found version "5.8.0") 
+-- Found KF5Crash: /usr/lib/x86_64-linux-gnu/cmake/KF5Crash/KF5CrashConfig.cmake (found version "5.8.0") 
+-- Found KF5GlobalAccel: /usr/lib/x86_64-linux-gnu/cmake/KF5GlobalAccel/KF5GlobalAccelConfig.cmake (found version "5.8.0") 
+-- Found KF5I18n: /usr/lib/x86_64-linux-gnu/cmake/KF5I18n/KF5I18nConfig.cmake (found version "5.8.0") 
+-- Found KF5Init: /usr/lib/x86_64-linux-gnu/cmake/KF5Init/KF5InitConfig.cmake (found version "5.8.0") 
+-- Found KF5Notifications: /usr/lib/x86_64-linux-gnu/cmake/KF5Notifications/KF5NotificationsConfig.cmake (found version "5.8.0") 
+-- Found KF5Service: /usr/lib/x86_64-linux-gnu/cmake/KF5Service/KF5ServiceConfig.cmake (found version "5.8.0") 
+-- Found KF5Plasma: /usr/lib/x86_64-linux-gnu/cmake/KF5Plasma/KF5PlasmaConfig.cmake (found version "5.8.0") 
+-- Found KF5WidgetsAddons: /usr/lib/x86_64-linux-gnu/cmake/KF5WidgetsAddons/KF5WidgetsAddonsConfig.cmake (found version "5.8.0") 
+-- Found KF5WindowSystem: /usr/lib/x86_64-linux-gnu/cmake/KF5WindowSystem/KF5WindowSystemConfig.cmake (found version "5.8.0") 
+-- Found KF5: success (found suitable version "5.8.0", minimum required is "5.8.0") found components:  Config ConfigWidgets CoreAddons Crash GlobalAccel I18n Init Notifications Service Plasma WidgetsAddons WindowSystem 
+-- Found KF5Completion: /usr/lib/x86_64-linux-gnu/cmake/KF5Completion/KF5CompletionConfig.cmake (found version "5.8.0") 
+-- Found KF5Declarative: /usr/lib/x86_64-linux-gnu/cmake/KF5Declarative/KF5DeclarativeConfig.cmake (found version "5.8.0") 
+-- Found KF5KCMUtils: /usr/lib/x86_64-linux-gnu/cmake/KF5KCMUtils/KF5KCMUtilsConfig.cmake (found version "5.8.0") 
+-- Found KF5KIO: /usr/lib/x86_64-linux-gnu/cmake/KF5KIO/KF5KIOConfig.cmake (found version "5.8.0") 
+-- Found KF5NewStuff: /usr/lib/x86_64-linux-gnu/cmake/KF5NewStuff/KF5NewStuffConfig.cmake (found version "5.8.0") 
+-- Found KF5XmlGui: /usr/lib/x86_64-linux-gnu/cmake/KF5XmlGui/KF5XmlGuiConfig.cmake (found version "5.8.0") 
+-- Found KF5: success (found suitable version "5.8.0", minimum required is "5.8.0") found components:  Completion Declarative KCMUtils KIO NewStuff XmlGui 
+-- Found PkgConfig: /usr/bin/pkg-config (found version "0.28") 
+-- Found EGL: /usr/lib/x86_64-linux-gnu/libEGL.so (found version "1.4") 
+-- Found epoxy: /usr/lib/x86_64-linux-gnu/libepoxy.so  
+-- Found Wayland_Client: /usr/lib/x86_64-linux-gnu/libwayland-client.so (found version "1.7.0") 
+-- Found Wayland_Server: /usr/lib/x86_64-linux-gnu/libwayland-server.so (found version "1.7.0") 
+-- Found Wayland_Cursor: /usr/lib/x86_64-linux-gnu/libwayland-cursor.so (found version "1.7.0") 
+-- Found Wayland_Egl: /usr/lib/x86_64-linux-gnu/libwayland-egl.so (found version "10.5.0-rc1") 
+-- Found Wayland: /usr/lib/x86_64-linux-gnu/libwayland-client.so;/usr/lib/x86_64-linux-gnu/libwayland-server.so;/usr/lib/x86_64-linux-gnu/libwayland-cursor.so;/usr/lib/x86_64-linux-gnu/libwayland-egl.so (found suitable version "1.7.0", minimum required is "1.2") found components:  Client Egl Cursor Server 
+-- Found XKB: /usr/lib/x86_64-linux-gnu/libxkbcommon.so (found suitable version "0.4.3", minimum required is "0.4.1") 
+-- Found Libinput: /usr/lib/x86_64-linux-gnu/libinput.so (found suitable version "0.9.0", minimum required is "0.5") 
+-- Found UDev: /usr/include  
+-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
+-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
+-- Looking for gethostbyname
+-- Looking for gethostbyname - found
+-- Looking for connect
+-- Looking for connect - found
+-- Looking for remove
+-- Looking for remove - found
+-- Looking for shmat
+-- Looking for shmat - found
+-- Looking for IceConnectionNumber in ICE
+-- Looking for IceConnectionNumber in ICE - found
+-- Found X11: /usr/lib/x86_64-linux-gnu/libX11.so
+-- Found XCB_XCB: /usr/lib/x86_64-linux-gnu/libxcb.so (found version "1.10") 
+-- Found XCB_RENDER: /usr/lib/x86_64-linux-gnu/libxcb-render.so (found version "1.10") 
+-- Found XCB_SHAPE: /usr/lib/x86_64-linux-gnu/libxcb-shape.so (found version "1.10") 
+-- Found XCB_XFIXES: /usr/lib/x86_64-linux-gnu/libxcb-xfixes.so (found version "1.10") 
+-- Found XCB_SHM: /usr/lib/x86_64-linux-gnu/libxcb-shm.so (found version "1.10") 
+-- Found XCB_COMPOSITE: /usr/lib/x86_64-linux-gnu/libxcb-composite.so (found version "1.10") 
+-- Could NOT find XCB_CURSOR (missing:  XCB_CURSOR_LIBRARY XCB_CURSOR_INCLUDE_DIR) 
+-- Found XCB_DAMAGE: /usr/lib/x86_64-linux-gnu/libxcb-damage.so (found version "1.10") 
+-- Found XCB_GLX: /usr/lib/x86_64-linux-gnu/libxcb-glx.so (found version "1.10") 
+-- Found XCB_ICCCM: /usr/lib/x86_64-linux-gnu/libxcb-icccm.so (found version "0.4.1") 
+-- Found XCB_IMAGE: /usr/lib/x86_64-linux-gnu/libxcb-image.so (found version "0.4.0") 
+-- Found XCB_KEYSYMS: /usr/lib/x86_64-linux-gnu/libxcb-keysyms.so (found version "0.4.0") 
+-- Found XCB_RANDR: /usr/lib/x86_64-linux-gnu/libxcb-randr.so (found version "1.10") 
+-- Found XCB_SYNC: /usr/lib/x86_64-linux-gnu/libxcb-sync.so (found version "1.10") 
+-- Found XCB_XTEST: /usr/lib/x86_64-linux-gnu/libxcb-xtest.so (found version "1.10") 
+-- Found XCB: /usr/lib/x86_64-linux-gnu/libxcb.so;/usr/lib/x86_64-linux-gnu/libxcb-render.so;/usr/lib/x86_64-linux-gnu/libxcb-shape.so;/usr/lib/x86_64-linux-gnu/libxcb-xfixes.so;/usr/lib/x86_64-linux-gnu/libxcb-shm.so;/usr/lib/x86_64-linux-gnu/libxcb-composite.so;/usr/lib/x86_64-linux-gnu/libxcb-damage.so;/usr/lib/x86_64-linux-gnu/libxcb-glx.so;/usr/lib/x86_64-linux-gnu/libxcb-icccm.so;/usr/lib/x86_64-linux-gnu/libxcb-image.so;/usr/lib/x86_64-linux-gnu/libxcb-keysyms.so;/usr/lib/x86_64-linux-gnu/libxcb-randr.so;/usr/lib/x86_64-linux-gnu/libxcb-sync.so;/usr/lib/x86_64-linux-gnu/libxcb-xtest.so (found version "1.10") found components:  XCB XFIXES DAMAGE COMPOSITE SHAPE SYNC RENDER RANDR KEYSYMS IMAGE SHM XTEST GLX ICCCM missing components:  CURSOR
+-- 
+-- The following features have been enabled:
+
+ * Qt5Test (required version >= 5.4.0) , Required for building tests
+   Required for tests
+ * KF5Activities (required version >= 5.8.0) , Enable building of KWin with kactivities support
+   Enable building of KWin with kactivities support
+ * KF5DocTools (required version >= 5.8.0) , Enable building documentation
+   Enable building documentation
+ * KF5Wayland , Required for Wayland Compositor Information Module
+ * Wayland-Client , Required for building the Wayland backend in KWin
+ * Wayland-EGL , Required for building the Wayland EGL compositing backend in KWin
+ * XCB-ICCCM , Required for building test applications for KWin
+ * XCB-SYNC , XCB Sync version >= 1.10 required for synced window resizing
+
+-- The following OPTIONAL packages have been found:
+
+ * Qt5Test (required version >= 5.4.0) , Required for building tests
+   Required for tests
+ * KF5Activities (required version >= 5.8.0) , Enable building of KWin with kactivities support
+   Enable building of KWin with kactivities support
+ * KF5DocTools (required version >= 5.8.0) , Enable building documentation
+   Enable building documentation
+ * KF5Wayland , Required for Wayland Compositor Information Module
+ * EGL , A platform-agnostic mechanism for creating rendering surfaces for use with other graphics libraries, such as OpenGL|ES and OpenVG. , <https://www.khronos.org/egl/>
+   Required to build KWin with EGL support
+ * Wayland (required version >= 1.2) , C library implementation of the Wayland protocol: a protocol for a compositor to talk to its clients , <http://wayland.freedesktop.org>
+   Required for building KWin with Wayland support
+ * XKB (required version >= 0.4.1) , XKB API common to servers and clients. , <http://xkbcommon.org>
+   Required for building KWin with Wayland support
+ * Libinput (required version >= 0.5) , Library to handle input devices in Wayland compositors and to provide a generic X.Org input driver. , <http://www.freedesktop.org/wiki/Software/libinput/>
+   Required for input handling on Wayland.
+ * UDev , Linux device library. , <http://www.freedesktop.org/software/systemd/libudev/>
+   Required for input handling on Wayland.
+ * PkgConfig
+
+-- The following REQUIRED packages have been found:
+
+ * Qt5Concurrent
+ * Qt5DBus
+ * Qt5Network (required version >= 5.4.0)
+ * Qt5Qml (required version >= 5.4.0)
+ * Qt5Gui (required version >= 5.4.0)
+ * Qt5Quick
+ * Qt5QuickWidgets
+ * Qt5Script
+ * Qt5UiTools
+ * Qt5Widgets
+ * Qt5X11Extras
+ * Qt5 (required version >= 5.4.0)
+ * KF5Config (required version >= 5.8.0)
+ * KF5ConfigWidgets (required version >= 5.8.0)
+ * KF5CoreAddons (required version >= 5.8.0)
+ * KF5Crash (required version >= 5.8.0)
+ * KF5GlobalAccel (required version >= 5.8.0)
+ * Gettext
+ * PythonInterp
+ * KF5I18n (required version >= 5.8.0)
+ * KF5Init (required version >= 5.8.0)
+ * KF5Notifications (required version >= 5.8.0)
+ * KF5Service (required version >= 5.8.0)
+ * ECM (required version >= 0.0.9)
+ * Qt5Core
+ * KF5Plasma (required version >= 5.8.0)
+ * KF5WidgetsAddons (required version >= 5.8.0)
+ * KF5WindowSystem (required version >= 5.8.0)
+ * KF5Completion (required version >= 5.8.0)
+ * KF5Declarative (required version >= 5.8.0)
+ * KF5KCMUtils (required version >= 5.8.0)
+ * KF5KIO (required version >= 5.8.0)
+ * KF5NewStuff (required version >= 5.8.0)
+ * KF5XmlGui (required version >= 5.8.0)
+ * KF5 (required version >= 5.8.0)
+ * KDecoration2
+ * epoxy , libepoxy , <http://github.com/anholt/libepoxy>
+   OpenGL dispatch library
+ * X11 , X11 libraries , <http://www.x.org>
+ * XCB , X protocol C-language Binding , <http://xcb.freedesktop.org>
+
+-- The following features have been disabled:
+
+ * XCB-CURSOR , Required for XCursor support
+
+-- The following RUNTIME packages have not been found:
+
+ * Qt5Multimedia
+   Runtime-only dependency for effect video playback
+
+Building KWin with OpenGL support
+-- Looking for include file unistd.h
+-- Looking for include file unistd.h - found
+-- Looking for include file malloc.h
+-- Looking for include file malloc.h - found
+-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY
+-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success
+-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY
+-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success
+-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
+-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success
+-- Configuring done
+-- Generating done
+-- Build files have been written to: /build/buildd/kwin-5.2.1+git20150226.0503+15.04/obj-x86_64-linux-gnu
+make[1]: Leaving directory '/build/buildd/kwin-5.2.1+git20150226.0503+15.04'
+touch debian/dhmk_configure
+# "configure" target is done
+/usr/bin/make -f debian/rules dhmk_run_build_commands DHMK_TARGET="build"
+make[1]: Entering directory '/build/buildd/kwin-5.2.1+git20150226.0503+15.04'
+dh_testdir  
+dh_auto_build '--buildsystem=kf5' --parallel  
\ No newline at end of file
diff --git a/test/data/test_cmake_parser/test_init b/test/data/test_cmake_parser/test_init
new file mode 100644
index 0000000..8d1c8b6
--- /dev/null
+++ b/test/data/test_cmake_parser/test_init
@@ -0,0 +1 @@
+ 
diff --git a/test/data/test_cmake_parser/test_missing_package b/test/data/test_cmake_parser/test_missing_package
new file mode 100644
index 0000000..5dbd970
--- /dev/null
+++ b/test/data/test_cmake_parser/test_missing_package
@@ -0,0 +1,75 @@
+dh_auto_configure '--buildsystem=kf5' --parallel  
+-- The C compiler identification is GNU 4.9.2
+-- The CXX compiler identification is GNU 4.9.2
+-- Check for working C compiler: /usr/bin/cc
+-- Check for working C compiler: /usr/bin/cc -- works
+-- Detecting C compiler ABI info
+-- Detecting C compiler ABI info - done
+-- Check for working CXX compiler: /usr/bin/c++
+-- Check for working CXX compiler: /usr/bin/c++ -- works
+-- Detecting CXX compiler ABI info
+-- Detecting CXX compiler ABI info - done
+-- Looking for __GLIBC__
+-- Looking for __GLIBC__ - found
+-- Performing Test _OFFT_IS_64BIT
+-- Performing Test _OFFT_IS_64BIT - Success
+-- Found KF5GuiAddons: /usr/lib/x86_64-linux-gnu/cmake/KF5GuiAddons/KF5GuiAddonsConfig.cmake (found version "5.7.0") 
+-- Found Gettext: /usr/bin/msgmerge (found version "0.19.2") 
+-- Found PythonInterp: /usr/bin/python (found version "2.7.9") 
+-- Found KF5I18n: /usr/lib/x86_64-linux-gnu/cmake/KF5I18n/KF5I18nConfig.cmake (found version "5.7.0") 
+-- Found KF5KDELibs4Support: /usr/lib/x86_64-linux-gnu/cmake/KF5KDELibs4Support/KF5KDELibs4SupportConfig.cmake (found version "5.7.0") 
+-- Found KF5Parts: /usr/lib/x86_64-linux-gnu/cmake/KF5Parts/KF5PartsConfig.cmake (found version "5.7.0") 
+-- Found KF5WidgetsAddons: /usr/lib/x86_64-linux-gnu/cmake/KF5WidgetsAddons/KF5WidgetsAddonsConfig.cmake (found version "5.7.0") 
+-- Found KF5: success (found version "5.7.0") found components:  GuiAddons I18n KDELibs4Support Parts WidgetsAddons 
+CMake Warning at CMakeLists.txt:24 (find_package):
+  By not providing "FindKF5Package.cmake" in CMAKE_MODULE_PATH this project has
+  asked CMake to find a package configuration file provided by "KF5Package", but
+  CMake did not find one.
+
+  Could not find a package configuration file provided by "KF5Package" with any of
+  the following names:
+
+    KF5PackageConfig.cmake
+    KF5Package-config.cmake
+
+  Add the installation prefix of "KF5Package" to CMAKE_PREFIX_PATH or set
+  "KF5Package_DIR" to a directory containing one of the above files.  If "KF5Package"
+  provides a separate development package or SDK, be sure it has been
+  installed.
+
+
+-- Looking for include file ieeefp.h
+-- Looking for include file ieeefp.h - not found
+-- 
+-- The following REQUIRED packages have been found:
+
+ * ECM (required version >= 1.3.0)
+ * Qt5Core
+ * Qt5Gui
+ * Qt5Svg
+ * Qt5Widgets
+ * Qt5PrintSupport
+ * Qt5 (required version >= 5.3.0)
+ * KF5GuiAddons
+ * Gettext
+ * PythonInterp
+ * KF5I18n
+ * KF5KDELibs4Support
+ * KF5Parts
+ * KF5WidgetsAddons
+ * KF5
+
+-- The following OPTIONAL packages have not been found:
+
+ * KF5Package
+
+-- Configuring done
+-- Generating done
+-- Build files have been written to: /home/me/src/git/k/kmplot/build
+make[1]: Leaving directory '/build/buildd/kanagram-14.12.2+git20150228.0146+15.04'
+touch debian/dhmk_configure
+# "configure" target is done
+/usr/bin/make -f debian/rules dhmk_run_build_commands DHMK_TARGET="build"
+make[1]: Entering directory '/build/buildd/kanagram-14.12.2+git20150228.0146+15.04'
+dh_testdir  
+dh_auto_build '--buildsystem=kf5' --parallel 
\ No newline at end of file
diff --git a/test/data/test_cmake_parser/test_optional b/test/data/test_cmake_parser/test_optional
new file mode 100644
index 0000000..4d7797d
--- /dev/null
+++ b/test/data/test_cmake_parser/test_optional
@@ -0,0 +1,19 @@
+dh_auto_configure '--buildsystem=kf5' --parallel  
+-- Found KF5KIO: /usr/lib/x86_64-linux-gnu/cmake/KF5KIO/KF5KIOConfig.cmake (found version "5.8.0") 
+-- Found KF5NewStuff: /usr/lib/x86_64-linux-gnu/cmake/KF5NewStuff/KF5NewStuffConfig.cmake (found version "5.8.0") 
+-- Found KF5: success (found version "5.8.0") found components:  I18n Crash Sonnet Config ConfigWidgets CoreAddons Declarative DocTools KIO NewStuff 
+-- 
+-- The following OPTIONAL packages have not been found:
+
+ * Qt5TextToSpeech
+
+-- Configuring done
+-- Generating done
+-- Build files have been written to: /build/buildd/kanagram-14.12.2+git20150228.0146+15.04/obj-x86_64-linux-gnu
+make[1]: Leaving directory '/build/buildd/kanagram-14.12.2+git20150228.0146+15.04'
+touch debian/dhmk_configure
+# "configure" target is done
+/usr/bin/make -f debian/rules dhmk_run_build_commands DHMK_TARGET="build"
+make[1]: Entering directory '/build/buildd/kanagram-14.12.2+git20150228.0146+15.04'
+dh_testdir  
+dh_auto_build '--buildsystem=kf5' --parallel 
\ No newline at end of file
diff --git a/test/data/test_cmake_parser/test_warning b/test/data/test_cmake_parser/test_warning
new file mode 100644
index 0000000..493164c
--- /dev/null
+++ b/test/data/test_cmake_parser/test_warning
@@ -0,0 +1,60 @@
+dh_auto_configure '--buildsystem=kf5' --parallel  
+-- The C compiler identification is GNU 4.9.2
+-- The CXX compiler identification is GNU 4.9.2
+-- Check for working C compiler: /usr/bin/cc
+-- Check for working C compiler: /usr/bin/cc -- works
+-- Detecting C compiler ABI info
+-- Detecting C compiler ABI info - done
+-- Check for working CXX compiler: /usr/bin/c++
+-- Check for working CXX compiler: /usr/bin/c++ -- works
+-- Detecting CXX compiler ABI info
+-- Detecting CXX compiler ABI info - done
+-- Looking for __GLIBC__
+-- Looking for __GLIBC__ - found
+-- Performing Test _OFFT_IS_64BIT
+-- Performing Test _OFFT_IS_64BIT - Success
+-- Found KF5GuiAddons: /usr/lib/x86_64-linux-gnu/cmake/KF5GuiAddons/KF5GuiAddonsConfig.cmake (found version "5.7.0") 
+-- Found Gettext: /usr/bin/msgmerge (found version "0.19.2") 
+-- Found PythonInterp: /usr/bin/python (found version "2.7.9") 
+-- Found KF5I18n: /usr/lib/x86_64-linux-gnu/cmake/KF5I18n/KF5I18nConfig.cmake (found version "5.7.0") 
+-- Found KF5KDELibs4Support: /usr/lib/x86_64-linux-gnu/cmake/KF5KDELibs4Support/KF5KDELibs4SupportConfig.cmake (found version "5.7.0") 
+-- Found KF5Parts: /usr/lib/x86_64-linux-gnu/cmake/KF5Parts/KF5PartsConfig.cmake (found version "5.7.0") 
+-- Found KF5WidgetsAddons: /usr/lib/x86_64-linux-gnu/cmake/KF5WidgetsAddons/KF5WidgetsAddonsConfig.cmake (found version "5.7.0") 
+-- Found KF5: success (found version "5.7.0") found components:  GuiAddons I18n KDELibs4Support Parts WidgetsAddons 
+-- Looking for include file ieeefp.h
+-- Looking for include file ieeefp.h - not found
+-- 
+-- The following REQUIRED packages have been found:
+
+ * ECM (required version >= 1.3.0)
+ * Qt5Core
+ * Qt5Gui
+ * Qt5Svg
+ * Qt5Widgets
+ * Qt5PrintSupport
+ * Qt5 (required version >= 5.3.0)
+ * KF5GuiAddons
+ * Gettext
+ * PythonInterp
+ * KF5I18n
+ * KF5KDELibs4Support
+ * KF5Parts
+ * KF5WidgetsAddons
+ * KF5
+
+-- Configuring done
+-- Generating done
+CMake Warning:
+  Manually-specified variables were not used by the project:
+
+    LIB_SUFFIX
+
+
+-- Build files have been written to: /home/me/src/git/k/kmplot/build
+make[1]: Leaving directory '/build/buildd/kanagram-14.12.2+git20150228.0146+15.04'
+touch debian/dhmk_configure
+# "configure" target is done
+/usr/bin/make -f debian/rules dhmk_run_build_commands DHMK_TARGET="build"
+make[1]: Entering directory '/build/buildd/kanagram-14.12.2+git20150228.0146+15.04'
+dh_testdir  
+dh_auto_build '--buildsystem=kf5' --parallel 
\ No newline at end of file
diff --git a/test/test_cmake_parser.rb b/test/test_cmake_parser.rb
new file mode 100644
index 0000000..97a97ec
--- /dev/null
+++ b/test/test_cmake_parser.rb
@@ -0,0 +1,44 @@
+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