## 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-10.0.git

Alternatively use Github mirror at https://github.com/ottok/mariadb-10.0.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-10.0
  cd mariadb-10.0
  git init
  git branch upstream
  git-import-orig --pristine-tar ../../upstream/mariadb-10.0.8

Fill in values prompted
  What will be the source package name? [mariadb] mariadb-10.0
  What is the upstream version? [10.0.8]

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-10.0
  uscan --verbose

Enter git repostitory path and apply new sources
  cd mariadb-10.0
  git-import-orig --pristine-tar ../mariadb-10.0.10.tar.gz

Generate new debian/changelog entry
  dch -v 10.0.10-1 -D unstable

Manually merge what needs to be done

Commit and push
  git commit -am "Merged with upstream 10.0.10"
  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@github.com:ottok/mariadb-10.0.git


### Maintaining symbols file for libmariadbclient18 et al ###

Update symbols file:
  dpkg-gensymbols -plibmariadbclient18 -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/libmariadbclient.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@seravo.fi"
  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

