get rid of the shell scripts
parent
86089f17d9
commit
0b3c3d6182
97
build.sh
97
build.sh
|
@ -1,97 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
. ./exports.sh
|
||||
|
||||
go get code.google.com/p/goprotobuf/proto
|
||||
go get github.com/goraft/raft
|
||||
go get github.com/gorilla/mux
|
||||
go get github.com/jmhodges/levigo >/dev/null 2>&1 || echo "levigo build will probably fail since we don't have leveldb or snappy"
|
||||
go get github.com/bmizerany/pat
|
||||
go get github.com/fitstar/falcore
|
||||
go get github.com/fitstar/falcore/filter
|
||||
go get code.google.com/p/log4go
|
||||
go get code.google.com/p/go.crypto/bcrypt
|
||||
go get launchpad.net/gocheck
|
||||
go get github.com/influxdb/go-cache
|
||||
|
||||
patch="off"
|
||||
cflags="-m32"
|
||||
arch=80386
|
||||
if [ "x$GOARCH" != "x386" ]; then
|
||||
arch=x86-64
|
||||
cflags=
|
||||
patch=on
|
||||
fi
|
||||
echo "Building for architecutre $arch"
|
||||
|
||||
if file $snappy_dir/.libs/libsnappy.so* | grep $arch >/dev/null 2>&1; then
|
||||
architecture_match=yes
|
||||
fi
|
||||
|
||||
# build snappy and leveldb
|
||||
if [ $on_linux == yes ]; then
|
||||
snappy_version=1.1.0
|
||||
snappy_file=snappy-$snappy_version.tar.gz
|
||||
|
||||
# path to leveldb and snappy patches
|
||||
snappy_patch=$GOPATH/leveldb-patches/0001-use-the-old-glibc-memcpy-snappy.patch
|
||||
leveldb_patch=$GOPATH/leveldb-patches/0001-use-the-old-glibc-memcpy-leveldb.patch
|
||||
|
||||
if [ ! -d $snappy_dir -o ! -e $snappy_dir/$snappy_file -o ! -e $snappy_dir/.libs/libsnappy.a -o "x$architecture_match" != "xyes" ]; then
|
||||
rm -rf $snappy_dir
|
||||
mkdir -p $snappy_dir
|
||||
pushd $snappy_dir
|
||||
wget https://snappy.googlecode.com/files/$snappy_file
|
||||
tar --strip-components=1 -xvzf $snappy_file
|
||||
# apply the path to use the old memcpy and avoid any references to the GLIBC_2.14 only if building the x64
|
||||
[ $patch == on ] && (patch -p1 < $snappy_patch || (echo "Cannot patch this version of snappy" && exit 1))
|
||||
CFLAGS=$cflags CXXFLAGS=$cflags ./configure
|
||||
make
|
||||
popd
|
||||
fi
|
||||
|
||||
leveldb_version=1.12.0
|
||||
leveldb_file=leveldb-$leveldb_version.tar.gz
|
||||
if [ ! -d $leveldb_dir -o ! -e $leveldb_dir/$leveldb_file -o ! -e $leveldb_dir/libleveldb.a -o "x$architecture_match" != "xyes" ]; then
|
||||
rm -rf $leveldb_dir
|
||||
mkdir -p $leveldb_dir
|
||||
pushd $leveldb_dir
|
||||
wget https://leveldb.googlecode.com/files/$leveldb_file
|
||||
tar --strip-components=1 -xvzf $leveldb_file
|
||||
# apply the path to use the old memcpy and avoid any references to the GLIBC_2.14 only if building the x64
|
||||
[ $patch == on ] && (patch -p1 < $leveldb_patch || (echo "Cannot patch this version of leveldb" && exit 1))
|
||||
CXXFLAGS="-I$snappy_dir $cflags" LDFLAGS="-L$snappy_dir/.libs" make
|
||||
popd
|
||||
fi
|
||||
|
||||
pushd src/github.com/jmhodges/levigo/
|
||||
find . -name \*.go | xargs sed -i 's/\/\/ #cgo LDFLAGS: -lleveldb\|#cgo LDFLAGS: -lleveldb//g'
|
||||
popd
|
||||
fi
|
||||
|
||||
if ! which protoc 2>/dev/null; then
|
||||
echo "Please install protobuf (protobuf-compiler on ubuntu) and try to run this script again"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "packages: go build $packages"
|
||||
|
||||
./compile_protobuf.sh
|
||||
|
||||
pushd src/parser
|
||||
./build_parser.sh
|
||||
popd
|
||||
|
||||
for i in $packages; do
|
||||
go build $i
|
||||
done
|
||||
|
||||
# make sure that the server doesn't use a new version of glibc
|
||||
if [ $on_linux == yes ]; then
|
||||
if readelf -a ./server | grep GLIBC_2.14 >/dev/null 2>&1; then
|
||||
echo "./server has some references to GLIBC_2.14. Aborting."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
|
@ -1,9 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
. ./exports.sh
|
||||
|
||||
go get code.google.com/p/goprotobuf/proto \
|
||||
code.google.com/p/goprotobuf/protoc-gen-go
|
||||
|
||||
rm src/protocol/*.pb.go
|
||||
PATH=bin:$PATH protoc --go_out=. src/protocol/*.proto
|
144
package.sh
144
package.sh
|
@ -1,144 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
. ./exports.sh
|
||||
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "Usage: $0 <version>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
admin_dir=`mktemp -d`
|
||||
influxdb_version=$1
|
||||
rm -rf packages
|
||||
mkdir packages
|
||||
bundle install
|
||||
|
||||
function package_admin_interface {
|
||||
pushd $admin_dir
|
||||
git clone https://github.com/influxdb/influxdb-admin.git .
|
||||
rvm rvmrc trust ./.rvmrc
|
||||
|
||||
gem install bundler
|
||||
bundle install
|
||||
bundle exec middleman build
|
||||
popd
|
||||
}
|
||||
|
||||
function packae_source {
|
||||
# make sure we revert the changes we made to the levigo
|
||||
# source packages are used by MacOSX which should be using
|
||||
# dynamic linking
|
||||
pushd src/github.com/jmhodges/levigo/
|
||||
git checkout .
|
||||
popd
|
||||
|
||||
rm -f influxd
|
||||
rm -f server
|
||||
git ls-files --others | egrep -v 'github|launchpad|code.google' > /tmp/influxdb.ignored
|
||||
echo "pkg/*" >> /tmp/influxdb.ignored
|
||||
echo "packages/*" >> /tmp/influxdb.ignored
|
||||
echo "build/*" >> /tmp/influxdb.ignored
|
||||
echo "out_rpm/*" >> /tmp/influxdb.ignored
|
||||
tar_file=influxdb-$influxdb_version.src.tar.gz
|
||||
tar -czf packages/$tar_file --exclude-vcs -X /tmp/influxdb.ignored *
|
||||
pushd packages
|
||||
# put all files in influxdb
|
||||
mkdir influxdb
|
||||
tar -xzf $tar_file -C influxdb
|
||||
rm $tar_file
|
||||
tar -czf $tar_file influxdb
|
||||
popd
|
||||
}
|
||||
|
||||
function package_files {
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "Usage: $0 architecture"
|
||||
return 1
|
||||
fi
|
||||
|
||||
rm -rf build
|
||||
mkdir build
|
||||
|
||||
package_admin_interface
|
||||
|
||||
mv daemon build/influxdb
|
||||
|
||||
# cp -R src/admin/site/ build/admin/
|
||||
mkdir build/admin
|
||||
cp -R $admin_dir/build/* build/admin/
|
||||
|
||||
cp -R scripts/ build/
|
||||
|
||||
tar_file=influxdb-$influxdb_version.$1.tar.gz
|
||||
|
||||
tar -czf $tar_file build/*
|
||||
|
||||
mv $tar_file packages/
|
||||
|
||||
# the tar file should use "./assets" but the deb and rpm packages should use "/opt/influxdb/current/admin"
|
||||
cat > build/config.json <<EOF
|
||||
{
|
||||
"AdminHttpPort": 8083,
|
||||
"AdminAssetsDir": "/opt/influxdb/current/admin",
|
||||
"ApiHttpPort": 8086,
|
||||
"RaftServerPort": 8090,
|
||||
"SeedServers": [],
|
||||
"DataDir": "/opt/influxdb/shared/data/db",
|
||||
"RaftDir": "/opt/influxdb/shared/data/raft"
|
||||
}
|
||||
EOF
|
||||
rm build/*.bak
|
||||
rm build/scripts/*.bak
|
||||
}
|
||||
|
||||
function build_packages {
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "Usage: $0 architecture"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ $1 == "386" ]; then
|
||||
rpm_args="setarch i386"
|
||||
deb_args="-a i386"
|
||||
fi
|
||||
|
||||
rm -rf out_rpm
|
||||
mkdir -p out_rpm/opt/influxdb/versions/$influxdb_version
|
||||
cp -r build/* out_rpm/opt/influxdb/versions/$influxdb_version
|
||||
pushd out_rpm
|
||||
$rpm_args fpm -s dir -t rpm --after-install ../scripts/post_install.sh -n influxdb -v $influxdb_version . || exit $?
|
||||
mv *.rpm ../packages/
|
||||
fpm -s dir -t deb $deb_args --after-install ../scripts/post_install.sh -n influxdb -v $influxdb_version . || exit $?
|
||||
mv *.deb ../packages/
|
||||
popd
|
||||
}
|
||||
|
||||
function setup_version {
|
||||
echo "Changing version from dev to $influxdb_version"
|
||||
sha1=`git rev-list --max-count=1 HEAD`
|
||||
sed -i.bak -e "s/version = \"dev\"/version = \"$influxdb_version\"/" -e "s/gitSha\s*=\s*\"HEAD\"/gitSha = \"$sha1\"/" src/daemon/influxd.go
|
||||
sed -i.bak -e "s/REPLACE_VERSION/$influxdb_version/" scripts/post_install.sh
|
||||
}
|
||||
|
||||
function revert_version {
|
||||
if [ -e src/daemon/influxd.go.bak ]; then
|
||||
rm src/daemon/influxd.go
|
||||
mv src/daemon/influxd.go.bak src/daemon/influxd.go
|
||||
fi
|
||||
|
||||
if [ -e scripts/post_install.sh ]; then
|
||||
rm scripts/post_install.sh
|
||||
mv scripts/post_install.sh.bak scripts/post_install.sh
|
||||
fi
|
||||
|
||||
echo "Changed version back to dev"
|
||||
}
|
||||
|
||||
setup_version
|
||||
UPDATE=on ./build.sh && package_files amd64 && build_packages amd64
|
||||
# we need to build to make sure all the dependencies are downloaded
|
||||
[ $on_linux == yes ] && CGO_ENABLED=1 GOARCH=386 UPDATE=on ./build.sh && package_files 386 && build_packages 386
|
||||
packae_source
|
||||
revert_version
|
76
test.sh
76
test.sh
|
@ -1,76 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
cd `dirname $0`
|
||||
. exports.sh
|
||||
|
||||
function print_usage {
|
||||
echo "$0 [-o regex] [-p package_name] -- <test arguments>"
|
||||
echo " -o|--only: Run the test that matches the given regex"
|
||||
echo " --no-valgrind: Skip the valgrind memory leak test"
|
||||
echo " -p|--packages: Run the test in the given packages only"
|
||||
echo " -b|--benchmarks: Run benchmarks"
|
||||
echo " -v|--verbose: Prints verbose output"
|
||||
echo " -h|--help: Prints this help message"
|
||||
}
|
||||
|
||||
while [ $# -ne 0 ]; do
|
||||
case "$1" in
|
||||
-h|--help) print_usage; exit 1; shift;;
|
||||
-v|--verbose) verbose=on; shift;;
|
||||
-o|--only) regex=$2; shift 2;;
|
||||
--no-valgrind) valgrind=no; shift;;
|
||||
-p|--packages) test_packages="$test_packages $2"; shift 2;;
|
||||
-b|--benchmarks) gocheck_args="$gocheck_args -gocheck.b"; shift;;
|
||||
--) shift ; break ;;
|
||||
*) echo "Internal error!" ; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
go fmt $packages || echo "Cannot format code"
|
||||
|
||||
./build.sh
|
||||
|
||||
if [ "x`uname`" == "xLinux" -a "x$valgrind" != "xno" ]; then
|
||||
pushd src/parser
|
||||
if ! ./test_memory_leaks.sh; then
|
||||
echo "ERROR: memory leak detected"
|
||||
exit 1
|
||||
fi
|
||||
popd
|
||||
fi
|
||||
|
||||
[ "x$test_packages" == "x" ] && test_packages="$packages"
|
||||
echo "Running tests for packages: $test_packages"
|
||||
|
||||
[ "x$regex" != "x" ] && gocheck_args="$gocheck_args -gocheck.f $regex"
|
||||
[ "x$verbose" == "xon" ] && gocheck_args="$gocheck_args -v -gocheck.v"
|
||||
|
||||
ulimit -n 2048 || echo could not change ulimit
|
||||
|
||||
function notify_failure {
|
||||
if ! which notify-send > /dev/null 2>&1; then
|
||||
return
|
||||
fi
|
||||
|
||||
notify-send Influxdb "Package $1 test failed"
|
||||
}
|
||||
|
||||
function notify_end {
|
||||
if ! which notify-send > /dev/null 2>&1; then
|
||||
return
|
||||
fi
|
||||
|
||||
notify-send Influxdb "Test script finished"
|
||||
}
|
||||
|
||||
for i in $test_packages; do
|
||||
if go version | grep go1.2 > /dev/null 2>&1; then
|
||||
go test -coverprofile /tmp/influxdb.${i/\//.}.coverage $i $gocheck_args $@ || notify_failure $i
|
||||
else
|
||||
go test $i $gocheck_args $@ || notify_failure $i
|
||||
fi
|
||||
done
|
||||
|
||||
notify_end
|
Loading…
Reference in New Issue