Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 674768 - cmake-utils.eclass: reduce patching of CMakeLists.txt
Summary: cmake-utils.eclass: reduce patching of CMakeLists.txt
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo KDE team
URL: https://archives.gentoo.org/gentoo-de...
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2019-01-07 09:21 UTC by Fabio Rossi
Modified: 2019-07-04 19:39 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
cmake-utils.patch (cmake-utils.patch,1.58 KB, patch)
2019-01-07 09:21 UTC, Fabio Rossi
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Fabio Rossi 2019-01-07 09:21:12 UTC
Created attachment 560170 [details, diff]
cmake-utils.patch

In the eclass there is a patching of the upstream CMakeLists.txt commenting out set() line redefining a few cmake variables used by the eclass itself. The sed line used for patching are too aggressive catching more cases than needed. For instance, in the opencascade package, there is a variable CMAKE_INSTALL_PREFIX_PREV which is commented out by the sed lines. 

I am attaching a simple patch proposal to restrict cases to be patched. In addition the patch also adds a better description to the commented out lines
Comment 1 Fabio Rossi 2019-01-07 09:39:10 UTC
sorry, I put the wrong title (now fixed), the bug must be then properly reassigned
Comment 2 Larry the Git Cow gentoo-dev 2019-03-01 13:29:35 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/kde.git/commit/?id=3603015258476c34dde7d805abc9b5474fd6e4dd

commit 3603015258476c34dde7d805abc9b5474fd6e4dd
Author:     Andreas Sturmlechner <asturm@gentoo.org>
AuthorDate: 2019-02-24 13:32:58 +0000
Commit:     Andreas Sturmlechner <asturm@gentoo.org>
CommitDate: 2019-03-01 13:29:08 +0000

    cmake-utils.eclass: Fix _cmake_modify-cmakelists, add QA output
    
    Bug: https://bugs.gentoo.org/674768
    Reported-by: Fabio Rossi <rossi.f@inwind.it>
    Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>

 eclass/cmake-utils.eclass | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
Comment 3 Larry the Git Cow gentoo-dev 2019-05-18 19:33:48 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6b7998b644e6f4469a7cb4c64776013a74363866

commit 6b7998b644e6f4469a7cb4c64776013a74363866
Author:     Andreas Sturmlechner <asturm@gentoo.org>
AuthorDate: 2019-02-24 13:32:58 +0000
Commit:     Andreas Sturmlechner <asturm@gentoo.org>
CommitDate: 2019-05-18 19:32:25 +0000

    cmake-utils.eclass: Fix _cmake_modify-cmakelists, add einfo output
    
    Closes: https://bugs.gentoo.org/674768
    Reported-by: Fabio Rossi <rossi.f@inwind.it>
    Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>

 eclass/cmake-utils.eclass | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
Comment 4 Samuel Holland 2019-05-18 21:55:23 UTC
The change in 6b7998b644e6f4469a7cb4c64776013a74363866 breaks the dev-util/cmake test suite, because it patches out calls to "set(CMAKE_BUILD_TYPE Debug)" in two tests, causing them to fail:

  Tests/CMakeOnly/SelectLibraryConfigurations
  Tests/OutDir
Comment 5 Andreas Sturmlechner gentoo-dev 2019-05-19 12:50:30 UTC
(In reply to Samuel Holland from comment #4)
> The change in 6b7998b644e6f4469a7cb4c64776013a74363866 breaks the
> dev-util/cmake test suite, because it patches out calls to
> "set(CMAKE_BUILD_TYPE Debug)" in two tests, causing them to fail:

No, 6b7998b644e6f4469a7cb4c64776013a74363866 does not change behaviour in that regard. It only makes the changes already being applied in cmake-utils.eclass more visible using einfo and a better comment.
Comment 6 Andreas Sturmlechner gentoo-dev 2019-05-19 13:02:35 UTC
Actually, it is doing less modifications, which was the intent of the commit. Here's the only effective difference, not sure about possible implications:

Before 6b7998b6:

> --- a/Tests/OutDir/CMakeLists.txt
> +++ b/Tests/OutDir/CMakeLists.txt
> @@ -7,9 +7,9 @@ if(_isMultiConfig)
>     string(TOUPPER "${config}" CONFIG)
>     list(APPEND configs "${CONFIG}")
>   endforeach()
> -  set(CMAKE_BUILD_TYPE)
> +#IGNORE   set(CMAKE_BUILD_TYPE)
> elseif(NOT CMAKE_BUILD_TYPE)
> -  set(CMAKE_BUILD_TYPE Debug)
> +#IGNORE   set(CMAKE_BUILD_TYPE Debug)
> endif()
> 
> if(CMAKE_BUILD_TYPE)

after:

> --- a/Tests/OutDir/CMakeLists.txt
> +++ b/Tests/OutDir/CMakeLists.txt
> @@ -9,7 +9,7 @@ if(_isMultiConfig)
>   endforeach()
>   set(CMAKE_BUILD_TYPE)
> elseif(NOT CMAKE_BUILD_TYPE)
> -  set(CMAKE_BUILD_TYPE Debug)
> +#_cmake_modify_IGNORE   set(CMAKE_BUILD_TYPE Debug)
> endif()
> 
> if(CMAKE_BUILD_TYPE)
Comment 7 Samuel Holland 2019-05-19 15:16:56 UTC
(In reply to Andreas Sturmlechner from comment #5)
> (In reply to Samuel Holland from comment #4)
> > The change in 6b7998b644e6f4469a7cb4c64776013a74363866 breaks the
> > dev-util/cmake test suite, because it patches out calls to
> > "set(CMAKE_BUILD_TYPE Debug)" in two tests, causing them to fail:
> 
> No, 6b7998b644e6f4469a7cb4c64776013a74363866 does not change behaviour in
> that regard. It only makes the changes already being applied in
> cmake-utils.eclass more visible using einfo and a better comment.

Okay. Sorry, I didn't fully bisect the change. What I know is that cmake used to pass it's test suite and doesn't anymore due to the commented-out lines. I applied this patch to the eclass (there's probably a better check to make) and the test suite passes again:

--- a/eclass/cmake-utils.eclass
+++ b/eclass/cmake-utils.eclass
@@ -468,7 +468,9 @@ _cmake_cleanup_cmake() {
        fi

        # Remove dangerous things.
-       _cmake_modify-cmakelists
+       if [[ ${PN} != "cmake" ]] ; then
+               _cmake_modify-cmakelists
+       fi
 }

 # @FUNCTION: cmake-utils_src_prepare
Comment 8 Larry the Git Cow gentoo-dev 2019-05-19 17:52:29 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/kde.git/commit/?id=e805777440326a241ed04343a995ed0cecddd682

commit e805777440326a241ed04343a995ed0cecddd682
Author:     Andreas Sturmlechner <asturm@gentoo.org>
AuthorDate: 2019-05-19 16:15:29 +0000
Commit:     Andreas Sturmlechner <asturm@gentoo.org>
CommitDate: 2019-05-19 16:48:05 +0000

    cmake-utils.eclass: _cmake_modify-cmakelists: Fix CMAKE_BUILD_TYPE sed
    
    Commit 6b7998b narrowed matching CMAKE_BUILD_TYPE too successfully and led
    to a string like `set(CMAKE_BUILD_TYPE)` being left over.
    
    Bug: https://bugs.gentoo.org/674768
    Closes: https://bugs.gentoo.org/686266
    Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>

 eclass/cmake-utils.eclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 9 Larry the Git Cow gentoo-dev 2019-07-04 19:39:58 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3b5582636d219284037ee65bc427194d7e969c4b

commit 3b5582636d219284037ee65bc427194d7e969c4b
Author:     Andreas Sturmlechner <asturm@gentoo.org>
AuthorDate: 2019-05-19 16:15:29 +0000
Commit:     Andreas Sturmlechner <asturm@gentoo.org>
CommitDate: 2019-07-04 19:36:08 +0000

    cmake-utils.eclass: _cmake_modify-cmakelists: Fix CMAKE_BUILD_TYPE sed
    
    Commit 6b7998b narrowed matching CMAKE_BUILD_TYPE too successfully and led
    to a string like `set(CMAKE_BUILD_TYPE)` being left over.
    
    Bug: https://bugs.gentoo.org/674768
    Closes: https://bugs.gentoo.org/686266
    Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>

 eclass/cmake-utils.eclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)