diff --git a/Makefile b/Makefile index a5719e9859..e3500a47ce 100644 --- a/Makefile +++ b/Makefile @@ -13,11 +13,7 @@ DEBUG=${ALL_DEBUG} export MAKE export CURVER?=2.0.3 export MAKEOPT=-j 4 -ifneq (,$(wildcard /etc/os-release)) - DISTRO := $(shell gawk -F= '/^NAME/{print $$2}' /etc/os-release) -else - DISTRO := unknown -endif +DISTRO := $(shell gawk -F= '/^NAME/{print $$2}' /etc/os-release) ifeq ($(wildcard /usr/lib/systemd/system), /usr/lib/systemd/system) SYSTEMD=1 else @@ -377,10 +373,6 @@ ifeq ($(DISTRO),"Ubuntu") else ifeq ($(DISTRO),"Debian GNU/Linux") update-rc.d proxysql defaults -else -ifeq ($(DISTRO),"Unknown") - $(warning Not sure how to install proxysql service on this OS) -endif endif endif endif @@ -413,10 +405,6 @@ else ifeq ($(DISTRO),"Debian GNU/Linux") if [ -f /etc/init.d/proxysql ]; then rm /etc/init.d/proxysql ; fi update-rc.d proxysql remove -else -ifeq ($(DISTRO),"Unknown") - $(warning Not sure how to uninstall proxysql service on this OS) -endif endif endif endif diff --git a/docker-compose.yml b/docker-compose.yml index faf292ec32..2b63fc5800 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,14 +17,13 @@ services: image: proxysql/packaging:build-centos5 volumes: - ./docker/images/proxysql/rhel-compliant/rpmmacros/:/root/ - - ./docker/images/proxysql/rhel-compliant/entrypoint/:/opt/entrypoint/ + - ./docker/images/proxysql/rhel-compliant/dbg-entrypoint/:/opt/entrypoint/ - ./:/opt/proxysql/ environment: - MAKE - MAKEOPT - CURVER - PKG_RELEASE=dbg-centos5 - - PROXYSQL_BUILD_TYPE=debug command: - /opt/entrypoint/entrypoint.bash centos67_build: @@ -44,14 +43,13 @@ services: image: proxysql/packaging:build-centos6.7 volumes: - ./docker/images/proxysql/rhel-compliant/rpmmacros/:/root/ - - ./docker/images/proxysql/rhel-compliant/entrypoint/:/opt/entrypoint/ + - ./docker/images/proxysql/rhel-compliant/dbg-entrypoint/:/opt/entrypoint/ - ./:/opt/proxysql/ environment: - MAKE - MAKEOPT - CURVER - PKG_RELEASE=dbg-centos67 - - PROXYSQL_BUILD_TYPE=debug command: - /opt/entrypoint/entrypoint.bash centos7_build: @@ -71,28 +69,26 @@ services: image: proxysql/packaging:build-centos7 volumes: - ./docker/images/proxysql/rhel-compliant/rpmmacros/:/root/ - - ./docker/images/proxysql/rhel-compliant/entrypoint/:/opt/entrypoint/ + - ./docker/images/proxysql/rhel-compliant/dbg-entrypoint/:/opt/entrypoint/ - ./:/opt/proxysql/ environment: - MAKE - MAKEOPT - CURVER - PKG_RELEASE=dbg-centos7 - - PROXYSQL_BUILD_TYPE=debug command: - /opt/entrypoint/entrypoint.bash centos7_ch_build: image: proxysql/packaging:build-centos7 volumes: - ./docker/images/proxysql/rhel-compliant/rpmmacros/:/root/ - - ./docker/images/proxysql/rhel-compliant/entrypoint/:/opt/entrypoint/ + - ./docker/images/proxysql/rhel-compliant/ch-entrypoint/:/opt/entrypoint/ - ./:/opt/proxysql/ environment: - MAKE - MAKEOPT - CURVER - PKG_RELEASE=clickhouse-centos7 - - PROXYSQL_BUILD_TYPE=clickhouse command: - /opt/entrypoint/entrypoint.bash fedora24_build: @@ -112,28 +108,26 @@ services: image: proxysql/packaging:build-fedora24 volumes: - ./docker/images/proxysql/rhel-compliant/rpmmacros/:/root/ - - ./docker/images/proxysql/rhel-compliant/entrypoint/:/opt/entrypoint/ + - ./docker/images/proxysql/rhel-compliant/dbg-entrypoint/:/opt/entrypoint/ - ./:/opt/proxysql/ environment: - MAKE - MAKEOPT - CURVER - PKG_RELEASE=dbg-fedora24 - - PROXYSQL_BUILD_TYPE=debug command: - /opt/entrypoint/entrypoint.bash fedora24_ch_build: image: proxysql/packaging:build-fedora24 volumes: - ./docker/images/proxysql/rhel-compliant/rpmmacros/:/root/ - - ./docker/images/proxysql/rhel-compliant/entrypoint/:/opt/entrypoint/ + - ./docker/images/proxysql/rhel-compliant/ch-entrypoint/:/opt/entrypoint/ - ./:/opt/proxysql/ environment: - MAKE - MAKEOPT - CURVER - PKG_RELEASE=clickhouse-fedora24 - - PROXYSQL_BUILD_TYPE=clickhouse command: - /opt/entrypoint/entrypoint.bash fedora27_build: @@ -153,28 +147,26 @@ services: image: proxysql/packaging:build-fedora27 volumes: - ./docker/images/proxysql/rhel-compliant/rpmmacros/:/root/ - - ./docker/images/proxysql/rhel-compliant/entrypoint/:/opt/entrypoint/ + - ./docker/images/proxysql/rhel-compliant/dbg-entrypoint/:/opt/entrypoint/ - ./:/opt/proxysql/ environment: - MAKE - MAKEOPT - CURVER - PKG_RELEASE=dbg-fedora27 - - PROXYSQL_BUILD_TYPE=debug command: - /opt/entrypoint/entrypoint.bash fedora27_ch_build: image: proxysql/packaging:build-fedora27 volumes: - ./docker/images/proxysql/rhel-compliant/rpmmacros/:/root/ - - ./docker/images/proxysql/rhel-compliant/entrypoint/:/opt/entrypoint/ + - ./docker/images/proxysql/rhel-compliant/ch-entrypoint/:/opt/entrypoint/ - ./:/opt/proxysql/ environment: - MAKE - MAKEOPT - CURVER - PKG_RELEASE=clickhouse-fedora27 - - PROXYSQL_BUILD_TYPE=clickhouse command: - /opt/entrypoint/entrypoint.bash fedora28_build: @@ -194,28 +186,26 @@ services: image: proxysql/packaging:build-fedora28 volumes: - ./docker/images/proxysql/rhel-compliant/rpmmacros/:/root/ - - ./docker/images/proxysql/rhel-compliant/entrypoint/:/opt/entrypoint/ + - ./docker/images/proxysql/rhel-compliant/dbg-entrypoint/:/opt/entrypoint/ - ./:/opt/proxysql/ environment: - MAKE - MAKEOPT - CURVER - PKG_RELEASE=dbg-fedora28 - - PROXYSQL_BUILD_TYPE=debug command: - /opt/entrypoint/entrypoint.bash fedora28_ch_build: image: proxysql/packaging:build-fedora28 volumes: - ./docker/images/proxysql/rhel-compliant/rpmmacros/:/root/ - - ./docker/images/proxysql/rhel-compliant/entrypoint/:/opt/entrypoint/ + - ./docker/images/proxysql/rhel-compliant/ch-entrypoint/:/opt/entrypoint/ - ./:/opt/proxysql/ environment: - MAKE - MAKEOPT - CURVER - PKG_RELEASE=clickhouse-fedora28 - - PROXYSQL_BUILD_TYPE=clickhouse command: - /opt/entrypoint/entrypoint.bash debian7_build: @@ -235,14 +225,13 @@ services: image: proxysql/packaging:build-debian7 volumes: - ./docker/images/proxysql/deb-compliant/pre-systemd/ctl/:/root/ctl/ - - ./docker/images/proxysql/deb-compliant/entrypoint/:/opt/entrypoint/ + - ./docker/images/proxysql/deb-compliant/dbg-entrypoint/:/opt/entrypoint/ - ./:/opt/proxysql/ environment: - MAKE - MAKEOPT - CURVER - PKG_RELEASE=dbg-debian7 - - PROXYSQL_BUILD_TYPE=debug command: - /opt/entrypoint/entrypoint.bash debian8_build: @@ -262,14 +251,13 @@ services: image: proxysql/packaging:build-debian8 volumes: - ./docker/images/proxysql/deb-compliant/pre-systemd/ctl/:/root/ctl/ - - ./docker/images/proxysql/deb-compliant/entrypoint/:/opt/entrypoint/ + - ./docker/images/proxysql/deb-compliant/dbg-entrypoint/:/opt/entrypoint/ - ./:/opt/proxysql/ environment: - MAKE - MAKEOPT - CURVER - PKG_RELEASE=dbg-debian8 - - PROXYSQL_BUILD_TYPE=debug command: - /opt/entrypoint/entrypoint.bash debian9_build: @@ -289,28 +277,26 @@ services: image: proxysql/packaging:build-debian9 volumes: - ./docker/images/proxysql/deb-compliant/ctl/:/root/ctl/ - - ./docker/images/proxysql/deb-compliant/entrypoint/:/opt/entrypoint/ + - ./docker/images/proxysql/deb-compliant/dbg-entrypoint/:/opt/entrypoint/ - ./:/opt/proxysql/ environment: - MAKE - MAKEOPT - CURVER - PKG_RELEASE=dbg-debian9 - - PROXYSQL_BUILD_TYPE=debug command: - /opt/entrypoint/entrypoint.bash debian9_ch_build: image: proxysql/packaging:build-debian9 volumes: - ./docker/images/proxysql/deb-compliant/ctl/:/root/ctl/ - - ./docker/images/proxysql/deb-compliant/entrypoint/:/opt/entrypoint/ + - ./docker/images/proxysql/deb-compliant/ch-entrypoint/:/opt/entrypoint/ - ./:/opt/proxysql/ environment: - MAKE - MAKEOPT - CURVER - PKG_RELEASE=clickhouse-debian9 - - PROXYSQL_BUILD_TYPE=clickhouse command: - /opt/entrypoint/entrypoint.bash debian9.4_build: @@ -330,28 +316,26 @@ services: image: proxysql/packaging:build-debian9.4 volumes: - ./docker/images/proxysql/deb-compliant/ctl/:/root/ctl/ - - ./docker/images/proxysql/deb-compliant/entrypoint/:/opt/entrypoint/ + - ./docker/images/proxysql/deb-compliant/dbg-entrypoint/:/opt/entrypoint/ - ./:/opt/proxysql/ environment: - MAKE - MAKEOPT - CURVER - PKG_RELEASE=dbg-debian9.4 - - PROXYSQL_BUILD_TYPE=debug command: - /opt/entrypoint/entrypoint.bash debian9.4_ch_build: image: proxysql/packaging:build-debian9.4 volumes: - ./docker/images/proxysql/deb-compliant/ctl/:/root/ctl/ - - ./docker/images/proxysql/deb-compliant/entrypoint/:/opt/entrypoint/ + - ./docker/images/proxysql/deb-compliant/ch-entrypoint/:/opt/entrypoint/ - ./:/opt/proxysql/ environment: - MAKE - MAKEOPT - CURVER - PKG_RELEASE=clickhouse-debian9.4 - - PROXYSQL_BUILD_TYPE=clickhouse command: - /opt/entrypoint/entrypoint.bash ubuntu12_build: @@ -371,14 +355,13 @@ services: image: proxysql/packaging:build-ubuntu12 volumes: - ./docker/images/proxysql/deb-compliant/pre-systemd/ctl/:/root/ctl/ - - ./docker/images/proxysql/deb-compliant/entrypoint/:/opt/entrypoint/ + - ./docker/images/proxysql/deb-compliant/dbg-entrypoint/:/opt/entrypoint/ - ./:/opt/proxysql/ environment: - MAKE - MAKEOPT - CURVER - PKG_RELEASE=dbg-ubuntu12 - - PROXYSQL_BUILD_TYPE=debug command: - /opt/entrypoint/entrypoint.bash ubuntu14_build: @@ -398,14 +381,13 @@ services: image: proxysql/packaging:build-ubuntu14 volumes: - ./docker/images/proxysql/deb-compliant/pre-systemd/ctl/:/root/ctl/ - - ./docker/images/proxysql/deb-compliant/entrypoint/:/opt/entrypoint/ + - ./docker/images/proxysql/deb-compliant/dbg-entrypoint/:/opt/entrypoint/ - ./:/opt/proxysql/ environment: - MAKE - MAKEOPT - CURVER - PKG_RELEASE=dbg-ubuntu14 - - PROXYSQL_BUILD_TYPE=debug command: - /opt/entrypoint/entrypoint.bash ubuntu16_build: @@ -425,28 +407,26 @@ services: image: proxysql/packaging:build-ubuntu16 volumes: - ./docker/images/proxysql/deb-compliant/pre-systemd/ctl/:/root/ctl/ - - ./docker/images/proxysql/deb-compliant/entrypoint/:/opt/entrypoint/ + - ./docker/images/proxysql/deb-compliant/dbg-entrypoint/:/opt/entrypoint/ - ./:/opt/proxysql/ environment: - MAKE - MAKEOPT - CURVER - PKG_RELEASE=dbg-ubuntu16 - - PROXYSQL_BUILD_TYPE=debug command: - /opt/entrypoint/entrypoint.bash ubuntu16_ch_build: image: proxysql/packaging:build-ubuntu16 volumes: - ./docker/images/proxysql/deb-compliant/pre-systemd/ctl/:/root/ctl/ - - ./docker/images/proxysql/deb-compliant/entrypoint/:/opt/entrypoint/ + - ./docker/images/proxysql/deb-compliant/ch-entrypoint/:/opt/entrypoint/ - ./:/opt/proxysql/ environment: - MAKE - MAKEOPT - CURVER - PKG_RELEASE=clickhouse-ubuntu16 - - PROXYSQL_BUILD_TYPE=clickhouse command: - /opt/entrypoint/entrypoint.bash ubuntu18_build: @@ -466,27 +446,25 @@ services: image: proxysql/packaging:build-ubuntu18 volumes: - ./docker/images/proxysql/deb-compliant/bionic-package/ctl/:/root/ctl/ - - ./docker/images/proxysql/deb-compliant/entrypoint/:/opt/entrypoint/ + - ./docker/images/proxysql/deb-compliant/dbg-entrypoint/:/opt/entrypoint/ - ./:/opt/proxysql/ environment: - MAKE - MAKEOPT - CURVER - PKG_RELEASE=dbg-ubuntu18 - - PROXYSQL_BUILD_TYPE=debug command: - /opt/entrypoint/entrypoint.bash ubuntu18_ch_build: image: proxysql/packaging:build-ubuntu18 volumes: - ./docker/images/proxysql/deb-compliant/bionic-package/ctl/:/root/ctl/ - - ./docker/images/proxysql/deb-compliant/entrypoint/:/opt/entrypoint/ + - ./docker/images/proxysql/deb-compliant/ch-entrypoint/:/opt/entrypoint/ - ./:/opt/proxysql/ environment: - MAKE - MAKEOPT - CURVER - PKG_RELEASE=clickhouse-ubuntu18 - - PROXYSQL_BUILD_TYPE=clickhouse command: - /opt/entrypoint/entrypoint.bash diff --git a/docker/images/proxysql/deb-compliant/ch-entrypoint/entrypoint.bash b/docker/images/proxysql/deb-compliant/ch-entrypoint/entrypoint.bash new file mode 100755 index 0000000000..548947c3d3 --- /dev/null +++ b/docker/images/proxysql/deb-compliant/ch-entrypoint/entrypoint.bash @@ -0,0 +1,18 @@ +#!/bin/bash +# Delete package if exists +rm -f /opt/proxysql/binaries/proxysql_${CURVER}-${PKG_RELEASE}_amd64.deb || true && +# Cleanup relic directories from a previously failed build +rm -f /opt/proxysql/proxysql.ctl || true && +# Clean and build dependancies and source +cd /opt/proxysql && \ +${MAKE} cleanbuild && \ +${MAKE} ${MAKEOPT} build_deps_clickhouse && \ +${MAKE} clickhouse ${MAKEOPT} && \ +# Prepare package files and build RPM +cp /root/ctl/proxysql.ctl /opt/proxysql/proxysql.ctl && \ +sed -i "s/PKG_VERSION_CURVER/${CURVER}/g" /opt/proxysql/proxysql.ctl && \ +cp /opt/proxysql/src/proxysql /opt/proxysql/ && \ +equivs-build proxysql.ctl && \ +mv /opt/proxysql/proxysql_${CURVER}_amd64.deb ./binaries/proxysql_${CURVER}-${PKG_RELEASE}_amd64.deb && \ +# Cleanup current build +rm -f /opt/proxysql/proxysql.ctl /opt/proxysql/proxysql diff --git a/docker/images/proxysql/deb-compliant/dbg-entrypoint/entrypoint.bash b/docker/images/proxysql/deb-compliant/dbg-entrypoint/entrypoint.bash new file mode 100755 index 0000000000..0f2b724bce --- /dev/null +++ b/docker/images/proxysql/deb-compliant/dbg-entrypoint/entrypoint.bash @@ -0,0 +1,18 @@ +#!/bin/bash +# Delete package if exists +rm -f /opt/proxysql/binaries/proxysql_${CURVER}-${PKG_RELEASE}_amd64.deb || true && +# Cleanup relic directories from a previously failed build +rm -f /opt/proxysql/proxysql.ctl /opt/proxysql/proxysql || true && +# Clean and build dependancies and source +cd /opt/proxysql && \ +${MAKE} cleanbuild && \ +${MAKE} ${MAKEOPT} build_deps_debug && \ +${MAKE} ${MAKEOPT} debug && \ +# Prepare package files and build RPM +cp /root/ctl/proxysql.ctl /opt/proxysql/proxysql.ctl && \ +sed -i "s/PKG_VERSION_CURVER/${CURVER}/g" /opt/proxysql/proxysql.ctl && \ +cp /opt/proxysql/src/proxysql /opt/proxysql/ && \ +equivs-build proxysql.ctl && \ +mv /opt/proxysql/proxysql_${CURVER}_amd64.deb ./binaries/proxysql_${CURVER}-${PKG_RELEASE}_amd64.deb && \ +# Cleanup current build +rm -f /opt/proxysql/proxysql.ctl /opt/proxysql/proxysql diff --git a/docker/images/proxysql/deb-compliant/entrypoint/entrypoint.bash b/docker/images/proxysql/deb-compliant/entrypoint/entrypoint.bash index e37dc1a3aa..a25f2ed549 100755 --- a/docker/images/proxysql/deb-compliant/entrypoint/entrypoint.bash +++ b/docker/images/proxysql/deb-compliant/entrypoint/entrypoint.bash @@ -1,38 +1,28 @@ #!/bin/bash - -set -eu - # Delete package if exists -rm -f "/opt/proxysql/binaries/proxysql_${CURVER}-${PKG_RELEASE}_amd64.deb" || true +rm -f /opt/proxysql/binaries/proxysql_${CURVER}-${PKG_RELEASE}_amd64.deb || true && \ # Cleanup relic directories from a previously failed build -rm -f /opt/proxysql/proxysql.ctl /opt/proxysql/proxysql || true +rm -f /opt/proxysql/proxysql.ctl || true && \ # Clean and build dependancies and source -cd /opt/proxysql +cd /opt/proxysql && \ # Patch for Ubuntu 12 if [ "`grep Ubuntu /etc/issue | awk '{print $2}' | cut -d. -f1`" == "12" ]; then sed -i -e 's/c++11/c++0x/' lib/Makefile sed -i -e 's/c++11/c++0x/' src/Makefile cd /opt/proxysql/deps/re2/ mv re2.tar.gz /tmp/ - wget -O re2.tar.gz https://github.com/sysown/proxysql/raw/v1.3.9/deps/re2/re2-20140304.tgz + wget -O re2.tar.gz https://github.com/sysown/proxysql/raw/v1.3.9/deps/re2/re2-20140304.tgz cd /opt/proxysql fi -if [[ -z ${PROXYSQL_BUILD_TYPE:-} ]] ; then - deps_target="build_deps" - build_target=() -else - deps_target="build_deps_$PROXYSQL_BUILD_TYPE" - build_target=("$PROXYSQL_BUILD_TYPE") -fi -${MAKE} cleanbuild -${MAKE} ${MAKEOPT} "$deps_target" -${MAKE} ${MAKEOPT} "${build_target[@]}" +${MAKE} cleanbuild && \ +${MAKE} ${MAKEOPT} build_deps && \ +${MAKE} ${MAKEOPT} && \ # Prepare package files and build RPM -cp /root/ctl/proxysql.ctl /opt/proxysql/proxysql.ctl -sed -i "s/PKG_VERSION_CURVER/${CURVER}/g" /opt/proxysql/proxysql.ctl -cp /opt/proxysql/src/proxysql /opt/proxysql/ -equivs-build proxysql.ctl -mv "/opt/proxysql/proxysql_${CURVER}_amd64.deb" "./binaries/proxysql_${CURVER}-${PKG_RELEASE}_amd64.deb" +cp /root/ctl/proxysql.ctl /opt/proxysql/proxysql.ctl && \ +sed -i "s/PKG_VERSION_CURVER/${CURVER}/g" /opt/proxysql/proxysql.ctl && \ +cp /opt/proxysql/src/proxysql /opt/proxysql/ && \ +equivs-build proxysql.ctl && \ +mv /opt/proxysql/proxysql_${CURVER}_amd64.deb ./binaries/proxysql_${CURVER}-${PKG_RELEASE}_amd64.deb && \ # Cleanup current build # Unpatch Ubuntu 12 if [ "`grep Ubuntu /etc/issue | awk '{print $2}' | cut -d. -f1`" == "12" ]; then diff --git a/docker/images/proxysql/rhel-compliant/ch-entrypoint/entrypoint.bash b/docker/images/proxysql/rhel-compliant/ch-entrypoint/entrypoint.bash new file mode 100755 index 0000000000..60338f1d6e --- /dev/null +++ b/docker/images/proxysql/rhel-compliant/ch-entrypoint/entrypoint.bash @@ -0,0 +1,24 @@ +#!/bin/bash +# Delete package if exists +rm -f /opt/proxysql/binaries/proxysql-${CURVER}-1-${PKG_RELEASE}.x86_64.rpm || true && \ +# Cleanup relic directories from a previously failed build +rm -fr /root/.pki /root/rpmbuild/{BUILDROOT,RPMS,SRPMS,BUILD,SOURCES,tmp} /opt/proxysql/proxysql /opt/proxysql/proxysql-${CURVER} || true && \ +# Clean and build dependancies and source +cd /opt/proxysql && \ +${MAKE} cleanbuild && \ +${MAKE} ${MAKEOPT} build_deps_clickhouse && \ +${MAKE} clickhouse ${MAKEOPT} && \ +# Prepare package files and build RPM +mkdir -p proxysql/usr/bin proxysql/etc && \ +cp src/proxysql proxysql/usr/bin/ && \ +cp -a etc proxysql && \ +mkdir -p proxysql/usr/share/proxysql/tools && \ +cp -a tools/proxysql_galera_checker.sh tools/proxysql_galera_writer.pl proxysql/usr/share/proxysql/tools && \ +mv proxysql proxysql-${CURVER} && \ +tar czvf proxysql-${CURVER}.tar.gz proxysql-${CURVER} && \ +mkdir -p /root/rpmbuild/{RPMS,SRPMS,BUILD,SOURCES,SPECS,tmp} && \ +mv /opt/proxysql/proxysql-${CURVER}.tar.gz /root/rpmbuild/SOURCES && \ +cd /root/rpmbuild && rpmbuild -ba SPECS/proxysql.spec --define "version ${CURVER}" && \ +mv /root/rpmbuild/RPMS/x86_64/proxysql-${CURVER}-1.x86_64.rpm /opt/proxysql/binaries/proxysql-${CURVER}-1-${PKG_RELEASE}.x86_64.rpm && \ +# Cleanup current build +rm -fr /root/.pki /root/rpmbuild/{BUILDROOT,RPMS,SRPMS,BUILD,SOURCES,tmp} /opt/proxysql/proxysql /opt/proxysql/proxysql-${CURVER} diff --git a/docker/images/proxysql/rhel-compliant/dbg-entrypoint/entrypoint.bash b/docker/images/proxysql/rhel-compliant/dbg-entrypoint/entrypoint.bash new file mode 100755 index 0000000000..51ee704706 --- /dev/null +++ b/docker/images/proxysql/rhel-compliant/dbg-entrypoint/entrypoint.bash @@ -0,0 +1,24 @@ +#!/bin/bash +# Delete package if exists +rm -f /opt/proxysql/binaries/proxysql-${CURVER}-1-${PKG_RELEASE}.x86_64.rpm || true && \ +# Cleanup relic directories from a previously failed build +rm -fr /root/.pki /root/rpmbuild/{BUILDROOT,RPMS,SRPMS,BUILD,SOURCES,tmp} /opt/proxysql/proxysql /opt/proxysql/proxysql-${CURVER} || true && \ +# Clean and build dependancies and source +cd /opt/proxysql && \ +${MAKE} cleanbuild && \ +${MAKE} ${MAKEOPT} build_deps_debug && \ +${MAKE} ${MAKEOPT} debug && \ +# Prepare package files and build RPM +mkdir -p proxysql/usr/bin proxysql/etc && \ +cp src/proxysql proxysql/usr/bin/ && \ +cp -a etc proxysql && \ +mkdir -p proxysql/usr/share/proxysql/tools && \ +cp -a tools/proxysql_galera_checker.sh tools/proxysql_galera_writer.pl proxysql/usr/share/proxysql/tools && \ +mv proxysql proxysql-${CURVER} && \ +tar czvf proxysql-${CURVER}.tar.gz proxysql-${CURVER} && \ +mkdir -p /root/rpmbuild/{RPMS,SRPMS,BUILD,SOURCES,SPECS,tmp} && \ +mv /opt/proxysql/proxysql-${CURVER}.tar.gz /root/rpmbuild/SOURCES && \ +cd /root/rpmbuild && rpmbuild -ba SPECS/proxysql.spec --define "version ${CURVER}" && \ +mv /root/rpmbuild/RPMS/x86_64/proxysql-${CURVER}-1.x86_64.rpm /opt/proxysql/binaries/proxysql-${CURVER}-1-${PKG_RELEASE}.x86_64.rpm && \ +# Cleanup current build +rm -fr /root/.pki /root/rpmbuild/{BUILDROOT,RPMS,SRPMS,BUILD,SOURCES,tmp} /opt/proxysql/proxysql /opt/proxysql/proxysql-${CURVER} diff --git a/docker/images/proxysql/rhel-compliant/entrypoint/entrypoint.bash b/docker/images/proxysql/rhel-compliant/entrypoint/entrypoint.bash index 4b41cfa486..59c7669ff9 100755 --- a/docker/images/proxysql/rhel-compliant/entrypoint/entrypoint.bash +++ b/docker/images/proxysql/rhel-compliant/entrypoint/entrypoint.bash @@ -1,41 +1,24 @@ #!/bin/bash -set -eu - -echo "==> Build environment:" -env - -echo "==> Cleaning" # Delete package if exists -rm -f /opt/proxysql/binaries/proxysql-${CURVER}-1-${PKG_RELEASE}.x86_64.rpm || true +rm -f /opt/proxysql/binaries/proxysql-${CURVER}-1-${PKG_RELEASE}.x86_64.rpm || true && \ # Cleanup relic directories from a previously failed build -rm -fr /root/.pki /root/rpmbuild/{BUILDROOT,RPMS,SRPMS,BUILD,SOURCES,tmp} /opt/proxysql/proxysql /opt/proxysql/proxysql-${CURVER} || true - +rm -fr /root/.pki /root/rpmbuild/{BUILDROOT,RPMS,SRPMS,BUILD,SOURCES,tmp} /opt/proxysql/proxysql /opt/proxysql/proxysql-${CURVER} || true && \ # Clean and build dependancies and source -echo "==> Building" -cd /opt/proxysql -if [[ -z ${PROXYSQL_BUILD_TYPE:-} ]] ; then - deps_target="build_deps" - build_target=() -else - deps_target="build_deps_$PROXYSQL_BUILD_TYPE" - build_target=("$PROXYSQL_BUILD_TYPE") -fi -${MAKE} cleanbuild -${MAKE} ${MAKEOPT} "$deps_target" -${MAKE} ${MAKEOPT} "${build_target[@]}" - +cd /opt/proxysql && \ +${MAKE} cleanbuild && \ +${MAKE} ${MAKEOPT} build_deps && \ +${MAKE} ${MAKEOPT} && \ # Prepare package files and build RPM -echo "==> Packaging" -mkdir -p proxysql/usr/bin proxysql/etc -cp src/proxysql proxysql/usr/bin/ -cp -a etc proxysql -mkdir -p proxysql/usr/share/proxysql/tools -cp -a tools/proxysql_galera_checker.sh tools/proxysql_galera_writer.pl proxysql/usr/share/proxysql/tools -mv proxysql "proxysql-${CURVER}" -tar czvf "proxysql-${CURVER}.tar.gz" proxysql-${CURVER} -mkdir -p /root/rpmbuild/{RPMS,SRPMS,BUILD,SOURCES,SPECS,tmp} -mv "/opt/proxysql/proxysql-${CURVER}.tar.gz" /root/rpmbuild/SOURCES -cd /root/rpmbuild && rpmbuild -ba SPECS/proxysql.spec --define "version ${CURVER}" -mv "/root/rpmbuild/RPMS/x86_64/proxysql-${CURVER}-1.x86_64.rpm" "/opt/proxysql/binaries/proxysql-${CURVER}-1-${PKG_RELEASE}.x86_64.rpm" +mkdir -p proxysql/usr/bin proxysql/etc && \ +cp src/proxysql proxysql/usr/bin/ && \ +cp -a etc proxysql && \ +mkdir -p proxysql/usr/share/proxysql/tools && \ +cp -a tools/proxysql_galera_checker.sh tools/proxysql_galera_writer.pl proxysql/usr/share/proxysql/tools && \ +mv proxysql proxysql-${CURVER} && \ +tar czvf proxysql-${CURVER}.tar.gz proxysql-${CURVER} && \ +mkdir -p /root/rpmbuild/{RPMS,SRPMS,BUILD,SOURCES,SPECS,tmp} && \ +mv /opt/proxysql/proxysql-${CURVER}.tar.gz /root/rpmbuild/SOURCES && \ +cd /root/rpmbuild && rpmbuild -ba SPECS/proxysql.spec --define "version ${CURVER}" && \ +mv /root/rpmbuild/RPMS/x86_64/proxysql-${CURVER}-1.x86_64.rpm /opt/proxysql/binaries/proxysql-${CURVER}-1-${PKG_RELEASE}.x86_64.rpm && \ # Cleanup current build -rm -fr /root/.pki /root/rpmbuild/{BUILDROOT,RPMS,SRPMS,BUILD,SOURCES,tmp} /opt/proxysql/proxysql "/opt/proxysql/proxysql-${CURVER}" +rm -fr /root/.pki /root/rpmbuild/{BUILDROOT,RPMS,SRPMS,BUILD,SOURCES,tmp} /opt/proxysql/proxysql /opt/proxysql/proxysql-${CURVER}