Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Manuel Rüger" <mrueg@g.o>
Subject: [gentoo-dev] Re: [gentoo-commits] repo/gentoo:master commit in: dev-libs/libgit2/
Date: Sat, 10 Oct 2015 11:51:55
Message-Id: 20151010135134.2efa0c13.mgorny@gentoo.org
1 Dnia 2015-10-10, o godz. 11:31:45
2 "Manuel Rüger" <mrueg@g.o> napisał(a):
3
4 > commit: 9d15a1c12b3c4f98445a45c051733eb2a67fdb28
5 > Author: Manuel Rüger <mrueg <AT> gentoo <DOT> org>
6 > AuthorDate: Sat Oct 10 11:30:54 2015 +0000
7 > Commit: Manuel Rüger <mrueg <AT> gentoo <DOT> org>
8 > CommitDate: Sat Oct 10 11:30:54 2015 +0000
9 > URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9d15a1c1
10 >
11 > dev-libs/libgit2: Version bump
12 >
13 > Package-Manager: portage-2.2.23
14
15 Pretty much picking up a random commit to point out a common mistake.
16
17 > [...]
18 >
19 > +src_configure() {
20 > + local mycmakeargs=(
21 > + -DLIB_INSTALL_DIR="${EPREFIX}/usr/$(get_libdir)"
22 > + $(cmake-utils_use_build test CLAR)
23 > + $(cmake-utils_use_enable trace TRACE)
24
25 The second argument is redundant. cmake-utils has some internal magic
26 to uppercase stuff, so trace->TRACE happens automagically.
27
28 Of course, some of us (like me) really hate unexpected magic like this.
29 Then, it's more readable (and often shorter) to use:
30
31 -DENABLE_TRACE=$(usex trace)
32
33 [just to be clear, yes/no returned by usex is as good as ON/OFF for
34 cmake]
35
36 > + $(cmake-utils_use_use gssapi GSSAPI)
37 > + $(cmake-utils_use_use ssh SSH)
38 > + $(cmake-utils_use threads THREADSAFE)
39 > + )
40
41 For comparison:
42
43 local mycmakeargs=(
44 -DLIB_INSTALL_DIR="${EPREFIX}/usr/$(get_libdir)"
45 -DBUILD_CLAR=$(usex test)
46 -DENABLE_TRACE=$(usex trace)
47 -DUSE_GSSAPI=$(usex gssapi)
48 -DUSE_SSH=$(usex ssh)
49 -DTHREADSAFE=$(usex threads)
50 )
51
52 Which one is shorter and less ambiguous?
53
54 > [...]
55
56 --
57 Best regards,
58 Michał Górny
59 <http://dev.gentoo.org/~mgorny/>

Replies