mariadb/debian/autobake-deb.sh

143 lines
4.5 KiB
Bash
Raw Normal View History

#!/bin/bash
#
# Build MariaDB .deb packages for test and release at mariadb.org
#
# Purpose of this script:
# Always keep the actual packaging as up-to-date as possible following the latest
# Debian policy and targeting Debian Sid. Then case-by-case run in autobake-deb.sh
# tests for backwards compatibility and strip away parts on older builders or
# specific build environments.
# Exit immediately on any error
set -e
# On Buildbot, don't run the mysql-test-run test suite as part of build.
# It takes a lot of time, and we will do a better test anyway in
# Buildbot, running the test suite from installed .debs on a clean VM.
export DEB_BUILD_OPTIONS="nocheck $DEB_BUILD_OPTIONS"
source ./VERSION
# General CI optimizations to keep build output smaller
2022-03-16 17:51:49 +11:00
if [[ $GITLAB_CI ]]
then
2022-03-16 17:51:49 +11:00
# On Gitlab the output log must stay under 4MB so make the
# build less verbose
sed '/Add support for verbose builds/,/^$/d' -i debian/rules
deb: columnstore not 32bit (fix stretch) This corrects the autobake on Stretch Caused by commit 0268b8712288d46fbd8a43fdef6bada399b68dff and commit 3d16e0e16c649505f06b39b7f7e800494ba0fef9. For very strange reasons (still a mistery) the above commits caused the federatedx, archive and blackhole plugins to be missing in the install location even though they where built in the build log. This only occured on Stretch and not recent Ubuntu and Debian distros. The stretch autobake output contained: dh_install: Cannot find (any matches for) "usr/lib/mysql/plugin/ha_archive.so" (tried in "." and "debian/tmp") dh_install: mariadb-server-10.5 missing files: usr/lib/mysql/plugin/ha_archive.so dh_install: Cannot find (any matches for) "usr/lib/mysql/plugin/ha_blackhole.so" (tried in "." and "debian/tmp") dh_install: mariadb-server-10.5 missing files: usr/lib/mysql/plugin/ha_blackhole.so dh_install: Cannot find (any matches for) "usr/lib/mysql/plugin/ha_federatedx.so" (tried in "." and "debian/tmp") dh_install: mariadb-server-10.5 missing files: usr/lib/mysql/plugin/ha_federatedx.sodh_install: Cannot find (any matches for) "usr/lib/mysql/plugin/ha_archive.so" (tried in "." and "debian/tmp") dh_install: mariadb-server-10.5 missing files: usr/lib/mysql/plugin/ha_archive.so dh_install: Cannot find (any matches for) "usr/lib/mysql/plugin/ha_blackhole.so" (tried in "." and "debian/tmp") dh_install: mariadb-server-10.5 missing files: usr/lib/mysql/plugin/ha_blackhole.so dh_install: Cannot find (any matches for) "usr/lib/mysql/plugin/ha_federatedx.so" (tried in "." and "debian/tmp") dh_install: mariadb-server-10.5 missing files: usr/lib/mysql/plugin/ha_federatedx.so
2021-08-20 10:36:38 +10:00
elif [ -d storage/columnstore/columnstore/debian ]
then
# ColumnStore is explicitly disabled in the native Debian build, so allow it
# now when build is triggered by autobake-deb.sh (MariaDB.org) and when the
# build is not running on Travis or Gitlab-CI
sed '/-DPLUGIN_COLUMNSTORE=NO/d' -i debian/rules
# Take the files and part of control from MCS directory
if [ ! -f debian/mariadb-plugin-columnstore.install ]
then
cp -v storage/columnstore/columnstore/debian/mariadb-plugin-columnstore.* debian/
echo >> debian/control
cat storage/columnstore/columnstore/debian/control >> debian/control
fi
fi
# Look up distro-version specific stuff
#
# Always keep the actual packaging as up-to-date as possible following the latest
# Debian policy and targeting Debian Sid. Then case-by-case run in autobake-deb.sh
# tests for backwards compatibility and strip away parts on older builders.
2022-03-16 17:51:49 +11:00
remove_rocksdb_tools()
{
sed '/rocksdb-tools/d' -i debian/control
sed '/sst_dump/d' -i debian/not-installed
2022-03-16 17:51:49 +11:00
if ! grep -q sst_dump debian/mariadb-plugin-rocksdb.install
then
echo "usr/bin/sst_dump" >> debian/mariadb-plugin-rocksdb.install
fi
}
architecture=$(dpkg-architecture -q DEB_BUILD_ARCH)
LSBID="$(lsb_release -si | tr '[:upper:]' '[:lower:]')"
LSBVERSION="$(lsb_release -sr | sed -e "s#\.##g")"
LSBNAME="$(lsb_release -sc)"
if [ -z "${LSBID}" ]
then
LSBID="unknown"
fi
case "${LSBNAME}" in
buster)
;&
bullseye|bookworm)
# mariadb-plugin-rocksdb in control is 4 arches covered by the distro rocksdb-tools
# so no removal is necessary.
;&
sid)
# should always be empty here.
# need to match here to avoid the default Error however
;;
# UBUNTU
focal)
;&
2022-09-07 19:58:55 +10:00
impish|jammy|kinetic)
# mariadb-plugin-rocksdb s390x not supported by us (yet)
# ubuntu doesn't support mips64el yet, so keep this just
# in case something changes.
if [[ ! "$architecture" =~ amd64|arm64|ppc64el|s390x ]]
then
remove_rocksdb_tools
fi
;;
*)
2022-06-27 10:51:20 +03:00
echo "Error - unknown release codename $LSBNAME" >&2
exit 1
esac
if [ -n "${AUTOBAKE_PREP_CONTROL_RULES_ONLY:-}" ]
then
exit 0
fi
# Adjust changelog, add new version
echo "Incrementing changelog and starting build scripts"
# Find major.minor version
UPSTREAM="${MYSQL_VERSION_MAJOR}.${MYSQL_VERSION_MINOR}.${MYSQL_VERSION_PATCH}${MYSQL_VERSION_EXTRA}"
PATCHLEVEL="+maria"
LOGSTRING="MariaDB build"
2018-05-22 11:47:09 +02:00
EPOCH="1:"
VERSION="${EPOCH}${UPSTREAM}${PATCHLEVEL}~${LSBID:0:3}${LSBVERSION}"
2022-06-27 10:51:20 +03:00
dch -b -D ${LSBNAME} -v "${VERSION}" "Automatic build with ${LOGSTRING}." --controlmaint
echo "Creating package version ${VERSION} ... "
# Use eatmydata is available to build faster with less I/O, skipping fsync()
# during the entire build process (safe because a build can always be restarted)
if which eatmydata > /dev/null
then
BUILDPACKAGE_PREPEND=eatmydata
fi
# Build the package
# Pass -I so that .git and other unnecessary temporary and source control files
# will be ignored by dpkg-source when creating the tar.gz source package.
fakeroot $BUILDPACKAGE_PREPEND dpkg-buildpackage -us -uc -I $BUILDPACKAGE_FLAGS
# If the step above fails due to missing dependencies, you can manually run
# sudo mk-build-deps debian/control -r -i
2022-03-16 17:51:49 +11:00
# Don't log package contents on Gitlab-CI to save time and log size
if [[ ! $GITLAB_CI ]]
then
echo "List package contents ..."
cd ..
for package in *.deb
do
echo "$package" | cut -d '_' -f 1
dpkg-deb -c "$package" | awk '{print $1 " " $2 " " $6 " " $7 " " $8}' | sort -k 3
echo "------------------------------------------------"
done
fi
echo "Build complete"