This describes what to do for an release!

= Info =

Following shell expansions are used in this document:
 ~e           .. source of libelektra
 ~build       .. the build directory
 ~elektra     .. the directory above ~e and ~build
 ~elektra-ftp .. where ftp files go to
 ~elektra-doc .. where doc flies go to


= TODO =

- make sure no TODO is in this file (resolve them first!)


= Cleanup =

For the first few steps you have to work on branch master:
 git-checkout master

If any feature branch is left over merge it:
 git-merge --no-ff feature

And now commit everything:
 git-commit -a

Clean up the mess left over:
 git-clean -df

Make an empty builddirectory:
 mkdir ~build


== Check ==

Try to move as much as possible from this manual checks to build-server!

Before release is done, following must be checked:
- Everything blue on http://community.markus-raab.org:8080/

If version numbers are correct in
- CMakeLists.txt

Rebuild cleanly, run all tests and also check for memleaks:
  cd ~build && ~e/scripts/configure-debian ~e && make -j5 && make run_all && make run_memcheck

Check if there are really >=91 or >=68 tests

Check if [doc/todo/API] is fulfilled


= Preperation =

Set environment variable VERSION to current version (assumed its already locally installed) to make the
commands below work for copy&paste:

 export VERSION=`kdb get system/elektra/version/constants/KDB_VERSION`


== Tag the version ==

 git tag --sign -f $VERSION -m "Release $VERSION"


== Prepare Source Package ==

Build tar.gz:
 cd ~build && make source-package

Check if tar is reproduceable + sign it:
 gpg --sign elektra-$VERSION.tar.gz

Unpack + compile (with all available plugins) + test those sources:
 tar xvzf elektra-$VERSION.tar.gz && mkdir build
 cd ~build/build && ~e/scripts/configure-debian ../elektra-$VERSION && make -j5 && make run_all && make run_memcheck

Now copy the packages to ftp:
 cp ~build/elektra-$VERSION.tar.gz* ~elektra-ftp/releases


== Debian Package ==

export DVERSION=$VERSION-1

Build deb:
 cd ~e && git-checkout debian
 git-merge --no-ff master -m "Merge for debian release $DVERSION"

 dch --newversion $DVERSION "New upstream version."
 git-add debian/changelog
 git-commit -m "Debian Package $DVERSION (UNRELEASED)"

UNRELEASED -> unstable

 dch --release $DVERSION "New upstream version"
 git-add debian/changelog
 git-commit -m "Debian Package $DVERSION"

Fix debian/ + document in NEWS what maintainer need to consider, then build the package:
 cp ~elektra-ftp/releases/elektra-$VERSION.tar.gz ~elektra/elektra_$VERSION.orig.tar.gz
 git-buildpackage -rfakeroot -k0B2F0DDC -sa

Now move and install:
 cd ~elektra && mkdir deb/$DVERSION
 mv elektra_$DVERSION* deb/$DVERSION && mv *.deb deb/$DVERSION && mv elektra_$VERSION.orig.tar.gz deb/$DVERSION/
 sudo dpkg -i deb/$DVERSION/*`dpkg-architecture -qDEB_BUILD_ARCH`.deb


Run some basic commands, at least:
 kdb --version
 kdb qt-gui
 strace kdb mount file.ecf user/release_test
 strace kdb file user/release_test/b
 strace kdb set user/release_test/b
 strace kdb get user/release_test/b
 strace kdb rm user/release_test/b


Run local tests:
 kdb run_all
 KDB=kdb kdb run_all
 KDB=kdb-static kdb run_all

Install libelektra-test of the previous version and run again:
 CHECK_VERSION=NO kdb run_all


== Test external tools ==


Check if tools based on elektra still do:
 dq

Run unit-tests in-source again (because some use installed Elektra):
 make run_all


== Test external test suites ==

#https://github.com/oyranos-cms/oyranos/blob/master/src/tests/test2.cpp#L185
#https://github.com/oyranos-cms/oyranos/blob/master/src/liboyranos_config/oyranos_elektra.c#L195

git clone git@github.com:oyranos-cms/oyranos.git
cd oyranos
mkdir build
cd build
cmake ..
make -j5
make test2 # or make test-2 for the most of the tests
src/tests/test2 Elektra


== Documentation ==

And the API docu:
 mkdir ~elektra-doc/api/$VERSION/
 cd ~build && cmake -DBUILD_PDF=ON . && rm -rf doc && make html man && cp -ra doc/html doc/latex doc/man ~elektra-doc/api/$VERSION/

Symlink current to latest version and add everything:
 cd ~elektra-doc/api/ && rm current && ln -s $VERSION current && git-add current $VERSION && git-commit -a -m "$VERSION Release"




= Publish =

== Debian Package ==

 cd ~elektra/deb/$DVERSION && reprepro --ignore=wrongdistribution include wheezy elektra_${DVERSION}_`dpkg-architecture -qDEB_BUILD_ARCH`.changes && update-reprepro

== Commit source package ==

Commit elektra-ftp:
 cd ~elektra-ftp && git-add releases/elektra-$VERSION.tar.gz* && git-commit -a -m "Release $VERSION"


== push ==

Now we know that everything worked well:

Now push release branch with tags to github:
 cd ~e && git-push && git-push --tags

Push elektra-ftp:
 cd ~elektra-ftp && git push && git push github

Push elektra-doc to github:
 cd ~elektra-doc && git push && git push github


== Announce ==

Finish NEWS.md for new release (hashsum, add links where to download release, check them):
 editor doc/NEWS.md

Add entry for release at main page
 editor README.md

Finally check links and send out mail to list
(Personal notice: see also NOTIFY)
