------------------------------------------------------------ revno: 290 committer: Stefan Monnier <monn...@iro.umontreal.ca> branch nick: elpa timestamp: Tue 2012-10-30 13:49:47 -0400 message: New script for auto-update of GNU ELPA. added: admin/update-archive.sh modified: Makefile
=== modified file 'Makefile' --- a/Makefile 2012-10-22 21:56:43 +0000 +++ b/Makefile 2012-10-30 17:49:47 +0000 @@ -25,7 +25,7 @@ archive-tmp: packages mkdir -p $(ARCHIVE_TMP) - cp -r packages $(ARCHIVE_TMP) + cp -r packages/. $(ARCHIVE_TMP)/packages process-archive: cd $(ARCHIVE_TMP)/packages; $(EMACS) -batch -l $(CURDIR)/admin/archive-contents.el -f batch-make-archive @@ -47,13 +47,13 @@ ## admin scripts: archive-full: archive-tmp org-fetch $(MAKE) $(MFLAGS) process-archive - mkdir -p archive/admin - cp admin/* archive/admin/ + #mkdir -p archive/admin + #cp admin/* archive/admin/ org-fetch: archive-tmp - cd archive-tmp/packages; \ - pkgname=`curl -s http://orgmode.org/elpa/|perl -ne 'push @f, $1 if m/(org-\d{8})\.tar/; END { @f = sort @f; print "$f[-1]\n"}'`; \ - wget -q http://orgmode.org/elpa/${pkgname}.tar -O ${pkgname}.tar; \ + cd $(ARCHIVE_TMP)/packages; \ + pkgname=`curl -s http://orgmode.org/elpa/|perl -ne 'push @f, $$1 if m/(org-\d{8})\.tar/; END { @f = sort @f; print "$$f[-1]\n"}'`; \ + wget -q http://orgmode.org/elpa/$${pkgname}.tar -O $${pkgname}.tar; \ if [ -f $${pkgname}.tar ]; then \ tar xf $${pkgname}.tar; \ rm -f $${pkgname}.tar; \
=== added file 'admin/update-archive.sh' --- a/admin/update-archive.sh 1970-01-01 00:00:00 +0000 +++ b/admin/update-archive.sh 2012-10-30 17:49:47 +0000 @@ -0,0 +1,83 @@ +#!/bin/sh -x + +batchmode=no + +export LANG=C +case "$1" in + "--batch") batchmode=yes ;; +esac + +# Return on STDOUT the files that don't seem to have the needed copyright +# notice, or that have a copyright notice that looks suspicious. +copyright_notices () { + find . -name '*.el' -print0 | + xargs -0 grep -L 'Free Software Foundation, Inc' | + grep -v '.-\(pkg\|autoloads\)\.el$' + + find . -name '*.el' -print | + while read f; do + sed -n -e '/[Cc]opyright.*, *[1-9][-0-9]*,\?$/N' \ + -e '/Free Software Foundation/d' \ + -e "s|^\\(.*[Cc]opyright\\)|$(echo $f | tr '|' '_'):\\1|p" "$f" + done +} + +# Send an email to warn about a problem. +# Takes the body on STDIN and the subject as argument. +signal_error () { + title="$*" + if [ "no" = "$batchmode" ]; then + cat - + echo "Error: $title" + else + set -- $(host -t mx gnu.org); + mx_gnu_org="$4" + (cat <<ENDDOC +HELO elpa.gnu.org +MAIL FROM: <e...@elpa.gnu.org> +RCPT TO: <emacs-elpa-diffs@gnu.org> +DATA +From: ELPA update <e...@elpa.gnu.org> +To: emacs-elpa-diffs@gnu.org +ENDDOC + echo "Subject: $title" + echo + cat - + echo ".") | telnet "$mx_gnu_org" smtp + fi +} + +check_copyright () { + base="copyright_exceptions" + (cd packages; copyright_notices) >"$base.new" + if [ -r "$base.old" ] && + ! diff "$base.old" "$base.new" >/dev/null; + then + diff -u "$base.old" "$base.new" | + signal_error "Copyright notices changed" + exit 1 + else + mv "$base.new" "$base.old" + fi +} + +cd ~elpa/build + +(cd ~elpa/elpa; bzr up) + +check_copyright + +rm -rf archive # In case there's one left over! +make archive-full >make.log 2>&1 || { + signal_error "make archive-full failed" <make.log + exit 1 +} +(cd ~elpa + rm -rf staging-old + mv staging staging-old + mv build/archive staging) +(cd ~elpa/staging + tar zcf emacs-packages-latest.tgz packages) + +# "make archive-full" already does fetch the daily org build. +#admin/org-synch.sh ~elpa/staging/packages ~elpa/build/admin