← Back to team overview

maria-developers team mailing list archive

Re: MariaDB Debian packaging: pending merge to upstream

 

Hi, Otto!

On May 30, Otto Kekäläinen wrote:
> Now when the rehearsal is done using simple spelling error fix
> patches, I now posted the first big merge request about my 5.5/debian
> upon the upstream 5.5 branch.
> 
> Issue at https://mariadb.atlassian.net/browse/MDEV-6284
> Merge request at
> https://code.launchpad.net/~otto/maria/maria-fix-debpkg-5.5/+merge/221576

Here's a review, lots of questions sorry.

It might be faster if you ping me on irc and we'll go through my
questions, instead of doing it by email.

Regards,
Sergei

> === added file 'debian/libmariadbclient-dev.manpages'
> --- debian/libmariadbclient-dev.manpages	1970-01-01 00:00:00 +0000
> +++ debian/libmariadbclient-dev.manpages	2014-07-24 08:02:44 +0000
> @@ -0,0 +1,1 @@
> +debian/tmp/usr/share/man/man1/mysql_config.1

Why the path here? Other install files don't do that.
An example in
https://www.debian.org/doc/manuals/maint-guide/dother.en.html#manpages
doesn't do it either.

> === modified file 'debian/compat'
> --- debian/compat	2012-01-23 11:20:16 +0000
> +++ debian/compat	2014-07-24 08:02:44 +0000
> @@ -1,1 +1,1 @@
> -5
> +9

should be 7 (we build on lucid)

> 
> === added file 'debian/mariadb-common.lintian-overrides'
> --- debian/mariadb-common.lintian-overrides	1970-01-01 00:00:00 +0000
> +++ debian/mariadb-common.lintian-overrides	2014-07-24 08:02:44 +0000
> @@ -0,0 +1,3 @@
> +mariadb-common: data.tar.xz-member-without-dpkg-pre-depends
> +# OK in newer Debian, includes support for xz
> +mariadb-common: data.tar.xz-member-without-dpkg-pre-depends

why twice?

> 
> === added file 'debian/clean'
> --- debian/clean	1970-01-01 00:00:00 +0000
> +++ debian/clean	2014-07-24 08:02:44 +0000
> @@ -0,0 +1,3 @@
> +debian/libmariadbclient18.links
> +debian/libmariadbclient-dev.links
> +debian/mysqld.sym.gz

Eh? Why do you remove *.links files?
And why do you remove mysqld.sym.gz?

> 
> === added file 'debian/gbp.conf'
> --- debian/gbp.conf	1970-01-01 00:00:00 +0000
> +++ debian/gbp.conf	2014-07-24 08:02:44 +0000
> @@ -0,0 +1,3 @@
> +[DEFAULT]
> +debian-branch = master
> +pristine-tar = True

Hmm, I'm not sure about it. We do not build from git repository,
we always build packages from a source tarball.
why would we want to support gpb?

> 
> === modified file 'debian/mariadb-client-5.5.menu'
> --- debian/mariadb-client-5.5.menu	2012-01-23 11:20:16 +0000
> +++ debian/mariadb-client-5.5.menu	2014-07-24 08:02:44 +0000
> @@ -1,3 +1,3 @@
>  # According to /usr/share/menu/ policy 1.4, not /usr/share/doc/debian-policy/
> -?package(innotop):needs="text" section="Applications/Data Management"\
> +?package(mariadb-client-5.5):needs="text" section="Applications/Data Management"\
>    title="innotop" command="/usr/bin/innotop"

Why would there be a menu with one single entry for a third-party tool innotop?
I'd expect a menu with most of the client tools. Or no menu at all.

> 
> === added file 'debian/mariadb-server-core-5.5.lintian-overrides'
> --- debian/mariadb-server-core-5.5.lintian-overrides	1970-01-01 00:00:00 +0000
> +++ debian/mariadb-server-core-5.5.lintian-overrides	2014-07-24 08:02:44 +0000
> @@ -0,0 +1,4 @@
> +# Embedded with same source OK
> +mariadb-server-core-5.5: embedded-library usr/sbin/mysqld: libmysqlclient

Hmm? Why?

> +# OK in newer Debian, includes support for xz
> +mariadb-server-core-5.5: data.tar.xz-member-without-dpkg-pre-depends
> 
> === added file 'debian/mariadb-client-core-5.5.lintian-overrides'
> --- debian/mariadb-client-core-5.5.lintian-overrides	1970-01-01 00:00:00 +0000
> +++ debian/mariadb-client-core-5.5.lintian-overrides	2014-07-24 08:02:44 +0000
> @@ -0,0 +1,5 @@
> +# these libs are OK
> +mariadb-client-core-5.5: embedded-library usr/bin/mysql: libmysqlclient
> +mariadb-client-core-5.5: embedded-library usr/bin/mysqlcheck: libmysqlclient

I'd rather not embed libmysqlclient in clients instead

> +# OK in newer Debian, includes support for xz
> +mariadb-client-core-5.5: data.tar.xz-member-without-dpkg-pre-depends
> 
> === modified file 'debian/watch'
> --- debian/watch	2012-01-23 11:20:16 +0000
> +++ debian/watch	2014-07-24 08:02:44 +0000
> @@ -1,3 +1,7 @@
>  version=3
>  opts="uversionmangle=s/-(rc|beta)/$1/" \
> -  ftp://sunsite.informatik.rwth-aachen.de/pub/mirror/www.mysql.com/Downloads/MySQL-5.1/mysql-([\d\.]*(?:-beta|-rc)?).tar.gz debian
> +   ftp://ftp.osuosl.org/pub/mariadb/mariadb-5.5.([\d\.]*(?:-beta|-rc)?)/source/mariadb-([\d\.]*(?:-beta|-rc)?).tar.gz \
> +   debian uupdate
> +
> +# Added string "-5.5." in path as MariaDB has release series 5.5 and 10.x in parallel,
> +# and we want uscan to check for updates only in the 5-series.

Why do we care about uscan at all and why do we want to have this watch
file?

> === added file 'debian/mariadb-server-5.5.dirs'
> --- debian/mariadb-server-5.5.dirs	1970-01-01 00:00:00 +0000
> +++ debian/mariadb-server-5.5.dirs	2014-07-24 08:02:44 +0000
> @@ -0,0 +1,7 @@
> +etc/init.d
> +etc/logrotate.d
> +etc/mysql/conf.d
> +usr/bin
> +usr/share/mysql
> +usr/share/doc/mariadb-server-5.5
> +var/lib/mysql-upgrade

Really? Why do you need all these directories in dirs file?
the last one is only used internally in the postinst script, it
should not leak out. Others should be created normally because
they contain files that this package installs.

> 
> === added file 'debian/libmariadbclient18.lintian-overrides'
> --- debian/libmariadbclient18.lintian-overrides	1970-01-01 00:00:00 +0000
> +++ debian/libmariadbclient18.lintian-overrides	2014-07-24 08:02:44 +0000
> @@ -0,0 +1,8 @@
> +# OK, file names don't conflict with the MySQL version
> +libmariadbclient18: arch-dependent-file-not-in-arch-specific-directory usr/lib/mysql/plugin/dialog.so
> +libmariadbclient18: arch-dependent-file-not-in-arch-specific-directory usr/lib/mysql/plugin/mysql_clear_password.so

Ok, iirc there's another MDEV to move these files to arch specific directory

> +# embedded libs are OK
> +libmariadbclient18: embedded-library usr/lib/x86_64-linux-gnu/libmysqlclient.so.18.0.0: libmysqlclient
> +libmariadbclient18: embedded-library usr/lib/i386-linux-gnu/libmysqlclient.so.18.0.0: libmysqlclient

What does that mean?

> +# OK, newer Debian should support xz
> +libmariadbclient18: data.tar.xz-member-without-dpkg-pre-depends

Why lintian doesn't complain that the package named libmariadbclient18
contains libmysqlclient18.so?

> 
> === added file 'debian/libmariadbd-dev.postinst'
> --- debian/libmariadbd-dev.postinst	1970-01-01 00:00:00 +0000
> +++ debian/libmariadbd-dev.postinst	2014-07-24 08:02:44 +0000
> @@ -0,0 +1,9 @@
> +#!/bin/bash
> +
> +set -e
> +
> +#DEBHELPER#
> +
> +ldconfig

Eh? It's dev package, it doesn't contain shared libraries.
At least it should not.

> +
> +exit 0
> 
> === added file 'debian/mariadb-test-5.5.lintian-overrides'
> --- debian/mariadb-test-5.5.lintian-overrides	1970-01-01 00:00:00 +0000
> +++ debian/mariadb-test-5.5.lintian-overrides	2014-07-24 08:02:44 +0000
> @@ -0,0 +1,9 @@
> +# in modern Debian this xz support exists, this should not matter anymore
> +mariadb-test-5.5: data.tar.xz-member-without-dpkg-pre-depends
> +# Embedded from same source is OK
> +mariadb-test-5.5: embedded-library usr/bin/mysql_client_test: libmysqlclient
> +mariadb-test-5.5: embedded-library usr/bin/mysql_client_test_embedded: libmysqlclient
> +mariadb-test-5.5: embedded-library usr/bin/mysqltest: libmysqlclient
> +mariadb-test-5.5: embedded-library usr/bin/mysqltest_embedded: libmysqlclient
> +# OK, file part of test suite
> +mariadb-test-5.5: arch-dependent-file-in-usr-share usr/share/mysql/mysql-test/lib/My/SafeProcess/my_safe_process

And where should it be installed instead?

> 
> === added file 'debian/libmariadbd-dev.lintian-overrides'
> --- debian/libmariadbd-dev.lintian-overrides	1970-01-01 00:00:00 +0000
> +++ debian/libmariadbd-dev.lintian-overrides	2014-07-24 08:02:44 +0000
> @@ -0,0 +1,11 @@
> +# These are OK for -dev package
> +libmariadbd-dev: package-name-doesnt-match-sonames libmysqld18

Why wouldn't you create libmysqld18 package?

> +# OK to have embedded from same source
> +libmariadbd-dev: embedded-library usr/lib/x86_64-linux-gnu/libmysqld.so.18: libmysqlclient
> +libmariadbd-dev: embedded-library usr/lib/i386-linux-gnu/libmysqld.so.18: libmysqlclient
> +# OK, newer Debian should support xz
> +libmariadbd-dev: data.tar.xz-member-without-dpkg-pre-depends
> +# OK, this is in fact a dev package
> +# but for soname libmysqlclient
> +# (due to upstream reasons)
> +libmariadbd-dev: non-dev-pkg-with-shlib-symlink usr/lib/x86_64-linux-gnu/libmysqld.so.18 usr/lib/x86_64-linux-gnu/libmysqld.so
> 
> === modified file 'debian/source.lintian-overrides'
> --- debian/source.lintian-overrides	2012-01-28 20:22:14 +0000
> +++ debian/source.lintian-overrides	2014-07-24 08:02:44 +0000
> @@ -1,2 +1,12 @@
> -maintainer-script-lacks-debhelper-token debian/mariadb-server-5.5.postinst
> +# The mysql-server-5.6.postrm script handles
> +# what debhelper normally would.
> +# This is apparently related to #526464.
>  maintainer-script-lacks-debhelper-token debian/mariadb-server-5.5.postrm

wouldn't it be better to fix the script instead?

> +# File is multi-licensed, and thus should be OK for Debian
> +license-problem-non-free-RFC include/sha1.h
> +license-problem-non-free-RFC mysys/sha1.c
> +# Autotools is not used, these files are just old cruft from upstream
> +outdated-autotools-helper-file extra/jemalloc/config.guess 2012-02-10
> +outdated-autotools-helper-file extra/jemalloc/config.sub 2012-02-10
> +outdated-autotools-helper-file storage/tokudb/ft-index/third_party/xz-4.999.9beta/build-aux/config.guess 2009-04-27
> +outdated-autotools-helper-file storage/tokudb/ft-index/third_party/xz-4.999.9beta/build-aux/config.sub 2009-04-17

we can, technically, fix that, no need to override

> 
> === modified file 'debian/mariadb-server-5.5.lintian-overrides'
> --- debian/mariadb-server-5.5.lintian-overrides	2012-01-28 20:22:14 +0000
> +++ debian/mariadb-server-5.5.lintian-overrides	2014-07-24 08:02:44 +0000
> @@ -1,5 +1,10 @@
> -mariadb-server-5.5: command-with-path-in-maintainer-script postinst
> -mariadb-server-5.5: possible-bashism-in-maintainer-script postinst:81 'p{("a".."z","A".."Z",0..9)[int(rand(62))]}'
> -mariadb-server-5.5: possible-bashism-in-maintainer-script preinst:33 '${cmd/ */}'
> -mariadb-server-5.5: statically-linked-binary ./usr/bin/mysql_tzinfo_to_sql
> -mariadb-server-5.5: statically-linked-binary ./usr/sbin/mysqld
> +# Embedded from same source is OK
> +mariadb-server-5.5: embedded-library usr/bin/mysqlbinlog: libmysqlclient
> +# OK in newer Debian, includes support for xz
> +mariadb-server-5.5: data.tar.xz-member-without-dpkg-pre-depends
> +# ash's buildin has no "-e" so use /bin/echo
> +mariadb-server-5.5: command-with-path-in-maintainer-script postinst:194 /bin/echo
> +mariadb-server-5.5: command-with-path-in-maintainer-script postinst:208 /bin/echo
> +mariadb-server-5.5: command-with-path-in-maintainer-script postinst:216 /bin/echo

I think this can be fixed too.

> +# mysql_plugin is a symlink and does not need its own manpage
> +mariadb-server-5.5: binary-without-manpage usr/bin/mysql_plugin

Really? I don't think it's a symlink

> 
> === added file 'debian/mariadb-client-5.5.manpages'
> --- debian/mariadb-client-5.5.manpages	1970-01-01 00:00:00 +0000
> +++ debian/mariadb-client-5.5.manpages	2014-07-24 08:02:44 +0000
> @@ -0,0 +1,16 @@
> +debian/additions/innotop/innotop.1
> +debian/tmp/usr/share/man/man1/mysqlaccess.1
> +debian/tmp/usr/share/man/man1/mysqladmin.1
> +debian/tmp/usr/share/man/man1/mysqlbug.1
> +debian/tmp/usr/share/man/man1/mysqldump.1
> +debian/tmp/usr/share/man/man1/mysqldumpslow.1
> +debian/tmp/usr/share/man/man1/mysql_find_rows.1
> +debian/tmp/usr/share/man/man1/mysql_fix_extensions.1
> +debian/tmp/usr/share/man/man1/mysqlimport.1
> +debian/tmp/usr/share/man/man1/mysqlman.1
> +debian/additions/mysqlreport.1
> +debian/tmp/usr/share/man/man1/mysqlshow.1
> +debian/tmp/usr/share/man/man1/mysqlslap.1
> +debian/additions/mysql_tableinfo.1

should be removed (and other dead stuff)

> +debian/tmp/usr/share/man/man1/mysql_waitpid.1
> +debian/tmp/usr/share/man/man8/mysqlmanager.8
> 
> === modified file 'debian/mariadb-client-5.5.lintian-overrides'
> --- debian/mariadb-client-5.5.lintian-overrides	2012-01-23 11:20:16 +0000
> +++ debian/mariadb-client-5.5.lintian-overrides	2014-07-24 08:02:44 +0000
> @@ -1,3 +1,13 @@
> -mariadb-client-5.3: package-has-a-duplicate-relation
> -mariadb-client-5.3: wrong-name-for-upstream-changelog usr/share/doc/mariadb-client-5.3/changelog.innotop.gz
> -mariadb-client-5.3: pkg-not-in-package-test innotop
> +# OK, embedded has same source
> +mariadb-client-5.5: embedded-library usr/bin/mysqladmin: libmysqlclient
> +mariadb-client-5.5: embedded-library usr/bin/mysqldump: libmysqlclient
> +mariadb-client-5.5: embedded-library usr/bin/mysqlimport: libmysqlclient
> +mariadb-client-5.5: embedded-library usr/bin/mysqlshow: libmysqlclient
> +mariadb-client-5.5: embedded-library usr/bin/mysqlslap: libmysqlclient
> +# OK, newer Debian should support xz
> +mariadb-client-5.5: data.tar.xz-member-without-dpkg-pre-depends
> +# Symlink to mysqlcheck, which does have a manpage
> +mariadb-client-5.5: binary-without-manpage usr/bin/innochecksum
> +mariadb-client-5.5: binary-without-manpage usr/bin/mysqlanalyze
> +mariadb-client-5.5: binary-without-manpage usr/bin/mysqloptimize
> +mariadb-client-5.5: binary-without-manpage usr/bin/mysqlrepair

all the four have manpages

> 
> === modified file 'debian/libmariadbclient18.postinst'
> --- debian/libmariadbclient18.postinst	2012-01-23 11:20:16 +0000
> +++ debian/libmariadbclient18.postinst	2014-07-24 08:02:44 +0000
> @@ -1,12 +1,15 @@
> -#!/bin/bash -e
> +#!/bin/bash
> +
> +set -e
>  
>  # dh_installdeb will replace this with shell code automatically
>  # generated by other debhelper scripts.
>  
>  #DEBHELPER#
>  
> +case "$1" in
> +  configure)
> +    ldconfig
> +esac

hmm, need to check the result...
I thought that #DEBHELPER# adds ldconfig line

> +
>  exit 0
> -
> -# vim: ts=4
> -
> -
> 
> === added file 'debian/mariadb-server-5.5.manpages'
> --- debian/mariadb-server-5.5.manpages	1970-01-01 00:00:00 +0000
> +++ debian/mariadb-server-5.5.manpages	2014-07-24 08:02:44 +0000
> @@ -0,0 +1,22 @@
> +debian/tmp/usr/share/man/man1/msql2mysql.1
> +debian/tmp/usr/share/man/man1/myisamchk.1
> +debian/tmp/usr/share/man/man1/myisam_ftdump.1
> +debian/tmp/usr/share/man/man1/myisamlog.1
> +debian/tmp/usr/share/man/man1/myisampack.1
> +debian/tmp/usr/share/man/man1/my_print_defaults.1
> +debian/tmp/usr/share/man/man1/mysqlbinlog.1
> +debian/tmp/usr/share/man/man1/mysql_convert_table_format.1
> +debian/tmp/usr/share/man/man1/mysqld_multi.1
> +debian/tmp/usr/share/man/man1/mysqld_safe.1
> +debian/tmp/usr/share/man/man1/mysqlhotcopy.1
> +debian/tmp/usr/share/man/man1/mysql_install_db.1
> +debian/tmp/usr/share/man/man1/mysql_secure_installation.1
> +debian/tmp/usr/share/man/man1/mysql_setpermission.1
> +debian/tmp/usr/share/man/man1/mysql_upgrade.1
> +debian/tmp/usr/share/man/man1/mysql_zap.1
> +debian/tmp/usr/share/man/man1/perror.1
> +debian/tmp/usr/share/man/man1/replace.1
> +debian/tmp/usr/share/man/man1/resolveip.1
> +debian/tmp/usr/share/man/man1/resolve_stack_dump.1
> +debian/tmp/usr/share/man/man1/innochecksum.1

Ah, manpage in the server package, the binary in the client - that's why
you needed an override. but better move the manpage where it belongs

> +debian/tmp/usr/share/man/man1/mysql_tzinfo_to_sql.1
> 
> === modified file 'debian/mariadb-test-5.5.dirs'
> --- debian/mariadb-test-5.5.dirs	2013-08-30 09:25:49 +0000
> +++ debian/mariadb-test-5.5.dirs	2014-07-24 08:02:44 +0000
> @@ -19,13 +19,6 @@
>  usr/share/mysql/mysql-test/suite/parts/inc
>  usr/share/mysql/mysql-test/suite/parts/t

why dirs are specified explicitly here?

>  usr/share/mysql/mysql-test/suite/parts/r
> -usr/share/mysql/mysql-test/suite/rpl_ndb
> -usr/share/mysql/mysql-test/suite/rpl_ndb/t
> -usr/share/mysql/mysql-test/suite/rpl_ndb/r
> -usr/share/mysql/mysql-test/suite/bugs
> -usr/share/mysql/mysql-test/suite/bugs/t
> -usr/share/mysql/mysql-test/suite/bugs/r
> -usr/share/mysql/mysql-test/suite/bugs/data
>  usr/share/mysql/mysql-test/suite/rpl
>  usr/share/mysql/mysql-test/suite/rpl/t
>  usr/share/mysql/mysql-test/suite/rpl/r
> === modified file 'debian/mariadb-server-5.5.preinst'
> --- debian/mariadb-server-5.5.preinst	2012-01-31 07:57:59 +0000
> +++ debian/mariadb-server-5.5.preinst	2014-07-24 08:02:44 +0000
> @@ -64,22 +78,22 @@
>  show_downgrade_warning=0
>  for i in `ls $DATADIR/debian-*.flag 2>/dev/null`; do
>    found_version=`echo $i | sed 's/.*debian-\([0-9\.]\+\).flag/\1/'`
> -  if dpkg --compare-versions "$this_version" '<<' "$found_version"; then
> +  if dpkg --compare-versions "5.5" '<<' "$found_version"; then

why did you remove $this_version ?

>      show_downgrade_warning=1
>      break;
>    fi
>  done
>  if [ "$show_downgrade_warning" = 1 ]; then
> -  db_fset mariadb-server-$this_version/really_downgrade seen false || true
> -  db_input medium mariadb-server-$this_version/really_downgrade || true
> +  db_fset mariadb-server-5.5/really_downgrade seen false || true
> +  db_input medium mariadb-server-5.5/really_downgrade || true
>    db_go
> -  db_get mariadb-server-$this_version/really_downgrade || true
> +  db_get mariadb-server-5.5/really_downgrade || true
>    if [ "$RET" = "true" ]; then
>      rm -f $DATADIR/debian-*.flag
> -    touch $DATADIR/debian-$this_version.flag
> +    touch $DATADIR/debian-5.5.flag
>    else
> -    echo "Aborting downgrade from (at least) $found_version to $this_version." 1>&2
> -    echo "If are sure you want to downgrade to $this_version, remove the file" 1>&2
> +    echo "Aborting downgrade from (at least) $found_version to 5.5." 1>&2
> +    echo "If are sure you want to downgrade to 5.5, remove the file" 1>&2
>      echo "$DATADIR/debian-*.flag and try installing again." 1>&2
>      db_stop
>      exit 1
> 
> === added file 'debian/mariadb-server-5.5.install'
> --- debian/mariadb-server-5.5.install	1970-01-01 00:00:00 +0000
> +++ debian/mariadb-server-5.5.install	2014-07-24 08:02:44 +0000
> @@ -0,0 +1,72 @@
> +etc/mysql/conf.d/mysqld_safe_syslog.cnf
> +etc/mysql/debian-start
> +usr/bin/aria_chk
> +usr/bin/aria_dump_log
> +usr/bin/aria_ftdump
> +usr/bin/aria_pack
> +usr/bin/aria_read_log
> +usr/bin/msql2mysql
> +usr/bin/my_print_defaults
> +usr/bin/myisam_ftdump
> +usr/bin/myisamchk
> +usr/bin/myisamlog
> +usr/bin/myisampack
> +usr/bin/mysql_convert_table_format
> +usr/bin/mysql_install_db
> +usr/bin/mysql_plugin
> +usr/bin/mysql_secure_installation
> +usr/bin/mysql_setpermission
> +usr/bin/mysql_tzinfo_to_sql
> +usr/bin/mysql_upgrade
> +usr/bin/mysql_zap
> +usr/bin/mysqlbinlog
> +usr/bin/mysqld_multi
> +usr/bin/mysqld_safe
> +usr/bin/mysqlhotcopy
> +usr/bin/perror
> +usr/bin/replace
> +usr/bin/resolve_stack_dump
> +usr/bin/resolveip
> +usr/lib/mysql/plugin/auth_pam.so
> +usr/lib/mysql/plugin/auth_socket.so
> +usr/lib/mysql/plugin/ha_innodb.so
> +usr/lib/mysql/plugin/handlersocket.so
> +usr/lib/mysql/plugin/semisync_master.so
> +usr/lib/mysql/plugin/semisync_slave.so
> +usr/lib/mysql/plugin/server_audit.so
> +usr/lib/mysql/plugin/sphinx.so
> +usr/lib/mysql/plugin/sql_errlog.so
> +usr/share/doc/mariadb-server-5.5/INFO_BIN
> +usr/share/doc/mariadb-server-5.5/INFO_SRC
> +usr/share/doc/mariadb-server-5.5/mysqld.sym.gz

eh? you delete mysqld.sym.gz in the clean file, don't you?

> +usr/share/man/man1/innochecksum.1
> +usr/share/man/man1/msql2mysql.1
> +usr/share/man/man1/my_print_defaults.1
> +usr/share/man/man1/myisam_ftdump.1
> +usr/share/man/man1/myisamchk.1
> +usr/share/man/man1/myisamlog.1
> +usr/share/man/man1/myisampack.1
> +usr/share/man/man1/mysql_convert_table_format.1
> +usr/share/man/man1/mysql_install_db.1
> +usr/share/man/man1/mysql_secure_installation.1
> +usr/share/man/man1/mysql_setpermission.1
> +usr/share/man/man1/mysql_tzinfo_to_sql.1
> +usr/share/man/man1/mysql_upgrade.1
> +usr/share/man/man1/mysql_zap.1
> +usr/share/man/man1/mysqlbinlog.1
> +usr/share/man/man1/mysqld_multi.1
> +usr/share/man/man1/mysqld_safe.1
> +usr/share/man/man1/mysqlhotcopy.1
> +usr/share/man/man1/perror.1
> +usr/share/man/man1/replace.1
> +usr/share/man/man1/resolve_stack_dump.1
> +usr/share/man/man1/resolveip.1
> +usr/share/mysql/debian-start.inc.sh
> +usr/share/mysql/echo_stderr
> +usr/share/mysql/errmsg-utf8.txt
> +usr/share/mysql/fill_help_tables.sql
> +usr/share/mysql/mysql_performance_tables.sql
> +usr/share/mysql/mysql_system_tables.sql
> +usr/share/mysql/mysql_system_tables_data.sql
> +usr/share/mysql/mysql_test_data_timezone.sql
> +usr/lib/mysql/plugin/ha_oqgraph.so

better to have the list of files sorted

> 
> === added file 'debian/mariadb-server-5.5.postrm'
> --- debian/mariadb-server-5.5.postrm	1970-01-01 00:00:00 +0000
> +++ debian/mariadb-server-5.5.postrm	2014-07-24 08:02:44 +0000
> @@ -0,0 +1,83 @@
> +#!/bin/bash -e
> +
> +# It is possible that Debconf has already been removed, too.
> +if [ -f /usr/share/debconf/confmodule ]; then
> +  . /usr/share/debconf/confmodule
> +fi

You use db_input/etc below. If you really care about confmodule being
removed, you need to protect them somehow. Or assume that confmodule
is always present and don't test for it.

> +
> +if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi
> +${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 }

I understand what it is, but I'm surprised that every
pre/post script needs to do that explicitly

> +
> +MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"
> +
> +# Try to stop the server in a sane way. If it does not success let the admin
> +# do it himself. No database directories should be removed while the server
> +# is running!
> +stop_server() {
> +  set +e
> +  if [ -x /usr/sbin/invoke-rc.d ]; then
> +    invoke-rc.d mysql stop

1. is invoke-rc.d indeed something optional that may or may not exist?
2. why is it better than using /etc/init.d/mysql directly ?

> +  else
> +    /etc/init.d/mysql stop
> +  fi
> +  errno=$?
> +  set -e
> +
> +  if [ "$?" != 0 ]; then
> +    echo "Trying to stop the MySQL server resulted in exitcode $?." 1>&2
> +    echo "Stop it yourself and try again!" 1>&2
> +    exit 1
> +  fi
> +}
> +
> +case "$1" in
> +  purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
> +    if [ -n "`$MYADMIN ping 2>/dev/null`" ]; then
> +      stop_server
> +      sleep 2
> +    fi
> +  ;;
> +  *)
> +    echo "postrm called with unknown argument '$1'" 1>&2
> +    exit 1
> +  ;;
> +esac
> +
> +#
> +# - Do NOT purge logs or data if another mysql-sever* package is installed (#307473)
> +# - Remove the mysql user only after all his owned files are purged.
> +#   
> +if [ "$1" = "purge" -a ! \( -x /usr/sbin/mysqld -o -L /usr/sbin/mysqld \) ]; then
> +  # we remove the mysql user only after all his owned files are purged
> +  rm -f /var/log/mysql.{log,err}{,.0,.[1234567].gz}
> +  rm -rf /var/log/mysql
> +
> +  db_input high mysql-server-5.5/postrm_remove_databases || true
> +  db_go || true
> +  db_get mysql-server-5.5/postrm_remove_databases || true
> +  if [ "$RET" = "true" ]; then
> +    # never remove the debian.cnf when the databases are still existing
> +    # else we ran into big trouble on the next install!
> +    rm -f /etc/mysql/debian.cnf
> +    rm -rf /var/lib/mysql
> +    rm -rf /var/run/mysqld # this directory is created by the init script, don't leave behind
> +    userdel mysql || true
> +  fi
> +
> +  # (normally) Automatically added by dh_installinit
> +  if [ "$1" = "purge" ] ; then
> +        update-rc.d mysql remove >/dev/null || exit 0
> +  fi
> +  # (normally) End automatically added section
> +fi
> +
> +# (normally) Automatically added by dh_installdebconf
> +if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ]; then
> +        . /usr/share/debconf/confmodule
> +        db_purge
> +fi
> +# (normally) End automatically added section
> +
> +# no DEBHELPER here, "update-rc.d remove" fails if mysql-server-5.1 is installed

I don't understand that. Why no DEBHELPER ?

> +
> +exit 0
> 
> === added file 'debian/mariadb-server-5.5.README.Debian'
> --- debian/mariadb-server-5.5.README.Debian	1970-01-01 00:00:00 +0000
> +++ debian/mariadb-server-5.5.README.Debian	2014-07-24 08:02:44 +0000
> @@ -0,0 +1,109 @@
> +* MYSQL WON'T START OR STOP?:
> +=============================
> +You may never ever delete the special mysql user "debian-sys-maint". This
> +user together with the credentials in /etc/mysql/debian.cnf are used by the
> +init scripts to stop the server as they would require knowledge of the mysql
> +root users password else.
> +So in most of the times you can fix the situation by making sure that the
> +debian.cnf file contains the right password, e.g. by setting a new one
> +(remember to do a "flush privileges" then).

Wouldn't it be better to get rid of debian-sys-maint and use kill to
stop the server? MySQL scripts, our scripts, RPM scripts all use kill,
only debian has debian-sys-maint

> +
> +* WHAT TO DO AFTER UPGRADES:
> +============================
> +The privilege tables are automatically updated so all there is left is read
> +the changelogs on dev.mysql.com to see if any changes affect custom apps.
> +
> +* WHAT TO DO AFTER INSTALLATION:
> +================================
> +The MySQL manual describes certain steps to do at this stage in a separate
> +chapter.  They are not necessary as the Debian packages does them
> +automatically.
> +
> +The only thing that is left over for the admin is 
> + - setting the passwords
> + - creating new users and databases
> + - read the rest of this text
> +
> +* DOWNGRADING TO 4.0 or 4.1:
> +============================
> +Unsupported. Period.
> +But if you do and get problems or make interesting experiences, mail me, it

mail *who* ?

> +might help others.
> +Ok, if you really want, I would recommend to "mysqldump --opt" all tables,
> +then purge 4.1, delete /var/lib/mysql, install 4.0 and insert the dumps.  Be
> +carefully, though, with the "mysql" table, you might not simply overwrite that
> +one as the password for the mysql "debian-sys-maint" user is stored in
> +/etc/mysql/debian.cnf and needed by /etc/init.d/ to start mysql and check if
> +it's alive. 
> +
> +* SOME APPLICATION CAN NO LONGER CONNECT:
> +=========================================
> +This application is probably linked against libmysqlclient12 or below and
> +somebody has created a mysql user with new-style passwords.
> +The old_passwords=1 option in /etc/mysql/my.cnf might help. If not the
> +application that inserted the user has to be changed or the application that
> +tries to connect updated to libmysqlclient14 or -15.
> +
> +* NETWORKING:
> +=============
> +For security reasons, the Debian package has enabled networking only on the
> +loop-back device using "bind-address" in /etc/mysql/my.cnf.  Check with
> +"netstat -tlnp" where it is listening. If your connection is aborted
> +immediately see if "mysqld: all" or similar is in /etc/hosts.allow and read
> +hosts_access(5).
> +
> +* WHERE IS THE DOCUMENTATION?:
> +==============================
> +Unfortunately due to licensing restrictions, debian currently not able
> +to provide the mysql-doc package in any format.  For the most up to date
> +documentation, please go to http://dev.mysql.com/doc.
> +
> +* PASSWORDS:
> +============
> +It is strongly recommended to set a password for the mysql root user (which
> +  /usr/bin/mysql -u root -D mysql -e "update user set password=password('new-password') where user='root'"
> +  /usr/bin/mysql -u root -e "flush privileges"
> +If you already had a password set add "-p" before "-u" to the lines above.
> +
> +
> +If you are tired to type the password in every time or want to automate your
> +scripts you can store it in the file $HOME/.my.cnf. It should be chmod 0600
> +(-rw------- username username .my.cnf) to ensure that nobody else can read
> +it.  Every other configuration parameter can be stored there, too. You will
> +find an example below and more information in the MySQL manual in
> +/usr/share/doc/mariadb-doc or www.mysql.com.
> +
> +ATTENTION: It is necessary, that a .my.cnf from root always contains a "user"
> +line wherever there is a "password" line, else, the Debian maintenance
> +scripts, that use /etc/mysql/debian.cnf, will use the username
> +"debian-sys-maint" but the password that is in root's .my.cnf. Also note,
> +that every change you make in the /root/.my.cnf will affect the mysql cron
> +script, too.
> +
> +        # an example of $HOME/.my.cnf
> +	[client]
> +	user		= your-mysql-username
> +	password	= enter-your-good-new-password-here
> +
> +* BIG_ROWS FOR EVEN MORE ROWS IN A TABLE:
> +=========================================
> +If you ever run out of rows in a table there is the possibility of building
> +the package with "-DBIG_ROWS" which, according to a MySQL employee on
> +packagers@xxxxxxxxxxxxxxx should lead to a 64bit row index (I guess > 2^32
> +rows) but also to an approx. 5% performance loss.

This is completely wrong, should be removed.

> +
> +* BerkeleyDB Storage Engine
> +===========================
> +Support for BerkeleyDB has been removed in 5.1, and consequently both the
> +have-bdb and skip-bdb configuration options will cause the server to fail. 
> +Removing the options from /etc/mysql/my.cnf will fix this problem.

First part is true, second is wrong. The whole section should be removed.

> +
> +* FURTHER NOTES ON REPLICATION
> +===============================
> +If the MySQL server is acting as a replication slave, you should not
> +set --tmpdir to point to a directory on a memory-based filesystem or to
> +a directory that is cleared when the server host restarts. A replication
> +slave needs some of its temporary files to survive a machine restart so
> +that it can replicate temporary tables or LOAD DATA INFILE operations. If
> +files in the temporary file directory are lost when the server restarts,
> +replication fails.
> 
> === modified file 'debian/README.Maintainer'
> --- debian/README.Maintainer	2012-01-23 11:20:16 +0000
> +++ debian/README.Maintainer	2014-07-24 08:02:44 +0000
> @@ -1,114 +1,123 @@
> -
> -###########################
> -##	FIXME for 5.1    ##
> -###########################
> -
> -* put this trigger-recreation thing into the init scripts -- what?!
> -
> -###########################################################################
> -# Here are some information that are only of interest for the current and #
> -# following Debian maintainers of MySQL.                                  #
> -###########################################################################
> -
> -The debian/ directory is under SVN control, see debian/control for URL.
> -
> -#
> -# Preparing a new version
> -#
> -The new orig.tar.gz (without non-free documentation) is created in /tmp/ when
> -running this command:
> - 
> -debian/rules get-orig-source
> -
> -#
> -# mysqlreport
> -#
> -The authors e-mail address is <public@xxxxxxxxxxxx>.
> -
> -#
> -# Remarks to dependencies
> -#
> -libwrap0-dev (>= 7.6-8.3)
> -	According to bug report 114582 where where build problems on
> -	IA-64/sid with at least two prior versions.
> -psmisc
> -	/usr/bin/killall in the initscript
> -
> -zlib1g in libmysqlclient-dev:	
> -	"mysql_config --libs" ads "-lz"
> -
> -Build-Dep:
> -
> -debhelper (>=4.1.16):
> -	See po-debconf(7).
> -
> -autoconf (>= 2.13-20), automake1.7
> -	Try to get rid of them.
> -
> -doxygen, tetex-bin, tetex-extra, gs
> -	for ndb/docs/*tex
> -
> -#
> -# Remarks to the start scripts
> -#
> -
> -## initscripts rely on mysqladmin from a different package
> -We have the problem that "/etc/init.d/mysql stop" relies on mysqladmin which
> -is in another package (mysql-client) and a passwordless access that's maybe
> -only available if the user configured his /root/.my.cnf. Can this be a problem?
> -* normal mode: not because the user is required to have it. Else:
> -* purge/remove: not, same as normal mode
> -* upgrade: not, same as normal mode
> -* first install: not, it depends on mysql-client which at least is unpacked
> -                 so mysqladmin is there (to ping). It is not yet configured
> -		passwordles but if there's a server running then there's a
> -                /root/.my.cnf. Anyways, we simply kill anything that's mysqld.
> -
> -## Passwordless access for the maintainer scripts
> -Another issue is that the scripts needs passwordless access. To ensure this
> -a debian-sys-maint user is configured which has process and shutdown privs.
> -The file with the randomly (that's important!) generated password must be
> -present as long as the databases remain installed because else a new install
> -would have no access. This file should be used like:
> -	mysqladmin --defaults-file=/etc/mysql/debian.cnf restart
> -to avoid providing the password in plaintext on a commandline where it would 
> -be visible to any user via the "ps" command.
> -
> -## When to start the daemon?
> -We aim to give the admin full control on when MySQL is running.
> -Issues to be faced here:
> -OLD:
> -        1. Debconf asks whether MySQL should be started on boot so update-rc.d is
> -           only run if the answer has been yes. The admin is likely to forget
> -           this decision but update-rc.d checks for an existing line in
> -           /etc/runlevel.conf and leaves it intact.
> -        2. On initial install, if the answer is yes, the daemon has to be started.
> -        3. On upgrades it should only be started if it was already running, everything
> -           else is confusing. Especiall relying on an debconf decision made month ago
> -           is considered suboptimal. See bug #274264
> -        Implementation so far:
> -        prerm (called on upgrade before stopping the server): 
> -          check for a running server and set flag if necessary
> -        preinst (called on initial install and before unpacking when upgrading):
> -          check for the debconf variable and set flag if necessary
> -        postinst (called on initial install and after each upgrade after unpacking):
> -          call update-rc.d if debconf says yes
> -          call invoce-rc.d if the flag has been set
> -        Problems remaining:
> -          dpkg-reconfigure and setting mysql start on boot to yes did not start mysql
> -          (ok "start on boot" literally does not mean "start now" so that might have been ok)
> -NEW:
> -        1. --- no debconf anymore for the sake of simplicity. We have runlevel.conf,
> -           the admin should use it
> -        2. On initial install the server is started.
> -        3. On upgrades the server is started exactly if it was running before so the
> -           runlevel configuration is irrelevant. It will be preserved by the mean of
> -           update-rc.d's builtin check.
> -        Implementation:
> -        prerm (called on upgrade before stopping the server):
> -          check for a running server and set flag if necessary
> -        preinst (called on initial install and before unpacking when upgrading):
> -          check for $1 beeing (initial) "install" and set flag
> -        postinst (called on initial install and after each upgrade after unpacking):
> -          call update-rc.d
> -          call invoce-rc.d if the flag has been set
> +## Building from sources with git-buildpackage ##
> +
> +
> +Clone sources with all branches
> +  sudo apt-get install git-buildpackage
> +  gbp-clone --pristine-tar git://git.debian.org/git/pkg-mysql/mariadb-5.5.git

We aren't using gpb and not building from the git repository

> +
> +Aalternatively use Github mirror at https://github.com/ottok/mariadb-5.5.git
> +
> +On later runs make sure to have latest version of sources
> +  gbp-pull --pristine-tar --force
> +
> +Install all build dependencies manually (see debian/control for latest full list)
> +  sudo apt-get install bison chrpath cmake debhelper hardening-wrapper libaio-dev libboost-dev libjemalloc-dev libjudy-dev libncurses5-dev libpam0g-dev libreadline-gplv2-dev libssl-dev libwrap0-dev lsb-release perl po-debconf psmisc zlib1g-dev
> +
> +Build
> +  git-buildpackage --git-pristine-tar
> +
> +For a more elaborate setup with automatic build dependency installation and multi-target chroot usage check out how http://labs.seravo.fi/~otto/mariadb-repo/build.sh uses git-buildpackage with pbuilder.
> +
> +If the build fails the easiest way to clean up before a new run is
> +  git clean -f -d && git reset --hard
> +
> +
> +### Tip ###
> +
> +  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"
> +
> +
> +## Importing initial sources from upstream the first fime ##
> +
> +Create repository
> +  mkdir mariadb-5.5
> +  cd mariadb-5.5
> +  git init
> +  git branch upstream
> +  git-import-orig --pristine-tar ../../upstream/mariadb-5.5.36
> +
> +Fill in values prompted
> +  What will be the source package name? [mariadb] mariadb-5.5
> +  What is the upstream version? [5.5.36]
> +
> +Checkout master into working dir and finish up manually what needs to be done
> +  git checkout master
> +
> +Eventually commit and push, build, test binaries, test packages etc..
> +  git commit -m "Created Debian packaging using git-buildpackage for easy maintenance"
> +  git push --all
> +  git push --tags
> +
> +
> +## Upgrading sources from upstream ##
> +
> +Download new source package
> +  cd pkg-mariadb-5.5
> +  uscan --verbose
> +
> +Enter git repostitory path and apply new sources
> +  cd mariadb-5.5
> +  git-import-orig --pristine-tar ../mariadb-5.5.36.tar.gz
> +
> +Generate new debian/changelog entry
> +  dch -v 5.5.36-1 -D unstable
> +
> +Manually merge what needs to be done
> +
> +Commit and push
> +  git commit -am "Merged with upstream 5.5.36"
> +  git push --all; git push --all github
> +  git push --tags; git push --tags github
> +
> +Note that in above if you want to sync to Github directly you need to have collaborator rights to the Github repo and you need to add it as a secondary remote location with:
> +  git remote add origin git@xxxxxxxxxx:ottok/mariadb-5.5.git
> +
> +
> +### Maintaining symbols file for libmariadbclient18 et al ###
> +
> +Update symbols file:
> +  dpkg-gensymbols -plibmysqlclient18 -Idebian/libmariadbclient18.symbols -Pdebian/libmariadbclient18 -edebian/libmariadbclient18/usr/lib/mysql/plugin/mysql_clear_password.so -edebian/libmariadbclient18/usr/lib/mysql/plugin/dialog.so -edebian/libmariadbclient18/usr/lib/x86_64-linux-gnu/libmysqlclient.so.18.0.0 > symbols.patch
> +
> +  patch debian/libmariadbclient18.symbols symbols.patch
> +
> +Finish it manually by e.g. making sure there are no '-1' file versions, upstream versions is enough. Finally remember to selectively commit:
> +  git add debian/libmariadbclient18.symbols
> +  git commit -m "Updated symbols file"
> +
> +
> +### Maintaining debian/copyright ###
> +
> +Check if licenses match
> +  license-reconcile
> +
> +Create new copyright file
> +  licensecheck --copyright -r . -c . | /usr/lib/cdbs/licensecheck2dep5 > /tmp/copyright
> +
> +..but you need to do lots of manual work to merge the new file with the old, as liscensecheck has a lot of cruft and the original copyright file already had those cleaned up.
> +
> +
> +### Quality control ###
> +
> +Run wrap-and-sort to style contents in debian/*
> +  wrap-and-sort
> +
> +Once packages are done check their quality with Lintian
> +  lintian -EvIL +pedantic --color=always *.deb
> +
> +
> +## Uploading to Ubuntu PPA for testing ##
> +
> +Make sure you have key ID set up in ~/.devscripts to avoid using -k parameter
> +  DEBSIGN_KEYID=B7F7E4E1
> +
> +These are good to have as environment variables (replace values with your own)
> +  DEBEMAIL="otto@xxxxxxxxx"
> +  DEBFULLNAME="Otto Kekäläinen"
> +  export DEBEMAIL DEBFULLNAME
> +
> +The run the commands to automatically change version and upload
> +  backportpackage -u ppa:mysql-ubuntu/mariadb -d precise -r *.dsc -S ~ppa1 -y
> 
> === added file 'debian/rules'
> --- debian/dist/Ubuntu/rules	2014-05-30 22:09:03.000000000 +0200
> +++ debian/rules	2014-07-25 10:51:16.000000000 +0200
> @@ -3,130 +3,125 @@
>  export DH_VERBOSE=1
>  export DEB_BUILD_HARDENING=1
>  
> -PACKAGE=mariadb-5.5
> -TMP=$(CURDIR)/debian/tmp/
> +TMP:=$(CURDIR)/debian/tmp/
>  
> -include /usr/share/dpatch/dpatch.make
> -
> -ARCH = $(shell dpkg-architecture -qDEB_BUILD_ARCH)
> +ARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH)
> -ARCH_OS = $(shell dpkg-architecture -qDEB_BUILD_ARCH_OS)
> +ARCH_OS := $(shell dpkg-architecture -qDEB_BUILD_ARCH_OS)
>  DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
>  DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
> +DEB_BUILD_GNU_SYSTEM ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_SYSTEM)
> -DEBVERSION = $(shell dpkg-parsechangelog | awk '/^Version: / { print $$2 }' | sed 's/^.*-//' )
> +DEBVERSION := $(shell dpkg-parsechangelog | awk '/^Version: / { print $$2 }' | sed 's/^.*-//' )
> +
> +ifneq (,$(filter $(ARCH), i386 kfreebsd-i386 hurd-i386))
> +    TAOCRYPT_OPT="-DTAOCRYPT_DISABLE_X86ASM"
> +endif

This belongs in CMakeLists.txt (or configure.cmake)
or in extra/yassl/taocrypt/include/misc.hpp 

> +
> +# Skip TokuDB if arch is not amd64
> +ifneq ($(ARCH), amd64)
> +    TOKUDB_OPT="-DWITHOUT_TOKUDB=true"
> +endif

This happens automatically, no need to disable tokudb explicitly

> +
> +export MYSQL_BUILD_CC=$(DEB_HOST_GNU_TYPE)-gcc
> +export MYSQL_BUILD_CXX=$(DEB_HOST_GNU_TYPE)-g++

why export, I'd expect this to be a normal make variable, like in

  MYSQL_BUILD_CXX := $(DEB_HOST_GNU_TYPE)-g++

>  
>  DEB_SOURCE_PACKAGE ?= $(strip $(shell egrep '^Source: ' debian/control | cut -f 2 -d ':'))
>  DEB_VERSION ?= $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ')
>  DEB_NOEPOCH_VERSION ?= $(shell echo $(DEB_VERSION) | cut -d: -f2-)
>  DEB_UPSTREAM_VERSION ?= $(shell echo $(DEB_NOEPOCH_VERSION) | sed 's/-[^-]*$$//')
>  DEB_UPSTREAM_VERSION_MAJOR_MINOR := $(shell echo $(DEB_UPSTREAM_VERSION) | sed -r -n 's/^([0-9]+\.[0-9]+).*/\1/p')
> +DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
>  
> -DISTRIBUTION = $(shell lsb_release -i -s)
> -RELEASE = $(shell lsb_release -r -s)
> +DISTRIBUTION := $(shell lsb_release -i -s)
> +RELEASE := $(shell lsb_release -r -s)
>  
> -MAKE_J = -j$(shell if [ -f /proc/cpuinfo ] ; then grep -c processor.* /proc/cpuinfo ; else echo 1 ; fi)
> -ifeq (${MAKE_J}, -j0)
> -  MAKE_J = -j1
> -endif

Did you disable parallel make? why?

> -
> -MAKE_TEST_TARGET=test-force
> +MAKE_TEST_TARGET:=test-force
>  ifneq ($(findstring fulltest,$(DEB_BUILD_OPTIONS)),)
>  # make test-bt is the testsuite run by the MySQL build team
>  # before a release, but it is long
> -    MAKE_TEST_TARGET=test-bt
> +    MAKE_TEST_TARGET:=test-bt
>  endif
>  
> -USE_ASSEMBLER=--enable-assembler 
> +USE_ASSEMBLER:=--enable-assembler
>  
> -ifneq (,$(filter $(ARCH), amd64 i386 ia64 s390))
> -    TESTSUITE_FAIL_CMD=exit 1
> +ifneq (,$(filter $(ARCH), amd64 kfreebsd-amd64 i386 kfreebsd-i386 ia64 s390 s390x))
> +    TESTSUITE_FAIL_CMD:=exit 1
>  else
> -    TESTSUITE_FAIL_CMD=true
> +    TESTSUITE_FAIL_CMD:=true
>  endif
>  
> +SHARED_LIBS_DIR := $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/

this doesn't seem to be used

> +
> -BUILDDIR = builddir
> +BUILDDIR := builddir
>  builddir = $(BUILDDIR)
>  
>  # This causes seg11 crashes if LDAP is used for groups in /etc/nsswitch.conf
>  # so it is disabled by default although, according to MySQL, it brings >10%
>  # performance gain if enabled. See #299382.
>  ifeq ($(STATIC_MYSQLD), 1)
> -    USE_STATIC_MYSQLD=--with-mysqld-ldflags=-all-static
> +    USE_STATIC_MYSQLD:=--with-mysqld-ldflags=-all-static
>  endif

Did you actually try it? If enabled, it'd pass
--with-mysqld-ldflags=-all-static
to cmake, but it's not a valid cmake argument, it'd fail immediately.
This can never work.

>  
> -configure: patch configure-stamp
> -configure-stamp:
> +override_dh_auto_clean:
>  	@echo "RULES.$@"
>  	dh_testdir
> +	dh_testroot
> +	[ ! -d mysql-test/var ] || rm -rf mysql-test/var
> +	rm -rf $(BUILDDIR)
> +	debconf-updatepo

why the echo?
why updatepo in auto_clean?
why did you need to override at all? to delete mysql-test/var ?

>  
> -ifneq ($(ARCH_OS),hurd)
> -	if [ ! -d /proc/self ]; then echo "/proc IS NEEDED" 1>&2; exit 1; fi 
> -endif
> +override_dh_auto_configure: configure-stamp
>  
> -	( test -d $(builddir) || mkdir $(builddir) ) && cd $(builddir) && \
> -	sh -c 'PATH=$${MYSQL_BUILD_PATH:-"/usr/local/bin:/usr/bin:/bin"} \
> -			CC=$${MYSQL_BUILD_CC:-gcc} \
> -			CFLAGS=$${MYSQL_BUILD_CFLAGS:-"-O2 -fno-omit-frame-pointer -g -pipe -Wall -Wno-uninitialized"} \
> -			CXX=$${MYSQL_BUILD_CXX:-g++} \
> -			CXXFLAGS=$${MYSQL_BUILD_CXXFLAGS:-"-O2 -fno-omit-frame-pointer -g -pipe -Wall -Wno-uninitialized"} \
> -		cmake .. \
> -		-DMYSQL_SERVER_SUFFIX="-$(DEBVERSION)" \
> -		-DBUILD_CONFIG=mysql_release \
> -		-DCOMPILATION_COMMENT="mariadb.org binary distribution" \
> -		-DSYSTEM_TYPE="debian-linux-gnu" \
> -		-DDEB=ubuntu'
> +override_dh_prep:
> +        # Don't clean /tmp/ away, it is needed by all binary packages

what?

>  
> +# We explicitly set -DINSTALL_SUPPORTFILESDIR as it is incorrect in upstream
> +# sources (will be fixed in 5.5.30).

This is no 5.5.30, INSTALL_SUPPORTFILESDIR is long time fixed

> +configure-stamp:

why configure-stamp instead of putting the rules below directly
into override_dh_auto_configure ?

> +	@echo "RULES.$@"
> +	dh_testdir
> +	
> +	( test -d $(builddir) || mkdir $(builddir) ) && cd $(builddir) && \
> +	sh -c  'PATH=$${MYSQL_BUILD_PATH:-"/bin:/usr/bin"} \

why sh -c? where's /usr/local/bin in the path?

> +	    	CC=$${MYSQL_BUILD_CC:-gcc} \
> +		CFLAGS=$${MYSQL_BUILD_CFLAGS:-"-O2 -DBIG_JOINS=1 -fno-strict-aliasing ${TAOCRYPT_OPT}"} \
> +	    	CXX=$${MYSQL_BUILD_CXX:-g++} \
> +	    	CXXFLAGS=$${MYSQL_BUILD_CXXFLAGS:-"-O3 -DBIG_JOINS=1 -felide-constructors -fno-exceptions -fno-rtti -fno-strict-aliasing ${TAOCRYPT_OPT}"} \
> +	    cmake -DCMAKE_INSTALL_PREFIX=/usr \
> +		$(USE_STATIC_MYSQLD) \
> +	    -DCOMPILATION_COMMENT="($(DISTRIBUTION))" \
> +	    -DMYSQL_SERVER_SUFFIX="-$(DEBVERSION)" \
> +	    -DSYSTEM_TYPE="debian-$(DEB_BUILD_GNU_SYSTEM)" $(TOKUDB_OPT) \
> +	    -DBUILD_CONFIG=mysql_release \
> +	    -DINSTALL_LIBDIR=lib/$(DEB_HOST_MULTIARCH) \
> +	    -DINSTALL_PLUGINDIR=lib/mysql/plugin \
> +	    -DINSTALL_SUPPORTFILESDIR=share/mysql \
> +		-DDEB=1 ..'
>  	touch $@
>  
> -build: build-stamp
> +override_dh_auto_build: build-stamp
>  
> -build-stamp: configure
> +build-stamp:
>  	@echo "RULES.$@"
> -	dh_testdir
> -
> -	cd $(builddir) && $(MAKE) $(MAKE_J) $(AM_EXTRA_MAKEFLAGS)
> +	cd $(builddir) && $(MAKE) $(AM_EXTRA_MAKEFLAGS)
> +	touch $@

I don't see any point in overwriting dh_auto_build, you don't add anything
valueable to make command line. You've removed -j, and did not
add support for DEB_BUILD_OPTIONS=parallel. AM_EXTRA_MAKEFLAGS
isn't needed here, it can be passed to cmake or set in MAKEFLAGS.

So, I think that
* dh_auto_build override shold be removed
* support for DEB_BUILD_OPTIONS=parallel should be added (via MAKEFLAGS)
* AM_EXTRA_MAKEFLAGS should go away, instead CMAKE_VERBOSE_MAKEFILE should
be set to 1 if DH_VERBOSE is set (or, may be, if DEB_BUILD_OPTIONS=verbose)

>  
> +override_dh_auto_test:
> +	@echo "RULES.$@"
>  ifeq ($(findstring nocheck,$(DEB_BUILD_OPTIONS)),)
> -	# Don't know why the following is necessary...
> -	cp unittest/unit.pl $(builddir)/unittest/
> -	cp -r mysql-test/* $(builddir)/mysql-test/
> -	cp -r sql/share/* $(builddir)/sql/share/
> -	cp -r scripts/*sql $(builddir)/scripts/
> -	if [ ! -f testsuite-stamp ] ; then \
> -	  cd $(builddir) && $(MAKE) $(MAKE_TEST_TARGET) || $(TESTSUITE_FAIL_CMD) ; \
> -	fi
> +	cd $(builddir) && $(MAKE) $(MAKE_TEST_TARGET) || $(TESTSUITE_FAIL_CMD) ;
>  endif
>  
> -	touch testsuite-stamp
> +override_dh_auto_install: auto_install-stamp
>  
> -	touch build-stamp
> -
> -clean: clean-patched unpatch
> -	rm -rf debian/patched
> -clean-patched:
> -	@echo "RULES.clean-patched"
> -	dh_testdir 
> -	dh_testroot
> -	rm -f configure-stamp*
> -	rm -f build-stamp*
> -	rm -f testsuite-stamp
> -	#
> -	[ ! -f Makefile ] || $(MAKE) clean
> -	[ ! -d mysql-test/var ] || rm -rf mysql-test/var
> -	#
> -	rm -rf $(BUILDDIR)
> -
> -	debconf-updatepo
> -	dh_clean -v
> -
> -
> -install: build
> +auto_install-stamp:
>  	@echo "RULES.$@"
>  	dh_testdir
>  	dh_testroot
> -	dh_clean -k
> -	dh_installdirs
> -
> +	
> +	# If TokuDB plugin was built
> +	# add it to the server install list.
> +	[ ! -f $(BUILDDIR)/usr/lib/mysql/plugin/ha_tokudb.so ] || echo 'usr/lib/mysql/plugin/ha_tokudb.so\netc/mysql/conf.d/tokudb.cnf\nusr/bin/tokuftdump\nusr/share/doc/mariadb-server-5.5/README-TOKUDB\nusr/share/doc/mariadb-server-5.5/README.md' >> debian/mariadb-server-5.5.install

Bad idea, you should never modify version controlled files from scripts.
Instead, there should be debian/mariadb-server-5.5.install.in file
and you copy it to debian/mariadb-server-5.5.install, appending whatever you
want. That would be a hack that works. A proper solution would be to let
cmake to create debian/mariadb-server-5.5.install from the *.in file
because cmake knows exactly whether tokudb is built and what files
needs to be installed. That's what the old code did.

> +	
>  	# some self written manpages which hopefully
>  	# gets overwritten sooner or later with upstreams
>  	mkdir -p $(TMP)/usr/share/man/man1/
> @@ -146,150 +141,66 @@
>  		| cut -d: -f 1 \
>  		| xargs --no-run-if-empty chrpath -d; \
>  	set -e
> -
> +	
>  	# libmysqlclient-dev: forgotten header file since 3.23.25?
>  	cp $(BUILDDIR)/include/my_config.h $(TMP)/usr/include/mysql/
>  	cp include/my_dir.h $(TMP)/usr/include/mysql/
> -
> -	# mysql-common: We provide our own version of this package for
> -	# completeness, but we can use an existing version; mariadb-specic
> -	# stuff is in mariadb-common
> -	install -d $(TMP)/etc/mysql
> -	install -m 0644 debian/additions/my.cnf $(TMP)/etc/mysql/my.cnf
> -
> +	
>  	# mariadb-common: MariaDB-specific config stuff.
>  	install -d $(TMP)/etc/mysql/conf.d
>  	install -m 0644 debian/additions/mariadb.cnf $(TMP)/etc/mysql/conf.d/mariadb.cnf
> -
> +	
>  	# mariadb-client
>  	install -m 0755 debian/additions/mysqlreport $(TMP)/usr/bin/
>  	install -m 0755 debian/additions/innotop/innotop $(TMP)/usr/bin/
>  	install -m 0644 debian/additions/innotop/innotop.1 $(TMP)/usr/share/man/man1/
> -
> +	
>  	# mariadb-server
> -	install -m 0755 $(BUILDDIR)/scripts/mysqld_safe $(TMP)/usr/bin/mysqld_safe
> -	mkdir -p $(TMP)/usr/share/doc/mariadb-server-5.5/examples
> -	# We have a sane my.cnf, cruft not needed (remove my-*.cnf and config-*.cnf)
> -	#  $(TMP)/usr/share/mysql/*cnf      $(TMP)/usr/share/doc/mariadb-server-5.5/examples/
> -	rm -vf $(TMP)/usr/share/mysql/my-*.cnf \
> -	       $(TMP)/usr/share/mysql/config-*.cnf \
> -	       $(TMP)/usr/share/mysql/mi_test_all* \
> +	rm -vf $(TMP)/usr/share/mysql/mi_test_all* \
>  	       $(TMP)/usr/share/mysql/mysql-log-rotate \
>  	       $(TMP)/usr/share/mysql/mysql.server \
>  	       $(TMP)/usr/share/mysql/binary-configure
>  	nm -n $(BUILDDIR)/sql/mysqld |gzip -9 > $(TMP)/usr/share/doc/mariadb-server-5.5/mysqld.sym.gz
> +	# Below didn't work, use more explicit command above
> +	# nm -n $(BUILDDIR)/sql/mysqld |gzip -9 > debian/mysqld.sym.gz
> +	mkdir -p $(TMP)/etc/mysql/conf.d/
>  	install -m 0755 debian/additions/echo_stderr $(TMP)/usr/share/mysql/
>  	install -m 0755 debian/additions/debian-start $(TMP)/etc/mysql/
>  	install -m 0755 debian/additions/debian-start.inc.sh $(TMP)/usr/share/mysql/
> -
> +	mkdir -p $(TMP)/usr/share/doc/mariadb-server-5.5
>  	install -m 0644 $(builddir)/Docs/INFO_SRC $(TMP)/usr/share/doc/mariadb-server-5.5/INFO_SRC
>  	install -m 0644 $(builddir)/Docs/INFO_BIN $(TMP)/usr/share/doc/mariadb-server-5.5/INFO_BIN
> -
> -	# mariadb-test
> -	mv $(TMP)/usr/mysql-test	$(TMP)/usr/share/mysql
> -
> -	# lintian overrides
> -	mkdir -p $(TMP)/usr/share/lintian/overrides/
> -	cp debian/mysql-common.lintian-overrides      $(TMP)/usr/share/lintian/overrides/mysql-common
> -	cp debian/mariadb-server-5.5.lintian-overrides $(TMP)/usr/share/lintian/overrides/mariadb-server-5.5
> -	cp debian/mariadb-client-5.5.lintian-overrides $(TMP)/usr/share/lintian/overrides/mariadb-client-5.5
> -
> -	# For 5.0 -> 5.5 transition
> -	d=$(TMP)/usr/share/mysql-common/internal-use-only/; \
> -	mkdir -p $$d; \
> -	cp debian/mariadb-server-5.5.mysql.init $$d/_etc_init.d_mysql; \
> -	cp debian/mariadb-server-5.5.mysql-server.logrotate $$d/_etc_logrotate.d_mysql-server; \
> -	cp debian/additions/debian-start $$d/_etc_mysql_debian-start;
> -
> +	
>  	# 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-5.5.py $(TMP)/usr/share/apport/package-hooks/source_mariadb-5.5.py
> +	
> +	# mariadb-test
> +	mv $(TMP)/usr/mysql-test $(TMP)/usr/share/mysql
> +	touch $@
>  
> -	autorm=debian/autorm-file;                                      \
> -	rm -f $$autorm;                                                 \
> -	ignore='';                                                      \
> -	for p in $$MARIADB_OPTIONAL_DEBS; do                            \
> -	  p=mariadb-$$p-5.5;                                            \
> -	  dh_movefiles --package=$$p || echo "../$$p*.deb" >> $$autorm; \
> -	  ignore="$$ignore --no-package=$$p";                           \
> -	done;                                                           \
> -	sh -c "dh_movefiles $$ignore"
> -
> -# Build architecture-independent files here.
> -binary-indep: build install
> -	@echo "RULES.binary-indep"
> -	dh_testdir -i
> -	dh_testroot -i
> -	dh_installdebconf -i
> -	dh_installdocs -i
> -	dh_installexamples -i
> -	dh_installmenu -i
> -	dh_installlogrotate -i
> -	dh_installinit -i
> -	dh_installcron -i 
> -	dh_installman -i
> -	dh_installinfo -i
> -	dh_installlogcheck -i
> -	dh_installchangelogs -i
> -	dh_link -i
> -	dh_compress -i
> -	dh_fixperms -i
> -	dh_installdeb -i
> -	dh_perl -i
> -	dh_gencontrol -i
> -	dh_md5sums -i
> -	dh_builddeb -i
> -
> -# Build architecture-dependent files here.
> -binary-arch: build install
> -	@echo "RULES.binary-arch"
> -	dh_testdir 
> -	dh_testroot
> +override_dh_installlogrotate-arch:
> +	dh_installlogrotate --name mysql-server

Why?

> +
> +# Start mysql in runlevel 19 before 20 where apache, proftpd etc gets
> +# started which might depend on a running database server.
> +override_dh_installinit-arch:
> +	dh_installinit --name=mysql -- defaults 19 21
>  
> -	dh_installdebconf -a
> -	dh_installdocs -a
> -	dh_installexamples -a
> -	dh_installmenu -a
> -	dh_installlogrotate -a --name mysql-server
> -	# Start mysql in runlevel 19 before 20 where apache, proftpd etc gets
> -	# started which might depend on a running database server.
> -	dh_installinit -a --name=mysql -- defaults 19 21
> -	dh_installcron -a --name mysql-server
> -	dh_installman -a
> -	dh_installinfo -a
> -	dh_installlogcheck -a
> -	dh_installchangelogs -a
> -	dh_strip -a
> -	dh_link -a	# .so muss nach .so.1.2.3 installier werden!
> -	dh_compress -a
> -	dh_fixperms -a
> -	dh_makeshlibs -a
> -	dh_makeshlibs -plibmariadbclient18 -V'libmariadbclient18 (>= 5.5.1-1)'
> -	dh_installdeb -a
> -	dh_perl -a
> -	dh_shlibdeps -a -l debian/libmariadbclient18/usr/lib -L libmariadbclient18
> -	dh_gencontrol -a
> -	dh_md5sums -a
> -	dh_builddeb -a
> +override_dh_installcron-arch:
> +	dh_installcron --name mysql-server

why?

>  
> -source diff:
> -	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
> +override_dh_builddeb:
> +	dh_builddeb -- -Zxz

why xz?

>  
>  binary:	binary-indep binary-arch
>  
>  get-orig-source:
> -	@wget -nv -T10 -t3 \
> -	  -O /tmp/mysql-$(DEB_UPSTREAM_VERSION).tar.gz \
> -	  http://ftp.gwdg.de/pub/misc/mysql/Downloads/MySQL-$(DEB_UPSTREAM_VERSION_MAJOR_MINOR)/mysql-$(DEB_UPSTREAM_VERSION).tar.gz
> -	@tar xfz /tmp/mysql-$(DEB_UPSTREAM_VERSION).tar.gz -C /tmp
> -	@rm -rf /tmp/mysql-$(DEB_UPSTREAM_VERSION)/Docs
> -	@rm -rf /tmp/mysql-$(DEB_UPSTREAM_VERSION)/debian
> -	@mv /tmp/mysql-$(DEB_UPSTREAM_VERSION) /tmp/$(DEB_SOURCE_PACKAGE)-$(DEB_UPSTREAM_VERSION).orig
> -	@cd /tmp ; tar czf $(DEB_SOURCE_PACKAGE)_$(DEB_UPSTREAM_VERSION).orig.tar.gz $(DEB_SOURCE_PACKAGE)-$(DEB_UPSTREAM_VERSION).orig
> -	@rm -f /tmp/mysql-$(DEB_UPSTREAM_VERSION).tar.gz
> -	@rm -rf /tmp/$(DEB_SOURCE_PACKAGE)-$(DEB_UPSTREAM_VERSION).orig
> +	uscan --force-download --verbose

Why this target exists here at all?

>  
> -.PHONY: clean clean-patched configure build binary binary-indep binary-arch install patch unpatch
> +%:
> +	dh $@ --parallel

Really? I've understood that the rules file has to support
it by understanding DEB_BUILD_OPTIONS=parallel

>  
>  # vim: ts=8
> === added file 'debian/control'
> --- debian/control	1970-01-01 00:00:00 +0000
> +++ debian/control	2014-07-24 08:02:44 +0000
> @@ -0,0 +1,259 @@
> +Source: mariadb-5.5
> +Section: database
> +Priority: optional
> +Maintainer: Debian MySQL Maintainers <pkg-mysql-maint@xxxxxxxxxxxxxxxxxxxxxxx>

Eh. for our packages we're the maintainer.

> +Uploaders: Otto Kekäläinen <otto@xxxxxxxxx>,
> +           Clint Byrum <clint@xxxxxxxxxx>,
> +           James Page <jamespage@xxxxxxxxxx>

And uploaders too. Not Clint and James.

> +Build-Depends: bison,
> +               chrpath,
> +               cmake,
> +               debhelper (>= 9),
> +               dh-apparmor,
> +               hardening-wrapper,
> +               libaio-dev [linux-any],
> +               libjemalloc-dev [linux-any],
> +               libncurses5-dev (>= 5.0-6),
> +               libpam0g-dev,
> +               libreadline-gplv2-dev,
> +               libssl-dev,
> +               libwrap0-dev (>= 7.6-8.3),
> +               lsb-release,
> +               perl,
> +               po-debconf,
> +               psmisc,
> +               zlib1g-dev (>= 1:1.1.3-5)
> +Standards-Version: 3.9.5
> +Homepage: http://mariadb.org/
> +Vcs-Git: git://git.debian.org/git/pkg-mysql/mariadb-5.5.git
> +Vcs-Browser: http://git.debian.org/?p=pkg-mysql/mariadb-5.5.git

At the moment 5.5 and 10.0 are still in bzr.
And we never build from the repository anyway.

> +
> +Package: libmariadbclient18
> +Section: libs
> +Architecture: any
> +Depends: mariadb-common, ${misc:Depends}, ${shlibs:Depends}
> +Pre-Depends: multiarch-support, ${misc:Pre-Depends}
> +Conflicts: mariadb-galera-server-5.5 (<< 5.5.33),
> +           mariadb-server-5.1,
> +           mariadb-server-5.2,
> +           mariadb-server-5.3,
> +           mariadb-server-5.5 (<< 5.5.33)
> +Multi-Arch: same
> +Description: MariaDB database client library
> + MariaDB is a fast, stable and true multi-user, multi-threaded SQL database
> + server. SQL (Structured Query Language) is the most popular database query
> + language in the world. The main goals of MariaDB are speed, robustness and
> + ease of use.
> + .
> + This package includes the client library.

There is no libmysqlclient18 package. And libmariadbclient18 doesn't
provide it. How is it a drop-in replacement?

> +
> +Package: libmariadbd-dev
> +Architecture: any
> +Section: libdevel
> +Pre-Depends: multiarch-support
> +Depends: libmariadbclient-dev (>= ${source:Version}),
> +         ${misc:Depends},
> +         ${shlibs:Depends}
> +Breaks: libmysqld-dev
> +Replaces: libmysqld-dev
> +Provides: libmysqld-dev
> +Description: MariaDB embedded database development files
> + MariaDB is a fast, stable and true multi-user, multi-threaded SQL database
> + server. SQL (Structured Query Language) is the most popular database query
> + language in the world. The main goals of MariaDB are speed, robustness and
> + ease of use.
> + .
> + This package includes the embedded server library and header files.
> +
> +Package: libmariadbclient-dev
> +Architecture: any
> +Section: libdevel
> +Depends: libmariadbclient18 (= ${binary:Version}),
> +         zlib1g-dev,
> +         ${misc:Depends},
> +         ${shlibs:Depends}
> +Breaks: libmysqlclient-dev
> +Replaces: libmysqlclient-dev
> +Provides: libmysqlclient-dev
> +Description: MariaDB database development files
> + MariaDB is a fast, stable and true multi-user, multi-threaded SQL database
> + server. SQL (Structured Query Language) is the most popular database query
> + language in the world. The main goals of MariaDB are speed, robustness and
> + ease of use.
> + .
> + This package includes development libraries and header files.
> +
> +Package: mariadb-common
> +Architecture: all
> +Depends: mysql-common, ${misc:Depends}
> +Multi-Arch: foreign
> +Description: MariaDB common metapackage
> + MariaDB is a fast, stable and true multi-user, multi-threaded SQL database
> + server. SQL (Structured Query Language) is the most popular database query
> + language in the world. The main goals of MariaDB are speed, robustness and
> + ease of use.
> + .
> + This empty metapackage makes the introduction on MariaDB specific
> + configurationfiles easier at any later time.

Eh, sorry. We do have mariadb specific conf files.
And we cannot have mariadb-common depending on mysql-common, they
have conflicting files.

> +
> +Package: mariadb-client-core-5.5
> +Architecture: any
> +Depends: libmariadbclient18 (>= ${source:Version}),
> +         mariadb-common,
> +         ${misc:Depends},
> +         ${shlibs:Depends}
> +Conflicts: mysql-client-5.5, mysql-client-5.6
> +Breaks: mysql-client-core-5.5, mysql-client-core-5.6, virtual-mysql-client-core
> +Replaces: mysql-client-core-5.5,
> +          mysql-client-core-5.6,
> +          virtual-mysql-client-core
> +Provides: virtual-mysql-client-core
> +Description: MariaDB database core client binaries
> + MariaDB is a fast, stable and true multi-user, multi-threaded SQL database
> + server. SQL (Structured Query Language) is the most popular database query
> + language in the world. The main goals of MariaDB are speed, robustness and
> + ease of use.
> + .
> + This package includes the core client files, as used by Akonadi.
> +
> +Package: mariadb-client-5.5
> +Architecture: any
> +Depends: debianutils (>=1.6),
> +         libdbi-perl,
> +	 libterm-readkey-perl,
> +         mariadb-client-core-5.5 (>= ${source:Version}),
> +         ${misc:Depends},
> +         ${perl:Depends},
> +         ${shlibs:Depends}
> +Recommends: libdbd-mysql-perl (>= 1.2202)
> +Suggests: libterm-readkey-perl
> +Conflicts: mysql-client-core-5.5, mysql-client-core-5.6
> +Breaks: mysql-client, mysql-client-5.5, mysql-client-5.6, virtual-mysql-client
> +Replaces: mysql-client, mysql-client-5.5, mysql-client-5.6, virtual-mysql-client
> +Provides: virtual-mysql-client
> +Description: MariaDB database client binaries
> + MariaDB is a fast, stable and true multi-user, multi-threaded SQL database
> + server. SQL (Structured Query Language) is the most popular database query
> + language in the world. The main goals of MariaDB are speed, robustness and
> + ease of use.
> + .
> + This package includes the client binaries and the additional tools
> + innotop and mysqlreport.
> +
> +Package: mariadb-server-core-5.5
> +Architecture: any
> +Depends: mariadb-common, ${misc:Depends}, ${shlibs:Depends}
> +Conflicts: mariadb-galera-server-5.5, mysql-server-5.5, mysql-server-5.6
> +Breaks: mysql-server-core-5.5, mysql-server-core-5.6, virtual-mysql-server-core
> +Replaces: mysql-server-core-5.5,
> +          mysql-server-core-5.6,
> +          virtual-mysql-server-core
> +Provides: virtual-mysql-server-core
> +Description: MariaDB database core server files
> + MariaDB is a fast, stable and true multi-user, multi-threaded SQL database
> + server. SQL (Structured Query Language) is the most popular database query
> + language in the world. The main goals of MariaDB are speed, robustness and
> + ease of use.
> + .
> + This package includes the core server files, as used by Akonadi.
> +
> +Package: mariadb-test-5.5
> +Architecture: any
> +Depends: mariadb-client-5.5 (>= ${source:Version}),
> +         mariadb-server-5.5 (>= ${source:Version}),
> +         ${misc:Depends},
> +         ${shlibs:Depends}
> +Breaks: mariadb-test (<< ${source:Version}),
> +        mysql-testsuite,
> +        mysql-testsuite-5.5,
> +        mysql-testsuite-5.6,
> +        virtual-mysql-testsuite
> +Replaces: mariadb-test (<< ${source:Version}),
> +          mysql-testsuite,
> +          mysql-testsuite-5.5,
> +          mysql-testsuite-5.6,
> +          virtual-mysql-testsuite
> +Provides: virtual-mysql-testsuite
> +Suggests: patch
> +Description: MariaDB database regression test suite
> + MariaDB is a fast, stable and true multi-user, multi-threaded SQL database
> + server. SQL (Structured Query Language) is the most popular database query
> + language in the world. The main goals of MariaDB are speed, robustness and
> + ease of use.
> + .
> + This package includes the regression test suite.
> +
> +Package: mariadb-server-5.5
> +Architecture: any
> +Suggests: mailx, mariadb-test, tinyca
> +Recommends: libhtml-template-perl
> +Pre-Depends: adduser (>= 3.40), debconf, mariadb-common
> +Depends: libdbi-perl,
> +         lsb-base (>= 3.0-10),
> +         mariadb-client-5.5 (>= ${source:Version}),
> +         mariadb-server-core-5.5 (>= ${binary:Version}),
> +         passwd,
> +         perl (>= 5.6),
> +         psmisc,
> +         ${misc:Depends},
> +         ${shlibs:Depends}
> +Conflicts: mariadb-tokudb-engine-10.0,
> +           mariadb-tokudb-engine-5.5,
> +           mysql-server-core-5.5,
> +           mysql-server-core-5.6
> +Breaks: mariadb-galera-server,
> +        mariadb-galera-server-5.5,
> +        mariadb-tokudb-engine-10.0,
> +        mariadb-tokudb-engine-5.5,
> +        mysql-server,
> +        mysql-server-5.5,
> +        mysql-server-5.6,
> +        virtual-mysql-server
> +Replaces: mariadb-galera-server,
> +          mariadb-galera-server-5.5,
> +          mariadb-tokudb-engine-10.0,
> +          mariadb-tokudb-engine-5.5,
> +          mysql-server,
> +          mysql-server-5.5,
> +          mysql-server-5.6,
> +          virtual-mysql-server
> +Provides: virtual-mysql-server
> +Description: MariaDB database server binaries
> + MariaDB is a fast, stable and true multi-user, multi-threaded SQL database
> + server. SQL (Structured Query Language) is the most popular database query
> + language in the world. The main goals of MariaDB are speed, robustness and
> + ease of use.
> + .
> + This package includes the server binaries.
> +
> +Package: mariadb-server
> +Architecture: all
> +Depends: mariadb-server-5.5 (>= ${source:Version}), ${misc:Depends}
> +Description: MariaDB database server (metapackage depending on the latest version)
> + This is an empty package that depends on the current "best" version of
> + mariadb-server (currently mariadb-server-5.5), as determined by the MariaDB
> + maintainers. Install this package if in doubt about which MariaDB
> + version you need. That will install the version recommended by the
> + package maintainers.
> + .
> + MariaDB is a fast, stable and true multi-user, multi-threaded SQL database
> + server. SQL (Structured Query Language) is the most popular database query
> + language in the world. The main goals of MariaDB are speed, robustness and
> + ease of use.
> +
> +Package: mariadb-client
> +Architecture: all
> +Depends: mariadb-client-5.5 (>= ${source:Version}), ${misc:Depends}
> +Description: MariaDB database client (metapackage depending on the latest version)
> + This is an empty package that depends on the current "best" version of
> + mariadb-client (currently mariadb-client-5.5), as determined by the MariaDB
> + maintainers.  Install this package if in doubt about which MariaDB version
> + you want, as this is the one considered to be in the best shape.
> +
> +Package: mariadb-test
> +Architecture: all
> +Depends: mariadb-test-5.5 (>= ${source:Version}), ${misc:Depends}
> +Description: MariaDB database regression test suite (metapackage for the latest version)
> + This is an empty package that depends on the current "best" version of
> + mariadb-test (currently mariadb-test-5.5), as determined by the MariaDB
> + maintainers.
> 
> === added file 'debian/mariadb-server-5.5.postinst'
> --- debian/mariadb-server-5.5.postinst	1970-01-01 00:00:00 +0000
> +++ debian/mariadb-server-5.5.postinst	2014-07-24 08:02:44 +0000
> @@ -0,0 +1,267 @@
> +#!/bin/bash -e
> +
> +. /usr/share/debconf/confmodule
> +
> +if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi
> +${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 }
> +
> +export PATH=$PATH:/sbin:/usr/sbin:/bin:/usr/bin
> +
> +# This command can be used as pipe to syslog. With "-s" it also logs to stderr.
> +ERR_LOGGER="logger -p daemon.err -t mysqld_safe -i"
> +# This will make an error in a logged command immediately apparent by aborting
> +# the install, rather than failing silently and leaving a broken install.
> +set -o pipefail
> +
> +invoke() {
> +  if [ -x /usr/sbin/invoke-rc.d ]; then
> +    invoke-rc.d mysql $1
> +  else
> +    /etc/init.d/mysql $1
> +  fi
> +}
> +
> +MYSQL_BOOTSTRAP="/usr/sbin/mysqld --bootstrap --user=mysql --skip-grant-tables --loose-innodb=OFF --default-storage-engine=myisam"
> +

This needs a comment: See if we can login as root without a password
Alternatively the function can be renamed to, say,
test_passwordless_root_login

> +test_mysql_access() {
> +       mysql --no-defaults -u root -h localhost </dev/null >/dev/null 2>&1
> +}
> +
> +# call with $1 = "online" to connect to the server, otherwise it bootstraps
> +set_mysql_rootpw() {
> +       # forget we ever saw the password.  don't use reset to keep the seen status
> +       db_set mysql-server/root_password ""
> +
> +       tfile=`mktemp`
> +       if [ ! -f "$tfile" ]; then
> +               return 1
> +       fi
> +
> +       # this avoids us having to call "test" or "[" on $rootpw
> +       cat << EOF > $tfile
> +USE mysql;
> +UPDATE user SET password=PASSWORD("$rootpw") WHERE user='root';
> +FLUSH PRIVILEGES;
> +EOF
> +       if grep -q 'PASSWORD("")' $tfile; then
> +               retval=0
> +       elif [ "$1" = "online" ]; then
> +               mysql --no-defaults -u root -h localhost <$tfile >/dev/null
> +               retval=$?
> +       else
> +               $MYSQL_BOOTSTRAP <$tfile
> +               retval=$?
> +       fi
> +       rm -f $tfile
> +       return $retval
> +}
> +
> +# This is necessary because mysql_install_db removes the pid file in /var/run
> +# and because changed configuration options should take effect immediately.
> +# In case the server wasn't running at all it should be ok if the stop
> +# script fails. I can't tell at this point because of the cleaned /var/run.
> +set +e; invoke stop; set -e
> +
> +case "$1" in
> +  configure)
> +    mysql_datadir=/usr/share/mysql
> +    mysql_statedir=/var/lib/mysql
> +    mysql_rundir=/var/run/mysqld
> +    mysql_logdir=/var/log
> +    mysql_cfgdir=/etc/mysql
> +    mysql_newlogdir=/var/log/mysql
> +    mysql_upgradedir=/var/lib/mysql-upgrade
> +
> +    # first things first, if the following symlink exists, it is a preserved
> +    # copy the old data dir from a mysql upgrade that would have otherwise
> +    # been replaced by an empty mysql dir.  this should restore it.
> +    for dir in DATADIR LOGDIR; do
> +        if [ "$dir" = "DATADIR" ]; then targetdir=$mysql_statedir; else targetdir=$mysql_newlogdir; fi
> +        savelink="$mysql_upgradedir/$dir.link"
> +        if [ -L "$savelink" ]; then
> +            # If the targetdir was a symlink before we upgraded it is supposed
> +            # to be either still be present or not existing anymore now.
> +            if [ -L "$targetdir" ]; then
> +                rm "$savelink"
> +            elif [ ! -d "$targetdir" ]; then
> +                mv "$savelink" "$targetdir"
> +            else
> +                # this should never even happen, but just in case...
> +                mysql_tmp=`mktemp -d -t mysql-symlink-restore-XXXXXX`
> +                echo "this is very strange!  see $mysql_tmp/README..." >&2
> +                mv "$targetdir" "$mysql_tmp"
> +                cat << EOF > "$mysql_tmp/README"
> +
> +if you're reading this, it's most likely because you had replaced /var/lib/mysql
> +with a symlink, then upgraded to a new version of mysql, and then dpkg
> +removed your symlink (see #182747 and others).  the mysql packages noticed
> +that this happened, and as a workaround have restored it.  however, because
> +/var/lib/mysql seems to have been re-created in the meantime, and because
> +we don't want to rm -rf something we don't know as much about, we are going
> +to leave this unexpected directory here.  If your database looks normal,
> +and this is not a symlink to your database, you should be able to blow
> +this all away.
> +
> +EOF
> +            fi
> +        fi
> +	rmdir $mysql_upgradedir 2>/dev/null || true
> +    done
> +
> +    # Ensure the existence and right permissions for the database and
> +    # log files.
> +    if [ ! -d "$mysql_statedir"       -a ! -L "$mysql_statedir"       ]; then mkdir "$mysql_statedir"; fi
> +    if [ ! -d "$mysql_statedir/mysql" -a ! -L "$mysql_statedir/mysql" ]; then mkdir "$mysql_statedir/mysql"; fi
> +    if [ ! -d "$mysql_newlogdir"      -a ! -L "$mysql_newlogdir"      ]; then mkdir "$mysql_newlogdir"; fi
> +    # When creating an ext3 jounal on an already mounted filesystem like e.g.
> +    # /var/lib/mysql, you get a .journal file that is not modifyable by chown.
> +    # The mysql_datadir must not be writable by the mysql user under any
> +    # circumstances as it contains scripts that are executed by root.
> +    set +e
> +    chown -R 0:0 $mysql_datadir
> +    chown -R mysql $mysql_statedir
> +    chown -R mysql:adm $mysql_newlogdir;	chmod 2750 $mysql_newlogdir;
> +    for i in log err; do
> +      touch             $mysql_logdir/mysql.$i
> +      chown mysql:adm   $mysql_logdir/mysql.$i
> +      chmod 0640        $mysql_logdir/mysql.$i
> +    done
> +    set -e
> +
> +    # This is important to avoid dataloss when there is a removed
> +    # mysql-server version from Woody lying around which used the same
> +    # data directory and then somewhen gets purged by the admin.
> +    db_set mysql-server/postrm_remove_database false || true

What does that mean? I don't understand the comment and don't see
how this line can help with anything, as postrm_remove_database isn't
used anywhere.

> +
> +    # To avoid downgrades.
> +    touch $mysql_statedir/debian-5.5.flag

I believe preinst has done that already

> +
> +    # initiate databases. Output is not allowed by debconf :-(
> +    # This will fail if we are upgrading an existing database; in this case
> +    # mysql_upgrade, called from the /etc/init.d/mysql start script, will
> +    # handle things.
> +    # Debian: beware of the bashisms... 
> +    # Debian: can safely run on upgrades with existing databases 
> +    set +e
> +    bash /usr/bin/mysql_install_db --rpm --user=mysql 2>&1 | $ERR_LOGGER
> +    set -e
> +    
> +    ## On every reconfiguration the maintenance user is recreated.
> +    #
> +    # - It is easier to regenerate the password every time but as people
> +    #   use fancy rsync scripts and file alteration monitors, the existing
> +    #   password is used and existing files not touched.
> +    # - The mysqld statement is like that in mysql_install_db because the
> +    #   server is not already running. This has some implications:
> +    # 	- The amount of newlines and semicolons in the query is important!
> +    #   - GRANT is not possible with --skip-grant-tables and "INSERT
> +    #     (user,host..) VALUES" is not --ansi compliant
> +    # - The echo is just for readability. ash's buildin has no "-e" so use /bin/echo.
> +    # - The Super_priv, Show_db_priv, Create_tmp_table_priv and Lock_tables_priv
> +    #   may not be present as old Woody 3.23 databases did not have it and the
> +    #   admin might not already have run mysql_upgrade which adds them.
> +    #   As the binlog cron scripts to need at least the Super_priv, I do first
> +    #   the old query which always succeeds and then the new which may or may not.
> +
> +    # recreate the credentials file if not present or without mysql_upgrade stanza
> +    dc=$mysql_cfgdir/debian.cnf; 
> +    if [ -e "$dc" -a -n "`fgrep mysql_upgrade $dc 2>/dev/null`" ]; then
> +        pass="`sed -n 's/^[     ]*password *= *// p' $dc | head -n 1`"
> +    else
> +	pass=`perl -e 'print map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..16)'`;
> +        if [ ! -d "$mysql_cfgdir" ]; then install -o 0 -g 0 -m 0755 -d $mysql_cfgdir; fi
> +        cat /dev/null > $dc
> +        echo "# Automatically generated for Debian scripts. DO NOT TOUCH!" >>$dc
> +        echo "[client]"                                                    >>$dc
> +        echo "host     = localhost"                                        >>$dc
> +        echo "user     = debian-sys-maint"                                 >>$dc
> +        echo "password = $pass"                                            >>$dc
> +        echo "socket   = $mysql_rundir/mysqld.sock"                        >>$dc
> +        echo "[mysql_upgrade]"                                             >>$dc
> +        echo "host     = localhost"                                        >>$dc
> +        echo "user     = debian-sys-maint"                                 >>$dc
> +        echo "password = $pass"                                            >>$dc
> +        echo "socket   = $mysql_rundir/mysqld.sock"                        >>$dc
> +        echo "basedir  = /usr"                                             >>$dc
> +    fi
> +    # If this dir chmod go+w then the admin did it. But this file should not.
> +    chown 0:0 $dc
> +    chmod 0600 $dc
> +
> +    # update privilege tables
> +    password_column_fix_query=`/bin/echo -e \
> +        "USE mysql\n" \
> +        "ALTER TABLE user CHANGE Password Password char(41) character set latin1 collate latin1_bin DEFAULT '' NOT NULL"`;
> +    replace_query=`/bin/echo -e \
> +        "USE mysql\n" \
> +        "SET sql_mode='';\n" \
> +        "REPLACE INTO user SET " \
> +        "  host='localhost', user='debian-sys-maint', password=password('$pass'), " \
> +        "  Select_priv='Y', Insert_priv='Y', Update_priv='Y', Delete_priv='Y', " \
> +        "  Create_priv='Y', Drop_priv='Y', Reload_priv='Y', Shutdown_priv='Y', " \
> +        "  Process_priv='Y',  File_priv='Y', Grant_priv='Y', References_priv='Y', " \
> +        "  Index_priv='Y', Alter_priv='Y', Super_priv='Y', Show_db_priv='Y', "\
> +        "  Create_tmp_table_priv='Y', Lock_tables_priv='Y', Execute_priv='Y', "\
> +        "  Repl_slave_priv='Y', Repl_client_priv='Y', Create_view_priv='Y', "\
> +        "  Show_view_priv='Y', Create_routine_priv='Y', Alter_routine_priv='Y', "\
> +        "  Create_user_priv='Y', Event_priv='Y', Trigger_priv='Y',"\
> +        "  ssl_cipher='', x509_issuer='', x509_subject='';"`;
> +    # Engines supported by etch should be installed per default. The query sequence is supposed
> +    # to be aborted if the CREATE TABLE fails due to an already existent table in which case the
> +    # admin might already have chosen to remove one or more plugins. Newlines are necessary.
> +    install_plugins=`/bin/echo -e \
> +        "USE mysql;\n" \
> +        "CREATE TABLE IF NOT EXISTS plugin (name char(64) COLLATE utf8_bin NOT NULL DEFAULT '', " \
> +        "  dl char(128) COLLATE utf8_bin NOT NULL DEFAULT '', " \
> +        "  PRIMARY KEY (name)) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='MySQL plugins';" `

Eh, there's mysql_upgrade and mysql_fix_privilege_tables.sql, etc
Why part of it has to be hard-coded in the debian scripts?

> +
> +    # Upgrade password column format before the root password gets set.
> +    echo "$password_column_fix_query"                        | $MYSQL_BOOTSTRAP 2>&1 | $ERR_LOGGER
> +
> +    db_get mysql-server/root_password && rootpw="$RET"
> +    if ! set_mysql_rootpw; then
> +        password_error="yes"
> +    fi
> +
> +    set +e
> +    echo "$replace_query"                                    | $MYSQL_BOOTSTRAP 2>&1 | $ERR_LOGGER
> +    echo "$install_plugins"                                  | $MYSQL_BOOTSTRAP 2>&1 | $ERR_LOGGER
> +    set -e
> +  ;;
> +
> +  abort-upgrade|abort-remove|abort-configure)
> +  ;;
> +
> +  *)
> +    echo "postinst called with unknown argument '$1'" 1>&2
> +    exit 1
> +  ;;
> +esac
> +
> +# here we check to see if we can connect as root without a password
> +# this should catch upgrades from previous versions where the root
> +# password wasn't set.  if there is a password, or if the connection
> +# fails for any other reason, nothing happens.
> +if [ "$1" = "configure" ]; then
> +       if test_mysql_access; then
> +               db_input medium mysql-server/root_password || true
> +               db_go
> +               db_get mysql-server/root_password && rootpw="$RET"
> +
> +               if ! set_mysql_rootpw "online"; then
> +                       password_error="yes"
> +               fi
> +       fi
> +
> +       if [ "$password_error" = "yes" ]; then
> +               db_input high mysql-server/error_setting_password || true
> +               db_go
> +       fi
> +
> +fi
> +
> +db_stop # in case invoke failes
> +
> +#DEBHELPER#
> +
> +exit 0
> 
> === added file 'debian/libmariadbclient18.symbols'
> --- debian/libmariadbclient18.symbols	1970-01-01 00:00:00 +0000
> +++ debian/libmariadbclient18.symbols	2014-07-24 08:02:44 +0000
> @@ -0,0 +1,374 @@
> +dialog.so libmaysqlclient18 #MINVER#

I doubt that plugins should be here at all, one isn't supposed to link
with them

> + _mysql_client_plugin_declaration_@Base 5.5.35
> + get_tty_password_buff@Base 5.5.35
> +libmaysqlclient.so.18 libmaysqlclient18 #MINVER#
> + THR_KEY_mysys@libmysqlclient_16 5.5.36

All @libmysqlclient_16 symbols should have 5.1.x version,
may be 5.3.x, but not 5.5.x

And I'll need to see whether we can make the maintenance of this file
less error-prone. Manually updating it for every symbol isn't going to work.

> + THR_KEY_mysys@libmysqlclient_18 5.5.36
> + alloc_dynamic@libmysqlclient_18 5.5.37
> + alloc_root@libmysqlclient_18 5.5.37

Follow ups

References