Gentoo Archives: gentoo-dev

From: Maciej Mrozowski <reavertm@×××××.com>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [RFC] Enable CMAKE_WARN_UNUSED_CLI by default in cmake-utils for EAPI>=6
Date: Wed, 18 May 2016 20:28:41
Message-Id: 3920608.pHNNlbhsxm@liwardyna
In Reply to: Re: [gentoo-dev] [RFC] Enable CMAKE_WARN_UNUSED_CLI by default in cmake-utils for EAPI>=6 by Andrew Savchenko
1 On Wednesday 18 of May 2016 09:22:53 Andrew Savchenko wrote:
2 > On Mon, 02 May 2016 18:06:44 +0200 Maciej Mrozowski wrote:
3 > > Hello,
4 > >
5 > > General advise: do not convert ebuilds inheriting cmake-utils to EAPI 6
6 > > unless you know what you are doing (you are fully aware of eclass
7 > > behaviour removed with https://bugs.gentoo.org/show_bug.cgi?id=514384).
8 > >
9 > > Background:
10 > >
11 > > Pre EAPI-6 cmake-utils.eclass contained certain feature to mitigate CMake
12 > > variable case changes done by upstream.
13 > > This feature was explicitly removed with
14 > > https://bugs.gentoo.org/show_bug.cgi?id=514384 and no alternative was
15 > > proposed.
16 > > It opened new area of possible ebuild regression bugs when switching to
17 > > EAPI-6 for ebuilds inheriting cmake-utils.eclass.
18 > >
19 > > Unfortunately there is common misconception, also among developers, that
20 > > it's sufficient to simply replace "${cmake-utils_use_with foo)" with
21 > > "-DWITH_foo=ON" etc.
22 > > This is MOST OF THE TIME not the case.
23 > > When converting cmake-utils ebuild to EAPI>=6, one needs to consult
24 > > CMakeLists.txt wrt case each variable is written with since CMake is case-
25 > > sensitive and WITH_FOO != WITH_foo != WITH_Foo.
26 > >
27 > > Proposal:
28 > >
29 > > CMake allows warning about unused CMake variables passed by CLI. Since
30 > > this is how Gentoo passes ebuild configuration options, it's proposed to
31 > > enable this feature.
32 > > Unfortunately it won't fail compilation but at least it gives a chance to
33 > > spot case mismatch when reading build output.
34 > >
35 > > Future thoughts:
36 > >
37 > > For better damage control it's technically possible to extend configure
38 > > phase of cmake-utuls eclass to check mycmakeargs against parsed package
39 > > buildsystem but this might not be very reliable.
40 >
41 > For me the real confusion was from this line:
42 >
43 > die "${FUNCNAME[1]} is banned in EAPI 6 and later: use
44 > -D$1${arg}=\"\$(usex $2)\" instead"
45 >
46 > It recommends to use ${arg} without any warning about case, so when I just
47 > copied what it recommends: -DWITH_nls="$(usex nls)", I had a nice surprise
48 > and fun debugging.
49
50 Ah, there you go..
51
52 @kensington
53 Come on, man, you should have known better.
54
55 Invalid suggestion removed. Thanks for noticing.
56 I prefer to have developers figure out the right EAPI-6 migration path
57 themselves rather than blindly relying on suggestions:
58
59 diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
60 index 427c13f..5958230 100644
61 --- a/eclass/cmake-utils.eclass
62 +++ b/eclass/cmake-utils.eclass
63 @@ -161,7 +161,7 @@ _cmake_use_me_now() {
64 local arg=$2
65 [[ ! -z $3 ]] && arg=$3
66
67 - [[ ${EAPI} == [2345] ]] || die "${FUNCNAME[1]} is banned in EAPI 6 and
68 later: use -D$1${arg}=\"\$(usex $2)\" instead"
69 + [[ ${EAPI} == [2345] ]] || die "${FUNCNAME[1]} is banned in EAPI 6 and
70 later"
71
72 local uper capitalised x
73 [[ -z $2 ]] && die "cmake-utils_use-$1 <USE flag> [<flag name>]"
74 @@ -184,7 +184,7 @@ _cmake_use_me_now_inverted() {
75 [[ ! -z $3 ]] && arg=$3
76
77 if [[ ${EAPI} != [2345] && "${FUNCNAME[1]}" != cmake-
78 utils_use_find_package ]] ; then
79 - die "${FUNCNAME[1]} is banned in EAPI 6 and later: use -
80 D$1${arg}=\"\$(usex $2)\" instead"
81 + die "${FUNCNAME[1]} is banned in EAPI 6 and later"
82 fi
83
84 local uper capitalised x
85
86 regards
87 MM

Attachments

File name MIME type
signature.asc application/pgp-signature