blob: 6a1ad34842f39dc7c4a4605468d90a6ff35d9688 [file] [log] [blame]
srikanth116e6e82014-08-19 07:22:37 -07001#!/bin/bash
2#
3# Copyright (c) 2013 Big Switch Networks, Inc.
4#
5# Licensed under the Eclipse Public License, Version 1.0 (the
6# "License"); you may not use this file except in compliance with the
7# License. You may obtain a copy of the License at
8#
9# http://www.eclipse.org/legal/epl-v10.html
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14# implied. See the License for the specific language governing
15# permissions and limitations under the License.
16
17SOURCE=$(pwd)
18WORKSPACE=${SOURCE}/workspace
19VIRTUALENV=${WORKSPACE}/ve
20TOOLS=${WORKSPACE}/tools
21DEPS=${SOURCE}/deps
22
23DJANGO_PKG=django-nonrel-20111024-be48c152abc6.zip
24DJANGO_TOOLBOX_PKG=djangotoolbox-20111024-957ea5f68040.zip
srikanthde50b092014-08-19 08:31:46 -070025#CASSANDRA_VERSION=1.0.10
26#CASSANDRA_PKG=apache-cassandra-${CASSANDRA_VERSION}-bin.tar.gz
srikanth116e6e82014-08-19 07:22:37 -070027THRIFT_VERSION=0.7.0
28THRIFT_PKG=thrift-${THRIFT_VERSION}.tar.gz
29
30rm -rf ${WORKSPACE}
31mkdir -p ${TOOLS}
32
33unzip -q -d ${TOOLS}/.tmp ${DEPS}/${DJANGO_PKG}
34cp ${DEPS}/${DJANGO_PKG} ${TOOLS}/
35unzip -q -d ${TOOLS}/.tmp ${DEPS}/${DJANGO_TOOLBOX_PKG}
36cp ${DEPS}/${DJANGO_TOOLBOX_PKG} ${TOOLS}/
srikanthde50b092014-08-19 08:31:46 -070037#tar -z -x -C ${TOOLS} -f ${DEPS}/${CASSANDRA_PKG}
38#mv ${TOOLS}/apache-cassandra-${CASSANDRA_VERSION} ${TOOLS}/cassandra
srikanth116e6e82014-08-19 07:22:37 -070039tar -z -x -C ${TOOLS} -f ${DEPS}/${THRIFT_PKG}
40mv ${TOOLS}/thrift-${THRIFT_VERSION} ${TOOLS}/thrift
41
42rm -rf ${VIRTUALENV} python
43virtualenv ${VIRTUALENV} --system-site-packages
44mkdir -p ${VIRTUALENV}/log
45ln -snf ${VIRTUALENV} ${WORKSPACE}/python
46ln -snf bin ${VIRTUALENV}/sbin
47source ${VIRTUALENV}/bin/activate
48(
49 cd ${TOOLS}/.tmp/django-nonrel
50 patch -p3 < ${SOURCE}/build/django-autoreload-notty.patch
51 python setup.py -q install
52)
53(
54 cd ${TOOLS}/.tmp/djangotoolbox
55 python setup.py -q install
56)
57(
58 cd ${TOOLS}/thrift
59 chmod +x ./configure
60 ./configure --with-cpp=no --with-erlang=no --with-perl=no --with-php=no --with-php_extension=no --with-ruby=no --with-haskell=no
61 ARCHFLAGS="-arch i386 -arch x86_64" make -j4 all
62 cd lib/py
63 python setup.py -q sdist -f --dist-dir=${TOOLS}
64 python setup.py -q install
65)
srikanthde50b092014-08-19 08:31:46 -070066#(
67# cd ${TOOLS}/cassandra/interface
68# ${TOOLS}/thrift/compiler/cpp/thrift --gen py --gen java cassandra.thrift
69# cd gen-py
70# echo -e "import distutils.core\ndistutils.core.setup(name=\"cassandra-py\", version=\"${THRIFT_VERSION}\", packages=[\"cassandra\"])" >setup.py
71# python setup.py -q sdist -f --dist-dir=${TOOLS}
72# python setup.py -q install
73# cd ../gen-java
74# cp ${TOOLS}/thrift/lib/java/build/libthrift-${THRIFT_VERSION}.jar .
75# SLF4J_JAR=`ls -1 ${TOOLS}/thrift/lib/java/build/lib | grep slf4j-api`
76# cp ${TOOLS}/thrift/lib/java/build/lib/${SLF4J_JAR} .
77# mkdir -p build/classes
78# javac -d build/classes -cp "${SLF4J_JAR}:libthrift-${THRIFT_VERSION}.jar" org/apache/cassandra/thrift/*.java
79# cd build
80# jar cf cassandra-thrift-${CASSANDRA_VERSION}.jar -C classes org
81# #mkdir -p ${SOURCE}/sdnplatform/lib
82# #cp cassandra-thrift-${CASSANDRA_VERSION}.jar ${SOURCE}/sdnplatform/lib
83#)
84#sed -i.old 's#/var/lib/cassandra/#'${VIRTUALENV}'/cassandra/#;s#^rpc_address: .*#rpc_address: 0.0.0.0#;s#^partitioner: .*#partitioner: org.apache.cassandra.dht.OrderPreservingPartitioner#' ${TOOLS}/cassandra/conf/cassandra.yaml
85#sed -i.old 's#/var/log/cassandra/system.log#'${VIRTUALENV}'/log/cassandra.log#' ${TOOLS}/cassandra/conf/log4j-server.properties
86#sed -i.old 's#^JMX_PORT=.*#JMX_PORT="8085"#' ${TOOLS}/cassandra/conf/cassandra-env.sh
87#echo 'JVM_OPTS="$JVM_OPTS -Xss160k"' >> ${TOOLS}/cassandra/conf/cassandra-env.sh
srikanth116e6e82014-08-19 07:22:37 -070088
89make clean
90
91echo "+++ Python virtualenv set up in ${VIRTUALENV}"
92echo "+++ To activate in the current shell, run:"
93echo "+++ source ${WORKSPACE}/ve/bin/activate"