Merge pull request #42349 from azat/packages/archlinux

Use nfpm packager for archlinux packages
This commit is contained in:
Mikhail f. Shiryaev 2022-10-24 10:26:24 +02:00 committed by GitHub
commit a29ece3bb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 31 additions and 77 deletions

1
.gitignore vendored
View File

@ -80,6 +80,7 @@ core
vgcore* vgcore*
*.deb *.deb
*.tar.zst
*.build *.build
*.upload *.upload
*.changes *.changes

View File

@ -73,7 +73,7 @@ RUN apt-get install binutils-riscv64-linux-gnu
# Architecture of the image when BuildKit/buildx is used # Architecture of the image when BuildKit/buildx is used
ARG TARGETARCH ARG TARGETARCH
ARG NFPM_VERSION=2.18.1 ARG NFPM_VERSION=2.20.0
RUN arch=${TARGETARCH:-amd64} \ RUN arch=${TARGETARCH:-amd64} \
&& curl -Lo /tmp/nfpm.deb "https://github.com/goreleaser/nfpm/releases/download/v${NFPM_VERSION}/nfpm_${arch}.deb" \ && curl -Lo /tmp/nfpm.deb "https://github.com/goreleaser/nfpm/releases/download/v${NFPM_VERSION}/nfpm_${arch}.deb" \

View File

@ -208,6 +208,7 @@ def parse_env_variables(
cxx = cc.replace("gcc", "g++").replace("clang", "clang++") cxx = cc.replace("gcc", "g++").replace("clang", "clang++")
if package_type == "deb": if package_type == "deb":
# NOTE: This are the env for packages/build script
result.append("MAKE_DEB=true") result.append("MAKE_DEB=true")
cmake_flags.append("-DENABLE_TESTS=0") cmake_flags.append("-DENABLE_TESTS=0")
cmake_flags.append("-DENABLE_UTILS=0") cmake_flags.append("-DENABLE_UTILS=0")
@ -268,6 +269,7 @@ def parse_env_variables(
result.append('DISTCC_HOSTS="localhost/`nproc`"') result.append('DISTCC_HOSTS="localhost/`nproc`"')
if additional_pkgs: if additional_pkgs:
# NOTE: This are the env for packages/build script
result.append("MAKE_APK=true") result.append("MAKE_APK=true")
result.append("MAKE_RPM=true") result.append("MAKE_RPM=true")
result.append("MAKE_TGZ=true") result.append("MAKE_TGZ=true")

View File

@ -26,8 +26,10 @@ SOURCE=${SOURCE:-$PKG_ROOT}
HELP="${0} [--test] [--rpm] [-h|--help] HELP="${0} [--test] [--rpm] [-h|--help]
--test - adds '+test' prefix to version --test - adds '+test' prefix to version
--apk - build APK packages --apk - build APK packages
--archlinux - build archlinux packages
--rpm - build RPM packages --rpm - build RPM packages
--tgz - build tarball package --tgz - build tarball package
--deb - build deb package
--help - show this help and exit --help - show this help and exit
Used envs: Used envs:
@ -47,16 +49,21 @@ fi
export CLICKHOUSE_VERSION_STRING export CLICKHOUSE_VERSION_STRING
while [[ $1 == --* ]] while [[ $1 == --* ]]
do do
case "$1" in case "$1" in
--test ) --test )
VERSION_POSTFIX+='+test' VERSION_POSTFIX+='+test'
shift ;; shift ;;
--deb )
MAKE_DEB=1
shift ;;
--apk ) --apk )
MAKE_APK=1 MAKE_APK=1
shift ;; shift ;;
--archlinux )
MAKE_ARCHLINUX=1
shift ;;
--rpm ) --rpm )
MAKE_RPM=1 MAKE_RPM=1
shift ;; shift ;;
@ -131,18 +138,24 @@ CLICKHOUSE_VERSION_STRING+=$VERSION_POSTFIX
echo -e "\nCurrent version is $CLICKHOUSE_VERSION_STRING" echo -e "\nCurrent version is $CLICKHOUSE_VERSION_STRING"
for config in clickhouse*.yaml; do for config in clickhouse*.yaml; do
echo "Building deb package for $config" if [ -n "$MAKE_DEB" ] || [ -n "$MAKE_TGZ" ]; then
echo "Building deb package for $config"
# Preserve package path # Preserve package path
exec 9>&1 exec 9>&1
PKG_PATH=$(nfpm package --target "$OUTPUT_DIR" --config "$config" --packager deb | tee /dev/fd/9) PKG_PATH=$(nfpm package --target "$OUTPUT_DIR" --config "$config" --packager deb | tee /dev/fd/9)
PKG_PATH=${PKG_PATH##*created package: } PKG_PATH=${PKG_PATH##*created package: }
exec 9>&- exec 9>&-
fi
if [ -n "$MAKE_APK" ]; then if [ -n "$MAKE_APK" ]; then
echo "Building apk package for $config" echo "Building apk package for $config"
nfpm package --target "$OUTPUT_DIR" --config "$config" --packager apk nfpm package --target "$OUTPUT_DIR" --config "$config" --packager apk
fi fi
if [ -n "$MAKE_ARCHLINUX" ]; then
echo "Building archlinux package for $config"
nfpm package --target "$OUTPUT_DIR" --config "$config" --packager archlinux
fi
if [ -n "$MAKE_RPM" ]; then if [ -n "$MAKE_RPM" ]; then
echo "Building rpm package for $config" echo "Building rpm package for $config"
nfpm package --target "$OUTPUT_DIR" --config "$config" --packager rpm nfpm package --target "$OUTPUT_DIR" --config "$config" --packager rpm

View File

@ -27,8 +27,8 @@ deb:
Source: clickhouse Source: clickhouse
contents: contents:
- src: root/etc/clickhouse-keeper - src: root/etc/clickhouse-keeper/keeper_config.xml
dst: /etc/clickhouse-keeper dst: /etc/clickhouse-keeper/keeper_config.xml
type: config type: config
- src: root/usr/bin/clickhouse-keeper - src: root/usr/bin/clickhouse-keeper
dst: /usr/bin/clickhouse-keeper dst: /usr/bin/clickhouse-keeper

View File

@ -42,8 +42,11 @@ deb:
Source: clickhouse Source: clickhouse
contents: contents:
- src: root/etc/clickhouse-server - src: root/etc/clickhouse-server/config.xml
dst: /etc/clickhouse-server dst: /etc/clickhouse-server/config.xml
type: config
- src: root/etc/clickhouse-server/users.xml
dst: /etc/clickhouse-server/users.xml
type: config type: config
- src: clickhouse-server.init - src: clickhouse-server.init
dst: /etc/init.d/clickhouse-server dst: /etc/init.d/clickhouse-server

View File

@ -44,5 +44,3 @@ if (NOT DEFINED ENABLE_UTILS OR ENABLE_UTILS)
add_subdirectory (memcpy-bench) add_subdirectory (memcpy-bench)
endif () endif ()
endif () endif ()
add_subdirectory (package)

View File

@ -1 +0,0 @@
add_subdirectory (arch)

View File

@ -1,2 +0,0 @@
include ("${ClickHouse_SOURCE_DIR}/cmake/version.cmake")
configure_file (PKGBUILD.in PKGBUILD)

View File

@ -1,33 +0,0 @@
pkgname=clickhouse
pkgver=${VERSION_STRING}
pkgrel=1
pkgdesc='An open-source column-oriented database management system that allows generating analytical data reports in real time'
arch=('x86_64')
url='https://clickhouse.com/'
license=('Apache')
package() {
install -dm 755 $pkgdir/usr/lib/tmpfiles.d
install -dm 755 $pkgdir/usr/lib/sysusers.d
install -Dm 644 ${CMAKE_CURRENT_SOURCE_DIR}/clickhouse.tmpfiles $pkgdir/usr/lib/tmpfiles.d/clickhouse.conf
install -Dm 644 ${CMAKE_CURRENT_SOURCE_DIR}/clickhouse.sysusers $pkgdir/usr/lib/sysusers.d/clickhouse.conf
install -dm 755 $pkgdir/etc/clickhouse-server/config.d
install -Dm 644 ${CMAKE_CURRENT_SOURCE_DIR}/logging.xml $pkgdir/etc/clickhouse-server/config.d/logging.xml
# This code was requisited from kmeaw@ https://aur.archlinux.org/packages/clickhouse/ .
SRC=${ClickHouse_SOURCE_DIR}
BIN=${ClickHouse_BINARY_DIR}
mkdir -p $pkgdir/etc/clickhouse-server/ $pkgdir/etc/clickhouse-client/
mkdir -p $pkgdir/usr/bin/
mkdir -p $pkgdir/usr/lib/systemd/system
ln -s clickhouse-client $pkgdir/usr/bin/clickhouse-server
cp $SRC/programs/server/config.xml $SRC/programs/server/users.xml $pkgdir/etc/clickhouse-server/
cp $BIN/programs/clickhouse $pkgdir/usr/bin/clickhouse-client
patchelf --remove-rpath $pkgdir/usr/bin/clickhouse-client
patchelf --replace-needed libz.so.1 libz-ng.so.1 $pkgdir/usr/bin/clickhouse-client
cp $SRC/programs/client/clickhouse-client.xml $pkgdir/etc/clickhouse-client/config.xml
compiler="libclickhouse-compiler.so"
if ! pacman -Q clang | grep '^clang 7'; then
compiler=""
fi
cp $SRC/debian/clickhouse-server.service $pkgdir/usr/lib/systemd/system
}

View File

@ -1,17 +0,0 @@
### Build Arch Linux package
From binary directory:
```
make
cd utils/package/arch
makepkg
```
### Install and start ClickHouse server
```
pacman -U clickhouse-*.pkg.tar.xz
systemctl enable clickhouse-server
systemctl start clickhouse-server
```

View File

@ -1,3 +0,0 @@
u clickhouse - "ClickHouse user" /nonexistent /bin/false
g clickhouse - "ClickHouse group"
m clickhouse clickhouse

View File

@ -1 +0,0 @@
d /var/lib/clickhouse 0700 clickhouse clickhouse

View File

@ -1,6 +0,0 @@
<clickhouse>
<logger>
<log></log>
<errorlog></errorlog>
</logger>
</clickhouse>