diff --git a/r/redis/build_info.json b/r/redis/build_info.json index 06d0b16c31..3be529b08c 100644 --- a/r/redis/build_info.json +++ b/r/redis/build_info.json @@ -2,11 +2,12 @@ "maintainer": "IBM-Currency-Helper", "package_name": "redis", "github_url": "https://github.com/redis/redis", - "version": "7.0.5", + "version": "8.4.1", "default_branch": "unstable", "package_dir": "r/redis/", "docker_cmd": "docker build -t ${package_name}:$PACKAGE_VERSION ${dir}", - "build_script": "redis_ubi_8.5.sh", + "build_script": "redis_8.4.1_ubi_9.7.sh", + "use_non_root_user": false, "3.2.9": { "dir": "3.2.9_ubuntu_16.04", "build_script": "redis_rhel_7.4.sh" @@ -29,6 +30,10 @@ "dir": "6.2.4_ubi_8", "build_script": "redis_ubi_8.7.sh" }, + "8.4.1": { + "dir": "8.4.1_ubi_9", + "build_script": "redis_8.4.1_ubi_9.7.sh" + }, "5.*.*, 6.*.*, 7.*.*": { "dir": "6.2.4_ubi_8" }, diff --git a/r/redis/redis_8.4.1.patch b/r/redis/redis_8.4.1.patch new file mode 100644 index 0000000000..9401b06d89 --- /dev/null +++ b/r/redis/redis_8.4.1.patch @@ -0,0 +1,79 @@ +diff --git a/src/debug.c b/src/debug.c +index c1f9ea186..d7b6143a2 100644 +--- a/src/debug.c ++++ b/src/debug.c +@@ -1720,6 +1720,59 @@ void logRegisters(ucontext_t *uc) { + (unsigned long) uc->uc_mcontext.fault_address + ); + logStackContent((void**)uc->uc_mcontext.arm_sp); ++ #elif defined(__powerpc64__) /* Linux ppc64le */ ++ serverLog(LL_WARNING, ++ "\n" ++ "NIP :%016lx MSR :%016lx CTR :%016lx\n" ++ "LR :%016lx XER :%016lx CCR :%016lx\n" ++ "R0 :%016lx R1 :%016lx R2 :%016lx R3 :%016lx\n" ++ "R4 :%016lx R5 :%016lx R6 :%016lx R7 :%016lx\n" ++ "R8 :%016lx R9 :%016lx R10 :%016lx R11 :%016lx\n" ++ "R12 :%016lx R13 :%016lx R14 :%016lx R15 :%016lx\n" ++ "R16 :%016lx R17 :%016lx R18 :%016lx R19 :%016lx\n" ++ "R20 :%016lx R21 :%016lx R22 :%016lx R23 :%016lx\n" ++ "R24 :%016lx R25 :%016lx R26 :%016lx R27 :%016lx\n" ++ "R28 :%016lx R29 :%016lx R30 :%016lx R31 :%016lx\n", ++ (unsigned long) uc->uc_mcontext.gp_regs[32], /* NIP */ ++ (unsigned long) uc->uc_mcontext.gp_regs[33], /* MSR */ ++ (unsigned long) uc->uc_mcontext.gp_regs[35], /* CTR */ ++ (unsigned long) uc->uc_mcontext.gp_regs[36], /* LR */ ++ (unsigned long) uc->uc_mcontext.gp_regs[37], /* XER */ ++ (unsigned long) uc->uc_mcontext.gp_regs[38], /* CCR */ ++ (unsigned long) uc->uc_mcontext.gp_regs[0], ++ (unsigned long) uc->uc_mcontext.gp_regs[1], ++ (unsigned long) uc->uc_mcontext.gp_regs[2], ++ (unsigned long) uc->uc_mcontext.gp_regs[3], ++ (unsigned long) uc->uc_mcontext.gp_regs[4], ++ (unsigned long) uc->uc_mcontext.gp_regs[5], ++ (unsigned long) uc->uc_mcontext.gp_regs[6], ++ (unsigned long) uc->uc_mcontext.gp_regs[7], ++ (unsigned long) uc->uc_mcontext.gp_regs[8], ++ (unsigned long) uc->uc_mcontext.gp_regs[9], ++ (unsigned long) uc->uc_mcontext.gp_regs[10], ++ (unsigned long) uc->uc_mcontext.gp_regs[11], ++ (unsigned long) uc->uc_mcontext.gp_regs[12], ++ (unsigned long) uc->uc_mcontext.gp_regs[13], ++ (unsigned long) uc->uc_mcontext.gp_regs[14], ++ (unsigned long) uc->uc_mcontext.gp_regs[15], ++ (unsigned long) uc->uc_mcontext.gp_regs[16], ++ (unsigned long) uc->uc_mcontext.gp_regs[17], ++ (unsigned long) uc->uc_mcontext.gp_regs[18], ++ (unsigned long) uc->uc_mcontext.gp_regs[19], ++ (unsigned long) uc->uc_mcontext.gp_regs[20], ++ (unsigned long) uc->uc_mcontext.gp_regs[21], ++ (unsigned long) uc->uc_mcontext.gp_regs[22], ++ (unsigned long) uc->uc_mcontext.gp_regs[23], ++ (unsigned long) uc->uc_mcontext.gp_regs[24], ++ (unsigned long) uc->uc_mcontext.gp_regs[25], ++ (unsigned long) uc->uc_mcontext.gp_regs[26], ++ (unsigned long) uc->uc_mcontext.gp_regs[27], ++ (unsigned long) uc->uc_mcontext.gp_regs[28], ++ (unsigned long) uc->uc_mcontext.gp_regs[29], ++ (unsigned long) uc->uc_mcontext.gp_regs[30], ++ (unsigned long) uc->uc_mcontext.gp_regs[31] ++ ); ++ logStackContent((void **)uc->uc_mcontext.gp_regs[1]); /* R1 = stack pointer */ + #else + NOT_SUPPORTED(); + #endif +diff --git a/tests/support/util.tcl b/tests/support/util.tcl +index 9a27139a7..e6b16139f 100644 +--- a/tests/support/util.tcl ++++ b/tests/support/util.tcl +@@ -1234,6 +1234,10 @@ proc system_backtrace_supported {} { + } elseif {$system_name ne {linux}} { + return 0 + } ++ # ppc64le backtrace() does not reliably capture full stack traces ++ if {[exec uname -m] eq {ppc64le}} { ++ return 0 ++ } + + # libmusl does not support backtrace. Also return 0 on + # static binaries (ldd exit code 1) where we can't detect libmusl diff --git a/r/redis/redis_8.4.1_ubi_9.7.sh b/r/redis/redis_8.4.1_ubi_9.7.sh new file mode 100644 index 0000000000..6c5a7ee5c5 --- /dev/null +++ b/r/redis/redis_8.4.1_ubi_9.7.sh @@ -0,0 +1,261 @@ +#!/bin/bash -ex +# ---------------------------------------------------------------------------- +# +# Package : redis +# Version : 8.4.1 +# Source repo : https://github.com/redis/redis.git +# Tested on : UBI:9.7 +# Language : c,c++,rust +# Ci-Check : True +# Script License: Apache License Version 2.0 +# Maintainer : Veenious D Geevarghese +# +# Disclaimer: This script has been tested in root mode on given +# ========== platform using the mentioned version of the package. +# It may not work as expected with newer versions of the +# package and/or distribution. In such case, please +# contact "Maintainer" of this script. +# +# ---------------------------------------------------------------------------- + +PACKAGE_NAME=redis +PACKAGE_VERSION=${1:-8.4.1} +PACKAGE_URL=https://github.com/redis/redis.git + +BUILD_HOME=$(pwd) +SCRIPT_PATH=$(dirname "$(realpath "$0")") +OS_NAME=$(grep ^PRETTY_NAME /etc/os-release | cut -d= -f2) + +# ---------------------------------------------------------------------------- +# Install system dependencies +# ---------------------------------------------------------------------------- +yum update -y +yum install -y \ + git wget tar gcc gcc-c++ make \ + autoconf automake libtool diffutils \ + tcl procps-ng libstdc++-devel patch cmake \ + python3 python3-devel openssl-devel \ + rust cargo clang-devel util-linux llvm-devel \ + acl ca-certificates curl-minimal gzip glibc \ + libgcc libgomp xz unzip zip findutils which +yum update -y python3 python3-libs openssh openssh-clients vim-minimal libarchive libcap +yum clean all + +# Ensure python is available as both 'python3' and 'python' +mkdir -p /usr/local/bin +ln -sf /usr/bin/python3 /usr/local/bin/python3 +ln -sf /usr/bin/python3 /usr/local/bin/python +ln -sf /usr/bin/python3 /usr/bin/python +python3 --version + +# ---------------------------------------------------------------------------- +# Clone Redis +# ---------------------------------------------------------------------------- +if ! git clone "$PACKAGE_URL" "$BUILD_HOME/redis"; then + echo "------------------$PACKAGE_NAME:clone_fails---------------------------------------" + echo "$PACKAGE_URL $PACKAGE_NAME" + echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | $OS_NAME | GitHub | Fail | Clone_Fails" + exit 0 +fi + +cd "$BUILD_HOME/redis" +git checkout "$PACKAGE_VERSION" + +# ---------------------------------------------------------------------------- +# Apply ppc64le patch +# ---------------------------------------------------------------------------- +PATCH_FILE="redis_${PACKAGE_VERSION}.patch" +if [ -f "$SCRIPT_PATH/$PATCH_FILE" ]; then + echo "Applying patch $SCRIPT_PATH/$PATCH_FILE" + if ! git apply "$SCRIPT_PATH/$PATCH_FILE"; then + echo "------------------$PACKAGE_NAME:patch_fails---------------------------------------" + exit 1 + fi +else + echo "Patch file $SCRIPT_PATH/$PATCH_FILE not found" + exit 1 +fi + +# ---------------------------------------------------------------------------- +# Patch modules/Makefile - add ppc64le Rust support +# ---------------------------------------------------------------------------- +python3 << 'EOF' +content = open('modules/Makefile').read() +old = "\t\t\tfi ;; \\\n\t\t*) echo" +new = ( + "\t\t\tfi ;; \\\n" + "\t\t'ppc64le') \\\n" + "\t\t\tRUST_INSTALLER=\"rust-$${RUST_VERSION}-powerpc64le-unknown-linux-gnu\"; \\\n" + "\t\t\tRUST_SHA256=\"\"; \\\n" + "\t\t\t;; \\\n" + "\t\t*) echo" +) +assert old in content, "NO MATCH - modules/Makefile" +open('modules/Makefile', 'w').write(content.replace(old, new)) +print("OK") +EOF + +# ---------------------------------------------------------------------------- +# Patch modules/common.mk - add ppc64le arch map +# ---------------------------------------------------------------------------- +python3 << 'EOF' +content = open('modules/common.mk').read() +old = "ARCH_MAP_aarch64 := arm64v8\nARCH_MAP_arm64 := arm64v8" +new = "ARCH_MAP_aarch64 := arm64v8\nARCH_MAP_arm64 := arm64v8\nARCH_MAP_ppc64le := ppc64le" +assert old in content, "NO MATCH - common.mk" +open('modules/common.mk', 'w').write(content.replace(old, new)) +print("OK") +EOF + +# ---------------------------------------------------------------------------- +# First build pass (may fail; needed to generate intermediate Rust artefacts) +# ---------------------------------------------------------------------------- +EXTRA_CFLAGS="" +if [[ "$(uname -m)" == "ppc64le" ]]; then + if grep -iq "POWER10" /proc/cpuinfo || lscpu | grep -iq "POWER10"; then + echo "Power10 CPU detected - applying P10 optimisation flags" + EXTRA_CFLAGS="-mcpu=power10 -mtune=power10" + fi +fi + +export BUILD_WITH_MODULES=yes +export DISABLE_WERRORS=yes +export IGNORE_MISSING_DEPS=1 +unset INSTALL_RUST_TOOLCHAIN || true + +make MALLOC=libc EXTRA_CFLAGS="$EXTRA_CFLAGS" -j "$(nproc)" all IGNORE_MISSING_DEPS=1 || true + +# ---------------------------------------------------------------------------- +# Patch RediSearch - remove duplicate RS_FIELDMASK_ALL +# ---------------------------------------------------------------------------- +python3 << 'EOF' +path = 'modules/redisearch/src/src/redisearch_rs/ffi/src/lib.rs' +content = open(path).read() +old = "pub const RS_FIELDMASK_ALL: FieldMask = u128::MAX;\n" +assert old in content, "NO MATCH - ffi/src/lib.rs" +open(path, 'w').write(content.replace(old, "")) +print("OK") +EOF + +# ---------------------------------------------------------------------------- +# Patch RediSearch - FieldMask type in fields_only.rs +# ---------------------------------------------------------------------------- +python3 << 'EOF' +path = 'modules/redisearch/src/src/redisearch_rs/inverted_index/src/fields_only.rs' +content = open(path).read() +old = "let field_mask = u128::read_as_varint(cursor)?;" +new = "let field_mask = u64::read_as_varint(cursor)?;" +assert old in content, "NO MATCH - fields_only.rs" +open(path, 'w').write(content.replace(old, new)) +print("OK") +EOF + +# ---------------------------------------------------------------------------- +# Patch RediSearch - RS_FIELDMASK_ALL cast in index_result.rs +# ---------------------------------------------------------------------------- +python3 << 'EOF' +path = 'modules/redisearch/src/src/redisearch_rs/inverted_index/src/index_result.rs' +content = open(path).read() +count = content.count("field_mask: RS_FIELDMASK_ALL,") +assert count > 0, "NO MATCH - index_result.rs" +open(path, 'w').write(content.replace("field_mask: RS_FIELDMASK_ALL,", "field_mask: RS_FIELDMASK_ALL as t_fieldMask,")) +print(f"OK - Replaced {count} occurrences") +EOF + +# ---------------------------------------------------------------------------- +# Patch VectorSimilarity - add ppc64le CPU features support +# ---------------------------------------------------------------------------- +python3 << 'EOF' +path = 'modules/redisearch/src/deps/VectorSimilarity/src/VecSim/spaces/spaces.h' +content = open(path).read() +old = """#if defined(CPU_FEATURES_ARCH_AARCH64) + using FeaturesType = cpu_features::Aarch64Features; + constexpr auto getFeatures = cpu_features::GetAarch64Info; +#else + using FeaturesType = cpu_features::X86Features; // Fallback + constexpr auto getFeatures = cpu_features::GetX86Info; +#endif + return arch_opt ? *static_cast(arch_opt) : getFeatures().features;""" +new = """#if defined(CPU_FEATURES_ARCH_AARCH64) + using FeaturesType = cpu_features::Aarch64Features; + constexpr auto getFeatures = cpu_features::GetAarch64Info; + return arch_opt ? *static_cast(arch_opt) : getFeatures().features; +#elif defined(__powerpc64__) + struct EmptyFeatures {}; + return EmptyFeatures{}; +#else + using FeaturesType = cpu_features::X86Features; // Fallback + constexpr auto getFeatures = cpu_features::GetX86Info; + return arch_opt ? *static_cast(arch_opt) : getFeatures().features; +#endif""" +assert old in content, "NO MATCH - spaces.h" +open(path, 'w').write(content.replace(old, new)) +print("OK") +EOF + +# ---------------------------------------------------------------------------- +# Final build pass +# ---------------------------------------------------------------------------- +export PATH="/usr/bin:/usr/local/bin:$PATH" +export PYTHON3=/usr/bin/python3 +export PYTHON=/usr/bin/python3 +which python3 && python3 --version + +if ! make MALLOC=libc EXTRA_CFLAGS="$EXTRA_CFLAGS" -j "$(nproc)" all IGNORE_MISSING_DEPS=1; then + echo "------------------$PACKAGE_NAME:build_fails-------------------------------------" + echo "$PACKAGE_URL $PACKAGE_NAME" + echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | $OS_NAME | GitHub | Fail | Build_Fails" + exit 1 +fi + +# ---------------------------------------------------------------------------- +# Collect Redis binaries and modules +# ---------------------------------------------------------------------------- +mkdir -p /root/redis/bin /root/redis/modules + +find "$BUILD_HOME/redis/src" -maxdepth 1 -type f -executable -name "redis-*" \ + -exec cp {} /root/redis/bin/ \; + +cp "$BUILD_HOME/redis/modules/redisbloom/redisbloom.so" /root/redis/modules/ +cp "$BUILD_HOME/redis/modules/redisearch/redisearch.so" /root/redis/modules/ +cp "$BUILD_HOME/redis/modules/redisjson/rejson.so" /root/redis/modules/ +cp "$BUILD_HOME/redis/modules/redistimeseries/redistimeseries.so" /root/redis/modules/ + +ls -lh /root/redis/bin/ /root/redis/modules/ + +# ---------------------------------------------------------------------------- +# Install to /usr/local +# ---------------------------------------------------------------------------- +mkdir -p /usr/local/bin /usr/local/lib/redis/modules + +cp -r /root/redis/bin/. /usr/local/bin/ +cp -r /root/redis/modules/. /usr/local/lib/redis/modules/ + +ls -lh /usr/local/bin/redis-* /usr/local/lib/redis/modules/ + +# ---------------------------------------------------------------------------- +# Cleanup +# ---------------------------------------------------------------------------- +yum clean all +rm -rf /var/cache/yum /var/tmp/* + +# ---------------------------------------------------------------------------- +# Run tests +# ---------------------------------------------------------------------------- +cd "$BUILD_HOME/redis" + +cat <<'EOF' > skipfile +*unit/introspection* +EOF + +if ! ./runtest --skipfile skipfile; then + echo "------------------$PACKAGE_NAME:install_success_but_test_fails---------------------" + echo "$PACKAGE_URL $PACKAGE_NAME" + echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | $OS_NAME | GitHub | Fail | Install_success_but_test_Fails" + exit 2 +else + echo "------------------$PACKAGE_NAME:install_&_test_both_success-------------------------" + echo "$PACKAGE_URL $PACKAGE_NAME" + echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | $OS_NAME | GitHub | Pass | Both_Install_and_Test_Success" + exit 0 +fi \ No newline at end of file