From 9c123a56704af574567af819193a825c15899d64 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 13 Aug 2013 17:36:47 -0400 Subject: [PATCH 1/1] Move check_copyright to the makefile --- GNUmakefile | 21 ++++++++++++ admin/archive-contents.el | 2 +- admin/update-archive.sh | 70 +++++++++++++-------------------------- copyright_exceptions | 49 +++++++++++++++++++++++++++ 4 files changed, 94 insertions(+), 48 deletions(-) create mode 100644 copyright_exceptions diff --git a/GNUmakefile b/GNUmakefile index d1baf58a3..1067e4c6f 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -9,6 +9,25 @@ SITE_DIR=site all: all-in-place +CR_EXCEPTIONS=copyright_exceptions +.PHONY: check_copyrights +check_copyrights: + @echo "Compute exceptions >$(CR_EXCEPTIONS)~" + @(cd packages; \ + export LANG=C; \ + find . -name '*.el' -print0 | \ + xargs -0 grep -L 'Free Software Foundation, Inc' | \ + grep -v '\(\.dir-locals\|.-\(pkg\|autoloads\)\)\.el$$'; \ + find . -name '*.el' -print | \ + while read f; do \ + fquoted="$$(echo $$f|tr '|' '_')"; \ + sed -n -e '/[Cc]opyright.*, *[1-9][-0-9]*,\?$$/N' \ + -e '/Free Software Foundation/d' \ + -e "s|^\\(.*[Cc]opyright\\)|$$fquoted:\\1|p" \ + "$$f"; \ + done) | sort >$(CR_EXCEPTIONS)~ + diff -u "$(CR_EXCEPTIONS)" "$(CR_EXCEPTIONS)~" + ## Deploy the package archive to archive/, with packages in ## archive/packages/: archive: archive-tmp @@ -46,6 +65,8 @@ archive-full: archive-tmp org-fetch #mkdir -p archive/admin #cp admin/* archive/admin/ +# FIXME: Turn it into an `external', which will require adding the notion of +# "snapshot" packages. 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"}'`; \ diff --git a/admin/archive-contents.el b/admin/archive-contents.el index 8ef73aaa1..863b13e47 100644 --- a/admin/archive-contents.el +++ b/admin/archive-contents.el @@ -207,7 +207,7 @@ Rename DIR/PKG.el to PKG-VERS.el, delete DIR, and return the descriptor." (while (progn (forward-line -1) (>= (point) start)) (insert ";; "))) (set (make-local-variable 'backup-inhibited) t) - (save-buffer) + (basic-save-buffer) ;Less chatty than save-buffer. (kill-buffer))) (delete-directory dir t) (cons (intern pkg) (vector (version-to-list vers) req desc 'single))) diff --git a/admin/update-archive.sh b/admin/update-archive.sh index 662d8db2a..91090ac83 100755 --- a/admin/update-archive.sh +++ b/admin/update-archive.sh @@ -1,33 +1,20 @@ #!/bin/sh -x -batchmode=no +makelog="" +buildir="$(pwd)" export LANG=C case "$1" in - "--batch") batchmode=yes ;; + "--batch") + makelog="$(pwd)/make.log" + exec >"$makelog" 2>&1 + ;; 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 '\(\.dir-locals\|.-\(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 - + if [ "" = "$makelog" ]; then echo "Error: $title" else mx_gnu_org="$(host -t mx gnu.org | sed 's/.*[ ]//')" @@ -41,37 +28,24 @@ To: emacs-elpa-diffs@gnu.org Subject: $title ENDDOC - cat - + cat "$makelog" echo "."; sleep 1) | telnet "$mx_gnu_org" smtp fi + exit 1 } -check_copyright () { - base="copyright_exceptions" - (cd $1/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 -(cd ../elpa; +# Fetch changes. +git pull || signal_error "git pull failed" - # Fetch changes. - git pull || signal_error "git pull failed"; +# Setup and update externals. +make externals - # Setup and update externals. - make externals - ) +make check_copyrights || signal_error "check_copyright failed" -#check_copyright ../elpa +cd "$buildir" rsync -av --delete --exclude=ChangeLog --exclude=.git ../elpa/packages ./ @@ -82,9 +56,8 @@ emacs -batch -l admin/archive-contents.el \ rm -rf archive # In case there's one left over! -make archive-full >make.log 2>&1 || { - signal_error "make archive-full failed"