2011-01-11 02:55:07 +03:00
#!/bin/bash
# make a release of a Samba library
if [ ! -d ".git" ] ; then
echo "Run this script from the top-level directory in the"
echo "repository"
exit 1
fi
if [ $# -lt 1 ] ; then
echo "Usage: librelease.sh <LIBNAMES>"
exit 1
fi
2011-04-22 12:14:45 +04:00
umask 0022
2011-01-11 02:55:07 +03:00
release_lib( ) {
lib = " $1 "
srcdir = " $2 "
2011-09-13 09:18:52 +04:00
ftpdir = " $3 "
2011-01-11 02:55:07 +03:00
pushd $srcdir
echo " Releasing library $lib "
echo "building release tarball"
tgzname = $( make dist 2>& 1 | grep ^Created | cut -d' ' -f2)
[ -f " $tgzname " ] || {
echo "Failed to create tarball"
exit 1
}
tarname = $( basename $tgzname .gz)
echo " Tarball: $tarname "
2011-01-11 03:22:04 +03:00
gunzip -f $tgzname || exit 1
2011-01-11 02:55:07 +03:00
[ -f " $tarname " ] || {
echo " Failed to decompress tarball $tarname "
exit 1
}
2011-01-11 03:22:04 +03:00
2011-06-28 14:55:47 +04:00
tagname = $( basename $tarname .tar)
2011-01-11 03:22:04 +03:00
echo " tagging as $tagname "
2011-04-22 12:18:15 +04:00
git tag -u $GPG_KEYID -s " $tagname " -m " $lib : tag release $tagname " || {
exit 1
}
2011-01-11 03:22:04 +03:00
2011-01-11 02:55:07 +03:00
echo "signing"
2011-01-11 03:22:04 +03:00
rm -f " $tarname .asc "
2011-04-22 12:18:15 +04:00
gpg -u " $GPG_USER " --detach-sign --armor $tarname || {
exit 1
}
2011-01-11 02:55:07 +03:00
[ -f " $tarname .asc " ] || {
echo " Failed to create signature $tarname .asc "
exit 1
}
echo "compressing"
2011-01-11 03:22:04 +03:00
gzip -f -9 $tarname
2011-01-11 02:55:07 +03:00
[ -f " $tgzname " ] || {
echo " Failed to compress $tgzname "
exit 1
}
2012-10-02 12:29:16 +04:00
[ -z " $ftpdir " ] && {
popd
return 0
}
2011-08-09 15:51:08 +04:00
echo " Push git tag $tagname "
git push ssh://git.samba.org/data/git/samba.git refs/tags/$tagname :refs/tags/$tagname || {
exit 1
}
echo "Transferring for FTP"
2011-09-13 09:18:52 +04:00
rsync -Pav $tarname .asc $tgzname master.samba.org:~ftp/pub/$ftpdir / || {
2011-04-22 12:18:15 +04:00
exit 1
}
2011-09-13 09:18:52 +04:00
rsync master.samba.org:~ftp/pub/$ftpdir /$tarname .*
2011-01-11 02:55:07 +03:00
popd
}
for lib in $* ; do
case $lib in
2015-03-12 16:25:38 +03:00
talloc | tdb | ntdb | tevent | ldb)
2012-10-02 12:29:16 +04:00
[ -z " $GPG_USER " ] && {
GPG_USER = 'Samba Library Distribution Key <samba-bugs@samba.org>'
}
[ -z " $GPG_KEYID " ] && {
GPG_KEYID = '13084025'
}
2011-09-13 09:18:52 +04:00
release_lib $lib " lib/ $lib " $lib
2011-01-11 02:55:07 +03:00
; ;
2012-10-02 12:29:16 +04:00
samba)
[ -z " $GPG_USER " ] && {
GPG_USER = '6568B7EA'
}
[ -z " $GPG_KEYID " ] && {
GPG_KEYID = '6568B7EA'
}
# for now we don't upload
release_lib $lib "." ""
2011-01-11 02:55:07 +03:00
; ;
*)
echo " Unknown library $lib "
exit 1
esac
done