[releaseme] /: fix documentation detection with excess spacing

Harald Sitter null at kde.org
Thu Sep 7 08:08:40 UTC 2017


Git commit fed50634ee86c5fb607bc01210d5fd62acc45a24 by Harald Sitter.
Committed on 07/09/2017 at 08:08.
Pushed by sitter into branch 'master'.

fix documentation detection with excess spacing

Previously we'd not take trailing spaces after the last argument into
account and prevent `(... SUBDIR foo    )` from matching. The regex now
gobbles up trailing spaces.
Added a test case with super excessive spacing to make sure this works.
Also adjusted the manpage fixture to employ fairly excessive spacing and
make sure space matching works as well for manpages.

CCMAIL: andrius at stikonas.eu

M  +2    -1    lib/releaseme/documentation.rb
A  +0    -0    test/data/excess-spacing-doc/CMakeLists.txt
A  +10   -0    test/data/excess-spacing-doc/doc/CMakeLists.txt
A  +0    -0    test/data/excess-spacing-doc/doc/index.docbook
M  +6    -4    test/data/source-with-manpage/doc/CMakeLists.txt
M  +16   -0    test/documentation_test.rb

https://commits.kde.org/releaseme/fed50634ee86c5fb607bc01210d5fd62acc45a24

diff --git a/lib/releaseme/documentation.rb b/lib/releaseme/documentation.rb
index ebc7861..d0517af 100644
--- a/lib/releaseme/documentation.rb
+++ b/lib/releaseme/documentation.rb
@@ -31,7 +31,8 @@ module ReleaseMe
     prepend Logable
 
     HANDBOOK_REGEX =
-      'kdoctools_create_handbook\s*\(.+\s+SUBDIR\s+(?<item>[^\)\s]+)\)'.freeze
+      'kdoctools_create_handbook\s*\(.+\s+SUBDIR\s+(?<item>[^\)\s]+)\s*\)'
+      .freeze
     MANPAGE_REGEX =
       'kdoctools_create_manpage\s*\(\s*(?<item>man-[^\)\s]+\.docbook)'.freeze
 
diff --git a/test/data/excess-spacing-doc/CMakeLists.txt b/test/data/excess-spacing-doc/CMakeLists.txt
new file mode 100644
index 0000000..e69de29
diff --git a/test/data/excess-spacing-doc/doc/CMakeLists.txt b/test/data/excess-spacing-doc/doc/CMakeLists.txt
new file mode 100644
index 0000000..2c6b249
--- /dev/null
+++ b/test/data/excess-spacing-doc/doc/CMakeLists.txt
@@ -0,0 +1,10 @@
+
+# Lots of usleess whitespacing and newlines
+
+        kdoctools_create_handbook
+   (
+    index.docbook   INSTALL_DESTINATION
+${KDE_INSTALL_DOCBUNDLEDIR}/en
+        SUBDIR
+amarok
+   )
diff --git a/test/data/excess-spacing-doc/doc/index.docbook b/test/data/excess-spacing-doc/doc/index.docbook
new file mode 100644
index 0000000..e69de29
diff --git a/test/data/source-with-manpage/doc/CMakeLists.txt b/test/data/source-with-manpage/doc/CMakeLists.txt
index 0137356..62045d6 100644
--- a/test/data/source-with-manpage/doc/CMakeLists.txt
+++ b/test/data/source-with-manpage/doc/CMakeLists.txt
@@ -1,4 +1,6 @@
-########### install files ###############
-#
-#
-kdoctools_create_manpage (man-amarok.1.docbook 1 INSTALL_DESTINATION ${MAN_INSTALL_DIR})
+
+# Intentionally excessive spacing to make sure the regex can handle it
+            kdoctools_create_manpage
+    (
+        man-amarok.1.docbook
+    1   INSTALL_DESTINATION      ${MAN_INSTALL_DIR}    )
diff --git a/test/documentation_test.rb b/test/documentation_test.rb
index 2cddd82..92c02bd 100644
--- a/test/documentation_test.rb
+++ b/test/documentation_test.rb
@@ -195,4 +195,20 @@ class TestDocumentation < Testme
       assert_equal(2, docs.size)
     end
   end
+
+  def test_doc_excess_spacing
+    # CMakeLists contains lots of excess spacing, regex should handle this and
+    # be able to retrieve the l10n.
+    d = create_doc
+    d.init_repo_url("file://#{Dir.pwd}/#{@svn_template_dir}")
+    FileUtils.rm_rf(@dir)
+    FileUtils.cp_r(data('excess-spacing-doc'), @dir)
+    d.get(@dir)
+    Dir.chdir(@dir) do
+      docs = Dir.glob('po/*/docs/*')
+      assert_includes(docs, 'po/fr/docs/amarok')
+      assert_includes(docs, 'po/de/docs/amarok')
+      assert_equal(2, docs.size)
+    end
+  end
 end


More information about the kde-doc-english mailing list