changeset 14:0e45fe64b10d

work on building from source
author Carl Byington <carl@five-ten-sg.com>
date Wed, 10 Apr 2013 21:24:14 -0700
parents c0150404962d
children c158cae7cd26
files GraphTastic-client.spec Makefile elasticsearch.spec jruby.spec logstash.Makefile logstash.spec
diffstat 6 files changed, 240 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/GraphTastic-client.spec	Wed Apr 10 21:24:14 2013 -0700
@@ -0,0 +1,52 @@
+# prevent brp repack jar files
+%define __os_install_post %{nil}
+
+%define _bindir  /usr/local/bin
+%define gtcommit   06a620d011d08bd2c1099c0d0810c053bf105400
+
+Summary:        Plot metrics sent from logstash
+Name:           GraphTastic-client
+Version:        0.0.0
+Release:        0%{?dist}
+License:        Apache 2.0
+Group:          System Environment/Daemons
+URL:            https://github.com/NickPadilla/GraphTastic
+BuildArch:      noarch
+#Source0:         https://github.com/NickPadilla/GraphTastic/tar.gz/%{gtcommit} >GraphTastic.tar.gz
+Source0:        GraphTastic.tar.gz
+BuildRoot:      %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
+BuildRequires:  java-1.7.0-openjdk
+
+%description
+
+
+%prep
+%setup -q -n GraphTastic-%{gtcommit}
+
+
+%build
+cd src/main/java
+javac com/monstersoftwarellc/graphtastic/rmi/IRmiService.java
+jar cf graphtastic-client.jar  com/monstersoftwarellc/graphtastic/rmi/IRmiService.class
+unzip -t graphtastic-client.jar
+
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT%{_bindir}
+install -D -p -m 644 src/main/java/graphtastic-client.jar $RPM_BUILD_ROOT%{_bindir}
+
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+
+%files
+%defattr(-,root,root,-)
+%attr(0755,root,root) %{_bindir}/*
+
+
+
+%changelog
+* Wed Apr 10 2013  <carl@five-ten-sg.com> - 0.0.0-0
+- Initial build.
--- a/Makefile	Sat Apr 06 08:48:09 2013 -0700
+++ b/Makefile	Wed Apr 10 21:24:14 2013 -0700
@@ -3,13 +3,24 @@
 h=elasticsearch-0.20.6.tar.gz
 i=GraphTastic.tar.gz
 icc=06a620d011d08bd2c1099c0d0810c053bf105400
+j=jruby-complete-1.7.3.jar
+k=GeoLite-City-2013-01-18.dat.gz
 all:
 	[ -f $f ] || curl https://logstash.objects.dreamhost.com/release/$f >$f
 	[ -f $g ] || curl https://nodeload.github.com/logstash/logstash/tar.gz/v1.1.9 >$g
 	[ -f $h ] || curl https://nodeload.github.com/elasticsearch/elasticsearch/tar.gz/v0.20.6 >$h
 	[ -f $i ] || curl https://nodeload.github.com/NickPadilla/GraphTastic/tar.gz/$(icc) >$i
-	[ -d builder ] && rm -rf builder || /bin/true
-	mkdir builder
-	rpmbuild --define "_sourcedir $(shell pwd)" --define "_builddir $(shell pwd)/builder" --define "_srcrpmdir $(shell pwd)" --define "_rpmdir $(shell pwd)" --define "_source_filedigest_algorithm md5" --define "_binary_filedigest_algorithm md5" -ba logstash.spec
-	[ -d builder ] && rm -rf builder || /bin/true
-	rpmbuild --define "_builddir $(shell pwd)/builder" --rebuild logstash-1.1.9-0.src.rpm
+	[ -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 .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 .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 .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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/elasticsearch.spec	Wed Apr 10 21:24:14 2013 -0700
@@ -0,0 +1,54 @@
+# prevent brp repack jar files
+%define __os_install_post %{nil}
+
+%define _bindir  /usr/local/bin
+
+Summary:        elasticsearch is a scalable full text search engine
+Name:           elasticsearch
+Version:        0.20.6
+Release:        0%{?dist}
+Group:          System Environment/Daemons
+License:        Apache 2.0
+URL:            http://www.elasticsearch.org/
+BuildArch:      noarch
+#Source0:         curl https://nodeload.github.com/elasticsearch/elasticsearch/tar.gz/v%{version} >elasticsearch-%{version}.tar.gz
+Source0:        %{name}-%{version}.tar.gz
+BuildRoot:      %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
+BuildRequires:  java-1.7.0-openjdk
+
+%if "%{?dist}" != ".el6"
+# el6 does not have maven yet, so we assume it is manually installed
+# in /usr/local/apache-maven-3.0.5
+BuildRequires:  maven
+%endif
+
+%description
+
+
+%prep
+%setup -q
+
+
+%build
+[ "%{?dist}" == ".el6" ] && export PATH=/usr/local/apache-maven-3.0.5/bin:$PATH
+mvn -Dmaven.test.skip=true package
+
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -D -p -m 644 target/elasticsearch-%{version}.jar $RPM_BUILD_ROOT%{_bindir}/elasticsearch.jar
+
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+
+%files
+%defattr(-,root,root,-)
+%attr(0755,root,root) %{_bindir}/*
+
+
+
+%changelog
+* Wed Apr 10 2013  <carl@five-ten-sg.com> - 0.20.6-0
+- Initial build.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jruby.spec	Wed Apr 10 21:24:14 2013 -0700
@@ -0,0 +1,44 @@
+# prevent brp repack jar files
+%define __os_install_post %{nil}
+
+%define _bindir  /usr/local/bin
+
+Summary:        just enough jruby for el6 to get logstash running
+Name:           jruby
+Version:        1.7.3
+Release:        0%{?dist}
+Group:          System Environment/Daemons
+License:        Apache 2.0
+URL:            http://www.jruby.org/
+BuildArch:      noarch
+Source0:        http://repository.codehaus.org/org/jruby/jruby-complete/%{version}/jruby-complete-%{version}.jar
+BuildRoot:      %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
+
+
+%description
+
+
+%prep
+
+
+%build
+
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -D -p -m 644 %SOURCE0 $RPM_BUILD_ROOT/%{_bindir}/%{name}.jar
+
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+
+%files
+%defattr(-,root,root,-)
+%attr(0755,root,root) %{_bindir}/*
+
+
+
+%changelog
+* Wed Apr 10 2013  <carl@five-ten-sg.com> - 1.7.3-0
+- Initial build.
--- a/logstash.Makefile	Sat Apr 06 08:48:09 2013 -0700
+++ b/logstash.Makefile	Wed Apr 10 21:24:14 2013 -0700
@@ -1,19 +1,70 @@
+#
+# fedora uses system jruby
+# el6	 uses minimal jruby.jar
+#
+VERSION=$(shell awk -F\" '/LOGSTASH_VERSION/ {print $$2}' lib/logstash/version.rb)
+
+SYSJRUBY=$(shell which jruby 2>/dev/null)
+ifeq ($(SYSJRUBY),)
+JRUBY_CMD=java -jar /usr/local/bin/jruby.jar
+else
+JRUBY_CMD=jruby
+endif
+WITH_JRUBY=$(JRUBY_CMD) -S
+JRUBYC=$(WITH_JRUBY) jrubyc
+GEOIP=GeoLiteCity.dat
+
 all:
 	echo '********** in my local makefile'
 
-	# make the graphtastic client interface class
-	echo '********** build with raw javac, rather than maven'
-	cd GT/GraphTastic;                                                              \
-	javac src/main/java/com/monstersoftwarellc/graphtastic/rmi/IRmiService.java;    \
-	find . -name '*.class'
-	echo '********* done with graphtastic build'
-
-	# make the elastic search jar
-	cd ES/elasticsearch-0.20.6;							   \
-	export PATH=/usr/local/apache-maven-3.0.5/bin:$(PATH); \
-	mvn -Dmaven.test.skip=true package;                    \
-	find . -name '*.jar';                                  \
-	find . -name '*.class'
-	echo '********* done with elastic search build'
+	# 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)
+	# 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)
+	rsync -av ./spec build/ruby
+	# install-gems
+	mkdir -p vendor/bundle
+	GEM_HOME=./vendor/bundle/jruby/1.9/ GEM_PATH= $(JRUBY_CMD) --1.9 ./gembag.rb logstash.gemspec
+	rm -rf ./vendor/bundle/jruby/1.9/gems/riak-client-1.0.3/pkg
+	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
+	# 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)
+	rm -f build/monolith/META-INF/*.LIST
+	rm -f build/monolith/META-INF/*.MF
+	rm -f build/monolith/META-INF/*.RSA
+	rm -f build/monolith/META-INF/*.SF
+	rm -f build/monolith/META-INF/NOTICE
+	rm -f build/monolith/META-INF/NOTICE.txt
+	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 \
+		-C build/ruby .								 \
+		-C build/monolith .							 \
+		-C vendor/bundle/jruby/1.9 gems				 \
+		-C vendor/bundle/jruby/1.9 specifications	 \
+		-C lib logstash/web/public					 \
+		-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.spec	Sat Apr 06 08:48:09 2013 -0700
+++ b/logstash.spec	Wed Apr 10 21:24:14 2013 -0700
@@ -2,26 +2,21 @@
 %define __os_install_post %{nil}
 
 %define _bindir  /usr/local/bin
-%define ES_VERSION 0.20.6
-%define gtcommit   06a620d011d08bd2c1099c0d0810c053bf105400
 
 Summary:        logstash is a tool for managing events and logs.
 Name:           logstash
 Version:        1.1.9
-Release:        0
+Release:        0%{?dist}
 License:        Apache 2.0
 Group:          System Environment/Daemons
 URL:            http://logstash.net/
 BuildArch:      noarch
 Source0:        https://logstash.objects.dreamhost.com/release/%{name}-%{version}-monolithic.jar
 Source1:        https://logstash.jira.com/secure/attachment/12610/logstash_index_cleaner.py
-#Source2:         curl https://nodeload.github.com/logstash/logstash/tar.gz/v1.1.9 >logstash-1.1.9.tar.gz
+#Source2:         curl https://nodeload.github.com/logstash/logstash/tar.gz/v%{version} >logstash-%{version}.tar.gz
 Source2:        %{name}-%{version}.tar.gz
-Source3:        %{name}.Makefile
-#Source4:         curl https://nodeload.github.com/elasticsearch/elasticsearch/tar.gz/V%{ES_VERSION}.tar.gz >elasticsearch-%{ES_VERSION}.tar.gz
-Source4:        elasticsearch-%{ES_VERSION}.tar.gz
-#Source5:         https://github.com/NickPadilla/GraphTastic/tar.gz/%{gtcommit} >GraphTastic.tar.gz
-Source5:        GraphTastic.tar.gz
+Source3:        http://logstash.objects.dreamhost.com/maxmind/GeoLite-City-2013-01-18.dat.gz
+Source4:        %{name}.Makefile
 Source10:       %{name}.rc
 Source11:       %{name}.cron
 Source12:       %{name}.conf
@@ -29,14 +24,14 @@
 Source20:       apache.pattern
 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(pre):          /usr/sbin/useradd
 Requires(pre):          /usr/bin/getent
 Requires(postun):       /usr/sbin/userdel
 Requires(post,preun):   /sbin/chkconfig
 Requires(post,preun):   /sbin/service
-#BuildRequires:  maven
-BuildRoot:      %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
+BuildRequires:  ragel jruby
 
 
 %description
@@ -48,24 +43,17 @@
 
 %prep
 %setup -q -T -b 2
-mkdir ES
-cd ES
-gzip -dc %SOURCE4 | tar -xvvf -
-cd ..
-mkdir GT
-cd GT
-gzip -dc %SOURCE5 | tar -xvvf -
-mv GraphTastic-%{gtcommit} GraphTastic
 
 
 %build
-make -f %SOURCE3
+gunzip -c %SOURCE3 >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
-mkdir  -p $RPM_BUILD_ROOT/var/log/%{name}
+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}