]> code.delx.au - gnu-emacs-elpa/blob - admin/update-archive.sh
* wcheck-mode: New package.
[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 pv="$1"
53 pkg="$(echo "$pv" | sed -e 's/^\(.*\)-\([^-]*\)\.[^-.]*$/\1/')"
54 ver="$(echo "$pv" | sed -e 's/^\(.*\)-\([^-]*\)\.[^-.]*$/\2/')"
55 if [ -z "$pkg" ] || [ -z "$ver" ]; then signal_error "bad PKG-VER: $pv"; fi
56 send_mail "$a_email" "[GNU ELPA] $pkg version $ver" <<ENDDOC
57 Version $ver of GNU ELPA package $pkg has just been released.
58 You can now find it in M-x package-list RET.
59
60 More at http://elpa.gnu.org/packages/$pkg.html
61 ENDDOC
62 }
63
64 cd ../elpa
65
66 # Fetch changes.
67 git pull || signal_error "git pull failed"
68
69 # Remember we're inside the "elpa" branch which we don't want to trust,
70 # So always refer to the makefile and admins files from $builddir".
71
72 # Setup and update externals.
73 emacs --batch -l "$buildir/admin/archive-contents.el" \
74 -f archive-add/remove/update-externals
75
76 make -f "$buildir/GNUmakefile" check_copyrights ||
77 signal_error "check_copyright failed"
78
79 cd "$buildir"
80
81 rsync -av --delete \
82 --exclude=ChangeLog \
83 --exclude=.git \
84 --exclude='*.elc' \
85 --exclude='*~' \
86 --exclude='*-autoloads.el' \
87 ../elpa/packages ./
88
89 # Refresh the ChangeLog files. This needs to be done in
90 # the source tree, because it needs the VCS data!
91 emacs -batch -l admin/archive-contents.el \
92 -eval '(archive-prepare-packages "../elpa")'
93
94
95 rm -rf archive # In case there's one left over!
96 make archive-full || {
97 signal_error "make archive-full failed"
98 }
99 latest="emacs-packages-latest.tgz"
100 (cd archive
101 GZIP=--best tar zcf "$latest" packages)
102 (cd ../
103 mkdir -p staging/packages
104 # Not sure why we have `staging-old', but let's keep it for now.
105 rm -rf staging-old
106 cp -a staging staging-old
107 # Move new files into place but don't throw out old package versions.
108 for f in build/archive/packages/*; do
109 # PKG-VER
110 pv=$(basename "$f")
111 dst="staging/packages/$pv"
112 # Actually, let's never overwrite an existing version. So changes can
113 # be installed without causing a new package to be built until the
114 # version field is changed. Some files need to be excluded from the
115 # "immutable" policy, most importantly "archive-contents"
116 # and "*-readme.txt".
117 case $dst in
118 */archive-contents | *-readme.txt ) mv "$f" "$dst" ;;
119 * ) if [ -r "$dst" ]
120 then rm "$f"
121 else
122 mv "$f" "$dst"
123 # FIXME: Add a tag to remember the precise code used.
124 announce_new "$pv"
125 fi ;;
126 esac
127 done
128 mv build/archive/"$latest" staging/
129 rm -rf build/archive)
130
131 # Make the HTML and readme.txt files.
132 (cd ../staging/packages
133 emacs --batch -l ../../build/admin/archive-contents.el \
134 --eval '(batch-html-make-index)')