updated on Thu Jan 12 04:00:44 UTC 2012
[aur-mirror.git] / solandra-git / PKGBUILD
blob283cf3470257ac7de5bfb4fa8867f72803579ccf
1 ## Contributor: shahid <helllamer@gmail.com>
2 ## Originally based on following PKGBUILDs:
3 ## - Thomas Dziedzic's: cassandra 
5 ## More info about this PKGBUILD: 
6 ## - https://bitbucket.org/helllamer/archlinux-pkgbuild/wiki/pkgbuild/solandra-git
8 name=solandra
9 pkgname=$name-git
10 pkgver=20111029
11 pkgrel=1
12 pkgdesc="NoSQL database (Cassandra with Apache Solr)"
13 arch=('any')
14 url="https://github.com/tjake/Solandra"
15 license=('Apache 2.0')
16 conflicts=('cassandra')
17 depends=('java-runtime')
18 makedepends=('apache-ant' 'git')
19 provides=('cassandra')
21 _gitroot=$url
22 _gitname=$name
24 gitdir=$srcdir/$_gitname
25 builddir=$srcdir/$_gitname-build
27 SOLANDRA_HOME=usr/share/$name
29 ## install directories
30 etc_d=etc/$name
31 share_d=$SOLANDRA_HOME
32 bin_d=usr/bin
33 var_lib_d=var/lib/$name
34 var_log_d=var/log/$name
37 build() {
38         cd $srcdir
39         msg "Connecting to the git server..."
41         if [[ -d $srcdir/$_gitname ]] ; then
42                 cd $_gitname
43                 git remote set-url origin $_gitroot
44                 git pull origin
45                 msg "The local files are updated."
46         else
47                 git clone --depth 1 $_gitroot $_gitname || echo skipping
48         fi
49         msg "Git checkout done"
51         msg "Starting make..."
52         rm -rf $builddir
53         cp -r $gitdir $builddir
55         ## recently installed apache-ant may not be seen shell
56         which ant || . /etc/profile.d/apache-ant.sh
58         ## making all things
59         cd $builddir
60         ant
63 ## unit tests
64 check1() {
65         cd $builddir
66         ant test
70 package() {
71         mkdir -p $pkgdir/$var_lib_d
72         mkdir -p $pkgdir/$var_log_d
73         mkdir -p $pkgdir/$bin_d
74         mkdir -p $pkgdir/$etc_d
75         mkdir -p $pkgdir/$share_d/lib
77         chown http:http $pkgdir/$var_lib_d $pkgdir/$var_log_d
78         
79         ## install everything
80         cd $builddir/solandra-app
81         install -D -m755 bin/{solandra,nodetool,cassandra-cli} $pkgdir/$bin_d
83         ## install bash-include with fixed paths
84         install -D -m755 bin/$name.in.sh $pkgdir/$share_d
85         sed -e "s@\`dirname \$0\`/..@/$share_d@" \
86             -e 's@\(for jar in \)\(lib\)@\1$SOLANDRA_HOME/\2@' \
87             -i $pkgdir/$share_d/$name.in.sh
88         
89         ## fix path for storing data: from /tmp to /var/lib
90         sed -e "s@/tmp/cassandra-data@/$var_lib_d@g" -i conf/cassandra.yaml
91         sed -e "s@/var/log/cassandra@/$var_log_d@g"  -i conf/log4j-server.properties
92         ## move configs to /etc with symlink
93         install -m644 conf/* $pkgdir/$etc_d
94         ln -s /$etc_d $pkgdir/$share_d/conf
95         
96         ## copy lib
97         install -D -m644 lib/* $pkgdir/$share_d/lib/