changeset 15:c158cae7cd26

work on building from source
author Carl Byington <carl@five-ten-sg.com>
date Thu, 11 Apr 2013 10:18:06 -0700
parents 0e45fe64b10d
children aa606d801e02
files Makefile jruby.spec logstash.Makefile logstash.rc logstash.spec
diffstat 5 files changed, 34 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Wed Apr 10 21:24:14 2013 -0700
+++ b/Makefile	Thu Apr 11 10:18:06 2013 -0700
@@ -1,3 +1,4 @@
+d=el6
 f=logstash-1.1.9-monolithic.jar
 g=logstash-1.1.9.tar.gz
 h=elasticsearch-0.20.6.tar.gz
@@ -13,14 +14,14 @@
 	[ -f $j ] || curl http://repository.codehaus.org/org/jruby/jruby-complete/1.7.3/$j >$j
 	[ -f $k ] || curl http://logstash.objects.dreamhost.com/maxmind/$k >$k
 
-	#rpmbuild --define "dist .el6" --define "_sourcedir $(shell pwd)" --define "_srcrpmdir $(shell pwd)" --define "_rpmdir $(shell pwd)" -bs jruby.spec
-	#rpmbuild --define "dist .el6" --define "_rpmdir $(shell pwd)" --rebuild jruby-1.7.3-0.el6.src.rpm
+	#rpmbuild --define "dist .$d" --define "_sourcedir $(shell pwd)" --define "_srcrpmdir $(shell pwd)" --define "_rpmdir $(shell pwd)" -bs jruby.spec
+	#rpmbuild --define "dist .$d" --define "_rpmdir $(shell pwd)" --rebuild jruby-1.7.3-0.$d.src.rpm
 
-	#rpmbuild --define "dist .el6" --define "_sourcedir $(shell pwd)" --define "_srcrpmdir $(shell pwd)" --define "_rpmdir $(shell pwd)" -bs GraphTastic-client.spec
-	#rpmbuild --define "dist .el6" --define "_rpmdir $(shell pwd)" --rebuild GraphTastic-client-0.0.0-0.el6.src.rpm
+	#rpmbuild --define "dist .$d" --define "_sourcedir $(shell pwd)" --define "_srcrpmdir $(shell pwd)" --define "_rpmdir $(shell pwd)" -bs GraphTastic-client.spec
+	#rpmbuild --define "dist .$d" --define "_rpmdir $(shell pwd)" --rebuild GraphTastic-client-0.0.0-0.$d.src.rpm
 
-	#rpmbuild --define "dist .el6" --define "_sourcedir $(shell pwd)" --define "_srcrpmdir $(shell pwd)" --define "_rpmdir $(shell pwd)" -bs elasticsearch.spec
-	#rpmbuild --define "dist .el6" --define "_rpmdir $(shell pwd)" --rebuild elasticsearch-0.20.6-0.el6.src.rpm
+	#rpmbuild --define "dist .$d" --define "_sourcedir $(shell pwd)" --define "_srcrpmdir $(shell pwd)" --define "_rpmdir $(shell pwd)" -bs elasticsearch.spec
+	#rpmbuild --define "dist .$d" --define "_rpmdir $(shell pwd)" --rebuild elasticsearch-0.20.6-0.$d.src.rpm
 
-	rpmbuild --define "dist .el6" --define "_sourcedir $(shell pwd)" --define "_srcrpmdir $(shell pwd)" --define "_rpmdir $(shell pwd)" -bs logstash.spec
-	rpmbuild --define "dist .el6" --define "_rpmdir $(shell pwd)" --rebuild logstash-1.1.9-0.el6.src.rpm
+	rpmbuild --define "dist .$d" --define "_sourcedir $(shell pwd)" --define "_srcrpmdir $(shell pwd)" --define "_rpmdir $(shell pwd)" -bs logstash.spec
+	rpmbuild --define "dist .$d" --define "_rpmdir $(shell pwd)" --rebuild logstash-1.1.9-0.$d.src.rpm
--- a/jruby.spec	Wed Apr 10 21:24:14 2013 -0700
+++ b/jruby.spec	Thu Apr 11 10:18:06 2013 -0700
@@ -1,7 +1,7 @@
 # prevent brp repack jar files
 %define __os_install_post %{nil}
 
-%define _bindir  /usr/local/bin
+%define _bindir  /usr/share
 
 Summary:        just enough jruby for el6 to get logstash running
 Name:           jruby
--- a/logstash.Makefile	Wed Apr 10 21:24:14 2013 -0700
+++ b/logstash.Makefile	Thu Apr 11 10:18:06 2013 -0700
@@ -6,7 +6,7 @@
 
 SYSJRUBY=$(shell which jruby 2>/dev/null)
 ifeq ($(SYSJRUBY),)
-JRUBY_CMD=java -jar /usr/local/bin/jruby.jar
+JRUBY_CMD=java -jar /usr/share/jruby.jar
 else
 JRUBY_CMD=jruby
 endif
@@ -15,18 +15,12 @@
 GEOIP=GeoLiteCity.dat
 
 all:
-	echo '********** in my local makefile'
-
-	# make the target directory to collect all the class files that will be in the final jar
-	mkdir target
-
-	# make the logstash jar
 	# compile-grammer
 	touch lib/logstash/config/grammar.rl	# force rebuild
 	make -C lib/logstash/config grammar.rb
 	# compile-runner
 	mkdir -p build/ruby
-	(cd lib; $(JRUBYC) -5 -t ../build/ruby logstash/runner.rb)
+	cd lib; $(JRUBYC) -5 -t ../build/ruby logstash/runner.rb
 	# copy-ruby-files
 	find ./lib	-name '*.rb' | sed -e 's,^\./lib/,,'  | (cd lib;  cpio -p --make-directories ../build/ruby)
 	find ./test -name '*.rb' | sed -e 's,^\./test/,,' | (cd test; cpio -p --make-directories ../build/ruby)
@@ -38,14 +32,15 @@
 	rm -rf ./vendor/bundle/jruby/1.9/gems/*/spec
 	rm -rf ./vendor/bundle/jruby/1.9/gems/*/test
 	# build-monolith
-	mkdir -p build/monolith/openssl build/monolith/jopenssl
+	mkdir -p build/monolith/openssl
+	mkdir -p build/monolith/jopenssl
 	# unpack all jars
 	find $$PWD/vendor/bundle -name '*.jar' | (cd build/monolith; xargs -n1 jar xf)
 	# copy openssl/lib/shared folders/files to root of jar - need this for openssl to work with JRuby
 	cp -r vendor/bundle/jruby/1.9/gems/jruby-openss*/lib/shared/openssl/*	build/monolith/openssl
 	cp -r vendor/bundle/jruby/1.9/gems/jruby-openss*/lib/shared/jopenssl/*	build/monolith/jopenssl
 	cp -r vendor/bundle/jruby/1.9/gems/jruby-openss*/lib/shared/openssl.rb	build/monolith/openssl.rb
-	# purge any extra files we don't need in META-INF (like manifests and @# signature files)
+	# purge any extra files we don't need in META-INF (like manifests and signature files)
 	rm -f build/monolith/META-INF/*.LIST
 	rm -f build/monolith/META-INF/*.MF
 	rm -f build/monolith/META-INF/*.RSA
@@ -55,8 +50,8 @@
 	rm -f build/monolith/META-INF/LICENSE
 	rm -f build/monolith/META-INF/LICENSE.txt
 	cp $(GEOIP) build/monolith/
-	# build-monolith-jar
-	jar cfe build/logstash-$(VERSION)-monolithic.jar logstash.runner \
+	# build-logstash-jar
+	jar cfe build/logstash.jar logstash.runner       \
 		-C build/ruby .								 \
 		-C build/monolith .							 \
 		-C vendor/bundle/jruby/1.9 gems				 \
@@ -65,6 +60,3 @@
 		-C lib logstash/certs						 \
 		-C lib logstash/web/views					 \
 		patterns
-	# see what we have
-	unzip -t build/logstash-$(VERSION)-monolithic.jar >/tmp/log.mono.jar.txt
-	sort /tmp/log.mono.jar.txt >/tmp/log.mono.jar.sort.txt
--- a/logstash.rc	Wed Apr 10 21:24:14 2013 -0700
+++ b/logstash.rc	Thu Apr 11 10:18:06 2013 -0700
@@ -50,6 +50,7 @@
     cd $HOME
     pid=$(
     exec sudo -u logstash /bin/bash - <<EOF
+        export CLASSPATH=/usr/share/jruby.jar:/usr/local/bin/graphtastic-client.jar:/usr/local/bin/elasticsearch.jar
         $JAVA $ARGS &
         echo \$!
 EOF
--- a/logstash.spec	Wed Apr 10 21:24:14 2013 -0700
+++ b/logstash.spec	Thu Apr 11 10:18:06 2013 -0700
@@ -11,11 +11,11 @@
 Group:          System Environment/Daemons
 URL:            http://logstash.net/
 BuildArch:      noarch
-Source0:        https://logstash.objects.dreamhost.com/release/%{name}-%{version}-monolithic.jar
+#Source0:        https://logstash.objects.dreamhost.com/release/%{name}-%{version}-monolithic.jar
+#Source0:         curl https://nodeload.github.com/logstash/logstash/tar.gz/v%{version} >logstash-%{version}.tar.gz
+Source0:        %{name}-%{version}.tar.gz
 Source1:        https://logstash.jira.com/secure/attachment/12610/logstash_index_cleaner.py
-#Source2:         curl https://nodeload.github.com/logstash/logstash/tar.gz/v%{version} >logstash-%{version}.tar.gz
-Source2:        %{name}-%{version}.tar.gz
-Source3:        http://logstash.objects.dreamhost.com/maxmind/GeoLite-City-2013-01-18.dat.gz
+Source2:        http://logstash.objects.dreamhost.com/maxmind/GeoLite-City-2013-01-18.dat.gz
 Source4:        %{name}.Makefile
 Source10:       %{name}.rc
 Source11:       %{name}.cron
@@ -25,7 +25,7 @@
 Source21:       sendmail.pattern
 Source22:       dnsbl.pattern
 BuildRoot:      %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
-Requires:       logrotate httpd java-1.7.0-openjdk python-pip python-argparse python-ordereddict
+Requires:       logrotate httpd java-1.7.0-openjdk python-pip python-argparse python-ordereddict jruby
 Requires(pre):          /usr/sbin/useradd
 Requires(pre):          /usr/bin/getent
 Requires(postun):       /usr/sbin/userdel
@@ -42,27 +42,26 @@
 
 
 %prep
-%setup -q -T -b 2
+%setup -q
 
 
 %build
-gunzip -c %SOURCE3 >GeoLiteCity.dat
+gunzip -c %SOURCE2 >GeoLiteCity.dat
 make -f %SOURCE4
 
 
 %install
-# for now, ignore the results of the build, and just package the source jar files.
 rm -rf $RPM_BUILD_ROOT
 install -d $RPM_BUILD_ROOT/var/log/%{name}
-install -D -m 750 %SOURCE0   $RPM_BUILD_ROOT/%{_bindir}/%{name}.jar
-install -D -m 750 %SOURCE1   $RPM_BUILD_ROOT/%{_bindir}/logstash_index_cleaner.py
-install -D -m 755 %SOURCE10  $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
-install -D -m 755 %SOURCE11  $RPM_BUILD_ROOT/etc/cron.daily/%{name}
-install -D -m 640 %SOURCE12  $RPM_BUILD_ROOT/etc/%{name}/%{name}.conf
-install -D -m 640 %SOURCE13  $RPM_BUILD_ROOT/etc/sysconfig/%{name}
-install -D -m 640 %SOURCE20  $RPM_BUILD_ROOT/var/lib/%{name}/data/patterns/apache
-install -D -m 640 %SOURCE21  $RPM_BUILD_ROOT/var/lib/%{name}/data/patterns/sendmail
-install -D -m 640 %SOURCE22  $RPM_BUILD_ROOT/var/lib/%{name}/data/patterns/dnsbl
+install -D -m 750 build/logstash.jar  $RPM_BUILD_ROOT/%{_bindir}/%{name}.jar
+install -D -m 750 %SOURCE1            $RPM_BUILD_ROOT/%{_bindir}/logstash_index_cleaner.py
+install -D -m 755 %SOURCE10           $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
+install -D -m 755 %SOURCE11           $RPM_BUILD_ROOT/etc/cron.daily/%{name}
+install -D -m 640 %SOURCE12           $RPM_BUILD_ROOT/etc/%{name}/%{name}.conf
+install -D -m 640 %SOURCE13           $RPM_BUILD_ROOT/etc/sysconfig/%{name}
+install -D -m 640 %SOURCE20           $RPM_BUILD_ROOT/var/lib/%{name}/data/patterns/apache
+install -D -m 640 %SOURCE21           $RPM_BUILD_ROOT/var/lib/%{name}/data/patterns/sendmail
+install -D -m 640 %SOURCE22           $RPM_BUILD_ROOT/var/lib/%{name}/data/patterns/dnsbl
 
 
 %pre