Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions l/lz4/build_info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"maintainer": "OpenSource-Edge-for-IBM-Tool-1",
"package_name": "lz4",
"github_url": "https://github.com/pierrec/lz4",
"version": "v4.4.4",
"default_branch": "v4",
"build_script": "lz4_ubi_9.3.sh",
"package_dir": "l/lz4",
"docker_build": false,
"wheel_build": true,
"validate_build_script": true,
"use_non_root_user": false
}
127 changes: 127 additions & 0 deletions l/lz4/lz4_ubi_9.3.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
#!/bin/bash -e
# -----------------------------------------------------------------------------
#
# Package : lz4
# Version : v4.4.4
# Source repo : https://github.com/pierrec/lz4
# Tested on : UBI:9.3
# Language : Python
# Ci-Check : True
# Script License: Apache License, Version 2 or later
# Maintainer : ICH <OpenSource-Edge-for-IBM-Tool-1>
#
# 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.
#
# ----------------------------------------------------------------------------

# Variables
PACKAGE_NAME=lz4
PACKAGE_VERSION=${1:-v4.4.4}
PACKAGE_URL=https://github.com/pierrec/lz4
PACKAGE_DIR=lz4

# Install dependencies
yum install -y git python3 python3-devel.ppc64le gcc-toolset-13 make wget sudo cmake
pip3 install pytest tox nox

export PATH=$PATH:/usr/local/bin/
export PATH=/opt/rh/gcc-toolset-13/root/usr/bin:$PATH
export LD_LIBRARY_PATH=/opt/rh/gcc-toolset-13/root/usr/lib64:$LD_LIBRARY_PATH

OS_NAME=$(grep ^PRETTY_NAME /etc/os-release | cut -d= -f2)
SOURCE=Github

# Install rust
if ! command -v rustc &> /dev/null
then
wget https://static.rust-lang.org/dist/rust-1.75.0-powerpc64le-unknown-linux-gnu.tar.gz
tar -xzf rust-1.75.0-powerpc64le-unknown-linux-gnu.tar.gz
cd rust-1.75.0-powerpc64le-unknown-linux-gnu
sudo ./install.sh
export PATH=$HOME/.cargo/bin:$PATH
rustc -V
cargo -V
cd ../
fi

# Clone or extract the package
if [[ "$PACKAGE_URL" == *github.com* ]]; then
if [ -d "$PACKAGE_DIR" ]; then
cd "$PACKAGE_DIR" || exit
else
if ! git clone "$PACKAGE_URL" "$PACKAGE_DIR"; then
echo "------------------$PACKAGE_NAME:clone_fails---------------------------------------"
echo "$PACKAGE_URL $PACKAGE_NAME"
echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | $OS_NAME | $SOURCE | Fail | Clone_Fails"
exit 1
fi
cd "$PACKAGE_DIR" || exit
git checkout "$PACKAGE_VERSION" || exit
fi
else
if [ -d "$PACKAGE_DIR" ]; then
cd "$PACKAGE_DIR" || exit
else
if ! curl -L "$PACKAGE_URL" -o "$PACKAGE_DIR.tar.gz"; then
echo "------------------$PACKAGE_NAME:download_fails---------------------------------------"
echo "$PACKAGE_URL $PACKAGE_NAME"
echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | $OS_NAME | $SOURCE | Fail | Download_Fails"
exit 1
fi
mkdir "$PACKAGE_DIR"
if ! tar -xzf "$PACKAGE_DIR.tar.gz" -C "$PACKAGE_DIR" --strip-components=1; then
echo "------------------$PACKAGE_NAME:untar_fails---------------------------------------"
echo "$PACKAGE_URL $PACKAGE_NAME"
echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | $OS_NAME | $SOURCE | Fail | Untar_Fails"
exit 1
fi
cd "$PACKAGE_DIR" || exit
fi
fi

# Install the package
if ! python3 -m pip install ./; then
echo "------------------$PACKAGE_NAME:install_fails------------------------"
echo "$PACKAGE_URL $PACKAGE_NAME"
echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | $OS_NAME | $SOURCE | Fail | Install_Failed"
exit 1
fi

# ------------------ Unified Test Execution Block ------------------

test_status=1 # 0 = success, non-zero = failure

# Run pytest if any matching test files found
if ls */test_*.py > /dev/null 2>&1 && [ $test_status -ne 0 ]; then
echo "Running pytest..."
(python3 -m pytest) && test_status=0 || test_status=$?
fi

# Run tox if tox.ini is present and previous tests failed
if [ -f "tox.ini" ] && [ $test_status -ne 0 ]; then
echo "Running tox..."
(python3 -m tox -e py39) && test_status=0 || test_status=$?
fi

# Run nox if noxfile.py is present and previous tests failed
if [ -f "noxfile.py" ] && [ $test_status -ne 0 ]; then
echo "Running nox..."
(python3 -m nox) && test_status=0 || test_status=$?
fi

# Final test result output
if [ $test_status -eq 0 ]; then
echo "------------------$PACKAGE_NAME:install_and_test_both_success-------------------------"
echo "$PACKAGE_URL $PACKAGE_NAME"
echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | $OS_NAME | $SOURCE | Pass | Both_Install_and_Test_Success"
exit 0
else
echo "------------------$PACKAGE_NAME:install_success_but_test_fails---------------------"
echo "$PACKAGE_URL $PACKAGE_NAME"
echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | $OS_NAME | $SOURCE | Fail | Install_success_but_test_Fails"
exit 2
fi
Loading