Create ubuntu and centos packages.
parent
ec05cd4ec7
commit
a89a6cbe7c
|
@ -31,3 +31,5 @@ src/code.google.com/p/go.crypto/
|
|||
src/launchpad.net/gocheck/
|
||||
/src/github.com/nsf/gocode/
|
||||
/src/github.com/*
|
||||
out_rpm/
|
||||
packages/
|
||||
|
|
39
build.sh
39
build.sh
|
@ -7,7 +7,7 @@ set -e
|
|||
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 || echo "levigo build will probably fail since we don't have leveldb or snappy"
|
||||
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
|
||||
|
@ -15,30 +15,53 @@ go get code.google.com/p/log4go
|
|||
go get code.google.com/p/go.crypto/bcrypt
|
||||
go get launchpad.net/gocheck
|
||||
|
||||
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 [ `uname` == "Linux" ]; then
|
||||
if [ $on_linux == yes ]; then
|
||||
snappy_version=1.1.0
|
||||
snappy_file=snappy-$snappy_version.tar.gz
|
||||
if [ ! -d $snappy_dir -o ! -e $snappy_dir/$snappy_file -o ! -e $snappy_dir/.libs/libsnappy.a ]; then
|
||||
|
||||
# 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
|
||||
./configure
|
||||
# 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 ]; then
|
||||
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
|
||||
CXXFLAGS="-I$snappy_dir" LDFLAGS="-L$snappy_dir/.libs" make
|
||||
# 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
|
||||
|
||||
|
@ -60,4 +83,6 @@ pushd src/parser
|
|||
./build_parser.sh
|
||||
popd
|
||||
|
||||
go build $packages
|
||||
for i in $packages; do
|
||||
go build $i
|
||||
done
|
||||
|
|
|
@ -24,7 +24,11 @@ popd
|
|||
snappy_dir=/tmp/snappychronosdb
|
||||
leveldb_dir=/tmp/leveldbchronosdb
|
||||
export LD_LIBRARY_PATH=/usr/local/lib
|
||||
on_linux="no"
|
||||
if [ `uname` == "Linux" ]; then
|
||||
on_linux=yes
|
||||
fi
|
||||
if [ $on_linux == yes ]; then
|
||||
export CGO_CFLAGS="-I$leveldb_dir/include"
|
||||
export CGO_LDFLAGS="$leveldb_dir/libleveldb.a $snappy_dir/.libs/libsnappy.a -lstdc++"
|
||||
else
|
||||
|
|
|
@ -0,0 +1,165 @@
|
|||
From 22404ea79ea9e76ea9a72366af8f2d7d920df07c Mon Sep 17 00:00:00 2001
|
||||
From: John Shahid <jvshahid@gmail.com>
|
||||
Date: Wed, 25 Sep 2013 11:08:42 -0400
|
||||
Subject: [PATCH] use the old glibc memcpy
|
||||
|
||||
---
|
||||
db/c.cc | 2 ++
|
||||
db/c_test.c | 2 ++
|
||||
db/dbformat.cc | 2 ++
|
||||
db/memtable.cc | 2 ++
|
||||
helpers/memenv/memenv.cc | 2 ++
|
||||
table/table_test.cc | 2 ++
|
||||
util/cache.cc | 2 ++
|
||||
util/coding.cc | 2 ++
|
||||
util/coding.h | 2 ++
|
||||
util/env_posix.cc | 2 ++
|
||||
util/status.cc | 2 ++
|
||||
11 files changed, 22 insertions(+)
|
||||
|
||||
diff --git a/db/c.cc b/db/c.cc
|
||||
index 08ff0ad..f622c62 100644
|
||||
--- a/db/c.cc
|
||||
+++ b/db/c.cc
|
||||
@@ -57,6 +57,8 @@ struct leveldb_writablefile_t { WritableFile* rep; };
|
||||
struct leveldb_logger_t { Logger* rep; };
|
||||
struct leveldb_filelock_t { FileLock* rep; };
|
||||
|
||||
+__asm__(".symver memcpy,memcpy@GLIBC_2.2.5");
|
||||
+
|
||||
struct leveldb_comparator_t : public Comparator {
|
||||
void* state_;
|
||||
void (*destructor_)(void*);
|
||||
diff --git a/db/c_test.c b/db/c_test.c
|
||||
index 7cd5ee0..4037152 100644
|
||||
--- a/db/c_test.c
|
||||
+++ b/db/c_test.c
|
||||
@@ -11,6 +11,8 @@
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
+__asm__(".symver memcpy,memcpy@GLIBC_2.2.5");
|
||||
+
|
||||
const char* phase = "";
|
||||
static char dbname[200];
|
||||
|
||||
diff --git a/db/dbformat.cc b/db/dbformat.cc
|
||||
index 20a7ca4..38bb88e 100644
|
||||
--- a/db/dbformat.cc
|
||||
+++ b/db/dbformat.cc
|
||||
@@ -7,6 +7,8 @@
|
||||
#include "port/port.h"
|
||||
#include "util/coding.h"
|
||||
|
||||
+__asm__(".symver memcpy,memcpy@GLIBC_2.2.5");
|
||||
+
|
||||
namespace leveldb {
|
||||
|
||||
static uint64_t PackSequenceAndType(uint64_t seq, ValueType t) {
|
||||
diff --git a/db/memtable.cc b/db/memtable.cc
|
||||
index bfec0a7..6ae47a4 100644
|
||||
--- a/db/memtable.cc
|
||||
+++ b/db/memtable.cc
|
||||
@@ -9,6 +9,8 @@
|
||||
#include "leveldb/iterator.h"
|
||||
#include "util/coding.h"
|
||||
|
||||
+__asm__(".symver memcpy,memcpy@GLIBC_2.2.5");
|
||||
+
|
||||
namespace leveldb {
|
||||
|
||||
static Slice GetLengthPrefixedSlice(const char* data) {
|
||||
diff --git a/helpers/memenv/memenv.cc b/helpers/memenv/memenv.cc
|
||||
index 5879de1..df572a9 100644
|
||||
--- a/helpers/memenv/memenv.cc
|
||||
+++ b/helpers/memenv/memenv.cc
|
||||
@@ -15,6 +15,8 @@
|
||||
|
||||
namespace leveldb {
|
||||
|
||||
+__asm__(".symver memcpy,memcpy@GLIBC_2.2.5");
|
||||
+
|
||||
namespace {
|
||||
|
||||
class FileState {
|
||||
diff --git a/table/table_test.cc b/table/table_test.cc
|
||||
index c723bf8..686a36e 100644
|
||||
--- a/table/table_test.cc
|
||||
+++ b/table/table_test.cc
|
||||
@@ -20,6 +20,8 @@
|
||||
#include "util/testharness.h"
|
||||
#include "util/testutil.h"
|
||||
|
||||
+__asm__(".symver memcpy,memcpy@GLIBC_2.2.5");
|
||||
+
|
||||
namespace leveldb {
|
||||
|
||||
// Return reverse of "key".
|
||||
diff --git a/util/cache.cc b/util/cache.cc
|
||||
index 8b197bc..aa2bcb0 100644
|
||||
--- a/util/cache.cc
|
||||
+++ b/util/cache.cc
|
||||
@@ -11,6 +11,8 @@
|
||||
#include "util/hash.h"
|
||||
#include "util/mutexlock.h"
|
||||
|
||||
+__asm__(".symver memcpy,memcpy@GLIBC_2.2.5");
|
||||
+
|
||||
namespace leveldb {
|
||||
|
||||
Cache::~Cache() {
|
||||
diff --git a/util/coding.cc b/util/coding.cc
|
||||
index 21e3186..dafce66 100644
|
||||
--- a/util/coding.cc
|
||||
+++ b/util/coding.cc
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
#include "util/coding.h"
|
||||
|
||||
+__asm__(".symver memcpy,memcpy@GLIBC_2.2.5");
|
||||
+
|
||||
namespace leveldb {
|
||||
|
||||
void EncodeFixed32(char* buf, uint32_t value) {
|
||||
diff --git a/util/coding.h b/util/coding.h
|
||||
index 3993c4a..56e7302 100644
|
||||
--- a/util/coding.h
|
||||
+++ b/util/coding.h
|
||||
@@ -16,6 +16,8 @@
|
||||
#include "leveldb/slice.h"
|
||||
#include "port/port.h"
|
||||
|
||||
+__asm__(".symver memcpy,memcpy@GLIBC_2.2.5");
|
||||
+
|
||||
namespace leveldb {
|
||||
|
||||
// Standard Put... routines append to a string
|
||||
diff --git a/util/env_posix.cc b/util/env_posix.cc
|
||||
index 3e2925d..99e31fb 100644
|
||||
--- a/util/env_posix.cc
|
||||
+++ b/util/env_posix.cc
|
||||
@@ -29,6 +29,8 @@
|
||||
|
||||
namespace leveldb {
|
||||
|
||||
+__asm__(".symver memcpy,memcpy@GLIBC_2.2.5");
|
||||
+
|
||||
namespace {
|
||||
|
||||
static Status IOError(const std::string& context, int err_number) {
|
||||
diff --git a/util/status.cc b/util/status.cc
|
||||
index a44f35b..17120da 100644
|
||||
--- a/util/status.cc
|
||||
+++ b/util/status.cc
|
||||
@@ -6,6 +6,8 @@
|
||||
#include "port/port.h"
|
||||
#include "leveldb/status.h"
|
||||
|
||||
+__asm__(".symver memcpy,memcpy@GLIBC_2.2.5");
|
||||
+
|
||||
namespace leveldb {
|
||||
|
||||
const char* Status::CopyState(const char* state) {
|
||||
--
|
||||
1.8.3.2
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
From 1d27e8ef967cefb504f9d471621f16e888001042 Mon Sep 17 00:00:00 2001
|
||||
From: John Shahid <jvshahid@gmail.com>
|
||||
Date: Wed, 25 Sep 2013 11:01:31 -0400
|
||||
Subject: [PATCH] use the old memcpy
|
||||
|
||||
---
|
||||
snappy-sinksource.cc | 1 +
|
||||
snappy-stubs-internal.h | 1 +
|
||||
snappy.cc | 1 +
|
||||
snappy_unittest.cc | 1 +
|
||||
4 files changed, 4 insertions(+)
|
||||
|
||||
diff --git a/snappy-sinksource.cc b/snappy-sinksource.cc
|
||||
index 5844552..a469155 100644
|
||||
--- a/snappy-sinksource.cc
|
||||
+++ b/snappy-sinksource.cc
|
||||
@@ -30,6 +30,7 @@
|
||||
|
||||
#include "snappy-sinksource.h"
|
||||
|
||||
+__asm__(".symver memcpy,memcpy@GLIBC_2.2.5");
|
||||
namespace snappy {
|
||||
|
||||
Source::~Source() { }
|
||||
diff --git a/snappy-stubs-internal.h b/snappy-stubs-internal.h
|
||||
index 12393b6..3353649 100644
|
||||
--- a/snappy-stubs-internal.h
|
||||
+++ b/snappy-stubs-internal.h
|
||||
@@ -89,6 +89,7 @@ using namespace std;
|
||||
#define DECLARE_bool(flag_name) \
|
||||
extern bool FLAGS_ ## flag_name
|
||||
|
||||
+__asm__(".symver memcpy,memcpy@GLIBC_2.2.5");
|
||||
namespace snappy {
|
||||
|
||||
static const uint32 kuint32max = static_cast<uint32>(0xFFFFFFFF);
|
||||
diff --git a/snappy.cc b/snappy.cc
|
||||
index 1230321..e32ce5a 100644
|
||||
--- a/snappy.cc
|
||||
+++ b/snappy.cc
|
||||
@@ -37,6 +37,7 @@
|
||||
#include <vector>
|
||||
|
||||
|
||||
+__asm__(".symver memcpy,memcpy@GLIBC_2.2.5");
|
||||
namespace snappy {
|
||||
|
||||
// Any hash function will produce a valid compressed bitstream, but a good
|
||||
diff --git a/snappy_unittest.cc b/snappy_unittest.cc
|
||||
index f345dc3..cbd96fd 100644
|
||||
--- a/snappy_unittest.cc
|
||||
+++ b/snappy_unittest.cc
|
||||
@@ -65,6 +65,7 @@ DEFINE_bool(write_compressed, false,
|
||||
DEFINE_bool(write_uncompressed, false,
|
||||
"Write uncompressed versions of each file to <file>.uncomp");
|
||||
|
||||
+__asm__(".symver memcpy,memcpy@GLIBC_2.2.5");
|
||||
namespace snappy {
|
||||
|
||||
|
||||
--
|
||||
1.8.3.2
|
||||
|
96
package.sh
96
package.sh
|
@ -1,23 +1,89 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
. ./exports.sh
|
||||
|
||||
if [ -e build ]; then
|
||||
rm -rf build/*
|
||||
else
|
||||
mkdir build
|
||||
fi
|
||||
influxdb_version=`cat VERSION`
|
||||
rm -rf packages
|
||||
mkdir packages
|
||||
|
||||
export INFLUXDB_VERSION=`cat VERSION`
|
||||
sed -i.bak "s/var version = \"dev\"/var version = \"$INFLUXDB_VERSION\"/" src/server/server.go
|
||||
export GOPATH=`pwd`
|
||||
go build src/server/server.go
|
||||
sed -i.bak "s/var version = \"$INFLUXDB_VERSION\"/var version = \"dev\"/" src/server/server.go
|
||||
rm src/server/server.go.bak
|
||||
mv server build/influxdb
|
||||
function setup_rvm {
|
||||
# Load RVM into a shell session *as a function*
|
||||
if [ -s "$HOME/.rvm/scripts/rvm" ]; then
|
||||
# First try to load from a user install
|
||||
source "$HOME/.rvm/scripts/rvm"
|
||||
elif [ -s "/usr/local/rvm/scripts/rvm" ]; then
|
||||
# Then try to load from a root install
|
||||
source "/usr/local/rvm/scripts/rvm"
|
||||
else
|
||||
printf "ERROR: An RVM installation was not found.\n"
|
||||
fi
|
||||
rvm use --create 1.9.3@errplane-agent
|
||||
gem install fpm
|
||||
}
|
||||
|
||||
cp config.json.sample build/config.json
|
||||
function package_files {
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "Usage: $0 architecture"
|
||||
return 1
|
||||
fi
|
||||
|
||||
cp -R src/admin/site/ build/admin/
|
||||
rm -rf build
|
||||
mkdir build
|
||||
|
||||
tar -czf influxdb-`cat VERSION`.tar.gz build/*
|
||||
mv server build/influxdb
|
||||
|
||||
cp config.json.sample build/config.json
|
||||
|
||||
cp -R src/admin/site/ build/admin/
|
||||
|
||||
tar_file=influxdb-$influxdb_version.$1.tar.gz
|
||||
|
||||
tar -czf $tar_file build/*
|
||||
|
||||
mv $tar_file packages/
|
||||
}
|
||||
|
||||
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 -n influxdb -v $influxdb_version . || exit $?
|
||||
mv *.rpm ../packages/
|
||||
fpm -s dir -t deb $deb_args -n influxdb -v $influxdb_version . || exit $?
|
||||
mv *.deb ../packages/
|
||||
popd
|
||||
}
|
||||
|
||||
function setup_version {
|
||||
echo "Changing version from dev to $influxdb_version"
|
||||
sed -i.bak "s/var version = \"dev\"/var version = \"$influxdb_version\"/" src/server/server.go
|
||||
}
|
||||
|
||||
function revert_version {
|
||||
if [ ! -e src/server/server.go.bak ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
rm src/server/server.go
|
||||
mv src/server/server.go.bak src/server/server.go
|
||||
echo "Changed version back to dev"
|
||||
}
|
||||
|
||||
setup_rvm
|
||||
setup_version
|
||||
UPDATE=on ./build.sh && package_files amd64 && build_packages amd64
|
||||
revert_version
|
||||
[ $on_linux == yes ] && CGO_ENABLED=1 GOARCH=386 UPDATE=on ./build.sh && package_files 386 && build_packages 386
|
||||
|
|
Loading…
Reference in New Issue