Skip to content
Browse files

minor improvements and fixed libraries reqs

  • Loading branch information...
1 parent f4ce1a9 commit 5ad6570a3d92ec7c759e98cdd4bb8a2cd9f8304d @saxix committed Nov 3, 2012
Showing with 58 additions and 16 deletions.
  1. +4 −5 bh/defaults.py
  2. +3 −1 bh/root.py
  3. +48 −8 bh/system.py
  4. +3 −2 bh/utils.py
View
9 bh/defaults.py
@@ -1,15 +1,14 @@
from fabric.api import *
-env.NGINX = 'nginx-1.0.10'
-env.UWSGI = 'uwsgi-0.9.9.3'
+env.NGINX = 'nginx-1.3.8'
+env.UWSGI = 'uwsgi-1.3'
env.PCRE = "8.20"
env.VIRTUALENV = "virtualenv-1.7"
env.REDMINE = "redmine-1.3.0"
-env.PYTHON = "Python-2.7.2"
+env.PYTHON = "2.7.3"
env.APACHE = "httpd-2.2.22"
-env.UWSGI = 'uwsgi-0.9.9.3'
env.MOD_WSGI = 'mod_wsgi-3.3'
-env.SQLITE = 'sqlite-autoconf-3071300'
+env.SQLITE = 'sqlite-autoconf-3071401'
env.APR = "apr-1.4.6"
env.DISTRIBUTE = "distribute-0.6.24"
env.PIP = "pip-1.0.2"
View
4 bh/root.py
@@ -134,7 +134,8 @@ def chown():
def ubuntu_prereq():
- reqs = ['gcc', 'build-essential', 'libaio-dev', 'libxml2-dev', 'libxslt1-dev',
+ reqs = ['gcc', 'build-essential', 'libaio-dev', 'libxml2-dev', 'libxslt1-dev', 'libreadline-dev',
+ 'libbz2-dev',
'curl', 'libssl-dev', 'libcurl4-openssl-dev', 'libldap2-dev', 'libsasl2-dev']
with settings(reqs=" ".join(reqs)):
sudo('apt-get -y --force-yes install %(reqs)s' % env)
@@ -144,6 +145,7 @@ def redhat_prereq():
""" install redhat/centos packages required to compile """
reqs = ['autoconf', 'bzip2-devel', 'db4-devel', 'expat-devel', 'findutils', 'gcc-c++', 'gdbm-devel', 'glibc-devel',
'gmp-devel', 'libGL-devel', 'libX11-devel', 'libtermcap-devel', 'ncurses-devel', 'openssl-devel',
+ 'libbz2-devel',
'pkgconfig', 'readline-devel', 'tar', 'tix-devel', 'tk-devel', 'zlib-devel', 'rpm-build',
'make', 'libxml2-devel', 'curl', 'libxslt-devel', 'postgresql-libs',
'openldap-devel']
View
56 bh/system.py
@@ -4,16 +4,21 @@
from bh.utils import as_bool
from bh.user import setup_env_for_user
+
@task
def python():
""" compile and install python
"""
setup_env_for_user(env.user)
+ with cd('%(packages_cache)s' % env):
+ if not exists('Python-%(PYTHON)s.tgz' % env):
+ run('wget http://www.python.org/ftp/python/2.7.3/Python-%(PYTHON)s.tgz' % env)
+
version = env.PYTHON.replace('Python-', '')
run('mkdir -p %(admin_home_dir)s/~build' % env)
with cd(env.build):
- run('tar -xzf %(packages_cache)s/%(PYTHON)s.tgz' % env)
- with cd(env.PYTHON):
+ run('tar -xzf %(packages_cache)s/Python-%(PYTHON)s.tgz' % env)
+ with cd('Python-%(PYTHON)s' % env):
run('./configure --prefix=%(base)s --enable-shared --with-threads' % env)
run('make clean')
run('make')
@@ -56,6 +61,7 @@ def apache():
' --includedir=%(base)s/lib/include/apache'\
' --localstatedir=%(base)s/var/run'\
' --enable-rewrite'\
+ ' --enable-headers'\
# ' --enable-rewrite=shared'\
# ' --enable-mods-shared=most'\
' --with-included-apr'\
@@ -69,9 +75,16 @@ def apache():
@task
def sqlite():
setup_env_for_user(env.user)
+
+
run('mkdir -p %(admin_home_dir)s/~build' % env)
+ with cd('%(packages_cache)s' % env):
+ if not exists('%(SQLITE)s.tar.gz' % env):
+ run('wget http://fossies.org/unix/misc/%(SQLITE)s.tar.gz' % env)
+
with cd(env.build):
run('tar -xzf %(packages_cache)s/%(SQLITE)s.tar.gz' % env)
+ run('ls -al')
with cd(env.SQLITE):
run('./configure '\
' --prefix=%(base)s'\
@@ -133,6 +146,12 @@ def oracle():
""" compile and install oracle drivers
"""
setup_env_for_user(env.user)
+ with cd('%(packages_cache)s' % env):
+ with settings(warn_only=True):
+ c = run('ls %(packages_cache)s/instantclient*' % env)
+ if not 'instantclient' in c:
+ put('%(tarball_dir)s/instantclient-*' % env, env.packages_cache)
+
run('mkdir -p %(admin_home_dir)s/~build' % env)
with cd(env.base):
run('rm -fr oracle*')
@@ -142,7 +161,7 @@ def oracle():
if arch == 'x86_64':
run('find %(packages_cache)s -name "instantclient*86-64*" -exec unzip "{}" \;' % env)
elif arch == 'i386':
- run('find %(packages_cache)s -name "instantclient*" -name "*86-64*" -exec unzip "{}" \;' % env)
+ run('find %(packages_cache)s -name "instantclient*" -not -name "*86-64*" -exec unzip "{}" \;' % env)
with cd('instantclient_*'):
env.oracle_home = '%(base)s/oracle/instantclient_11_2' % env
run('ln -sf libclntsh.so.11.1 libclntsh.so')
@@ -165,11 +184,19 @@ def ngnix(recover=False, configure=True, make=True, install=True):
_configure = as_bool(configure, True)
_make = as_bool(make, True)
_install = as_bool(install, True)
+ with cd(env.packages_cache):
+ if not exists('%(packages_cache)s/%(NGINX)s.tar.gz' % env):
+ run("wget http://nginx.org/download/%(NGINX)s.tar.gz" % env)
+ if not exists('%(packages_cache)s/pcre-%(PCRE)s.tar.gz' % env):
+ run("wget http://sourceforge.net/projects/pcre/files/pcre/%(PCRE)s/pcre-%(PCRE)s.tar.gz" % env)
+ if not exists('%(packages_cache)s/%(UWSGI)s.tar.gz' % env):
+ run("wget http://projects.unbit.it/downloads/%(UWSGI)s.tar.gz" % env)
+
+
with cd(env.build):
- if not _recover:
- run("tar -xzf %(packages_cache)s/%(NGINX)s.tar.gz" % env)
- run("tar -xzf %(packages_cache)s/pcre-%(PCRE)s.tar.gz" % env)
- run("tar -xzf %(packages_cache)s/%(UWSGI)s.tar.gz" % env)
+ run("tar -xzf %(packages_cache)s/%(NGINX)s.tar.gz" % env)
+ run("tar -xzf %(packages_cache)s/pcre-%(PCRE)s.tar.gz" % env)
+ run("tar -xzf %(packages_cache)s/%(UWSGI)s.tar.gz" % env)
with cd(env.NGINX):
if _configure:
@@ -250,10 +277,23 @@ def copy_cmds():
run('chmod +x %(PREFIX)s/sbin/*.sh' % env)
@task
+def openldap():
+ setup_env_for_user(env.user)
+ run('mkdir -p %(build)s' % env )
+ with cd(env.build):
+# run('wget ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/openldap-2.4.9.tgz')
+ run('tar xzvf openldap-2.4.9.tgz')
+ with cd('openldap-2.4.9'):
+ run('./configure --prefix=%(base)s' % env)
+ run('make')
+ run('make install')
+@task
def postgresql():
setup_env_for_user(env.user)
+ run('mkdir -p %(build)s' % env )
with cd(env.build):
- run('wget http://ftp.postgresql.org/pub/source/v%(POSTGRES)s/postgresql-%(POSTGRES)s.tar.bz2' % env)
+ if not exists('postgresql-%(POSTGRES)s.tar.bz2' % env):
+ run('wget http://ftp.postgresql.org/pub/source/v%(POSTGRES)s/postgresql-%(POSTGRES)s.tar.bz2' % env)
run('tar -xf postgresql-%(POSTGRES)s.tar.bz2' % env)
with cd('postgresql-%(POSTGRES)s' % env):
View
5 bh/utils.py
@@ -23,7 +23,7 @@ def init():
env.packages_cache = "%s/packages_cache" % env.PREFIX
env.pip_cache = "%s/pip_download_cache" % env.PREFIX
env.template_dir = os.path.join(os.path.dirname(__file__), 'tpls')
-
+ env.tarball_dir = os.path.join(os.path.dirname(__file__), 'tarballs')
def usudo(command, shell=True, pty=True, combine_stderr=None, user=None):
@@ -42,7 +42,8 @@ def as_bool(value, default):
return bool(value)
def _upload_template( name, dest, **kwargs ):
- upload_template(name % env, dest % env, env, use_jinja=True, template_dir=env.template_dir, **kwargs)
+ tpl_dir = kwargs.pop('template_dir', env.template_dir)
+ upload_template(name % env, dest % env, env, use_jinja=True, template_dir=tpl_dir, **kwargs)
def setup_env_for_user(admin=None):

0 comments on commit 5ad6570

Please sign in to comment.
Something went wrong with that request. Please try again.