Bug 374435

Summary: kdoctools_install() use a wrong directory when the parameter ends with "docs"
Product: [Frameworks and Libraries] frameworks-kdoctools Reporter: Luigi Toscano <luigi.toscano>
Component: generalAssignee: Documentation Editorial Team <kde-doc-english>
Status: RESOLVED FIXED    
Severity: normal CC: kdelibs-bugs, maxantispam
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=357428
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Luigi Toscano 2017-01-01 20:30:01 UTC
When the value of parameter (i.e. the folder which contains the documentation) ends with "docs", the *.docbook files are installed under

<base_doc_dir>/<lang>/<lang>/docs/<appname>

instead of the expected
<base_doc_dir>/<lang>/docs/<appname>

(where <base_doc_dir> is currently <base_prefix>/share/doc/HTML/)

The cause of the issue is the way this match line is built:

string(REGEX MATCH "docs/(.*)/index.docbook" match ${docbook})

If the parameter ends with "docs", the value of ${docbook} will be something like:

.../foodocs/<lang>/docs/<program>/index.docbook

and then the content of cmake_match_1 will be: 
<lang>/docs/<program>

instead of the expected:
<program>


Man pages are not affected (they are handled few lines before).

If you use any name for the directory which does not end in docs, the macro works.

Please file a new bug (as it is a corner case), or I can do it, I will prepare a patch.

The bug was found by MaxiPunkt as follow up of https://bugs.kde.org/show_bug.cgi?id=357428
Comment 1 Luigi Toscano 2017-01-01 23:37:38 UTC
Review available: https://phabricator.kde.org/D3912
Comment 2 MaxiPunkt 2017-01-02 09:05:16 UTC
Hi there,

happy new year & thanks for your recent efforts.  :)

> If you use any name for the directory which does not end in docs,
> the macro works.
Cool, this is my (already successfully tested) workaround for now.
Right now I didn't check your patch of kdoctools, yet.
Comment 3 Luigi Toscano 2017-01-03 00:20:23 UTC
Git commit 938e439db2067381dd3df6a0ea71f50aa73fd310 by Luigi Toscano.
Committed on 03/01/2017 at 00:20.
Pushed by ltoscano into branch 'master'.

kdoctools_install: match the full path for the program

Summary:
In order to get the name of the program, match against the full path
which includes the path of the directory currently scanned for a
certain language.
So if docs/ appears somewhere in the path, it does not interfere
with the matching regular expression and the name of the program
is correctly extracted.

Test Plan: kdoctools_install(l10n-docs) now works

Reviewers: #frameworks, #documentation, aacid

Reviewed By: #documentation, aacid

Tags: #frameworks, #documentation

Differential Revision: https://phabricator.kde.org/D3912

M  +1    -1    KF5DocToolsMacros.cmake

https://commits.kde.org/kdoctools/938e439db2067381dd3df6a0ea71f50aa73fd310