summaryrefslogtreecommitdiff
path: root/contrib/release
blob: ac708c10c456cc7063d561e80bb72eb34077d52b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/bin/bash -e
#
# Written 2016 by Tim Ruehsen
#
# To get the version number right: add a signed tag and
#   make sure the working dir is clean (git diff).
# If that fails, put the version into '.tarball-version'.

export CFLAGS="-g -O2 -Wall"

echo
echo "* Bootstrap"
#./bootstrap >/dev/null

echo
echo "* Configure"
#./configure -q

extensions="gz lz"
app_name=$(grep "^PACKAGE_NAME='" configure|cut -d "'" -f2)
app_ver=$(grep "^PACKAGE_VERSION='" configure|cut -d "'" -f2)

echo "Current version of $app_name is $app_ver"
echo
echo -n "Is that OK ? [y/N] "
read x
[ "$x" != "y" -a "$x" != "Y" ] && exit 0

echo
grep -i "Changes in $app_name" NEWS|head -1
echo -n "Did you edit the NEWS file ? [y/N] "
read x
[ "$x" != "y" -a "$x" != "Y" ] && exit 0

echo
echo "* Make"
#make -s clean
#make -s

echo
echo "* Make distcheck"
#make -s distcheck >/dev/null

echo
echo "* Make dist"
for ext in $extensions; do
  [[ $ext = 'gz' ]] && ext="gzip"
  [[ $ext = 'lz' ]] && ext="lzip"
  make -s dist-$ext >/dev/null
done

while true; do
  echo "Alpha or Regular release ? [R/A] "
  read x
  if test "$x" = "r" || test "$x" = "R"; then
    directory="/incoming/ftp"
    break
  elif test "$x" = "a" || test "$x" = "A"; then
    directory="/incoming/alpha"
    break
  fi
done

x=$(gpg --list-secret-keys 2>/dev/null|grep ^sec|awk '{ print $2 }')
echo $x
if [ "$x" = "" ]; then
  echo No signing key found - please check with 'gpg --list-secret-keys'
  exit 1
fi

# arrays just work in Bash
keys=($x)
if [ ${#keys[@]} -eq 1 ]; then
  IFS='/' arr=($x)
  signing_key=${arr[1]}
else
  for ((i=0; i < ${#keys[@]}; i++)); do
    echo "$((i+1))) ${keys[i]}"
  done
  while true; do
    echo -n "Enter 1-${#keys[@]}: "
    read x

    # check for digits only
    if [ -n "${i//[0-9]/}" ]; then continue; fi

    if test $x -ge 1 || test $x -le ${#keys[@]}; then
      IFS='/' arr=(${keys[$((x-1))]})
      signing_key=${arr[1]}
      break
    fi
  done
fi
unset IFS

echo
echo -n "Really upload to ftp-upload.gnu.org/$directory ? "
read x
[ "$x" != "y" -a "$x" != "Y" ] && exit 0

for ext in $extensions; do
  app_tarball="${app_name}-${app_ver}.tar.$ext"
  gpg --default-key $signing_key --yes -b $app_tarball

  echo -e "version: 1.2\nfilename: ${app_tarball}\ndirectory: ${app_name}\n" >${app_tarball}.directive
  gpg --default-key $signing_key --yes --clearsign ${app_tarball}.directive

ftp -v -n -i -p ftp-upload.gnu.org <<EOF
user anonymous
cd $directory
put ${app_tarball}
put ${app_tarball}.sig
put ${app_tarball}.directive.asc
EOF

done

prev_tag=`git tag|tail -2|head -1`
echo "Don't forget to mention the following contributors in the announcement:"
(
  git log ${prev_tag}.. --format="%aN" --reverse
  git log ${prev_tag}.. --reverse|grep -i reported|cut -d':' -f2|cut -d'<' -f1|cut -d' ' -f2-|tr -d '"'
) | sort -u