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 ## If second arg is provided, copy in the admin directory and run the
69 ## Org daily synch scripts
71 echo "Skipping admin directory" >> $LOG
72 echo "Skipping post-export fetchers" >> $LOG
74 echo "Exporting admin scripts to $ADMINROOT" >> $LOG
76 $BZR export $ADMINROOT $REPO_ADMIN
77 echo "Running post-export org-mode fetcher as '$ADMINROOT/org-synch.sh $TMP_PKGROOT $ADMINROOT'" >> $LOG
78 $ADMINROOT/org-synch.sh
$TMP_PKGROOT $ADMINROOT >> $LOG 2>&1
81 ## Generate archive-contents and the readme files.
86 $EMACS -batch -l $REPO_ROOT_DIR/admin
/archive-contents.el
-f batch-make-archive-contents
88 ## Tar up the multi-file packages.
90 echo "Creating multi-file package tarballs in $TMP_PKGROOT" >> $LOG
93 echo "Creating tarball $TMP_PKGROOT/$pt.tar" >> $LOG
94 tar -cf $pt.
tar $pt --remove-files
98 ## Move the working directory to its final location
99 echo "Moving $TMP_PKGROOT to $PKGROOT" >> $LOG
101 if [ -d $PKGROOT ]; then
102 mv $PKGROOT $PKGROOT-old
104 mv $TMP_PKGROOT $PKGROOT
107 ## If doing a full update, make a tarball of the entire archive.
108 if [ -z $FULL ]; then
109 echo "Skipping archive tarball" >> $LOG
111 echo "Exporting packages into $TARBALL (root = $TARBALL_ROOT)" >> $LOG
113 $BZR export --format=tgz
--root=$TARBALL_ROOT $TARBALL $REPO_PACKAGES
116 chmod -R a
+rX
$PKGROOT
117 echo "Update complete at" `/bin/date` >> $LOG