From 2c9557e39454c351ec4aad2a75896ac1f12edb0c Mon Sep 17 00:00:00 2001 From: Steve Vinoski Date: Mon, 26 Mar 2012 20:07:51 -0400 Subject: [PATCH] add helper script to enable wterl Add a helper script to enable wterl in a riak devrel build. The script is meant to be temporary, to be used during wterl development. --- enable-wterl | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100755 enable-wterl diff --git a/enable-wterl b/enable-wterl new file mode 100755 index 0000000..ad275ce --- /dev/null +++ b/enable-wterl @@ -0,0 +1,59 @@ +#!/bin/sh + +# This script adds wterl to a riak github repo. Run it in the riak repo +# directory. +# +# First it adds wterl, then runs "make all devrel" and then enables the +# wterl storage backend in the resulting dev nodes. +# +# This script is intended to be temporary. Once wterl is made into a proper +# riak citizen, this script will no longer be needed. + +set -e + +wd=`pwd` +if [ `basename $wd` != riak ]; then + echo "This doesn't appear to be a riak repo directory. Exiting." + exit 1 +fi + +if [ -d dev ]; then + echo + echo 'NOTE: THIS SCRIPT WILL DELETE YOUR EXISTING DEV DIRECTORY!' + while [ 1 ]; do + printf '\n%s' ' Do you wish to proceed? [no] ' + read answer + answer=${answer:-n} + case $answer in + [Nn]*) exit 0 ;; + [Yy]*) break ;; + *) echo 'Please answer y or n.' ;; + esac + done +fi + +rebar get-deps + +file=./deps/riak_kv/rebar.config +if ! grep -q wterl $file ; then + echo + echo "Modifying $file, saving the original as ${file}.orig ..." + perl -i.orig -pe '/\bsext\b/ && print qq( {wterl, ".*", {git, "git\@github.com:basho/wterl.git", "master"}},\n)' $file +fi +file=./deps/riak_kv/src/riak_kv.app.src +if ! grep -q wterl $file ; then + echo + echo "Modifying $file, saving the original as ${file}.orig ..." + perl -i.orig -pe '/\briak_pipe\b/ && print " wterl,\n"' $file +fi + +rebar get-deps + +rm -rf dev +make all devrel + +echo +echo 'Modifying all dev/dev*/etc/app.config files, saving originals with .orig suffix...' +perl -i.orig -ne 'if (/\bstorage_backend,/) { s/(storage_backend, )[^\}]+/\1riak_kv_wterl_backend/; print } elsif (/\{eleveldb,/) { $eleveldb++; print } elsif ($eleveldb && /^\s+\]\},/) { $eleveldb = 0; print; print qq(\n {wterl, [\n {data_root, "./data/wt"}\n ]},\n\n) } else { print }' dev/dev*/etc/app.config + +exit 0