Merge tag 'samba-4.0.21' into v4-0-test
[Samba.git] / script / librelease.sh
blob5119ca4aca78bf5543623fe080ff94a3ade5b4c6
1 #!/bin/bash
2 # make a release of a Samba library
4 if [ ! -d ".git" ]; then
5 echo "Run this script from the top-level directory in the"
6 echo "repository"
7 exit 1
8 fi
10 if [ $# -lt 1 ]; then
11 echo "Usage: librelease.sh <LIBNAMES>"
12 exit 1
15 umask 0022
17 release_lib() {
18 lib="$1"
19 srcdir="$2"
20 ftpdir="$3"
22 pushd $srcdir
24 echo "Releasing library $lib"
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
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
40 tagname=$(basename $tarname .tar)
41 echo "tagging as $tagname"
42 git tag -u $GPG_KEYID -s "$tagname" -m "$lib: tag release $tagname" || {
43 exit 1
46 echo "signing"
47 rm -f "$tarname.asc"
48 gpg -u "$GPG_USER" --detach-sign --armor $tarname || {
49 exit 1
51 [ -f "$tarname.asc" ] || {
52 echo "Failed to create signature $tarname.asc"
53 exit 1
55 echo "compressing"
56 gzip -f -9 $tarname
57 [ -f "$tgzname" ] || {
58 echo "Failed to compress $tgzname"
59 exit 1
62 [ -z "$ftpdir" ] && {
63 popd
64 return 0
67 echo "Push git tag $tagname"
68 git push ssh://git.samba.org/data/git/samba.git refs/tags/$tagname:refs/tags/$tagname || {
69 exit 1
72 echo "Transferring for FTP"
73 rsync -Pav $tarname.asc $tgzname master.samba.org:~ftp/pub/$ftpdir/ || {
74 exit 1
76 rsync master.samba.org:~ftp/pub/$ftpdir/$tarname.*
78 popd
81 for lib in $*; do
82 case $lib in
83 talloc | tdb | tevent | ldb)
84 [ -z "$GPG_USER" ] && {
85 GPG_USER='Samba Library Distribution Key <samba-bugs@samba.org>'
88 [ -z "$GPG_KEYID" ] && {
89 GPG_KEYID='13084025'
92 release_lib $lib "lib/$lib" $lib
94 samba)
95 [ -z "$GPG_USER" ] && {
96 GPG_USER='6568B7EA'
99 [ -z "$GPG_KEYID" ] && {
100 GPG_KEYID='6568B7EA'
103 # for now we don't upload
104 release_lib $lib "." ""
107 echo "Unknown library $lib"
108 exit 1
109 esac
110 done