You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

125 lines
4.8 KiB

  1. #!/bin/bash
  2. #
  3. # Build MariaDB .deb packages for test and release at mariadb.org
  4. #
  5. # Exit immediately on any error
  6. set -e
  7. # This file is invocated from Buildbot and Travis-CI to build deb packages.
  8. # As both of those CI systems have many parallel jobs that include different
  9. # parts of the test suite, we don't need to run the mysql-test-run at all when
  10. # building the deb packages here.
  11. export DEB_BUILD_OPTIONS="nocheck $DEB_BUILD_OPTIONS"
  12. # Travis-CI optimizations
  13. if [[ $TRAVIS ]]
  14. then
  15. # On Travis-CI, the log must stay under 4MB so make the build less verbose
  16. sed -i -e '/Add support for verbose builds/,+2d' debian/rules
  17. # Don't include test suite package on Travis-CI to make the build time shorter
  18. sed '/Package: mariadb-test-data/,+28d' -i debian/control
  19. sed '/Package: mariadb-test/,+36d' -i debian/control
  20. # Don't build the test package at all to save time and disk space
  21. sed 's|DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test|DINSTALL_MYSQLTESTDIR=false|' -i debian/rules
  22. # Also skip building RocksDB and TokuDB to save even more time and disk space
  23. sed 's|-DDEB|-DWITHOUT_TOKUDB_STORAGE_ENGINE=true -DWITHOUT_MROONGA_STORAGE_ENGINE=true -DWITHOUT_ROCKSDB_STORAGE_ENGINE=true -DDEB|' -i debian/rules
  24. fi
  25. # Look up distro-version specific stuff
  26. #
  27. # Always keep the actual packaging as up-to-date as possible following the latest
  28. # Debian policy and targeting Debian Sid. Then case-by-case run in autobake-deb.sh
  29. # tests for backwards compatibility and strip away parts on older builders.
  30. # If iproute2 is not available (before Debian Jessie and Ubuntu Trusty)
  31. # fall back to the old iproute package.
  32. if ! apt-cache madison iproute2 | grep 'iproute2 *|' >/dev/null 2>&1
  33. then
  34. sed 's/iproute2/iproute/' -i debian/control
  35. fi
  36. # If libcrack2 (>= 2.9.0) is not available (before Debian Jessie and Ubuntu Trusty)
  37. # clean away the cracklib stanzas so the package can build without them.
  38. if ! apt-cache madison libcrack2-dev | grep 'libcrack2-dev *| *2\.9' >/dev/null 2>&1
  39. then
  40. sed '/libcrack2-dev/d' -i debian/control
  41. sed '/Package: mariadb-plugin-cracklib/,+9d' -i debian/control
  42. fi
  43. # If libpcre3-dev (>= 2:8.35-3.2~) is not available (before Debian Jessie or Ubuntu Wily)
  44. # clean away the PCRE3 stanzas so the package can build without them.
  45. # Update check when version 2:8.40 or newer is available.
  46. if ! apt-cache madison libpcre3-dev | grep 'libpcre3-dev *| *2:8\.3[2-9]' >/dev/null 2>&1
  47. then
  48. sed '/libpcre3-dev/d' -i debian/control
  49. fi
  50. # If libsystemd-dev is not available (before Debian Jessie or Ubuntu Wily)
  51. # clean away the systemd stanzas so the package can build without them.
  52. if ! apt-cache madison libsystemd-dev | grep 'libsystemd-dev' >/dev/null 2>&1
  53. then
  54. sed '/dh-systemd/d' -i debian/control
  55. sed '/libsystemd-dev/d' -i debian/control
  56. sed 's/ --with systemd//' -i debian/rules
  57. sed '/systemd/d' -i debian/rules
  58. sed '/\.service/d' -i debian/rules
  59. sed '/galera_new_cluster/d' -i debian/mariadb-server-10.3.install
  60. sed '/galera_recovery/d' -i debian/mariadb-server-10.3.install
  61. sed '/mariadb-service-convert/d' -i debian/mariadb-server-10.3.install
  62. fi
  63. # Convert gcc version to numberical value. Format is Mmmpp where M is Major
  64. # version, mm is minor version and p is patch.
  65. GCCVERSION=$(gcc -dumpversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9]\)/0\1/g' -e 's/^[0-9]\{3,4\}$/&00/')
  66. # Don't build rocksdb package if gcc version is less than 4.8 or we are running on
  67. # x86 32 bit.
  68. if [[ $GCCVERSION -lt 40800 ]] || [[ $(arch) =~ i[346]86 ]] || [[ $TRAVIS ]]
  69. then
  70. sed '/Package: mariadb-plugin-rocksdb/,+13d' -i debian/control
  71. fi
  72. if [[ $GCCVERSION -lt 40800 ]] || [[ $TRAVIS ]]
  73. then
  74. sed '/Package: mariadb-plugin-aws-key-management-10.3/,+15d' -i debian/control
  75. fi
  76. # Adjust changelog, add new version
  77. echo "Incrementing changelog and starting build scripts"
  78. # Find major.minor version
  79. source ./VERSION
  80. UPSTREAM="${MYSQL_VERSION_MAJOR}.${MYSQL_VERSION_MINOR}.${MYSQL_VERSION_PATCH}${MYSQL_VERSION_EXTRA}"
  81. PATCHLEVEL="+maria"
  82. LOGSTRING="MariaDB build"
  83. CODENAME="$(lsb_release -sc)"
  84. dch -b -D ${CODENAME} -v "${UPSTREAM}${PATCHLEVEL}~${CODENAME}" "Automatic build with ${LOGSTRING}."
  85. echo "Creating package version ${UPSTREAM}${PATCHLEVEL}~${CODENAME} ... "
  86. # Build the package
  87. # Pass -I so that .git and other unnecessary temporary and source control files
  88. # will be ignored by dpkg-source when creating the tar.gz source package.
  89. # Use -b to build binary only packages as there is no need to waste time on
  90. # generating the source package.
  91. fakeroot dpkg-buildpackage -us -uc -I -b
  92. # Don't log package contents on Travis-CI to save time and log size
  93. if [[ ! $TRAVIS ]]
  94. then
  95. echo "List package contents ..."
  96. cd ..
  97. for package in `ls *.deb`
  98. do
  99. echo $package | cut -d '_' -f 1
  100. dpkg-deb -c $package | awk '{print $1 " " $2 " " $6}' | sort -k 3
  101. echo "------------------------------------------------"
  102. done
  103. fi
  104. echo "Build complete"