From 321776ac495f3322e09cf0d1a273201e4c4165be Mon Sep 17 00:00:00 2001 From: "shu.chen" Date: Tue, 22 Aug 2023 19:26:29 +0100 Subject: [PATCH] provision: Add provision support for Fedora 38. Tweaked provision script to run successfully in Fedora 38 and included a script to build the groonga libs from source because the packages in Fedora repos are outdated. There is a major version jump from the last supported version (F34) which is EOL so references and support for older versions were removed. Fixes: #20635 --- docs/development/setup-advanced.md | 2 +- scripts/lib/build-groonga | 18 ++++++++++++++++++ tools/lib/provision.py | 25 ++++++++++++++++++------- 3 files changed, 37 insertions(+), 8 deletions(-) create mode 100755 scripts/lib/build-groonga diff --git a/docs/development/setup-advanced.md b/docs/development/setup-advanced.md index bedf4467c6..f8ada7106a 100644 --- a/docs/development/setup-advanced.md +++ b/docs/development/setup-advanced.md @@ -22,7 +22,7 @@ are: - Ubuntu 20.04, 22.04 - Debian 11, 12 - CentOS 7 (beta) -- Fedora 33 and 34 (beta) +- Fedora 38 (beta) - RHEL 7 (beta) **Note**: You should not use the `root` user to run the installation. diff --git a/scripts/lib/build-groonga b/scripts/lib/build-groonga new file mode 100755 index 0000000000..4a1b0c39a6 --- /dev/null +++ b/scripts/lib/build-groonga @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +set -euxo pipefail + +version="13.0.5" +sha256=f49c4b2bd24f60a3237495dda241017c42076f4d2012bc523fcfa4f349f069a0 + +tmpdir="$(mktemp -d)" +trap 'rm -r "$tmpdir"' EXIT +cd "$tmpdir" +tarball="groonga-$version.tar.gz" +curl -fLO --retry 3 "https://github.com/groonga/groonga/releases/download/v$version/$tarball" +sha256sum -c <<<"$sha256 $tarball" +tar -xzf "$tarball" +cd "groonga-$version" + +./configure --prefix=/usr +make -j "$(nproc)" +make install diff --git a/tools/lib/provision.py b/tools/lib/provision.py index efd63c69f8..56e646ba0b 100755 --- a/tools/lib/provision.py +++ b/tools/lib/provision.py @@ -88,10 +88,8 @@ elif vendor == "ubuntu" and os_version == "22.04": # jammy POSTGRESQL_VERSION = "14" elif vendor == "neon" and os_version == "20.04": # KDE Neon POSTGRESQL_VERSION = "12" -elif vendor == "fedora" and os_version == "33": - POSTGRESQL_VERSION = "13" -elif vendor == "fedora" and os_version == "34": - POSTGRESQL_VERSION = "13" +elif vendor == "fedora" and os_version == "38": + POSTGRESQL_VERSION = "15" elif vendor == "rhel" and os_version.startswith("7."): POSTGRESQL_VERSION = "10" elif vendor == "centos" and os_version == "7": @@ -160,6 +158,7 @@ COMMON_YUM_DEPENDENCIES = [ # Puppeteer dependencies end here. ] +BUILD_GROONGA_FROM_SOURCE = False BUILD_PGROONGA_FROM_SOURCE = False if vendor == "debian" and os_version in ["12"] or vendor == "ubuntu" and os_version in []: # For platforms without a PGroonga release, we need to build it @@ -213,10 +212,10 @@ elif "fedora" in os_families(): f"postgresql{POSTGRESQL_VERSION}", f"postgresql{POSTGRESQL_VERSION}-devel", # Needed to build PGroonga from source - "groonga-devel", "msgpack-devel", *VENV_DEPENDENCIES, ] + BUILD_GROONGA_FROM_SOURCE = True BUILD_PGROONGA_FROM_SOURCE = True if "fedora" in os_families(): @@ -246,6 +245,8 @@ def install_system_deps() -> None: # For some platforms, there aren't published PGroonga # packages available, so we build them from source. + if BUILD_GROONGA_FROM_SOURCE: + run_as_root(["./scripts/lib/build-groonga"]) if BUILD_PGROONGA_FROM_SOURCE: run_as_root(["./scripts/lib/build-pgroonga"]) @@ -329,11 +330,16 @@ def install_yum_deps(deps_to_install: List[str]) -> None: # Later steps will ensure PostgreSQL is started # Link in tsearch data files + if vendor == "fedora": + # Since F36 dictionary files were moved away from /usr/share/myspell + tsearch_source_prefix = "/usr/share/hunspell" + else: + tsearch_source_prefix = "/usr/share/myspell" run_as_root( [ "ln", "-nsf", - "/usr/share/myspell/en_US.dic", + os.path.join(tsearch_source_prefix, "en_US.dic"), f"/usr/pgsql-{POSTGRESQL_VERSION}/share/tsearch_data/en_us.dict", ] ) @@ -341,7 +347,7 @@ def install_yum_deps(deps_to_install: List[str]) -> None: [ "ln", "-nsf", - "/usr/share/myspell/en_US.aff", + os.path.join(tsearch_source_prefix, "en_US.aff"), f"/usr/pgsql-{POSTGRESQL_VERSION}/share/tsearch_data/en_us.affix", ] ) @@ -365,6 +371,11 @@ def main(options: argparse.Namespace) -> NoReturn: with open("scripts/lib/setup-yum-repo", "rb") as fb: sha_sum.update(fb.read()) + # hash the content of build-pgroonga if Groonga is built from source + if BUILD_GROONGA_FROM_SOURCE: + with open("scripts/lib/build-groonga", "rb") as fb: + sha_sum.update(fb.read()) + # hash the content of build-pgroonga if PGroonga is built from source if BUILD_PGROONGA_FROM_SOURCE: with open("scripts/lib/build-pgroonga", "rb") as fb: