Skip to content

Commit 4fa35d0

Browse files
author
Brett Hazen
committed
Merge pull request #858 from basho/feature/bch/rtdev-install-script
Add script rtdev-install.sh to install arbitrary devrel in Git repository
2 parents 9463789 + 8a99d75 commit 4fa35d0

File tree

3 files changed

+50
-37
lines changed

3 files changed

+50
-37
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,12 @@ to a release number, e.g. `2.0.0`. It will automatically be prefixed with
134134
the repo name, e.g. `riak_ee-2.0.0`. To use `riak_ee` instead of `riak` set [`$RT_USE_EE`](https://github.com/basho/riak_test/blob/master/bin/rtdev-setup-releases.sh#L23)
135135
to any non-empty string.
136136

137+
### rtdev-install.sh
138+
139+
`rtdev-install.sh` is exactly the same as `rtdev-current.sh`, however,
140+
you can use arbitrary names like `riak-2.1.2` instead of just `current`.
141+
The single argument supplied to this script is that directory name.
142+
137143
#### reset-current-env.sh
138144

139145
`reset-current-env.sh` resets test environments setup using `rtdev-current.sh`

bin/rtdev-current.sh

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,4 @@
11
#!/usr/bin/env bash
2-
3-
# bail out if things go south
4-
set -e
5-
6-
: ${RT_DEST_DIR:="$HOME/rt/riak"}
7-
# If RT_CURRENT_TAG is specified, it will use that version number
8-
# otherwise the last annotated tag will be used
9-
: ${RT_CURRENT_TAG:=""}
10-
11-
echo "Making $(pwd) the current release:"
12-
cwd=$(pwd)
13-
echo -n " - Determining version: "
14-
if [ -n "$RT_CURRENT_TAG" ]; then
15-
VERSION=$RT_CURRENT_TAG
16-
elif [ -f $cwd/dependency_manifest.git ]; then
17-
VERSION=`cat $cwd/dependency_manifest.git | awk '/^-/ { print $NF }'`
18-
else
19-
VERSION="$(git describe --tags)-$(git branch | awk '/\*/ {print $2}')"
20-
fi
21-
echo $VERSION
22-
cd $RT_DEST_DIR
23-
echo " - Resetting existing $RT_DEST_DIR"
24-
export GIT_WORK_TREE="$RT_DEST_DIR"
25-
git reset HEAD --hard > /dev/null
26-
git clean -fd > /dev/null
27-
echo " - Removing and recreating $RT_DEST_DIR/current"
28-
rm -rf $RT_DEST_DIR/current
29-
mkdir $RT_DEST_DIR/current
30-
cd $cwd
31-
echo " - Copying devrel to $RT_DEST_DIR/current"
32-
cp -p -P -R dev $RT_DEST_DIR/current
33-
echo " - Writing $RT_DEST_DIR/current/VERSION"
34-
echo -n $VERSION > $RT_DEST_DIR/current/VERSION
35-
cd $RT_DEST_DIR
36-
echo " - Reinitializing git state"
37-
git add .
38-
git commit -a -m "riak_test init" --amend > /dev/null
2+
SCRIPT=$0
3+
DIR=${SCRIPT%/*}
4+
$DIR/rtdev-install.sh current

bin/rtdev-install.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/bin/env bash
2+
3+
# bail out if things go south
4+
set -e
5+
6+
: ${RT_DEST_DIR:="$HOME/rt/riak"}
7+
if [[ $# < 1 ]]; then
8+
echo "Missing release directory as argument, e.g. riak_ee-2.1.2"
9+
exit 1
10+
fi
11+
RELEASE=$1
12+
13+
echo "Making $(pwd) the $RELEASE release:"
14+
cwd=$(pwd)
15+
echo -n " - Determining version: "
16+
if [ -f $cwd/dependency_manifest.git ]; then
17+
VERSION=`cat $cwd/dependency_manifest.git | awk '/^-/ { print $NF }'`
18+
else
19+
VERSION="$(git describe --tags)-$(git branch | awk '/\*/ {print $2}')"
20+
fi
21+
if [[ "$RELEASE" == "current" && ! -z "$RT_CURRENT_TAG" ]]; then
22+
VERSION=$RT_CURRENT_TAG
23+
fi
24+
echo $VERSION
25+
cd $RT_DEST_DIR
26+
echo " - Resetting existing $RT_DEST_DIR"
27+
export GIT_WORK_TREE="$RT_DEST_DIR"
28+
git reset HEAD --hard > /dev/null
29+
git clean -fd > /dev/null
30+
echo " - Removing and recreating $RT_DEST_DIR/$RELEASE"
31+
rm -rf $RT_DEST_DIR/$RELEASE
32+
mkdir $RT_DEST_DIR/$RELEASE
33+
cd $cwd
34+
echo " - Copying devrel to $RT_DEST_DIR/$RELEASE"
35+
cp -p -P -R dev $RT_DEST_DIR/$RELEASE
36+
echo " - Writing $RT_DEST_DIR/$RELEASE/VERSION"
37+
echo -n $VERSION > $RT_DEST_DIR/$RELEASE/VERSION
38+
cd $RT_DEST_DIR
39+
echo " - Reinitializing git state"
40+
git add .
41+
git commit -a -m "riak_test init" --amend > /dev/null

0 commit comments

Comments
 (0)