From: Stefan Monnier Date: Tue, 30 Oct 2012 17:49:47 +0000 (-0400) Subject: New script for auto-update of GNU ELPA. X-Git-Url: https://code.delx.au/gnu-emacs-elpa/commitdiff_plain/d59c60cb9e98043fbc4cfa361ba37bfabaf4a399 New script for auto-update of GNU ELPA. --- diff --git a/Makefile b/Makefile index 9523b7334..b2b8b451f 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ archive: archive-tmp 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 @@ process-archive: ## 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; \ diff --git a/admin/update-archive.sh b/admin/update-archive.sh new file mode 100755 index 000000000..04e724e79 --- /dev/null +++ b/admin/update-archive.sh @@ -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 < +RCPT TO: +DATA +From: ELPA update +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"