]> code.delx.au - gnu-emacs-elpa/blob - admin/update-archive.sh
* update-archive.sh (signal_error): Fix up sendmail script.
[gnu-emacs-elpa] / admin / update-archive.sh
1 #!/bin/sh -x
2
3 batchmode=no
4
5 export LANG=C
6 case "$1" in
7 "--batch") batchmode=yes ;;
8 esac
9
10 # Return on STDOUT the files that don't seem to have the needed copyright
11 # notice, or that have a copyright notice that looks suspicious.
12 copyright_notices () {
13 find . -name '*.el' -print0 |
14 xargs -0 grep -L 'Free Software Foundation, Inc' |
15 grep -v '.-\(pkg\|autoloads\)\.el$'
16
17 find . -name '*.el' -print |
18 while read f; do
19 sed -n -e '/[Cc]opyright.*, *[1-9][-0-9]*,\?$/N' \
20 -e '/Free Software Foundation/d' \
21 -e "s|^\\(.*[Cc]opyright\\)|$(echo $f | tr '|' '_'):\\1|p" "$f"
22 done
23 }
24
25 # Send an email to warn about a problem.
26 # Takes the body on STDIN and the subject as argument.
27 signal_error () {
28 title="$*"
29 if [ "no" = "$batchmode" ]; then
30 cat -
31 echo "Error: $title"
32 else
33 set -- $(host -t mx gnu.org);
34 mx_gnu_org="$4"
35 (sleep 5; echo "HELO elpa.gnu.org"
36 sleep 1; echo "MAIL FROM: <elpa@elpa.gnu.org>"
37 sleep 1; echo "RCPT TO: <emacs-elpa-diffs@gnu.org>"
38 sleep 1; echo "DATA"
39 sleep 1; cat <<ENDDOC
40 From: ELPA update <elpa@elpa.gnu.org>
41 To: emacs-elpa-diffs@gnu.org
42 Subject: $title
43
44 ENDDOC
45 cat -
46 echo ".") | telnet "$mx_gnu_org" smtp
47 fi
48 }
49
50 check_copyright () {
51 base="copyright_exceptions"
52 (cd packages; copyright_notices) >"$base.new"
53 if [ -r "$base.old" ] &&
54 ! diff "$base.old" "$base.new" >/dev/null;
55 then
56 diff -u "$base.old" "$base.new" |
57 signal_error "Copyright notices changed"
58 exit 1
59 else
60 mv "$base.new" "$base.old"
61 fi
62 }
63
64 cd ~elpa/build
65
66 (cd ~elpa/elpa; bzr up)
67
68 check_copyright
69
70 rm -rf archive # In case there's one left over!
71 make archive-full >make.log 2>&1 || {
72 signal_error "make archive-full failed" <make.log
73 exit 1
74 }
75 (cd ~elpa
76 rm -rf staging-old
77 mv staging staging-old
78 mv build/archive staging)
79 (cd ~elpa/staging
80 tar zcf emacs-packages-latest.tgz packages)
81
82 # "make archive-full" already does fetch the daily org build.
83 #admin/org-synch.sh ~elpa/staging/packages ~elpa/build/admin