Skip to content

Commit

Permalink
Merge pull request #251 from ottok/ok-debpkg-10.2
Browse files Browse the repository at this point in the history
MDEV-6284 - Partially merge downstream Debian/Ubuntu packaging into upstream MariaDB
  • Loading branch information
ottok committed Nov 1, 2016
2 parents 71e11bc + c912d05 commit 23cb94f
Show file tree
Hide file tree
Showing 90 changed files with 1,977 additions and 1,767 deletions.
6 changes: 0 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -435,12 +435,6 @@ CONFIGURE_FILE(
${CMAKE_SOURCE_DIR}/cmake/info_macros.cmake.in
${CMAKE_BINARY_DIR}/info_macros.cmake @ONLY)

IF(DEB)
CONFIGURE_FILE(
${CMAKE_SOURCE_DIR}/debian/mariadb-server-10.2.files.in
${CMAKE_SOURCE_DIR}/debian/mariadb-server-10.2.files)
ENDIF(DEB)

# Handle the "INFO_*" files.
INCLUDE(${CMAKE_BINARY_DIR}/info_macros.cmake)
# Source: This can be done during the cmake phase, all information is
Expand Down
6 changes: 0 additions & 6 deletions cmake/systemd.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,6 @@ MACRO(CHECK_SYSTEMD)
AND HAVE_SYSTEMD_SD_NOTIFY AND HAVE_SYSTEMD_SD_NOTIFYF)
ADD_DEFINITIONS(-DHAVE_SYSTEMD)
SET(SYSTEMD_SCRIPTS mariadb-service-convert galera_new_cluster galera_recovery)
SET(SYSTEMD_DEB_FILES "usr/bin/mariadb-service-convert
usr/bin/galera_new_cluster
usr/bin/galera_recovery
${INSTALL_SYSTEMD_UNITDIR}/mariadb.service
${INSTALL_SYSTEMD_UNITDIR}/mariadb@.service
${INSTALL_SYSTEMD_UNITDIR}/mariadb@bootstrap.service.d/use_galera_new_cluster.conf")
IF(DEB)
SET(SYSTEMD_EXECSTARTPRE "ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld")
SET(SYSTEMD_EXECSTARTPOST "ExecStartPost=/etc/mysql/debian-start")
Expand Down
13 changes: 9 additions & 4 deletions debian/additions/debian-start
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,27 +1,32 @@
#!/bin/bash
#
# This script is executed by "/etc/init.d/mysql" on every (re)start.
#
#
# Changes to this file will be preserved when updating the Debian package.
#

source /usr/share/mysql/debian-start.inc.sh

if [ -f /etc/default/mysql ]; then
. /etc/default/mysql
fi

MYSQL="/usr/bin/mysql --defaults-file=/etc/mysql/debian.cnf"
MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"
MYUPGRADE="/usr/bin/mysql_upgrade --defaults-extra-file=/etc/mysql/debian.cnf"
MYCHECK="/usr/bin/mysqlcheck --defaults-file=/etc/mysql/debian.cnf"
MYCHECK_SUBJECT="WARNING: mysqlcheck has found corrupt tables"
MYCHECK_PARAMS="--all-databases --fast --silent"
MYCHECK_RCPT="root"
MYCHECK_RCPT="${MYCHECK_RCPT:-root}"

## Checking for corrupt, not cleanly closed (only for MyISAM and Aria engines) and upgrade needing tables.

# The following commands should be run when the server is up but in background
# where they do not block the server start and in one shell instance so that
# they run sequentially. They are supposed not to echo anything to stdout.
# If you want to disable the check for crashed tables comment
# "check_for_crashed_tables" out.
# "check_for_crashed_tables" out.
# (There may be no output to stdout inside the background process!)
echo "Checking for corrupt, not cleanly closed and upgrade needing tables."

# Need to ignore SIGHUP, as otherwise a SIGHUP can sometimes abort the upgrade
# process in the middle.
Expand Down
21 changes: 14 additions & 7 deletions debian/additions/debian-start.inc.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,35 @@
# This file is included by /etc/mysql/debian-start
#

## Check all unclosed tables.
## Check MyISAM and Aria unclosed tables.
# - Requires the server to be up.
# - Is supposed to run silently in background.
function check_for_crashed_tables() {
set -e
set -u

# But do it in the background to not stall the boot process.
logger -p daemon.info -i -t$0 "Triggering myisam-recover for all MyISAM tables"
logger -p daemon.info -i -t$0 "Triggering myisam-recover for all MyISAM tables and aria-recover for all Aria tables"

# Checking for $? is unreliable so the size of the output is checked.
# Some table handlers like HEAP do not support CHECK TABLE.
tempfile=`tempfile`
# We have to use xargs in this case, because a for loop barfs on the
# spaces in the thing to be looped over.

# We have to use xargs in this case, because a for loop barfs on the
# spaces in the thing to be looped over.

# If a crashed table is encountered, the "mysql" command will return with a status different from 0
set +e

LC_ALL=C $MYSQL --skip-column-names --batch -e '
select concat('\''select count(*) into @discard from `'\'',
TABLE_SCHEMA, '\''`.`'\'', TABLE_NAME, '\''`'\'')
from information_schema.TABLES where ENGINE='\''MyISAM'\' | \
from information_schema.TABLES where TABLE_SCHEMA<>'\''INFORMATION_SCHEMA'\'' and TABLE_SCHEMA<>'\''PERFORMANCE_SCHEMA'\'' and ( ENGINE='\''MyISAM'\'' or ENGINE='\''Aria'\'' )' | \
xargs -i $MYSQL --skip-column-names --silent --batch \
--force -e "{}" >$tempfile
if [ -s $tempfile ]; then
--force -e "{}" &>$tempfile
set -e

if [ -s "$tempfile" ]; then
(
/bin/echo -e "\n" \
"Improperly closed tables are also reported if clients are accessing\n" \
Expand Down
Empty file modified debian/additions/echo_stderr
100644 → 100755
Empty file.
2 changes: 2 additions & 0 deletions debian/additions/mariadb.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@
#collation-server = utf8_general_ci
#character_set_server = utf8
#collation_server = utf8_general_ci
# Import all .cnf files from configuration directory
!includedir /etc/mysql/mariadb.conf.d/
72 changes: 45 additions & 27 deletions debian/autobake-deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,62 +21,80 @@ then
export DEB_BUILD_OPTIONS="nocheck"
fi

# Don't include test suite package on Travis-CI to make the build time shorter
if [[ $TRAVIS ]]
then
sed '/Package: mariadb-test-data/,+26d' -i debian/control
sed '/Package: mariadb-test/,+34d' -i debian/control
fi

export MARIADB_OPTIONAL_DEBS=""

# Find major.minor version.
#
source ./VERSION
UPSTREAM="${MYSQL_VERSION_MAJOR}.${MYSQL_VERSION_MINOR}.${MYSQL_VERSION_PATCH}${MYSQL_VERSION_EXTRA}"
RELEASE_EXTRA=""

RELEASE_NAME=""
PATCHLEVEL="+maria"
LOGSTRING="MariaDB build"

# Look up distro-version specific stuff.
# Always keep the actual packaging as up-to-date as possible following the latest
# Debian policy and targetting Debian Sid. Then case-by-case run in autobake-deb.sh
# tests for backwards compatibility and strip away parts on older builders.

CODENAME="$(lsb_release -sc)"

# Add libcrack2 (>= 2.9.0) as a build dependency if available in the distribution
# This matches Debian Jessie, Stretch and Ubuntu Trusty, Wily, Xenial, Yakkety
# Update check when version 2.10 or newer is available.
if apt-cache madison libcrack2-dev | grep 'libcrack2-dev *| *2\.9' >/dev/null 2>&1
# If libcrack2 (>= 2.9.0) is not available (before Debian Jessie and Ubuntu Trusty)
# clean away the cracklib stanzas so the package can build without them.
if ! apt-cache madison libcrack2-dev | grep 'libcrack2-dev *| *2\.9' >/dev/null 2>&1
then
sed 's/Standards-Version/,libcrack2-dev (>= 2.9.0)\nStandards-Version/' debian/control
cat <<EOT >> debian/control
Package: mariadb-cracklib-password-check-10.2
Architecture: any
Depends: libcrack2 (>= 2.9.0),
mariadb-server-10.2,
\${misc:Depends},
\${shlibs:Depends}
Description: CrackLib Password Validation Plugin for MariaDB
This password validation plugin uses cracklib to allow only
sufficiently secure (as defined by cracklib) user passwords in MariaDB.
EOT
sed '/libcrack2-dev/d' -i debian/control
sed '/Package: mariadb-plugin-cracklib/,+10d' -i debian/control
fi

# Add libpcre3-dev (>= 2:8.35-3.2~) as a build dependency if available in the distribution
# This matches Debian Jessie, Stretch and Ubuntu Wily, Xenial, Yakkety
# If libpcre3-dev (>= 2:8.35-3.2~) is not available (before Debian Jessie or Ubuntu Wily)
# clean away the PCRE3 stanzas so the package can build without them.
# Update check when version 2:8.40 or newer is available.
if apt-cache madison libpcre3-dev | grep 'libpcre3-dev *| *2:8\.3[2-9]' >/dev/null 2>&1
if ! apt-cache madison libpcre3-dev | grep 'libpcre3-dev *| *2:8\.3[2-9]' >/dev/null 2>&1
then
sed 's/Standards-Version/,libpcre3-dev (>= 2:8.35-3.2~)\nStandards-Version/' debian/control
sed '/libpcre3-dev/d' -i debian/control
fi

# If libsystemd-dev is not available (before Debian Jessie or Ubuntu Wily)
# clean away the systemd stanzas so the package can build without them.
if ! apt-cache madison libsystemd-dev | grep 'libsystemd-dev' >/dev/null 2>&1
then
sed '/dh-systemd/d' -i debian/control
sed '/libsystemd-dev/d' -i debian/control
sed 's/ --with systemd//' -i debian/rules
sed '/systemd/d' -i debian/rules
sed '/\.service/d' -i debian/rules
sed '/galera_new_cluster/d' -i debian/mariadb-server-10.2.install
sed '/galera_recovery/d' -i debian/mariadb-server-10.2.install
sed '/mariadb-service-convert/d' -i debian/mariadb-server-10.2.install
fi

# On Travis-CI, the log must stay under 4MB so make the build less verbose
if [[ $TRAVIS ]]
then
sed -i -e '/Add support for verbose builds/,+2d' debian/rules
fi


# Adjust changelog, add new version.
#
echo "Incrementing changelog and starting build scripts"

dch -b -D ${CODENAME} -v "${UPSTREAM}${PATCHLEVEL}-${RELEASE_NAME}${RELEASE_EXTRA:+-${RELEASE_EXTRA}}1~${CODENAME}" "Automatic build with ${LOGSTRING}."
dch -b -D ${CODENAME} -v "${UPSTREAM}${PATCHLEVEL}~${CODENAME}" "Automatic build with ${LOGSTRING}."

echo "Creating package version ${UPSTREAM}${PATCHLEVEL}-${RELEASE_NAME}${RELEASE_EXTRA:+-${RELEASE_EXTRA}}1~${CODENAME} ... "
echo "Creating package version ${UPSTREAM}${PATCHLEVEL}~${CODENAME} ... "

# Build the package.
# Pass -I so that .git and other unnecessary temporary and source control files
# will be ignored by dpkg-source when createing the tar.gz source package
fakeroot dpkg-buildpackage -us -uc -I
# Use -b to build binary only packages as there is no need to waste time on
# generating the source package.
fakeroot dpkg-buildpackage -us -uc -I -b

[ -e debian/autorm-file ] && rm -vf `cat debian/autorm-file`

Expand Down
2 changes: 1 addition & 1 deletion debian/compat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5
9
Loading

0 comments on commit 23cb94f

Please sign in to comment.