Gentoo Archives: gentoo-commits

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Wed, 29 Jan 2020 22:04:58
Message-Id: 1580335486.f58d31d661f7bda2fe7b591419f0d9f138a2dae6.slyfox@gentoo
1 commit: f58d31d661f7bda2fe7b591419f0d9f138a2dae6
2 Author: Benjamin Gordon <bmgordon <AT> chromium <DOT> org>
3 AuthorDate: Wed Jan 29 19:38:13 2020 +0000
4 Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
5 CommitDate: Wed Jan 29 22:04:46 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f58d31d6
7
8 ghc-package.eclass: Handle missing ghc in lookups
9
10 ghc-getghc() and ghc-getghcpkg() both assume that they can find an
11 installed binary. If ghc isn't installed (e.g., because it's being
12 being rebuilt or has been unmerged), there is no such binary. This
13 causes the intended arguments to be run as a command, which produces
14 "command not found" QA Notices.
15
16 If ghc can't be found, return "false" instead. The false command will
17 harmlessly absorb the other command-line arguments. This doesn't
18 produce any difference in the final result because the invalid commands
19 were failing anyway.
20
21 Closes: https://bugs.gentoo.org/683144
22 Signed-off-by: Benjamin Gordon <bmgordon <AT> chromium.org>
23 Closes: https://github.com/gentoo/gentoo/pull/14499
24 Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
25
26 eclass/ghc-package.eclass | 10 ++++++++--
27 1 file changed, 8 insertions(+), 2 deletions(-)
28
29 diff --git a/eclass/ghc-package.eclass b/eclass/ghc-package.eclass
30 index 27fafff5a21..dbe7dc2a5ac 100644
31 --- a/eclass/ghc-package.eclass
32 +++ b/eclass/ghc-package.eclass
33 @@ -22,14 +22,20 @@ esac
34 # @DESCRIPTION:
35 # returns the name of the ghc executable
36 ghc-getghc() {
37 - type -P ${HC:-ghc}
38 + if ! type -P ${HC:-ghc}; then
39 + ewarn "ghc not found"
40 + type -P false
41 + fi
42 }
43
44 # @FUNCTION: ghc-getghcpkg
45 # @DESCRIPTION:
46 # Internal function determines returns the name of the ghc-pkg executable
47 ghc-getghcpkg() {
48 - type -P ${HC_PKG:-ghc-pkg}
49 + if ! type -P ${HC_PKG:-ghc-pkg}; then
50 + ewarn "ghc-pkg not found"
51 + type -P false
52 + fi
53 }
54
55 # @FUNCTION: ghc-getghcpkgbin