Skip to content

Commit

Permalink
HPCC-31426 CentOS 7 + Python 3.8
Browse files Browse the repository at this point in the history
Add custom build to support CentOS 7 + Python 3.8
Mount local vcpkg cache to avoid rebuilding packages

Signed-off-by: Gordon Smith <[email protected]>
  • Loading branch information
GordonSmith committed Apr 4, 2024
1 parent 4c416cf commit 665df8f
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 16 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build-assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ jobs:
name: LN
cmake_options_extra: "-DVCPKG_TARGET_TRIPLET=x64-centos-7-dynamic"
ln: true
- os: centos-7-rh-python38
name: LN Python 3.8
cmake_options_extra: "-DVCPKG_TARGET_TRIPLET=x64-centos-7-dynamic -DCUSTOM_LABEL=_rh_python38"
ln: true
fail-fast: false

steps:
Expand Down
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -340,11 +340,11 @@ if(TOP_LEVEL_PROJECT)
message("-- distro uses ${packageManagement}, revision is ${packageRevisionArch}")

if("${packageManagement}" STREQUAL "DEB")
set(CPACK_PACKAGE_FILE_NAME "${PACKAGE_FILE_NAME_PREFIX}_${CPACK_RPM_PACKAGE_VERSION}-${stagever}${packageRevisionArch}${packageStrippedLabel}${packageContainerizedLabel}")
set(CPACK_PACKAGE_FILE_NAME "${PACKAGE_FILE_NAME_PREFIX}_${CPACK_RPM_PACKAGE_VERSION}-${stagever}${packageRevisionArch}${packageStrippedLabel}${packageContainerizedLabel}${CUSTOM_LABEL}")
elseif("${packageManagement}" STREQUAL "RPM")
set(CPACK_PACKAGE_FILE_NAME "${PACKAGE_FILE_NAME_PREFIX}_${CPACK_RPM_PACKAGE_VERSION}-${stagever}.${packageRevisionArch}${packageStrippedLabel}${packageContainerizedLabel}")
set(CPACK_PACKAGE_FILE_NAME "${PACKAGE_FILE_NAME_PREFIX}_${CPACK_RPM_PACKAGE_VERSION}-${stagever}.${packageRevisionArch}${packageStrippedLabel}${packageContainerizedLabel}${CUSTOM_LABEL}")
else()
set(CPACK_PACKAGE_FILE_NAME "${PACKAGE_FILE_NAME_PREFIX}_${CPACK_RPM_PACKAGE_VERSION}_${stagever}${CPACK_SYSTEM_NAME}${packageStrippedLabel}${packageContainerizedLabel}")
set(CPACK_PACKAGE_FILE_NAME "${PACKAGE_FILE_NAME_PREFIX}_${CPACK_RPM_PACKAGE_VERSION}_${stagever}${CPACK_SYSTEM_NAME}${packageStrippedLabel}${packageContainerizedLabel}${CUSTOM_LABEL}")
endif()
endif ()

Expand Down Expand Up @@ -500,7 +500,7 @@ if(TOP_LEVEL_PROJECT)
set(CPACK_GENERATOR "productbuild")
endif ()
if(APPLE OR WIN32)
set(CPACK_PACKAGE_FILE_NAME "${PACKAGE_FILE_NAME_PREFIX}_${version}-${stagever}${CPACK_SYSTEM_NAME}${packageStrippedLabel}${packageContainerizedLabel}")
set(CPACK_PACKAGE_FILE_NAME "${PACKAGE_FILE_NAME_PREFIX}_${version}-${stagever}${CPACK_SYSTEM_NAME}${packageStrippedLabel}${packageContainerizedLabel}${CUSTOM_LABEL}")
endif()
file(WRITE "${PROJECT_BINARY_DIR}/welcome.txt"
"HPCC Systems® - Client Tools\r"
Expand Down
2 changes: 2 additions & 0 deletions cmake_modules/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ option(INSTALL_VCPKG_CATALOG "Install vcpkg-catalog.txt" ON)
option(PORTALURL "Set url to hpccsystems portal download page")
option(PROFILING "Set to true if planning to profile so stacks are informative" OFF)

set(CUSTOM_LABEL "" CACHE STRING "Appends a custom label to the final package name")

if ( NOT PORTALURL )
set( PORTALURL "http://hpccsystems.com/download" )
endif()
Expand Down
40 changes: 28 additions & 12 deletions dockerfiles/vcpkg/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ cd vcpkg
VCPKG_REF=$(git rev-parse --short=8 HEAD)
cd ..
GITHUB_BRANCH=$(git log -50 --pretty=format:"%D" | tr ',' '\n' | grep 'upstream/' | awk 'NR==1 {sub("upstream/", ""); print}' | xargs)
GITHUB_BRANCH=${GITHUB_BRANCH:-master}
DOCKER_USERNAME="${DOCKER_USERNAME:-hpccbuilds}"
DOCKER_PASSWORD="${DOCKER_PASSWORD:-none}"

Expand All @@ -26,7 +27,9 @@ echo "DOCKER_PASSWORD: $DOCKER_PASSWORD"

docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD

CMAKE_OPTIONS="-G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DVCPKG_FILES_DIR=/hpcc-dev -DCPACK_THREADS=0 -DUSE_OPTIONAL=OFF -DINCLUDE_PLUGINS=ON -DSUPPRESS_V8EMBED=ON"
CMAKE_ALL_OPTIONS="-G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHPCC_SOURCE_DIR=/hpcc-dev/HPCC-Platform -DCONTAINERIZED=OFF -DCPACK_STRIP_FILES=ON -DINCLUDE_PLUGINS=ON -DVCPKG_FILES_DIR=/hpcc-dev -DCPACK_THREADS=0 -DUSE_OPTIONAL=OFF -DUSE_CPPUNIT=ON -DSUPPRESS_REMBED=ON -DSUPPRESS_V8EMBED=ON -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
CMAKE_OPENBLAS_OPTIONS="-G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHPCC_SOURCE_DIR=/hpcc-dev/HPCC-Platform -DCONTAINERIZED=OFF -DCPACK_STRIP_FILES=OFF -DECLBLAS=ON -DVCPKG_FILES_DIR=/hpcc-dev -DCPACK_THREADS=0 -DUSE_OPTIONAL=OFF -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
CMAKE_PLATFORM_OPTIONS="-G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHPCC_SOURCE_DIR=/hpcc-dev/HPCC-Platform -DCONTAINERIZED=OFF -DCPACK_STRIP_FILES=ON -DPLATFORM=ON -DVCPKG_FILES_DIR=/hpcc-dev -DCPACK_THREADS=0 -DUSE_OPTIONAL=OFF -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache"

function doBuild() {
docker pull "hpccsystems/platform-build-base-$1:$VCPKG_REF" || true
Expand All @@ -46,30 +49,43 @@ function doBuild() {
# docker push hpccsystems/platform-build-$1:$GITHUB_BRANCH

CMAKE_OPTIONS_EXTRA=""
if [ "$1" == "centos-7" ]; then
if [ "$1" == "centos-7*" ]; then
CMAKE_OPTIONS_EXTRA="-DVCPKG_TARGET_TRIPLET=x64-centos-7-dynamic"
elif [ "$1" == "amazonlinux" ]; then
CMAKE_OPTIONS_EXTRA="-DVCPKG_TARGET_TRIPLET=x64-amazonlinux-dynamic"
fi
mkdir -p $HOME/.ccache
docker run --rm \
--mount source="$(pwd)",target=/hpcc-dev/HPCC-Platform,type=bind,consistency=cached \
--mount source="$(realpath ~)/.cache/vcpkg",target=/root/.cache/vcpkg,type=bind,consistency=cached \
--mount source="$HOME/.ccache",target=/root/.ccache,type=bind,consistency=cached \
hpccsystems/platform-build-$1:$VCPKG_REF \
"cmake -S /hpcc-dev/HPCC-Platform -B /hpcc-dev/HPCC-Platform/build-$1 ${CMAKE_OPTIONS} ${CMAKE_OPTIONS_EXTRA} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache && \
cmake --build /hpcc-dev/HPCC-Platform/build-$1 --target install --parallel $(nproc) && \
/etc/init.d/hpcc-init start"
"rm -rf /hpcc-dev/HPCC-Platform/build-$1/CMakeCache.txt /hpcc-dev/HPCC-Platform/build-$1/CMakeFiles && \
cmake -S /hpcc-dev/HPCC-Platform -B /hpcc-dev/HPCC-Platform/build-$1 ${CMAKE_ALL_OPTIONS} ${CMAKE_OPTIONS_EXTRA} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache && \
cmake --build /hpcc-dev/HPCC-Platform/build-$1 --parallel && \
echo 'Done'"

sudo chown -R $(id -u):$(id -g) ./build-$1
# sudo chown -R $(id -u):$(id -g) ./build-$1
# docker run -it --mount source="$(pwd)",target=/hpcc-dev/HPCC-Platform,type=bind,consistency=cached build-ubuntu-22.04:latest bash
}

# doBuild ubuntu-23.10
# doBuild ubuntu-20.04
# doBuild amazonlinux
# doBuild ubuntu-22.04
# doBuild centos-8
doBuild centos-7
trap 'kill $(jobs -p)' EXIT

# ./vcpkg/bootstrap-vcpkg.sh
mkdir -p ./vcpkg-logs

if [ "$1" != "" ]; then
doBuild $1 &
else
# doBuild ubuntu-24.04 &> vcpkg-logs/ubuntu-24.04.log &
doBuild ubuntu-22.04 &> vcpkg-logs/ubuntu-22.04.log &
doBuild ubuntu-20.04 &> vcpkg-logs/ubuntu-20.04.log &
# doBuild rockylinux-8 &> vcpkg-logs/rockylinux-8.log &
doBuild centos-8 &> vcpkg-logs/centos-8.log &
doBuild amazonlinux &> vcpkg-logs/amazonlinux.log &
doBuild centos-7-rh-python38 &> vcpkg-logs/centos-7-rh-python38.log &
doBuild centos-7 &> vcpkg-logs/centos-7.log &
fi

wait

Expand Down
13 changes: 13 additions & 0 deletions dockerfiles/vcpkg/centos-7-rh-python38.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
ARG VCPKG_REF=latest
FROM hpccsystems/platform-build-base-centos-7:$VCPKG_REF

RUN yum remove -y python3 python3-devel && \
yum install -y rh-python38 rh-python38-python-devel && \
yum clean all

RUN echo "source /opt/rh/rh-python38/enable" >> /etc/bashrc
SHELL ["/bin/bash", "--login", "-c"]

ENTRYPOINT ["/bin/bash", "--login", "-c"]

CMD ["/bin/bash"]

0 comments on commit 665df8f

Please sign in to comment.