summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/dist/s_release_docs
blob: 965f59662e885525583663d0d8d285b4429d392d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/sh
# Build a WiredTiger release package.

set -e

. ../RELEASE_INFO || exit 1

TOPDIR=`pwd`/..
RELEASE_DIR=$TOPDIR/releases
DOC_DIR=$TOPDIR/../wiredtiger.github.com
DOCFILE=$TOPDIR/src/docs/top/main.dox
tmp=$0.tmp

RELEASE_PACKAGE=`ls $RELEASE_DIR | tail -n 1`

# Parse command line options.
while getopts d:r: OPT; do
    case "$OPT" in
        d)
            DOC_DIR=$OPTARG
            ;;
        r)
            RELEASE_PACKAGE=$OPTARG
            ;;
        \?)
            # getopts issues an error message
            echo $USAGE >&2
            exit 1
            ;;
    esac
done

# Remove the switches we parsed above.
shift `expr $OPTIND - 1`

if [ ! -d "$DOC_DIR" ]; then
	echo "Invalid Git doc repository $DOC_DIR"
fi
if [ ! -f "$RELEASE_DIR/$RELEASE_PACKAGE" ]; then
	echo "Invalid release package: $RELEASE_DIR/$RELEASE_PACKAGE"
fi

pkgver="$WIREDTIGER_VERSION"

# Find the old versions in the documentation.
oldrel=`grep current $DOCFILE | cut -d ' ' -f 2 | cut -d '<' -f 1`
prevrel=`grep previous $DOCFILE | cut -d ' ' -f 2 | cut -d '<' -f 1`

OLD_VERSION_MAJOR=`echo $oldrel | cut -d '.' -f 1`
OLD_VERSION_MINOR=`echo $oldrel | cut -d '.' -f 2`
OLD_VERSION_PATCH=`echo $oldrel | cut -d '.' -f 3`
PREV_VERSION_MAJOR=`echo $prevrel | cut -d '.' -f 1`
PREV_VERSION_MINOR=`echo $prevrel | cut -d '.' -f 2`
PREV_VERSION_PATCH=`echo $prevrel | cut -d '.' -f 3`

# Update the release versions on the landing page.
sed -e "s/$oldrel/$pkgver/" $DOCFILE > $tmp && mv $tmp $DOCFILE
if [ $OLD_VERSION_MINOR != $WIREDTIGER_VERSION_MINOR ]; then
	sed -e "s/$prevrel/$oldrel/" $DOCFILE > $tmp && mv $tmp $DOCFILE
fi

echo "Rebuild documentation root"
(cd "$TOPDIR/dist" && sh s_docs -l > /dev/null)

# Copy the new files into the documentation repository
(cd $TOPDIR && cp docs/top/* $DOC_DIR/)

# Unpack the documentation into the right location
(mkdir -p $DOC_DIR/$pkgver && cd $RELEASE_DIR && \
    cp $RELEASE_PACKAGE $DOC_DIR/releases/ &&
    tar xjf $RELEASE_PACKAGE -C $DOC_DIR/$pkgver --strip-components 2 wiredtiger-$pkgver/docs)

(cd $DOC_DIR && git add . $pkgver releases/wiredtiger-$pkgver.tar.bz2 && \
    git commit -m "Release $pkgver")

echo "Finished packaging documentation, you should now push the results. Run:"
echo "cd $DOC_DIR && git push origin"
echo "To backout changes run 'git reset HEAD~1'"