]> code.delx.au - gnu-emacs-elpa/blob - admin/update-archive.sh
Add ergoemacs-mode; fix up externals maintenance
[gnu-emacs-elpa] / admin / update-archive.sh
1 #!/bin/sh -x
2
3 makelog=""
4 buildir="$(pwd)"
5
6 announce=no
7 a_email="" #info-gnu-emacs@gnu.org
8
9 export LANG=C
10 while [ $# -gt 0 ]; do
11 case "$1" in
12 "--announce") announce=yes; a_email="$2"; shift ;;
13 "--batch")
14 makelog="$(pwd)/make.log"
15 exec >"$makelog" 2>&1
16 ;;
17 esac
18 shift
19 done
20
21 send_mail () {
22 to="$1"; shift
23 title="$*"
24 mx_gnu_org="$(host -t mx gnu.org | sed 's/.*[ ]//')"
25 (sleep 5; echo "HELO elpa.gnu.org"
26 sleep 1; echo "MAIL FROM: <elpa@elpa.gnu.org>"
27 sleep 1; echo "RCPT TO: <$to>"
28 sleep 1; echo "DATA"
29 sleep 1; cat <<ENDDOC
30 From: ELPA update <do.not.reply@elpa.gnu.org>
31 To: $to
32 Subject: $title
33
34 ENDDOC
35 cat -; echo
36 echo "."; sleep 1) | telnet "$mx_gnu_org" smtp
37 }
38
39 # Send an email to warn about a problem.
40 signal_error () {
41 title="$*"
42 if [ "" = "$makelog" ]; then
43 echo "Error: $title"
44 else
45 send_mail "emacs-elpa-diffs@gnu.org" "$title" <"$makelog"
46 fi
47 exit 1
48 }
49
50 announce_new () {
51 if [ "yes" != "$announce" ]; then return; fi
52 file="$1"
53 version="$(echo "$file" | sed -e 's|^.*/||' -e 's/^\(.*\)-\([^-]*\)\.[^-.]*$/\2/')"
54 pkg="$(echo "$file" | sed -e 's|^.*/||' -e 's/^\(.*\)-\([^-]*\)\.[^-.]*$/\1/')"
55 send_mail "$a_email" "[GNU ELPA] $pkg version $version" <<ENDDOC
56 Version $version of GNU ELPA package $pkg has just been released.
57 You can now find it in M-x package-list RET.
58
59 More at http://elpa.gnu.org/packages/$pkg.html
60 ENDDOC
61 }
62
63 cd ../elpa
64
65 # Fetch changes.
66 git pull || signal_error "git pull failed"
67
68 # Remember we're inside the "elpa" branch which we don't want to trust,
69 # So always refer to the makefile and admins files from $builddir".
70
71 # Setup and update externals.
72 emacs --batch -l "$buildir/admin/archive-contents.el" \
73 -f archive-add/remove/update-externals
74
75 make -f "$buildir/GNUmakefile" check_copyrights ||
76 signal_error "check_copyright failed"
77
78 cd "$buildir"
79
80 rsync -av --delete \
81 --exclude=ChangeLog \
82 --exclude=.git \
83 --exclude='*.elc' \
84 --exclude='*~' \
85 --exclude='*-autoloads.el' \
86 ../elpa/packages ./
87
88 # Refresh the ChangeLog files. This needs to be done in
89 # the source tree, because it needs the VCS data!
90 emacs -batch -l admin/archive-contents.el \
91 -eval '(archive-prepare-packages "../elpa")'
92
93
94 rm -rf archive # In case there's one left over!
95 make archive-full || {
96 signal_error "make archive-full failed"
97 }
98 latest="emacs-packages-latest.tgz"
99 (cd archive
100 GZIP=--best tar zcf "$latest" packages)
101 (cd ../
102 mkdir -p staging/packages
103 # Not sure why we have `staging-old', but let's keep it for now.
104 rm -rf staging-old
105 cp -a staging staging-old
106 # Move new files into place but don't throw out old package versions.
107 for f in build/archive/packages/*; do
108 dst="staging/packages/$(basename "$f")"
109 # Actually, let's never overwrite an existing version. So changes can
110 # be installed without causing a new package to be built until the
111 # version field is changed. Some files need to be excluded from the
112 # "immutable" policy, most importantly "archive-contents"
113 # and "*-readme.txt".
114 case $dst in
115 */archive-contents | *-readme.txt ) mv "$f" "$dst" ;;
116 * ) if [ -r "$dst" ]
117 then rm "$f"
118 else
119 mv "$f" "$dst"
120 # FIXME: Add a tag to remember the precise code used.
121 announce_new "$f"
122 fi ;;
123 esac
124 done
125 mv build/archive/"$latest" staging/
126 rm -rf build/archive)
127
128 # Make the HTML and readme.txt files.
129 (cd ../staging/packages
130 emacs --batch -l ../../build/admin/archive-contents.el \
131 --eval '(batch-html-make-index)')