Commit 7a0eeaaf authored by Otto Kekäläinen's avatar Otto Kekäläinen Committed by Vicențiu-Marian Ciorbaru

MDEV-6284: Sync deb build rules etc with downstream

- Ensure cmake builds also apply CPPFLAGS flags for hardening to fully work
  https://salsa.debian.org/mariadb-team/mariadb-10.4/-/commit/fc4f33cf40d0a10ef5d1992accd2af734ba96356
- Install Ubuntu Apport files in the same way with same filename.
- MDEV-21705: Build flags to keep WolfSSL from crashing
- Clean away sql-bench from packaging immediately after build step.
- Delete private files from libraries so they don't get shipped in the -dev
  packages.
parent bc11f392
......@@ -4,6 +4,7 @@
Author: Mathias Gug <mathias.gug@canonical.com>
'''
from __future__ import print_function, unicode_literals
import os, os.path
from apport.hookutils import *
......@@ -29,24 +30,25 @@ def add_info(report):
report[key] += line + '\n'
except IndexError:
continue
key = 'Logs' + path_to_key('/var/log/kern.log')
report[key] = ""
for line in read_file('/var/log/kern.log').split('\n'):
try:
if '/usr/sbin/mysqld' in string.join(line.split()[4:]):
report[key] += line + '\n'
except IndexError:
continue
_add_my_conf_files(report, '/etc/mysql/my.cnf')
if os.path.exists('/var/log/mysql/error.log'):
key = 'Logs' + path_to_key('/var/log/mysql/error.log')
report[key] = ""
for line in read_file('/var/log/mysql/error.log').split('\n'):
report[key] += line + '\n'
attach_mac_events(report, '/usr/sbin/mysqld')
attach_file(report,'/etc/apparmor.d/usr.sbin.mysqld')
_add_my_conf_files(report, '/etc/mysql/mariadb.cnf')
for f in os.listdir('/etc/mysql/conf.d'):
_add_my_conf_files(report, os.path.join('/etc/mysql/conf.d', f))
for f in os.listdir('/etc/mysql/mariadb.conf.d'):
_add_my_conf_files(report, os.path.join('/etc/mysql/mariadb.conf.d', f))
try:
report['MySQLVarLibDirListing'] = unicode(os.listdir('/var/lib/mysql'))
report['MySQLVarLibDirListing'] = str(os.listdir('/var/lib/mysql'))
except OSError:
report['MySQLVarLibDirListing'] = unicode(False)
report['MySQLVarLibDirListing'] = str(False)
if __name__ == '__main__':
report = {}
add_info(report)
for key in report:
print '%s: %s' % (key, report[key].split('\n', 1)[0])
print('%s: %s' % (key, report[key].split('\n', 1)[0]))
......@@ -3,6 +3,7 @@ debian/additions/debian-start.inc.sh usr/share/mysql
debian/additions/echo_stderr usr/share/mysql
debian/additions/mysql.init usr/share/mysql
debian/additions/mysqld_safe_syslog.cnf etc/mysql/conf.d
debian/additions/source_mariadb-10.5.py usr/share/apport/package-hooks
etc/apparmor.d/usr.sbin.mysqld
etc/security/user_map.conf
lib/*/security/pam_user_map.so
......@@ -58,7 +59,6 @@ usr/lib/mysql/plugin/server_audit.so
usr/lib/mysql/plugin/simple_password_check.so
usr/lib/mysql/plugin/sql_errlog.so
usr/lib/mysql/plugin/wsrep_info.so
usr/share/apport/package-hooks/source_mariadb-10.5.py
usr/share/doc/mariadb-server-10.5/mysqld.sym.gz
usr/share/man/man1/aria_chk.1
usr/share/man/man1/aria_dump_log.1
......
......@@ -43,86 +43,3 @@ usr/share/mysql/systemd/mariadb.service # Installed by rules file
usr/share/mysql/systemd/mariadb@.service # Installed by rules file
usr/share/mysql/systemd/use_galera_new_cluster.conf
usr/share/mysql/wsrep.cnf
usr/sql-bench/bench-count-distinct
usr/sql-bench/bench-init.pl # SQL-bench is distributed from a separate source package
usr/sql-bench/compare-results
usr/sql-bench/copy-db
usr/sql-bench/crash-me
usr/sql-bench/Data/ATIS/aircraft.txt
usr/sql-bench/Data/ATIS/airline.txt
usr/sql-bench/Data/ATIS/airport_service.txt
usr/sql-bench/Data/ATIS/airport.txt
usr/sql-bench/Data/ATIS/city.txt
usr/sql-bench/Data/ATIS/class_of_service.txt
usr/sql-bench/Data/ATIS/code_description.txt
usr/sql-bench/Data/ATIS/compound_class.txt
usr/sql-bench/Data/ATIS/connect_leg.txt
usr/sql-bench/Data/ATIS/date_day.txt
usr/sql-bench/Data/ATIS/day_name.txt
usr/sql-bench/Data/ATIS/dual_carrier.txt
usr/sql-bench/Data/ATIS/fare.txt
usr/sql-bench/Data/ATIS/fconnection.txt
usr/sql-bench/Data/ATIS/flight_class.txt
usr/sql-bench/Data/ATIS/flight_day.txt
usr/sql-bench/Data/ATIS/flight_fare.txt
usr/sql-bench/Data/ATIS/flight.txt
usr/sql-bench/Data/ATIS/food_service.txt
usr/sql-bench/Data/ATIS/ground_service.txt
usr/sql-bench/Data/ATIS/month_name.txt
usr/sql-bench/Data/ATIS/restrict_carrier.txt
usr/sql-bench/Data/ATIS/restrict_class.txt
usr/sql-bench/Data/ATIS/restriction.txt
usr/sql-bench/Data/ATIS/state.txt
usr/sql-bench/Data/ATIS/stop1.txt
usr/sql-bench/Data/ATIS/stop.txt
usr/sql-bench/Data/ATIS/time_interval.txt
usr/sql-bench/Data/ATIS/time_zone.txt
usr/sql-bench/Data/ATIS/transport.txt
usr/sql-bench/Data/Wisconsin/onek.data
usr/sql-bench/Data/Wisconsin/tenk.data
usr/sql-bench/graph-compare-results
usr/sql-bench/innotest1
usr/sql-bench/innotest1a
usr/sql-bench/innotest1b
usr/sql-bench/innotest2
usr/sql-bench/innotest2a
usr/sql-bench/innotest2b
usr/sql-bench/limits/access.cfg
usr/sql-bench/limits/access_odbc.cfg
usr/sql-bench/limits/Adabas.cfg
usr/sql-bench/limits/db2.cfg
usr/sql-bench/limits/empress.cfg
usr/sql-bench/limits/frontbase.cfg
usr/sql-bench/limits/Informix.cfg
usr/sql-bench/limits/interbase.cfg
usr/sql-bench/limits/interbase-dialect1.cfg
usr/sql-bench/limits/interbase-dialect3.cfg
usr/sql-bench/limits/interbase-superserver.cfg
usr/sql-bench/limits/mimer.cfg
usr/sql-bench/limits/msql.cfg
usr/sql-bench/limits/ms-sql65.cfg
usr/sql-bench/limits/ms-sql.cfg
usr/sql-bench/limits/mysql-3.22.cfg
usr/sql-bench/limits/mysql-3.23.cfg
usr/sql-bench/limits/mysql-4.0.cfg
usr/sql-bench/limits/mysql-4.1.cfg
usr/sql-bench/limits/mysql.cfg
usr/sql-bench/limits/oracle.cfg
usr/sql-bench/limits/pg.cfg
usr/sql-bench/limits/solid.cfg
usr/sql-bench/limits/solid-nt4.cfg
usr/sql-bench/limits/sybase.cfg
usr/sql-bench/myisam.cnf
usr/sql-bench/README
usr/sql-bench/run-all-tests
usr/sql-bench/server-cfg
usr/sql-bench/test-alter-table
usr/sql-bench/test-ATIS
usr/sql-bench/test-big-tables
usr/sql-bench/test-connect
usr/sql-bench/test-create
usr/sql-bench/test-insert
usr/sql-bench/test-select
usr/sql-bench/test-table-elimination
usr/sql-bench/test-transactions
usr/sql-bench/test-wisconsin
......@@ -8,6 +8,11 @@ export DEB_BUILD_HARDENING=1
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
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)
BUILDDIR := builddir
DEB_VERSION_REVISION := $(shell echo $(DEB_VERSION) | sed -e 's/^.*-//')
......@@ -28,7 +33,7 @@ else
endif
# Ignore test suite exit code on unstable platforms
ifneq (,$(filter $(DEB_HOST_ARCH),mips mipsel mips64el alpha powerpc sh4 hurd-i386 sparc64 kfreebsd-i386 kfreebsd-amd64))
ifeq ($(DEB_HOST_ARCH),$(filter $(DEB_HOST_ARCH),mips mipsel mips64el alpha powerpc sh4 hurd-i386 sparc64 kfreebsd-i386 kfreebsd-amd64))
TESTSUITE_FAIL_CMD:=true
else
TESTSUITE_FAIL_CMD:=exit 1
......@@ -45,9 +50,12 @@ ifneq ($(DEB_HOST_ARCH),amd64)
CMAKEFLAGS += -DWITHOUT_TOKUDB=true
endif
# Disable jemalloc on mips* due to #843926
ifneq (,$(filter $(DEB_HOST_ARCH), mips mipsel mips64 mips64el))
CMAKEFLAGS += -DWITH_JEMALLOC=no
# Add extra flag to avoid WolfSSL code crashing the entire mysqld on s390x. This
# can be removed once upstream has made the code s390x compatible, see
# https://jira.mariadb.org/browse/MDEV-21705 and
# https://github.com/wolfSSL/wolfssl/issues/2828
ifeq ($(DEB_HOST_ARCH),s390x)
CFLAGS += -DWC_NO_CACHE_RESISTANT
endif
# Add support for verbose builds
......@@ -57,22 +65,20 @@ override_dh_auto_clean:
@echo "RULES.$@"
dh_testdir
dh_testroot
[ ! -d mysql-test/var ] || rm -rf mysql-test/var
rm -rf $(BUILDDIR)
debconf-updatepo # Update po-files when clean runs before each build
rm -rf $(BUILDDIR) builddir-native
[ ! -f debian/mysql-test-unstable-tests.orig ] || \
mv debian/mysql-test-unstable-tests.orig mysql-test/unstable-tests
override_dh_prep:
# Don't clean /tmp/ away, it is needed by all binary packages
debconf-updatepo # Update po-files when clean runs before each build
override_dh_auto_configure:
@echo "RULES.$@"
dh_testdir
# Versioned symbols are only available on Linux.
# Remove symbols file on kFreeBSD builds so that
# dpkg-gensymbols will not fail the build.
ifneq (,$(filter $(DEB_HOST_ARCH), kfreebsd-i386 kfreebsd-amd64))
rm debian/libmariadb3.symbols
ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
dpkg-architecture -a$(DEB_BUILD_ARCH) -f -c dh_auto_configure --builddirectory=builddir-native
dh_auto_build --builddirectory=builddir-native -- import_executables
endif
mkdir -p $(BUILDDIR) && cd $(BUILDDIR) && \
......@@ -100,6 +106,7 @@ override_dh_auto_test:
@echo "RULES.$@"
dh_testdir
# Skip unstable tests if such are defined for arch
cp mysql-test/unstable-tests debian/mysql-test-unstable-tests.orig
[ ! -f debian/unstable-tests.$(DEB_HOST_ARCH) ] || cat debian/unstable-tests.$(DEB_HOST_ARCH) >> mysql-test/unstable-tests
# Run testsuite
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
......@@ -128,14 +135,15 @@ endif
# Delete private files from libraries so they don't get shipped in the -dev pacakges
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
nm --defined-only $(BUILDDIR)/sql/mysqld | LC_ALL=C sort | gzip -n -9 > $(TMP)/usr/share/doc/mariadb-server-10.5/mysqld.sym.gz
# rename and install AppArmor profile
install -D -m 644 debian/apparmor-profile $(TMP)/etc/apparmor.d/usr.sbin.mysqld
# install Apport hook
install -D -m 644 debian/mariadb-server-10.5.py $(TMP)/usr/share/apport/package-hooks/source_mariadb-10.5.py
# Install libmariadbclient18 compatibility links
ln -s libmariadb.so.3 $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmariadbclient.so
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment