From dd2325eecaffa5c2191fbc737e66b0695688f0e2 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Fri, 1 Jul 2011 16:32:27 -0400 Subject: [PATCH] Add a top-level Makefile. Makefile: Rules for partial and full package archive deployment. admin/package-update.sh: Handle relative filenames in DEST argument, including calling from Makefile rule. --- Makefile | 16 +++++++++++ admin/package-update.sh | 63 +++++++++++++++++++++++------------------ 2 files changed, 52 insertions(+), 27 deletions(-) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..115cbb068 --- /dev/null +++ b/Makefile @@ -0,0 +1,16 @@ +# Makefile for GNU Emacs Lisp Package Archive. + +ARCHIVE_DIR=archive + +## Deploy the package archive to archive/ +archive: packages + mkdir -p $(ARCHIVE_DIR) + admin/package-update.sh $(ARCHIVE_DIR) + +## Deploy the package archive to archive/ including the Org daily and +## admin scripts. +full-archive: .PHONY + mkdir -p $(ARCHIVE_DIR) + admin/package-update.sh $(ARCHIVE_DIR) 1 + +.PHONY: diff --git a/admin/package-update.sh b/admin/package-update.sh index b1c8b21c7..ca2274219 100755 --- a/admin/package-update.sh +++ b/admin/package-update.sh @@ -16,16 +16,13 @@ ## - the Org mode daily package PATH="/bin:/usr/bin:/usr/local/bin:${PATH}" +## Remove any trailing slash from DEST DEST=${1%/} FULL=$2 EMACS=emacs BZR=bzr TAR=tar - -LOG=$DEST/update-log -PKGROOT=$DEST/packages -TMP_PKGROOT=$DEST/packages-new REPO_PACKAGES=packages ## Parse arguments @@ -33,15 +30,18 @@ if [ -z $DEST ]; then echo "Syntax: $0 DEST [fetch-extras-boolean]" exit 1 elif [ -d $DEST ]; then - echo "Installing into '$DEST', log is '$LOG'" - echo "Installing into '$DEST'" > $LOG + cd $DEST + DEST_FULL=$(pwd) + PKGROOT=$DEST_FULL/packages + TMP_PKGROOT=$DEST_FULL/packages-new + echo "Installing into '$DEST_FULL'" if [ -z $FULL ]; then echo "Base archive update only (pass second arg for full update)." else echo "Performing full archive update." TARBALL=$PKGROOT/emacs-packages-latest.tgz TARBALL_ROOT="emacs-24.1-packages-`/bin/date +'%F'`" - ADMINROOT=$DEST/admin + ADMINROOT=$DEST_FULL/admin REPO_ADMIN=admin fi else @@ -50,7 +50,6 @@ else fi ## Change to the bzr root directory -cd $(dirname $0) REPO_ROOT_DIR=`$BZR root`; if [ -z $REPO_ROOT_DIR ]; then "This script should be run from a bzr repository, aborting." @@ -61,42 +60,52 @@ fi ## Create the working directory that will be the world-facing copy of ## the package archive base. -echo "Exporting packages to temporary working directory $TMP_PKGROOT" >> $LOG +echo "Exporting packages to temporary working directory $TMP_PKGROOT" rm -rf $TMP_PKGROOT $BZR export $TMP_PKGROOT $REPO_PACKAGES -## If second arg is provided, copy in the admin directory and run the -## Org daily synch scripts +## If second arg is provided, copy in the admin directory. if [ -z $FULL ]; then - echo "Skipping admin directory" >> $LOG - echo "Skipping post-export fetchers" >> $LOG + echo "Skipping admin directory" else - echo "Exporting admin scripts to $ADMINROOT" >> $LOG + echo "Exporting admin scripts to $ADMINROOT" rm -rf $ADMINROOT $BZR export $ADMINROOT $REPO_ADMIN - echo "Running post-export org-mode fetcher as '$ADMINROOT/org-synch.sh $TMP_PKGROOT $ADMINROOT'" >> $LOG - $ADMINROOT/org-synch.sh $TMP_PKGROOT $ADMINROOT >> $LOG 2>&1 fi -## Generate archive-contents and the readme files. cd $TMP_PKGROOT -$TAR xf *.tar -rm -f *.tar -$EMACS -batch -l $REPO_ROOT_DIR/admin/archive-contents.el -f batch-make-archive-contents -## Tar up the multi-file packages. -echo "Creating multi-file package tarballs in $TMP_PKGROOT" >> $LOG +## If second arg is provided, grab the Org daily +if [ -z $FULL ]; then + echo "Not fetching Org daily from orgmode.org" +else + echo "Fetching Org daily from orgmode.org" + pkgname=`curl -s http://orgmode.org/pkg/daily/|perl -ne 'push @f, $1 if m/(org-\d{8})\.tar/; END { @f = sort @f; print "$f[-1]\n"}'` + wget -q http://orgmode.org/pkg/daily/${pkgname}.tar -O ${pkgname}.tar + if [ -f ${pkgname}.tar ]; then + tar xf ${pkgname}.tar + rm -f ${pkgname}.tar + mv ${pkgname} org + fi +fi + +## Call `batch-make-archive' to generate archive-contents, the readme +## files, etc. +$EMACS -batch -l $REPO_ROOT_DIR/admin/archive-contents.el -f batch-make-archive + +## Tar up the multi-file packages. +echo "Creating multi-file package tarballs in $TMP_PKGROOT" for pt in *; do if [ -d $pt ]; then - echo "Creating tarball $TMP_PKGROOT/$pt.tar" >> $LOG + echo "Creating tarball $TMP_PKGROOT/$pt.tar" tar -cf $pt.tar $pt --remove-files fi done ## Move the working directory to its final location -echo "Moving $TMP_PKGROOT to $PKGROOT" >> $LOG +cd .. rm -rf $PKGROOT-old if [ -d $PKGROOT ]; then mv $PKGROOT $PKGROOT-old @@ -106,12 +115,12 @@ rm -rf $PKGROOT-old ## If doing a full update, make a tarball of the entire archive. if [ -z $FULL ]; then - echo "Skipping archive tarball" >> $LOG + echo "Skipping archive tarball" else - echo "Exporting packages into $TARBALL (root = $TARBALL_ROOT)" >> $LOG + echo "Exporting packages into $TARBALL (root = $TARBALL_ROOT)" cd $REPO_ROOT_DIR $BZR export --format=tgz --root=$TARBALL_ROOT $TARBALL $REPO_PACKAGES fi chmod -R a+rX $PKGROOT -echo "Update complete at" `/bin/date` >> $LOG +echo "Update complete at" `/bin/date` -- 2.39.2