Commit f2fde3f6 authored by Tuukka Pasanen's avatar Tuukka Pasanen Committed by Daniel Black

MDEV-30687: Make small facelifting to autobake-debs.sh

Currently autobake-debs.sh does not pass shellcheck
it fails making errors:

 * SC1091 when using shellcheck -x it needs to know where to
   find ./VERSION. As this is not needed we just specify it
   as /dev/null as mentioned in shellcheck documentation:
   https://www.shellcheck.net/wiki/SC1091

 * SC2086 make sure that there is no globbing or word splitting
   in dpkg-buidpackage string. This not big problem or about to happen
   but now extra parameter parsing is more Bash compliant with
   using array.
   Change BUILDPACKAGE_PREPEND to BUILDPACKAGE_DPKGCMD which holds
   'eatmydata' if it's available and needed 'dpkg-buildpackage'
   https://www.shellcheck.net/wiki/SC2086

Fix small script indentation problem.
parent 1e4eef5c
...@@ -16,6 +16,7 @@ set -e ...@@ -16,6 +16,7 @@ set -e
# Buildbot, running the test suite from installed .debs on a clean VM. # Buildbot, running the test suite from installed .debs on a clean VM.
export DEB_BUILD_OPTIONS="nocheck $DEB_BUILD_OPTIONS" export DEB_BUILD_OPTIONS="nocheck $DEB_BUILD_OPTIONS"
# shellcheck source=/dev/null
source ./VERSION source ./VERSION
# General CI optimizations to keep build output smaller # General CI optimizations to keep build output smaller
if [[ $GITLAB_CI ]] if [[ $GITLAB_CI ]]
...@@ -91,20 +92,20 @@ fi ...@@ -91,20 +92,20 @@ fi
# If not known, use 'unknown' in .deb version identifier # If not known, use 'unknown' in .deb version identifier
if [ -z "${LSBID}" ] if [ -z "${LSBID}" ]
then then
LSBID="unknown" LSBID="unknown"
fi fi
case "${LSBNAME}" case "${LSBNAME}"
in in
# Debian # Debian
buster) "buster")
replace_uring_with_aio replace_uring_with_aio
if [ ! "$architecture" = amd64 ] if [ ! "$architecture" = amd64 ]
then then
disable_pmem disable_pmem
fi fi
;& ;&
bullseye|bookworm) "bullseye"|"bookworm")
# mariadb-plugin-rocksdb in control is 4 arches covered by the distro rocksdb-tools # mariadb-plugin-rocksdb in control is 4 arches covered by the distro rocksdb-tools
# so no removal is necessary. # so no removal is necessary.
if [[ ! "$architecture" =~ amd64|arm64|ppc64el ]] if [[ ! "$architecture" =~ amd64|arm64|ppc64el ]]
...@@ -116,19 +117,19 @@ in ...@@ -116,19 +117,19 @@ in
replace_uring_with_aio replace_uring_with_aio
fi fi
;& ;&
sid) "sid")
# The default packaging should always target Debian Sid, so in this case # The default packaging should always target Debian Sid, so in this case
# there is intentionally no customizations whatsoever. # there is intentionally no customizations whatsoever.
;; ;;
# Ubuntu # Ubuntu
bionic) "bionic")
remove_rocksdb_tools remove_rocksdb_tools
[ "$architecture" != amd64 ] && disable_pmem [ "$architecture" != amd64 ] && disable_pmem
;& ;&
focal) "focal")
replace_uring_with_aio replace_uring_with_aio
;& ;&
impish|jammy|kinetic) "impish"|"jammy"|"kinetic")
# mariadb-plugin-rocksdb s390x not supported by us (yet) # mariadb-plugin-rocksdb s390x not supported by us (yet)
# ubuntu doesn't support mips64el yet, so keep this just # ubuntu doesn't support mips64el yet, so keep this just
# in case something changes. # in case something changes.
...@@ -169,17 +170,34 @@ dch -b -D "${LSBNAME}" -v "${VERSION}" "Automatic build with ${LOGSTRING}." --co ...@@ -169,17 +170,34 @@ dch -b -D "${LSBNAME}" -v "${VERSION}" "Automatic build with ${LOGSTRING}." --co
echo "Creating package version ${VERSION} ... " echo "Creating package version ${VERSION} ... "
BUILDPACKAGE_DPKGCMD=""
# Use eatmydata is available to build faster with less I/O, skipping fsync() # 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) # during the entire build process (safe because a build can always be restarted)
if which eatmydata > /dev/null if which eatmydata > /dev/null
then then
BUILDPACKAGE_PREPEND=eatmydata BUILDPACKAGE_DPKGCMD="eatmydata"
fi
BUILDPACKAGE_DPKGCMD+="dpkg-buildpackage"
# Using dpkg-buildpackage args
# -us Allow unsigned sources
# -uc Allow unsigned changes
# -I Tar ignore
BUILDPACKAGE_DPKG_ARGS=(-us -uc -I)
# There can be also extra flags that are appended to args
if [ -n "$BUILDPACKAGE_FLAGS" ]
then
read -ra BUILDPACKAGE_TMP_ARGS <<< "$BUILDPACKAGE_FLAGS"
BUILDPACKAGE_DPKG_ARGS=("${BUILDPACKAGE_DPKG_ARGS[@]} ${BUILDPACKAGE_TMP_ARGS[@]}")
fi fi
# Build the package # Build the package
# Pass -I so that .git and other unnecessary temporary and source control files # 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. # will be ignored by dpkg-source when creating the tar.gz source package.
fakeroot $BUILDPACKAGE_PREPEND dpkg-buildpackage -us -uc -I $BUILDPACKAGE_FLAGS fakeroot -- "${BUILDPACKAGE_DPKGCMD}" "${BUILDPACKAGE_DPKG_ARGS[@]}"
# If the step above fails due to missing dependencies, you can manually run # If the step above fails due to missing dependencies, you can manually run
# sudo mk-build-deps debian/control -r -i # sudo mk-build-deps debian/control -r -i
......
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