srikanth | 116e6e8 | 2014-08-19 07:22:37 -0700 | [diff] [blame] | 1 | #!/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 | |
| 17 | SOURCE=$(pwd) |
| 18 | WORKSPACE=${SOURCE}/workspace |
| 19 | VIRTUALENV=${WORKSPACE}/ve |
| 20 | TOOLS=${WORKSPACE}/tools |
| 21 | DEPS=${SOURCE}/deps |
| 22 | |
| 23 | DJANGO_PKG=django-nonrel-20111024-be48c152abc6.zip |
| 24 | DJANGO_TOOLBOX_PKG=djangotoolbox-20111024-957ea5f68040.zip |
srikanth | de50b09 | 2014-08-19 08:31:46 -0700 | [diff] [blame] | 25 | #CASSANDRA_VERSION=1.0.10 |
| 26 | #CASSANDRA_PKG=apache-cassandra-${CASSANDRA_VERSION}-bin.tar.gz |
srikanth | 116e6e8 | 2014-08-19 07:22:37 -0700 | [diff] [blame] | 27 | THRIFT_VERSION=0.7.0 |
| 28 | THRIFT_PKG=thrift-${THRIFT_VERSION}.tar.gz |
| 29 | |
| 30 | rm -rf ${WORKSPACE} |
| 31 | mkdir -p ${TOOLS} |
| 32 | |
| 33 | unzip -q -d ${TOOLS}/.tmp ${DEPS}/${DJANGO_PKG} |
| 34 | cp ${DEPS}/${DJANGO_PKG} ${TOOLS}/ |
| 35 | unzip -q -d ${TOOLS}/.tmp ${DEPS}/${DJANGO_TOOLBOX_PKG} |
| 36 | cp ${DEPS}/${DJANGO_TOOLBOX_PKG} ${TOOLS}/ |
srikanth | de50b09 | 2014-08-19 08:31:46 -0700 | [diff] [blame] | 37 | #tar -z -x -C ${TOOLS} -f ${DEPS}/${CASSANDRA_PKG} |
| 38 | #mv ${TOOLS}/apache-cassandra-${CASSANDRA_VERSION} ${TOOLS}/cassandra |
srikanth | 116e6e8 | 2014-08-19 07:22:37 -0700 | [diff] [blame] | 39 | tar -z -x -C ${TOOLS} -f ${DEPS}/${THRIFT_PKG} |
| 40 | mv ${TOOLS}/thrift-${THRIFT_VERSION} ${TOOLS}/thrift |
| 41 | |
| 42 | rm -rf ${VIRTUALENV} python |
| 43 | virtualenv ${VIRTUALENV} --system-site-packages |
| 44 | mkdir -p ${VIRTUALENV}/log |
| 45 | ln -snf ${VIRTUALENV} ${WORKSPACE}/python |
| 46 | ln -snf bin ${VIRTUALENV}/sbin |
| 47 | source ${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 | ) |
srikanth | de50b09 | 2014-08-19 08:31:46 -0700 | [diff] [blame] | 66 | #( |
| 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 |
srikanth | 116e6e8 | 2014-08-19 07:22:37 -0700 | [diff] [blame] | 88 | |
| 89 | make clean |
| 90 | |
| 91 | echo "+++ Python virtualenv set up in ${VIRTUALENV}" |
| 92 | echo "+++ To activate in the current shell, run:" |
| 93 | echo "+++ source ${WORKSPACE}/ve/bin/activate" |