Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH 1/4] llvm.eclass: Check for installed package rather than executable
Date: Fri, 30 Jun 2017 21:35:52
Message-Id: 20170630213431.17767-2-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCHES] llvm.eclass: More flexible slot testing and fix to /usr/bin PATH prepending by "Michał Górny"
1 Ensure that a specific LLVM slot is installed via using has_version on
2 "sys-devel/llvm:${SLOT}" rather than checking whether llvm-config is
3 installed in expected location. While it is a bit slower, this is closer
4 to a canonical way of testing it and will be useful when we allow
5 testing for more specific dependency strings. Right now, it could be
6 helpful if one has broken LLVM installation (i.e. stray files).
7 ---
8 eclass/llvm.eclass | 13 ++++++-------
9 1 file changed, 6 insertions(+), 7 deletions(-)
10
11 diff --git a/eclass/llvm.eclass b/eclass/llvm.eclass
12 index 294e27b019b9..94adba17a2b7 100644
13 --- a/eclass/llvm.eclass
14 +++ b/eclass/llvm.eclass
15 @@ -91,9 +91,9 @@ get_llvm_prefix() {
16 fi
17 fi
18
19 - local p=${EPREFIX}/usr/lib/llvm/${slot}
20 - if [[ -x ${p}/bin/llvm-config ]]; then
21 - echo "${p}"
22 + # check if LLVM package is installed
23 + if has_version "sys-devel/llvm:${slot}"; then
24 + echo "${EPREFIX}/usr/lib/llvm/${slot}"
25 return
26 fi
27 done
28 @@ -105,13 +105,12 @@ get_llvm_prefix() {
29
30 # fallback to :0
31 # assume it's always <= 4 (the lower max_slot allowed)
32 - p=${EPREFIX}/usr
33 - if [[ -x ${p}/bin/llvm-config ]]; then
34 - echo "${p}"
35 + if has_version "sys-devel/llvm:0"; then
36 + echo "${EPREFIX}/usr"
37 return
38 fi
39
40 - die "No LLVM slot${1:+ <= ${1}} found in PATH!"
41 + die "No LLVM slot${1:+ <= ${1}} found installed!"
42 }
43
44 # @FUNCTION: llvm_pkg_setup
45 --
46 2.13.2