mariadb/debian/rules

203 lines
8.6 KiB
Text
Raw Normal View History

#!/usr/bin/make -f
Deb: Sync Salsa-CI from Debian MariaDB 10.6 Compare to Debian packaging of MariaDB 1:10.6.11-2 release at commit https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/2934e8a795cbd1eba79e33b8d6c82ed2b0897128 and sync upstream everything that is relevant for upstream and safe to import on a stable 10.6 release. * Use OpenSSL 1.1 from Debian Snapshots https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/0040c272bf8a9a253fcd393b235b18cd5cdc9289 Related: https://jira.mariadb.org/browse/MDEV-30322 * Prefer using bullseye-backports in mosts tests over buster-bpo https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/daa827ecded9dc1f096ecb05242116173298d602 * Add new upgrade test for MySQL Community Cluster 8.0 https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/3c71bec9b7626d25a55e23b2e570b4e125d5d5df * Enable automatic datadir move also on upgrades from MySQL.com packages https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/4cbbcb7e56d9604a67230d11a68543d5a83960e3 * Update Breaks/Replaces https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/2cab13d05959fe8f6ea56b866df51f3bfe17dd3f * Normalize apt-get and curl commands https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/8754ea2578bd214d75a2a9e6a0f7b4b74c062b41 * Standardize on using capitalized 'ON' in CMake build options https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/938757a85aee44c727f3f6996677ef1126c2f5aa * Apply wrap-and-sort -av and other minor tweaks and inline documentation NOTE TO MERGERS: This commit is made on 10.6 branch and can be merged to all later branches (10.7, 10.8, ..., 11.0).
2023-01-06 06:56:14 +01:00
# Enable Debian Hardening
# https://wiki.debian.org/Hardening
Misc Debian/Salsa-CI fixes (#2299) * Deb: Handle codename 'n/a' from Debian Sid properly and autobake-deb cleanup This fixes autobake-deb.sh builds on Sid which was visible as 4 failing build steps on Salsa-CI. - In Sid the LSBNAME might evaluate to 'n/a', so accept it as 'Sid' to fix builds that failed with error: Error - unknown release codename n/a - Refactor list to have Ubuntu versions first, then Debian, and as last the special case of Debian Sid - Fix minor syntax issues detected by Shellcheck Also remove useless DEB_HOST_ARCH_CPU check from debian/rules: * It was never in effect as the 'sed' in autobake-deb.sh cleared it anyway * The variable name was wrong and always empty * If variable would have been correct, logic was still reversed - Define 3h timeout as the default 1h timeout on Gitlab.com (and others) is usually not enough for initial (uncached) MariaDB builds. - Replace Buster to Bookworm/Sid upgrade testing with upgrade inside Buster testing as direct upgrades from Stretch to Bullseye and Buster to Bookworm are no longer possible due to: Bug#993755: libcrypt.so.1: cannot open shared object file when upgrading from Stretch to Sid (https://bugs.debian.org/993755) - Stop ignoring MariaDB.org 10.6 to this version upgrade testing failures to reveal bug MDEV-28640. Originally this step was failing as the uring dependencies in upstream builders lagged behind and there was nothing that needed work, only time time to resolve. Now there is an actual bug in packaging that should be visible as a CI failure. - Stop testing for 'service mysql status' on systems that upgraded from MySQL 8.0 to MariaDB.org vended 10.6. Due to some unidentified debian/control changes in 10.6 on upstream the upgrade is no longer compatible in a way that would maintain the init.d script with name 'mysql'. - Fix typos where mergers had changed occurrences of 10.5 to 10.6 while they intentionally need to be exactly 10.5, otherwise the meaning changes. - Align autopkgtest code with downstream official Debian packaging one. This is change is safe on a stable branch because is only affects builds and testing, not any actual usage of MariaDB 10.6. - Standardize on using capitalized 'YES' in CMake build options (instead of 'yes' or mixed case) - Add some comments to better document debian/rules - Fix typo in Lintian overrides Ubuntu bug: https://bugs.launchpad.net/ubuntu/+source/mariadb-10.6/+bug/1970634 MariaDB ticket: https://jira.mariadb.org/browse/MDEV-25633 When built with LTO on Ubuntu, MariaDB does not catch an exception when the uring initialization fails due to a low RLIMIT_MEMLOCK value. This commit amends the commit 0609b345554f9a148e165c497aadbe368e0900aa to be identical to the one done downstream in Debian: https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/8d20ca979cf422d3a507283b86c2547d78559179 This way both the inline comments and 'git blame' for this section will show properly why this is needed, and the fix is one that is fully tested on Debian and Ubuntu. Also having this section fully identical in upstream MariaDB and downstream Debian will make the packaging maintenance easier as 'diff` runs on this file will not flag this as a difference anymore. In MDEV-28640 the init script failed to stop/start the MariaDB server due to missing mysqladmin on the system. This was however very hard to spot from the console output. Add an explicit check for the binary the script depends on, and fail verbosely if the dependency is missing.
2022-11-11 08:51:34 +01:00
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
# Disable LTO on Ubuntu, see LP: #1970634 and https://jira.mariadb.org/browse/MDEV-25633
ifeq ($(shell dpkg-vendor --derives-from Ubuntu && echo yes), yes)
export DEB_BUILD_MAINT_OPTIONS += optimize=-lto
endif
DPKG_EXPORT_BUILDFLAGS = 1
# Include all defaults, including buildflags.mk
include /usr/share/dpkg/default.mk
# CPPFLAGS are nor read by CMake, so copy them to CXXFLAGS
# See why at https://cmake.org/Bug/view.php?id=12928
# This is needed for e.g. all automatic Debian hardening flags to apply on all cmake builds.
CFLAGS+=$(CPPFLAGS)
CXXFLAGS+=$(CPPFLAGS)
# Only do a strict symbol checking on Linux
# https://manpages.debian.org/testing/dpkg-dev/dpkg-gensymbols.1.en.html
# Level 4: Fails if some libraries have been introduced.
ifneq (,$(filter linux,$(DEB_HOST_ARCH_OS)))
export DPKG_GENSYMBOLS_CHECK_LEVEL = 4
endif
BUILDDIR := builddir
DEB_VERSION_REVISION := $(shell echo $(DEB_VERSION) | sed -e 's/.*[~-]\(.*\)/\1/')
DEB_VERSION_VERSION := $(shell echo $(DEB_VERSION) | sed -e 's/^.*:\(.*\)\(-\|+\).*/\1/')
DEB_VERSION_MAJOR := $(shell echo $(DEB_VERSION_VERSION) | sed -e 's/^\(.*\)\..*$$/\1/')
RELEASE := $(shell lsb_release -r -s) # Use changelog based DEB_DISTRIBUTION instead?
MDEV-33750: Sync maintainer scripts etc with latest downstream 10.11.5 in Debian Fix a large amount of minor fixes to maintainer scripts and other done downstream in the official Debian packaging. Changes include: https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/38198d0b9e1c7821ddd074e308b25034bdcdce5b > Limit check of running mysqld/mariadbd to system users (Closes: #1032047) > > If a random user has their own copy of mysqld/mariadbd running, the > dpkg maintainer script should not care about it. https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/8116354d22e0b8eade6d8f0594c57300d5d5cff5 > Make error more helpful in case server restart fails (Related: #1033234) > > Bugs such as https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1033234 > and https://bugs.launchpad.net/ubuntu/+source/mariadb-10.6/+bug/2011293 > show that currently dpkg stopping on service stop/start does not have > a very helpful error message. https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/8675e97202171812a1afdb438a17cb29a99836fb > Complement upstream commits with more complete mysql->mariadb conversion > > The upstream commit 952af4a1 missed some places where 'mysql' or > 'MySQL' can and should be converted to use 'mariadb' or 'MariaDB'. https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/c98361330063e7dccbf8d21aa20e48179ba5c1e4 > Fix indentation in Debian post and pre scripts > > There is several misindentation inside Debian post and pre > installation scripts. False indentation with space as indent space > should be 2 and indentation with tabs. > > Adopt upstream commit 7cbb45d1 in Debian by conserving customizations > in: > - debian/mariadb-server.postinst > - debian/mariadb-server.postrm > - debian/mariadb-server.preinst https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/d0bcab443fa6d44084dc674ba29b79516c6239ba > Ensure spaces are used everywhere instead of tabs for indentation https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/0300a9157cc69f75e01ac9c0d6e033d8be661492 > Complement previous upstream commits to fix Shellcheck issues > > - Unify if/then and while/do on separate lines > - Fix indentation to be consistent > - Use "$()" instead of backticks for subshells > - Exit code cannot be -1, must be 0-255 > - Remove unused variables MYCHECK and MYCHECK_PARAMS > - Rewrite messy command-line database calls to an easier to read form > that does exactly the same > - Use 'command -v' test instead of 'which' > > With this commit, all of debian/* is Shellcheck clean. Also * Update mariadb.conf.d template to tell users where to create logdir if they are not using journald * Remove use of work 'slave' * Add minor workaround for Debian Bug #1022994 if TMPDIR is empty * Make start/stop in maintainer scripts correctly check mariadbd ownership and only start/stop processes owned by root or 'mysql' * Remove obsolete 'NO_UPDATE_BUILD_VERSION=1' as it did not affect the RocksDB build reproducibility as previously assumed * Run 'wrap-and-sort -av'
2023-10-08 04:42:31 +02:00
TMP := $(CURDIR)/debian/tmp
MTR_SKIP_TEST_LIST := $(shell mktemp)
# According to Debian Policy version 4.2.0 builds should be as verbose as
# possible unless 'terse' is specifically passed.
ifeq (,$(filter terse,$(DEB_BUILD_OPTIONS)))
export DH_VERBOSE=1
endif
# Parallel build support as advised
# at https://www.debian.org/doc/debian-policy/ch-source.html#s-debianrules-options
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
MAKEFLAGS += -j$(NUMJOBS)
else
# NUMJOBS cannot be empty as it is used as a parameter to mtr, default to 'auto'.
NUMJOBS = auto
endif
# RocksDB cannot build on 32-bit platforms
ifeq (32,$(DEB_HOST_ARCH_BITS))
CMAKEFLAGS += -DPLUGIN_ROCKSDB=NO
endif
# Add support for verbose builds
MAKEFLAGS += VERBOSE=1
override_dh_auto_clean:
@echo "RULES.$@"
dh_testdir
dh_testroot
rm -rf $(BUILDDIR) builddir-native mysql-test/unstable-tests
debconf-updatepo # Update po-files when clean runs before each build
override_dh_auto_configure:
@echo "RULES.$@"
dh_testdir
ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
MDEV-33750: Sync maintainer scripts etc with latest downstream 10.11.5 in Debian Fix a large amount of minor fixes to maintainer scripts and other done downstream in the official Debian packaging. Changes include: https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/38198d0b9e1c7821ddd074e308b25034bdcdce5b > Limit check of running mysqld/mariadbd to system users (Closes: #1032047) > > If a random user has their own copy of mysqld/mariadbd running, the > dpkg maintainer script should not care about it. https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/8116354d22e0b8eade6d8f0594c57300d5d5cff5 > Make error more helpful in case server restart fails (Related: #1033234) > > Bugs such as https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1033234 > and https://bugs.launchpad.net/ubuntu/+source/mariadb-10.6/+bug/2011293 > show that currently dpkg stopping on service stop/start does not have > a very helpful error message. https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/8675e97202171812a1afdb438a17cb29a99836fb > Complement upstream commits with more complete mysql->mariadb conversion > > The upstream commit 952af4a1 missed some places where 'mysql' or > 'MySQL' can and should be converted to use 'mariadb' or 'MariaDB'. https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/c98361330063e7dccbf8d21aa20e48179ba5c1e4 > Fix indentation in Debian post and pre scripts > > There is several misindentation inside Debian post and pre > installation scripts. False indentation with space as indent space > should be 2 and indentation with tabs. > > Adopt upstream commit 7cbb45d1 in Debian by conserving customizations > in: > - debian/mariadb-server.postinst > - debian/mariadb-server.postrm > - debian/mariadb-server.preinst https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/d0bcab443fa6d44084dc674ba29b79516c6239ba > Ensure spaces are used everywhere instead of tabs for indentation https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/0300a9157cc69f75e01ac9c0d6e033d8be661492 > Complement previous upstream commits to fix Shellcheck issues > > - Unify if/then and while/do on separate lines > - Fix indentation to be consistent > - Use "$()" instead of backticks for subshells > - Exit code cannot be -1, must be 0-255 > - Remove unused variables MYCHECK and MYCHECK_PARAMS > - Rewrite messy command-line database calls to an easier to read form > that does exactly the same > - Use 'command -v' test instead of 'which' > > With this commit, all of debian/* is Shellcheck clean. Also * Update mariadb.conf.d template to tell users where to create logdir if they are not using journald * Remove use of work 'slave' * Add minor workaround for Debian Bug #1022994 if TMPDIR is empty * Make start/stop in maintainer scripts correctly check mariadbd ownership and only start/stop processes owned by root or 'mysql' * Remove obsolete 'NO_UPDATE_BUILD_VERSION=1' as it did not affect the RocksDB build reproducibility as previously assumed * Run 'wrap-and-sort -av'
2023-10-08 04:42:31 +02:00
dpkg-architecture -a$(DEB_BUILD_ARCH) -f -c dh_auto_configure --builddirectory=builddir-native --reload-all-buildenv-variables
dh_auto_build --builddirectory=builddir-native -- import_executables
endif
echo "server:Version=$(DEB_VERSION)" >> debian/substvars
MDEV-33750: Sync maintainer scripts etc with latest downstream 10.11.5 in Debian Fix a large amount of minor fixes to maintainer scripts and other done downstream in the official Debian packaging. Changes include: https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/38198d0b9e1c7821ddd074e308b25034bdcdce5b > Limit check of running mysqld/mariadbd to system users (Closes: #1032047) > > If a random user has their own copy of mysqld/mariadbd running, the > dpkg maintainer script should not care about it. https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/8116354d22e0b8eade6d8f0594c57300d5d5cff5 > Make error more helpful in case server restart fails (Related: #1033234) > > Bugs such as https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1033234 > and https://bugs.launchpad.net/ubuntu/+source/mariadb-10.6/+bug/2011293 > show that currently dpkg stopping on service stop/start does not have > a very helpful error message. https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/8675e97202171812a1afdb438a17cb29a99836fb > Complement upstream commits with more complete mysql->mariadb conversion > > The upstream commit 952af4a1 missed some places where 'mysql' or > 'MySQL' can and should be converted to use 'mariadb' or 'MariaDB'. https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/c98361330063e7dccbf8d21aa20e48179ba5c1e4 > Fix indentation in Debian post and pre scripts > > There is several misindentation inside Debian post and pre > installation scripts. False indentation with space as indent space > should be 2 and indentation with tabs. > > Adopt upstream commit 7cbb45d1 in Debian by conserving customizations > in: > - debian/mariadb-server.postinst > - debian/mariadb-server.postrm > - debian/mariadb-server.preinst https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/d0bcab443fa6d44084dc674ba29b79516c6239ba > Ensure spaces are used everywhere instead of tabs for indentation https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/0300a9157cc69f75e01ac9c0d6e033d8be661492 > Complement previous upstream commits to fix Shellcheck issues > > - Unify if/then and while/do on separate lines > - Fix indentation to be consistent > - Use "$()" instead of backticks for subshells > - Exit code cannot be -1, must be 0-255 > - Remove unused variables MYCHECK and MYCHECK_PARAMS > - Rewrite messy command-line database calls to an easier to read form > that does exactly the same > - Use 'command -v' test instead of 'which' > > With this commit, all of debian/* is Shellcheck clean. Also * Update mariadb.conf.d template to tell users where to create logdir if they are not using journald * Remove use of work 'slave' * Add minor workaround for Debian Bug #1022994 if TMPDIR is empty * Make start/stop in maintainer scripts correctly check mariadbd ownership and only start/stop processes owned by root or 'mysql' * Remove obsolete 'NO_UPDATE_BUILD_VERSION=1' as it did not affect the RocksDB build reproducibility as previously assumed * Run 'wrap-and-sort -av'
2023-10-08 04:42:31 +02:00
# As packages does not have major version any more in package name there is no
# way as it not set by dpkg to use this on postinst script. Use sed to
# determine major version instead.
# @TODO: Rewrite this to use the new upstream /var/lib/mysql_upgrade_info file
# instead of the legacy /var/lib/debian-XX.X.flag file
sed -i 's/__MARIADB_MAJOR_VER__/$(DEB_VERSION_MAJOR)/g' debian/mariadb-server.post* debian/mariadb-server.preinst
# Don't build ColumnStore as part of the native build as it does not meet the
# quality standards in Debian. Also building it requires an extra 4 GB of disk
# space which makes native Debian builds fail as the total disk space needed
# for MariaDB becomes over 10 GB. Only build CS via autobake-deb.sh.
Deb: Sync Salsa-CI from Debian MariaDB 10.6 Compare to Debian packaging of MariaDB 1:10.6.11-2 release at commit https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/2934e8a795cbd1eba79e33b8d6c82ed2b0897128 and sync upstream everything that is relevant for upstream and safe to import on a stable 10.6 release. * Use OpenSSL 1.1 from Debian Snapshots https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/0040c272bf8a9a253fcd393b235b18cd5cdc9289 Related: https://jira.mariadb.org/browse/MDEV-30322 * Prefer using bullseye-backports in mosts tests over buster-bpo https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/daa827ecded9dc1f096ecb05242116173298d602 * Add new upgrade test for MySQL Community Cluster 8.0 https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/3c71bec9b7626d25a55e23b2e570b4e125d5d5df * Enable automatic datadir move also on upgrades from MySQL.com packages https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/4cbbcb7e56d9604a67230d11a68543d5a83960e3 * Update Breaks/Replaces https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/2cab13d05959fe8f6ea56b866df51f3bfe17dd3f * Normalize apt-get and curl commands https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/8754ea2578bd214d75a2a9e6a0f7b4b74c062b41 * Standardize on using capitalized 'ON' in CMake build options https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/938757a85aee44c727f3f6996677ef1126c2f5aa * Apply wrap-and-sort -av and other minor tweaks and inline documentation NOTE TO MERGERS: This commit is made on 10.6 branch and can be merged to all later branches (10.7, 10.8, ..., 11.0).
2023-01-06 06:56:14 +01:00
#
# Note: Don't use '-DWITH_URING=ON' as some Buildbot builders are missing it
# and would fail permanently.
PATH=$${MYSQL_BUILD_PATH:-"/usr/lib/ccache:/usr/local/bin:/usr/bin:/bin"} \
dh_auto_configure --builddirectory=$(BUILDDIR) -- \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
$(CMAKEFLAGS) \
$(if $(filter $(DEB_BUILD_ARCH),$(DEB_HOST_ARCH)),,-DIMPORT_EXECUTABLES=$(CURDIR)/builddir-native/import_executables.cmake) \
-DCOMPILATION_COMMENT="mariadb.org binary distribution" \
-DMYSQL_SERVER_SUFFIX="-$(DEB_VERSION_REVISION)" \
-DSYSTEM_TYPE="debian-$(DEB_HOST_GNU_SYSTEM)" \
-DBUILD_CONFIG=mysql_release \
-DCONC_DEFAULT_CHARSET=utf8mb4 \
-DPLUGIN_AWS_KEY_MANAGEMENT=NO \
Misc Debian/Salsa-CI fixes (#2299) * Deb: Handle codename 'n/a' from Debian Sid properly and autobake-deb cleanup This fixes autobake-deb.sh builds on Sid which was visible as 4 failing build steps on Salsa-CI. - In Sid the LSBNAME might evaluate to 'n/a', so accept it as 'Sid' to fix builds that failed with error: Error - unknown release codename n/a - Refactor list to have Ubuntu versions first, then Debian, and as last the special case of Debian Sid - Fix minor syntax issues detected by Shellcheck Also remove useless DEB_HOST_ARCH_CPU check from debian/rules: * It was never in effect as the 'sed' in autobake-deb.sh cleared it anyway * The variable name was wrong and always empty * If variable would have been correct, logic was still reversed - Define 3h timeout as the default 1h timeout on Gitlab.com (and others) is usually not enough for initial (uncached) MariaDB builds. - Replace Buster to Bookworm/Sid upgrade testing with upgrade inside Buster testing as direct upgrades from Stretch to Bullseye and Buster to Bookworm are no longer possible due to: Bug#993755: libcrypt.so.1: cannot open shared object file when upgrading from Stretch to Sid (https://bugs.debian.org/993755) - Stop ignoring MariaDB.org 10.6 to this version upgrade testing failures to reveal bug MDEV-28640. Originally this step was failing as the uring dependencies in upstream builders lagged behind and there was nothing that needed work, only time time to resolve. Now there is an actual bug in packaging that should be visible as a CI failure. - Stop testing for 'service mysql status' on systems that upgraded from MySQL 8.0 to MariaDB.org vended 10.6. Due to some unidentified debian/control changes in 10.6 on upstream the upgrade is no longer compatible in a way that would maintain the init.d script with name 'mysql'. - Fix typos where mergers had changed occurrences of 10.5 to 10.6 while they intentionally need to be exactly 10.5, otherwise the meaning changes. - Align autopkgtest code with downstream official Debian packaging one. This is change is safe on a stable branch because is only affects builds and testing, not any actual usage of MariaDB 10.6. - Standardize on using capitalized 'YES' in CMake build options (instead of 'yes' or mixed case) - Add some comments to better document debian/rules - Fix typo in Lintian overrides Ubuntu bug: https://bugs.launchpad.net/ubuntu/+source/mariadb-10.6/+bug/1970634 MariaDB ticket: https://jira.mariadb.org/browse/MDEV-25633 When built with LTO on Ubuntu, MariaDB does not catch an exception when the uring initialization fails due to a low RLIMIT_MEMLOCK value. This commit amends the commit 0609b345554f9a148e165c497aadbe368e0900aa to be identical to the one done downstream in Debian: https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/8d20ca979cf422d3a507283b86c2547d78559179 This way both the inline comments and 'git blame' for this section will show properly why this is needed, and the fix is one that is fully tested on Debian and Ubuntu. Also having this section fully identical in upstream MariaDB and downstream Debian will make the packaging maintenance easier as 'diff` runs on this file will not flag this as a difference anymore. In MDEV-28640 the init script failed to stop/start the MariaDB server due to missing mysqladmin on the system. This was however very hard to spot from the console output. Add an explicit check for the binary the script depends on, and fail verbosely if the dependency is missing.
2022-11-11 08:51:34 +01:00
-DPLUGIN_COLUMNSTORE=NO \
Deb: Sync Salsa-CI from Debian MariaDB 10.6 Compare to Debian packaging of MariaDB 1:10.6.11-2 release at commit https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/2934e8a795cbd1eba79e33b8d6c82ed2b0897128 and sync upstream everything that is relevant for upstream and safe to import on a stable 10.6 release. * Use OpenSSL 1.1 from Debian Snapshots https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/0040c272bf8a9a253fcd393b235b18cd5cdc9289 Related: https://jira.mariadb.org/browse/MDEV-30322 * Prefer using bullseye-backports in mosts tests over buster-bpo https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/daa827ecded9dc1f096ecb05242116173298d602 * Add new upgrade test for MySQL Community Cluster 8.0 https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/3c71bec9b7626d25a55e23b2e570b4e125d5d5df * Enable automatic datadir move also on upgrades from MySQL.com packages https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/4cbbcb7e56d9604a67230d11a68543d5a83960e3 * Update Breaks/Replaces https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/2cab13d05959fe8f6ea56b866df51f3bfe17dd3f * Normalize apt-get and curl commands https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/8754ea2578bd214d75a2a9e6a0f7b4b74c062b41 * Standardize on using capitalized 'ON' in CMake build options https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/938757a85aee44c727f3f6996677ef1126c2f5aa * Apply wrap-and-sort -av and other minor tweaks and inline documentation NOTE TO MERGERS: This commit is made on 10.6 branch and can be merged to all later branches (10.7, 10.8, ..., 11.0).
2023-01-06 06:56:14 +01:00
-DIGNORE_AIO_CHECK=ON \
-DDEB=$(DEB_VENDOR)
# This is needed, otherwise 'make test' will run before binaries have been built
override_dh_auto_build:
@echo "RULES.$@"
# Print build env info to help debug builds on different platforms
dpkg-architecture
cd $(BUILDDIR) && $(MAKE) --output-sync=target
override_dh_auto_test:
@echo "RULES.$@"
dh_testdir
# Skip running test suite after build if DEB_BUILD_OPTIONS contains 'nocheck'
@echo "DEB_BUILD_OPTIONS: $(DEB_BUILD_OPTIONS)"
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
Deb: Sync Salsa-CI from Debian MariaDB 10.6 Compare to Debian packaging of MariaDB 1:10.6.11-2 release at commit https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/2934e8a795cbd1eba79e33b8d6c82ed2b0897128 and sync upstream everything that is relevant for upstream and safe to import on a stable 10.6 release. * Use OpenSSL 1.1 from Debian Snapshots https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/0040c272bf8a9a253fcd393b235b18cd5cdc9289 Related: https://jira.mariadb.org/browse/MDEV-30322 * Prefer using bullseye-backports in mosts tests over buster-bpo https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/daa827ecded9dc1f096ecb05242116173298d602 * Add new upgrade test for MySQL Community Cluster 8.0 https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/3c71bec9b7626d25a55e23b2e570b4e125d5d5df * Enable automatic datadir move also on upgrades from MySQL.com packages https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/4cbbcb7e56d9604a67230d11a68543d5a83960e3 * Update Breaks/Replaces https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/2cab13d05959fe8f6ea56b866df51f3bfe17dd3f * Normalize apt-get and curl commands https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/8754ea2578bd214d75a2a9e6a0f7b4b74c062b41 * Standardize on using capitalized 'ON' in CMake build options https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/938757a85aee44c727f3f6996677ef1126c2f5aa * Apply wrap-and-sort -av and other minor tweaks and inline documentation NOTE TO MERGERS: This commit is made on 10.6 branch and can be merged to all later branches (10.7, 10.8, ..., 11.0).
2023-01-06 06:56:14 +01:00
# Skip unstable tests if such are defined for arch
[ ! -f debian/unstable-tests.$(DEB_HOST_ARCH) ] || cat debian/unstable-tests.$(DEB_HOST_ARCH) >> $(MTR_SKIP_TEST_LIST)
# Show contents of skip list on this architecture
@echo "On architecture $(DEB_HOST_ARCH) skip tests:"
cat $(MTR_SKIP_TEST_LIST)
# Run testsuite
cd $(BUILDDIR)/mysql-test && \
export MTR_PRINT_CORE=detailed && \
./mtr --force --testcase-timeout=120 --suite-timeout=540 --retry=3 \
MDEV-33750: Sync maintainer scripts etc with latest downstream 10.11.5 in Debian Fix a large amount of minor fixes to maintainer scripts and other done downstream in the official Debian packaging. Changes include: https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/38198d0b9e1c7821ddd074e308b25034bdcdce5b > Limit check of running mysqld/mariadbd to system users (Closes: #1032047) > > If a random user has their own copy of mysqld/mariadbd running, the > dpkg maintainer script should not care about it. https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/8116354d22e0b8eade6d8f0594c57300d5d5cff5 > Make error more helpful in case server restart fails (Related: #1033234) > > Bugs such as https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1033234 > and https://bugs.launchpad.net/ubuntu/+source/mariadb-10.6/+bug/2011293 > show that currently dpkg stopping on service stop/start does not have > a very helpful error message. https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/8675e97202171812a1afdb438a17cb29a99836fb > Complement upstream commits with more complete mysql->mariadb conversion > > The upstream commit 952af4a1 missed some places where 'mysql' or > 'MySQL' can and should be converted to use 'mariadb' or 'MariaDB'. https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/c98361330063e7dccbf8d21aa20e48179ba5c1e4 > Fix indentation in Debian post and pre scripts > > There is several misindentation inside Debian post and pre > installation scripts. False indentation with space as indent space > should be 2 and indentation with tabs. > > Adopt upstream commit 7cbb45d1 in Debian by conserving customizations > in: > - debian/mariadb-server.postinst > - debian/mariadb-server.postrm > - debian/mariadb-server.preinst https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/d0bcab443fa6d44084dc674ba29b79516c6239ba > Ensure spaces are used everywhere instead of tabs for indentation https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/0300a9157cc69f75e01ac9c0d6e033d8be661492 > Complement previous upstream commits to fix Shellcheck issues > > - Unify if/then and while/do on separate lines > - Fix indentation to be consistent > - Use "$()" instead of backticks for subshells > - Exit code cannot be -1, must be 0-255 > - Remove unused variables MYCHECK and MYCHECK_PARAMS > - Rewrite messy command-line database calls to an easier to read form > that does exactly the same > - Use 'command -v' test instead of 'which' > > With this commit, all of debian/* is Shellcheck clean. Also * Update mariadb.conf.d template to tell users where to create logdir if they are not using journald * Remove use of work 'slave' * Add minor workaround for Debian Bug #1022994 if TMPDIR is empty * Make start/stop in maintainer scripts correctly check mariadbd ownership and only start/stop processes owned by root or 'mysql' * Remove obsolete 'NO_UPDATE_BUILD_VERSION=1' as it did not affect the RocksDB build reproducibility as previously assumed * Run 'wrap-and-sort -av'
2023-10-08 04:42:31 +02:00
--verbose-restart --max-save-core=1 --max-save-datadir=1 \
--parallel=$(NUMJOBS) --skip-rpl --suite=main \
MDEV-33750: Sync maintainer scripts etc with latest downstream 10.11.5 in Debian Fix a large amount of minor fixes to maintainer scripts and other done downstream in the official Debian packaging. Changes include: https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/38198d0b9e1c7821ddd074e308b25034bdcdce5b > Limit check of running mysqld/mariadbd to system users (Closes: #1032047) > > If a random user has their own copy of mysqld/mariadbd running, the > dpkg maintainer script should not care about it. https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/8116354d22e0b8eade6d8f0594c57300d5d5cff5 > Make error more helpful in case server restart fails (Related: #1033234) > > Bugs such as https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1033234 > and https://bugs.launchpad.net/ubuntu/+source/mariadb-10.6/+bug/2011293 > show that currently dpkg stopping on service stop/start does not have > a very helpful error message. https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/8675e97202171812a1afdb438a17cb29a99836fb > Complement upstream commits with more complete mysql->mariadb conversion > > The upstream commit 952af4a1 missed some places where 'mysql' or > 'MySQL' can and should be converted to use 'mariadb' or 'MariaDB'. https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/c98361330063e7dccbf8d21aa20e48179ba5c1e4 > Fix indentation in Debian post and pre scripts > > There is several misindentation inside Debian post and pre > installation scripts. False indentation with space as indent space > should be 2 and indentation with tabs. > > Adopt upstream commit 7cbb45d1 in Debian by conserving customizations > in: > - debian/mariadb-server.postinst > - debian/mariadb-server.postrm > - debian/mariadb-server.preinst https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/d0bcab443fa6d44084dc674ba29b79516c6239ba > Ensure spaces are used everywhere instead of tabs for indentation https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/0300a9157cc69f75e01ac9c0d6e033d8be661492 > Complement previous upstream commits to fix Shellcheck issues > > - Unify if/then and while/do on separate lines > - Fix indentation to be consistent > - Use "$()" instead of backticks for subshells > - Exit code cannot be -1, must be 0-255 > - Remove unused variables MYCHECK and MYCHECK_PARAMS > - Rewrite messy command-line database calls to an easier to read form > that does exactly the same > - Use 'command -v' test instead of 'which' > > With this commit, all of debian/* is Shellcheck clean. Also * Update mariadb.conf.d template to tell users where to create logdir if they are not using journald * Remove use of work 'slave' * Add minor workaround for Debian Bug #1022994 if TMPDIR is empty * Make start/stop in maintainer scripts correctly check mariadbd ownership and only start/stop processes owned by root or 'mysql' * Remove obsolete 'NO_UPDATE_BUILD_VERSION=1' as it did not affect the RocksDB build reproducibility as previously assumed * Run 'wrap-and-sort -av'
2023-10-08 04:42:31 +02:00
--skip-test-list=$(MTR_SKIP_TEST_LIST)
# Don't use --mem here as official Debian builders and most Docker systems don't have a large mem device available and
# would fail with errors on lack of disk space.
endif
override_dh_auto_install:
@echo "RULES.$@"
dh_testdir
dh_testroot
# Run 'make install' without output since it is uninteresting and
# silencing it helps to make overall build log shorter and more readable
@echo "Running $(MAKE) install DESTDIR=$(TMP) ..."
cd $(BUILDDIR) && $(MAKE) install DESTDIR=$(TMP) > /dev/null
# If mariadb-test package is removed, also remove most of it's files
grep --quiet "Package: mariadb-test" debian/control || rm -rf $(TMP)/usr/share/mariadb/mariadb-test
# Delete private files from libraries so they don't get shipped in the -dev packages
rm -r $(TMP)/usr/include/mariadb/server/private
# Don't ship sql-bench at all, just delete it completely even though it builds
rm -r $(TMP)/usr/sql-bench
# nm numeric soft is not enough, therefore extra sort in command
# to satisfy Debian reproducible build requirements
mkdir -p $(TMP)/usr/share/doc/mariadb-server
nm --defined-only $(BUILDDIR)/sql/mariadbd | LC_ALL=C sort | gzip -n -9 > $(TMP)/usr/share/doc/mariadb-server/mariadbd.sym.gz
# Rename and install AppArmor profile
install -D -m 644 debian/apparmor-profile $(TMP)/etc/apparmor.d/usr.sbin.mariadbd
# Install libmariadbclient18 compatibility links
ln -s libmariadb.so.3 $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmariadbclient.so
ln -s libmariadb.so.3 $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmariadbclient.so.18
# Install libmysqlclientclientXX compatibility links
ln -s libmariadb.so.3 $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmysqlclient.so.18
ln -s libmariadb.so.3 $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmysqlclient.so.19
ln -s libmariadb.so.3 $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmysqlclient.so.20
# Install libmariadbclient.a compatibility link
ln -s libmariadb.a $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmariadbclient.a
# Symlink plugins that are used by both server and client and thus need to
# load from the libmariadb path as well
ln -s ../../../mysql/plugin/auth_test_plugin.so $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmariadb3/plugin/auth_test_plugin.so
ln -s ../../../mysql/plugin/qa_auth_interface.so $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmariadb3/plugin/qa_auth_interface.so
ln -s ../../../mysql/plugin/test_sql_service.so $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmariadb3/plugin/test_sql_service.so
# Move test plugins that are only needed by the client to the libmariadb path
mv -v $(TMP)/usr/lib/mysql/plugin/qa_auth_client.so $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmariadb3/plugin/
override_dh_installsystemd:
dh_installsystemd -pmariadb-server mariadb.service
MDEV-33750: Sync maintainer scripts etc with latest downstream 10.11.5 in Debian Fix a large amount of minor fixes to maintainer scripts and other done downstream in the official Debian packaging. Changes include: https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/38198d0b9e1c7821ddd074e308b25034bdcdce5b > Limit check of running mysqld/mariadbd to system users (Closes: #1032047) > > If a random user has their own copy of mysqld/mariadbd running, the > dpkg maintainer script should not care about it. https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/8116354d22e0b8eade6d8f0594c57300d5d5cff5 > Make error more helpful in case server restart fails (Related: #1033234) > > Bugs such as https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1033234 > and https://bugs.launchpad.net/ubuntu/+source/mariadb-10.6/+bug/2011293 > show that currently dpkg stopping on service stop/start does not have > a very helpful error message. https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/8675e97202171812a1afdb438a17cb29a99836fb > Complement upstream commits with more complete mysql->mariadb conversion > > The upstream commit 952af4a1 missed some places where 'mysql' or > 'MySQL' can and should be converted to use 'mariadb' or 'MariaDB'. https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/c98361330063e7dccbf8d21aa20e48179ba5c1e4 > Fix indentation in Debian post and pre scripts > > There is several misindentation inside Debian post and pre > installation scripts. False indentation with space as indent space > should be 2 and indentation with tabs. > > Adopt upstream commit 7cbb45d1 in Debian by conserving customizations > in: > - debian/mariadb-server.postinst > - debian/mariadb-server.postrm > - debian/mariadb-server.preinst https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/d0bcab443fa6d44084dc674ba29b79516c6239ba > Ensure spaces are used everywhere instead of tabs for indentation https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/0300a9157cc69f75e01ac9c0d6e033d8be661492 > Complement previous upstream commits to fix Shellcheck issues > > - Unify if/then and while/do on separate lines > - Fix indentation to be consistent > - Use "$()" instead of backticks for subshells > - Exit code cannot be -1, must be 0-255 > - Remove unused variables MYCHECK and MYCHECK_PARAMS > - Rewrite messy command-line database calls to an easier to read form > that does exactly the same > - Use 'command -v' test instead of 'which' > > With this commit, all of debian/* is Shellcheck clean. Also * Update mariadb.conf.d template to tell users where to create logdir if they are not using journald * Remove use of work 'slave' * Add minor workaround for Debian Bug #1022994 if TMPDIR is empty * Make start/stop in maintainer scripts correctly check mariadbd ownership and only start/stop processes owned by root or 'mysql' * Remove obsolete 'NO_UPDATE_BUILD_VERSION=1' as it did not affect the RocksDB build reproducibility as previously assumed * Run 'wrap-and-sort -av'
2023-10-08 04:42:31 +02:00
# Start mariadbd at sequence number 19 before 20 where apache, proftpd etc gets
# started which might depend on a running database server.
override_dh_installinit-arch:
dh_installinit --name=mariadb -- defaults 19 21
Misc Debian/Salsa-CI fixes (#2299) * Deb: Handle codename 'n/a' from Debian Sid properly and autobake-deb cleanup This fixes autobake-deb.sh builds on Sid which was visible as 4 failing build steps on Salsa-CI. - In Sid the LSBNAME might evaluate to 'n/a', so accept it as 'Sid' to fix builds that failed with error: Error - unknown release codename n/a - Refactor list to have Ubuntu versions first, then Debian, and as last the special case of Debian Sid - Fix minor syntax issues detected by Shellcheck Also remove useless DEB_HOST_ARCH_CPU check from debian/rules: * It was never in effect as the 'sed' in autobake-deb.sh cleared it anyway * The variable name was wrong and always empty * If variable would have been correct, logic was still reversed - Define 3h timeout as the default 1h timeout on Gitlab.com (and others) is usually not enough for initial (uncached) MariaDB builds. - Replace Buster to Bookworm/Sid upgrade testing with upgrade inside Buster testing as direct upgrades from Stretch to Bullseye and Buster to Bookworm are no longer possible due to: Bug#993755: libcrypt.so.1: cannot open shared object file when upgrading from Stretch to Sid (https://bugs.debian.org/993755) - Stop ignoring MariaDB.org 10.6 to this version upgrade testing failures to reveal bug MDEV-28640. Originally this step was failing as the uring dependencies in upstream builders lagged behind and there was nothing that needed work, only time time to resolve. Now there is an actual bug in packaging that should be visible as a CI failure. - Stop testing for 'service mysql status' on systems that upgraded from MySQL 8.0 to MariaDB.org vended 10.6. Due to some unidentified debian/control changes in 10.6 on upstream the upgrade is no longer compatible in a way that would maintain the init.d script with name 'mysql'. - Fix typos where mergers had changed occurrences of 10.5 to 10.6 while they intentionally need to be exactly 10.5, otherwise the meaning changes. - Align autopkgtest code with downstream official Debian packaging one. This is change is safe on a stable branch because is only affects builds and testing, not any actual usage of MariaDB 10.6. - Standardize on using capitalized 'YES' in CMake build options (instead of 'yes' or mixed case) - Add some comments to better document debian/rules - Fix typo in Lintian overrides Ubuntu bug: https://bugs.launchpad.net/ubuntu/+source/mariadb-10.6/+bug/1970634 MariaDB ticket: https://jira.mariadb.org/browse/MDEV-25633 When built with LTO on Ubuntu, MariaDB does not catch an exception when the uring initialization fails due to a low RLIMIT_MEMLOCK value. This commit amends the commit 0609b345554f9a148e165c497aadbe368e0900aa to be identical to the one done downstream in Debian: https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/8d20ca979cf422d3a507283b86c2547d78559179 This way both the inline comments and 'git blame' for this section will show properly why this is needed, and the fix is one that is fully tested on Debian and Ubuntu. Also having this section fully identical in upstream MariaDB and downstream Debian will make the packaging maintenance easier as 'diff` runs on this file will not flag this as a difference anymore. In MDEV-28640 the init script failed to stop/start the MariaDB server due to missing mysqladmin on the system. This was however very hard to spot from the console output. Add an explicit check for the binary the script depends on, and fail verbosely if the dependency is missing.
2022-11-11 08:51:34 +01:00
# Use custom server version string variable
override_dh_gencontrol:
dh_gencontrol -- -Tdebian/substvars
# If a file is not supposed to be included anywhere, add it to the not-installed
# file and document the reason. Note that dh_install supports the above mentioned
# white list file only starting from Debian Stretch and Ubuntu Xenial.
# To find more, grep build logs for 'but is not installed to anywhere'.
%:
dh $@ --parallel --fail-missing
# vim: ts=8