s3-waf: enable nss_winbind in make test for nss_wrapper.
[amitay/samba.git] / script / librelease.sh
1 #!/bin/bash
2 # make a release of a Samba library
3
4 GPG_USER='Samba Library Distribution Key <samba-bugs@samba.org>'
5
6 if [ ! -d ".git" ]; then
7         echo "Run this script from the top-level directory in the"
8         echo "repository"
9         exit 1
10 fi
11
12 if [ $# -lt 1 ]; then
13     echo "Usage: librelease.sh <LIBNAMES>"
14     exit 1
15 fi
16
17
18 release_lib() {
19     lib="$1"
20     srcdir="$2"
21
22     pushd $srcdir
23
24     echo "Releasing library $lib"
25
26     echo "building release tarball"
27     tgzname=$(make dist 2>&1 | grep ^Created | cut -d' ' -f2)
28     [ -f "$tgzname" ] || {
29         echo "Failed to create tarball"
30         exit 1
31     }
32     tarname=$(basename $tgzname .gz)
33     echo "Tarball: $tarname"
34     gunzip -f $tgzname || exit 1
35     [ -f "$tarname" ] || {
36         echo "Failed to decompress tarball $tarname"
37         exit 1
38     }
39
40     tagname=$(basename $tarname .tar | sed s/[\.]/-/g)
41     echo "tagging as $tagname"
42     git tag -s "$tagname" -m "$lib: tag release $tagname"
43
44     echo "signing"
45     rm -f "$tarname.asc"
46     gpg -u "$GPG_USER" --detach-sign --armor $tarname || exit 1
47     [ -f "$tarname.asc" ] || {
48         echo "Failed to create signature $tarname.asc"
49         exit 1
50     }
51     echo "compressing"
52     gzip -f -9 $tarname
53     [ -f "$tgzname" ] || {
54         echo "Failed to compress $tgzname"
55         exit 1
56     }
57
58     echo "Transferring"
59     rsync -Pav $tarname.asc $tgzname master.samba.org:~ftp/pub/$lib/
60
61     popd
62 }
63
64 for lib in $*; do
65     case $lib in
66         talloc | tdb | tevent)
67             release_lib $lib "lib/$lib"
68             ;;
69         ldb)
70             release_lib $lib "source4/lib/$lib"
71             ;;
72         *)
73             echo "Unknown library $lib"
74             exit 1
75     esac
76 done