]> code.delx.au - gnu-emacs-elpa/blob - admin/update-archive.sh
Move check_copyright to the makefile
[gnu-emacs-elpa] / admin / update-archive.sh
1 #!/bin/sh -x
2
3 makelog=""
4 buildir="$(pwd)"
5
6 export LANG=C
7 case "$1" in
8 "--batch")
9 makelog="$(pwd)/make.log"
10 exec >"$makelog" 2>&1
11 ;;
12 esac
13
14 # Send an email to warn about a problem.
15 signal_error () {
16 title="$*"
17 if [ "" = "$makelog" ]; then
18 echo "Error: $title"
19 else
20 mx_gnu_org="$(host -t mx gnu.org | sed 's/.*[ ]//')"
21 (sleep 5; echo "HELO elpa.gnu.org"
22 sleep 1; echo "MAIL FROM: <elpa@elpa.gnu.org>"
23 sleep 1; echo "RCPT TO: <emacs-elpa-diffs@gnu.org>"
24 sleep 1; echo "DATA"
25 sleep 1; cat <<ENDDOC
26 From: ELPA update <elpa@elpa.gnu.org>
27 To: emacs-elpa-diffs@gnu.org
28 Subject: $title
29
30 ENDDOC
31 cat "$makelog"
32 echo "."; sleep 1) | telnet "$mx_gnu_org" smtp
33 fi
34 exit 1
35 }
36
37
38 cd ../elpa
39
40 # Fetch changes.
41 git pull || signal_error "git pull failed"
42
43 # Setup and update externals.
44 make externals
45
46 make check_copyrights || signal_error "check_copyright failed"
47
48 cd "$buildir"
49
50 rsync -av --delete --exclude=ChangeLog --exclude=.git ../elpa/packages ./
51
52 # Refresh the ChangeLog files. This needs to be done in
53 # the source tree, because it needs the VCS data!
54 emacs -batch -l admin/archive-contents.el \
55 -eval '(archive-prepare-packages "../elpa")'
56
57
58 rm -rf archive # In case there's one left over!
59 make archive-full || {
60 signal_error "make archive-full failed"
61 }
62 latest="emacs-packages-latest.tgz"
63 (cd archive
64 tar zcf "$latest" packages)
65 (cd ../
66 mkdir -p staging/packages
67 # Not sure why we have `staging-old', but let's keep it for now.
68 rm -rf staging-old
69 cp -a staging staging-old
70 # Move new files into place but don't throw out old package versions.
71 for f in build/archive/packages/*; do
72 dst="staging/packages/$(basename "$f")"
73 # Actually, let's never overwrite an existing version. So changes can
74 # be installed without causing a new package to be built until the
75 # version field is changed. Some files need to be excluded from the
76 # "immutable" policy, most importantly "archive-contents"
77 # and "*-readme.txt".
78 case $dst in
79 */archive-contents | *-readme.txt ) mv "$f" "$dst" ;;
80 * ) if [ -r "$dst" ]
81 then rm "$f"
82 else
83 # FIXME: Announce the new package/version on
84 # gnu.emacs.sources!
85 mv "$f" "$dst"
86 fi ;;
87 esac
88 done
89 mv build/archive/"$latest" staging/
90 rm -rf build/archive)
91
92 # Make the HTML and readme.txt files.
93 (cd ../staging/packages
94 emacs --batch -l ../../build/admin/archive-contents.el \
95 --eval '(batch-html-make-index)')