Lichen

Annotated docs/tools/make_releases.sh

932:c07b0dd14f85
12 months ago Paul Boddie Moved integer instantiation support to library functions.
paul@810 1
#!/bin/sh
paul@810 2
paul@810 3
DIRNAME=`dirname "$0"`
paul@810 4
PROGNAME=`basename "$0"`
paul@810 5
paul@810 6
ARCHIVE=Lichen
paul@810 7
paul@810 8
if [ ! "$1" ] || [ "$1" = '--help' ] ; then
paul@810 9
    cat 1>&2 <<EOF
paul@810 10
Usage: $PROGNAME <output directory> [ -f ]
paul@810 11
paul@810 12
Make release archives from tags starting with "rel-" in the repository,
paul@810 13
storing the archives in the output directory. If an archive already exists for
paul@810 14
a release, it is not regenerated unless the -f (force) option is given.
paul@810 15
paul@810 16
All newly-created archive filenames are emitted on standard output.
paul@810 17
EOF
paul@810 18
    exit 1
paul@810 19
fi
paul@810 20
paul@810 21
OUTDIR=$1
paul@810 22
FORCE=$2
paul@810 23
paul@810 24
if [ "$FORCE" != '-f' ]; then
paul@810 25
    FORCE=
paul@810 26
fi
paul@810 27
paul@810 28
if [ ! -e "$OUTDIR" ]; then
paul@810 29
    mkdir -p "$OUTDIR"
paul@810 30
fi
paul@810 31
paul@810 32
for TAG in `hg tags | grep ^rel- | cut -f 1 -d ' '` ; do
paul@810 33
    NUM=`echo "$TAG" | sed 's/rel-//;s/-/./g'`
paul@810 34
    OUTFILE="$OUTDIR/$ARCHIVE-$NUM.tar.bz2"
paul@810 35
    if [ ! -e "$OUTFILE" ] || [ "$FORCE" ]; then
paul@810 36
        hg archive -t tbz2 -r "$TAG" "$OUTFILE"
paul@810 37
        echo "$OUTFILE"
paul@810 38
    fi
paul@810 39
done