]> code.delx.au - gnu-emacs-elpa/blob - admin/update-archive.sh
Merge commit '51c140ca9ee32d27cacc7b2b07d4539bf98ae575' from company-master
[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 # Remember we're inside the "elpa" branch which we don't want to trust,
44 # So always refer to the makefile and admins files from $builddir".
45
46 # Setup and update externals.
47 emacs --batch -l "$buildir/admin/archive-contents.el" \
48 -f archive-add/remove/update-externals
49
50 make -f "$buildir/GNUmakefile" check_copyrights ||
51 signal_error "check_copyright failed"
52
53 cd "$buildir"
54
55 rsync -av --delete \
56 --exclude=ChangeLog \
57 --exclude=.git \
58 --exclude='*.elc' \
59 --exclude='*~' \
60 --exclude='*-autoloads.el' \
61 ../elpa/packages ./
62
63 # Refresh the ChangeLog files. This needs to be done in
64 # the source tree, because it needs the VCS data!
65 emacs -batch -l admin/archive-contents.el \
66 -eval '(archive-prepare-packages "../elpa")'
67
68
69 rm -rf archive # In case there's one left over!
70 make archive-full || {
71 signal_error "make archive-full failed"
72 }
73 latest="emacs-packages-latest.tgz"
74 (cd archive
75 GZIP=--best tar zcf "$latest" packages)
76 (cd ../
77 mkdir -p staging/packages
78 # Not sure why we have `staging-old', but let's keep it for now.
79 rm -rf staging-old
80 cp -a staging staging-old
81 # Move new files into place but don't throw out old package versions.
82 for f in build/archive/packages/*; do
83 dst="staging/packages/$(basename "$f")"
84 # Actually, let's never overwrite an existing version. So changes can
85 # be installed without causing a new package to be built until the
86 # version field is changed. Some files need to be excluded from the
87 # "immutable" policy, most importantly "archive-contents"
88 # and "*-readme.txt".
89 case $dst in
90 */archive-contents | *-readme.txt ) mv "$f" "$dst" ;;
91 * ) if [ -r "$dst" ]
92 then rm "$f"
93 else
94 # FIXME: Announce the new package/version on
95 # gnu.emacs.sources!
96 mv "$f" "$dst"
97 fi ;;
98 esac
99 done
100 mv build/archive/"$latest" staging/
101 rm -rf build/archive)
102
103 # Make the HTML and readme.txt files.
104 (cd ../staging/packages
105 emacs --batch -l ../../build/admin/archive-contents.el \
106 --eval '(batch-html-make-index)')