2 ## package-update.sh -- Create a package archive from the elpa repository
4 ## Usage: ./package-update.sh DEST [FULL-UPDATE]
6 ## This creates a package archive beginning in DEST.
8 ## The package archive itself is created in DEST/packages. This dir
9 ## contains the package files.
11 ## If a second argument FULL-UPDATE is specified (whatever its value),
12 ## also create the following:
13 ## - the archive admin scripts in DEST/admin
14 ## - a tarball containing the entire archive in
15 ## DEST/packages/emacs-packages-latest.tgz
16 ## - the Org mode daily package
18 PATH
="/bin:/usr/bin:/usr/local/bin:${PATH}"
27 PKGROOT
=$DEST/packages
28 TMP_PKGROOT
=$DEST/packages-new
29 REPO_PACKAGES
=packages
33 echo "Syntax: $0 DEST [fetch-extras-boolean]"
35 elif [ -d $DEST ]; then
36 echo "Installing into '$DEST', log is '$LOG'"
37 echo "Installing into '$DEST'" > $LOG
39 echo "Base archive update only (pass second arg for full update)."
41 echo "Performing full archive update."
42 TARBALL
=$PKGROOT/emacs-packages-latest.tgz
43 TARBALL_ROOT
="emacs-24.1-packages-`/bin/date +'%F'`"
48 echo "Sorry but $DEST is not a directory, aborting."
52 ## Change to the bzr root directory
54 REPO_ROOT_DIR
=`$BZR root`;
55 if [ -z $REPO_ROOT_DIR ]; then
56 "This script should be run from a bzr repository, aborting."
62 ## Create the working directory that will be the world-facing copy of
63 ## the package archive base.
64 echo "Exporting packages to temporary working directory $TMP_PKGROOT" >> $LOG
66 $BZR export $TMP_PKGROOT $REPO_PACKAGES
68 ## Call the `make-package-archive' Lisp function.
70 ## If second arg is provided, copy in the admin directory and run the
71 ## Org daily synch scripts
73 echo "Skipping admin directory" >> $LOG
74 echo "Skipping post-export fetchers" >> $LOG
76 echo "Exporting admin scripts to $ADMINROOT" >> $LOG
78 $BZR export $ADMINROOT $REPO_ADMIN
79 echo "Running post-export org-mode fetcher as '$ADMINROOT/org-synch.sh $TMP_PKGROOT $ADMINROOT'" >> $LOG
80 $ADMINROOT/org-synch.sh
$TMP_PKGROOT $ADMINROOT >> $LOG 2>&1
83 ## Generate archive-contents and the readme files.
88 $EMACS -batch -l $REPO_ROOT_DIR/admin
/archive-contents.el
-f batch-make-archive-contents
90 ## Tar up the multi-file packages.
92 echo "Creating multi-file package tarballs in $TMP_PKGROOT" >> $LOG
95 echo "Creating tarball $TMP_PKGROOT/$pt.tar" >> $LOG
96 tar -cf $pt.
tar $pt --remove-files
100 ## Move the working directory to its final location
101 echo "Moving $TMP_PKGROOT to $PKGROOT" >> $LOG
103 if [ -d $PKGROOT ]; then
104 mv $PKGROOT $PKGROOT-old
106 mv $TMP_PKGROOT $PKGROOT
109 ## If doing a full update, make a tarball of the entire archive.
110 if [ -z $FULL ]; then
111 echo "Skipping archive tarball" >> $LOG
113 echo "Exporting packages into $TARBALL (root = $TARBALL_ROOT)" >> $LOG
115 $BZR export --format=tgz
--root=$TARBALL_ROOT $TARBALL $REPO_PACKAGES
118 chmod -R a
+rX
$PKGROOT
119 echo "Update complete at" `/bin/date` >> $LOG