]> code.delx.au - gnu-emacs-elpa/blobdiff - admin/update-archive.sh
Move check_copyright to the makefile
[gnu-emacs-elpa] / admin / update-archive.sh
index 091d7c07b7d180040fffe63a01839e17ec3d43c3..91090ac837e8f45ddf52f8374f3f01678ffb4256 100755 (executable)
@@ -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,40 +28,42 @@ 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 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/elpa; bzr up)
+# Fetch changes.
+git pull || signal_error "git pull failed"
+
+# Setup and update externals.
+make externals
+
+make check_copyrights || signal_error "check_copyright failed"
+
+cd "$buildir"
+
+rsync -av --delete --exclude=ChangeLog --exclude=.git ../elpa/packages ./
+
+# Refresh the ChangeLog files.  This needs to be done in
+# the source tree, because it needs the VCS data!
+emacs -batch -l admin/archive-contents.el \
+      -eval '(archive-prepare-packages "../elpa")'
 
-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
+make archive-full || {
+    signal_error "make archive-full failed"
 }
 latest="emacs-packages-latest.tgz"
 (cd archive
  tar zcf "$latest" packages)
-(cd ~elpa
+(cd ../
+ mkdir -p staging/packages
  # Not sure why we have `staging-old', but let's keep it for now.
  rm -rf staging-old
  cp -a staging staging-old
@@ -90,17 +79,17 @@ latest="emacs-packages-latest.tgz"
          */archive-contents | *-readme.txt ) mv "$f" "$dst" ;;
          * ) if [ -r "$dst" ]
              then rm "$f"
-             else mv "$f" "$dst"
+             else
+                 # FIXME: Announce the new package/version on
+                 # gnu.emacs.sources!
+                 mv "$f" "$dst"
              fi ;;
      esac
  done
  mv build/archive/"$latest" staging/
  rm -rf build/archive)
 
-# Make the HTML files.
-(cd ~elpa/staging/packages
- emacs --batch -l ~elpa/build/admin/archive-contents.el \
+# Make the HTML and readme.txt files.
+(cd ../staging/packages
+ emacs --batch -l ../../build/admin/archive-contents.el \
        --eval '(batch-html-make-index)')
-
-# "make archive-full" already does fetch the daily org build.
-#admin/org-synch.sh ~elpa/staging/packages ~elpa/build/admin