Skip to content

Commit

Permalink
ghc-package.eclass: Handle missing ghc in lookups
Browse files Browse the repository at this point in the history
ghc-getghc() and ghc-getghcpkg() both assume that they can find an
installed binary.  If ghc isn't installed (e.g., because it's being
being rebuilt or has been unmerged), there is no such binary. This
causes the intended arguments to be run as a command, which produces
"command not found" QA Notices.

If ghc can't be found, return "false" instead.  The false command will
harmlessly absorb the other command-line arguments.  This doesn't
produce any difference in the final result because the invalid commands
were failing anyway.

Closes: https://bugs.gentoo.org/683144
Signed-off-by: Benjamin Gordon <[email protected]>
Closes: gentoo#14499
Signed-off-by: Sergei Trofimovich <[email protected]>
  • Loading branch information
yetamrra authored and Sergei Trofimovich committed Jan 29, 2020
1 parent 46068b1 commit f58d31d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions eclass/ghc-package.eclass
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,20 @@ esac
# @DESCRIPTION:
# returns the name of the ghc executable
ghc-getghc() {
type -P ${HC:-ghc}
if ! type -P ${HC:-ghc}; then
ewarn "ghc not found"
type -P false
fi
}

# @FUNCTION: ghc-getghcpkg
# @DESCRIPTION:
# Internal function determines returns the name of the ghc-pkg executable
ghc-getghcpkg() {
type -P ${HC_PKG:-ghc-pkg}
if ! type -P ${HC_PKG:-ghc-pkg}; then
ewarn "ghc-pkg not found"
type -P false
fi
}

# @FUNCTION: ghc-getghcpkgbin
Expand Down

0 comments on commit f58d31d

Please sign in to comment.