Bug 5917 : Fix for xgettext.pl
[koha.git] / debian / build-git-snapshot
blob476871928c8815dbe6c57533c99c97810b231ea8
1 #!/bin/sh
3 # This script will build a .deb from a git snapshot of koha.
4 # Don't use it for building actual versions for uploading to Debian.
6 # To use:
7 # - commit any changes into git
8 # - run this script
10 set -e
12 die()
14 echo "$@"
15 exit 1
18 everything_is_commited()
20 if git status --short | grep -q '^'
21 then
22 return 1
23 else
24 return 0
28 latest_sha1() {
29 git rev-parse --short=8 HEAD
32 newversion() {
33 printf '3.3-1~git%s.%s' $(date +%Y%m%d%H%M%S) $(latest_sha1)
36 adjust_debian_changelog() {
37 dch --force-distribution -D squeeze-dev -v "$1" \
38 "Building git snapshot."
39 dch -r "Building git snapshot."
42 reset_debian_changelog() {
43 git checkout -- debian/changelog
46 build_package() {
47 git archive --format=tar --prefix="koha-$1/" HEAD |
48 gzip -9 > "../koha_$1.tar.gz"
49 pdebuild $2
52 if ! everything_is_commited
53 then
54 die "cannot build: uncommited changes"
57 version="$(newversion)"
58 if [ -n "$1" ]
59 then
60 pdebuildopts="--buildresult $1"
62 adjust_debian_changelog "$version"
63 build_package "$version" "$pdebuildopts"
64 reset_debian_changelog