• [gentoo-dev] [PATCH 1/3] postgres.eclass: die if no matching postgresql

    From Sam James@21:1/5 to All on Thu Apr 13 05:00:01 2023
    This matches what we do in other eclasses like for python and ruby.

    It leads to a nicer error if e.g. manually using ebuild(1) rather
    than emerge(1) and deps aren't satisfied, or forgot to set POSTGRES_TARGETS locally, etc.

    Signed-off-by: Sam James <sam@gentoo.org>
    ---
    eclass/postgres.eclass | 6 +++++-
    1 file changed, 5 insertions(+), 1 deletion(-)

    diff --git a/eclass/postgres.eclass b/eclass/postgres.eclass
    index e94ab56a40ae0..c3dc24e9db526 100644
    --- a/eclass/postgres.eclass
    +++ b/eclass/postgres.eclass
    @@ -1,4 +1,4 @@
    -# Copyright 1999-2022 Gentoo Authors
    +# Copyright 1999-2023 Gentoo Authors
    # Distributed under the terms of the GNU General Public License v2

    # @ECLASS: postgres.eclass
    @@ -150,6 +150,10 @@ postgres_pkg_setup() {
    export PG_SLOT=${best_slot}
    export PG_CONFIG=$(type -P pg_config${best_slot//./})

    + if [[ -z ${PG_CONFIG} ]] ; then
    + die "Could not find pg_config for ${PG_SLOT}. Is dev-db/postgresql:${PG_SLOT} installed?"
    + fi
    +
    local pg_pkg_config_path="$(${PG_CONFIG} --libdir)/pkgconfig"
    if [[ -n "${PKG_CONFIG_PATH}" ]]; then
    export PKG_CONFIG_PATH="${pg_pkg_config_path}:${PKG_CONFIG_PATH}"
    --
    2.40.0

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)