mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 06:37:19 -04:00
- generate VERSION based on some local state (logstash's declared
version, git revision if any, 'modified' flag if local modifications are included) - add tarball build targets
This commit is contained in:
parent
4a035d295f
commit
72f79a5f94
2 changed files with 57 additions and 18 deletions
45
Makefile
45
Makefile
|
@ -4,8 +4,6 @@
|
|||
#
|
||||
JRUBY_VERSION=1.7.5
|
||||
ELASTICSEARCH_VERSION=0.90.3
|
||||
#VERSION=$(shell ruby -r./lib/logstash/version -e 'puts LOGSTASH_VERSION')
|
||||
VERSION=$(shell awk -F\" '/LOGSTASH_VERSION/ {print $$2}' lib/logstash/version.rb)
|
||||
|
||||
WITH_JRUBY=java -jar $(shell pwd)/$(JRUBY) -S
|
||||
JRUBY=vendor/jar/jruby-complete-$(JRUBY_VERSION).jar
|
||||
|
@ -31,7 +29,6 @@ else
|
|||
TAR_OPTS=--wildcards
|
||||
endif
|
||||
|
||||
TESTS=$(wildcard spec/support/*.rb spec/filters/*.rb spec/examples/*.rb spec/codecs/*.rb spec/conditionals/*.rb spec/event.rb spec/jar.rb)
|
||||
#spec/outputs/graphite.rb spec/outputs/email.rb)
|
||||
default:
|
||||
@echo "Make targets you might be interested in:"
|
||||
|
@ -40,6 +37,23 @@ default:
|
|||
@echo " jar -- builds the monolithic jar"
|
||||
@echo " jar-test -- runs the test suite against the monolithic jar"
|
||||
|
||||
TESTS=$(wildcard spec/support/*.rb spec/filters/*.rb spec/examples/*.rb spec/codecs/*.rb spec/conditionals/*.rb spec/event.rb spec/jar.rb)
|
||||
|
||||
# The 'version' is generated based on the logstash version, git revision, etc.
|
||||
.PHONY: .VERSION.mk
|
||||
.VERSION.mk: | build
|
||||
@REVISION="$$(git rev-parse --short HEAD | tr -d ' ')" ; \
|
||||
RELEASE=$$(awk -F\" '/LOGSTASH_VERSION/ {print $$2}' lib/logstash/version.rb | tr -d ' ') ; \
|
||||
if git diff --shortstat --exit-code > /dev/null ; then \
|
||||
echo "VERSION=$${RELEASE}-$${REVISION}" ; \
|
||||
else \
|
||||
echo "VERSION=$${RELEASE}-$${REVISION}-modified"; \
|
||||
fi > $@
|
||||
|
||||
-include .VERSION.mk
|
||||
version:
|
||||
@echo "Version: $(VERSION)"
|
||||
|
||||
# Figure out if we're using wget or curl
|
||||
.PHONY: wget-or-curl
|
||||
wget-or-curl:
|
||||
|
@ -365,3 +379,28 @@ package:
|
|||
vendor/kibana: | build
|
||||
$(QUIET)mkdir vendor/kibana || true
|
||||
$(DOWNLOAD_COMMAND) - $(KIBANA_URL) | tar -C $@ -zx --strip-components=1
|
||||
|
||||
build/tarball: | build
|
||||
mkdir $@
|
||||
build/tarball/logstash-%: | build/tarball
|
||||
mkdir $@
|
||||
|
||||
show:
|
||||
echo $(VERSION)
|
||||
|
||||
.PHONY: prepare-tarball
|
||||
prepare-tarball tarball: WORKDIR=build/tarball/logstash-$(VERSION)
|
||||
prepare-tarball: vendor/kibana $(ELASTICSEARCH) $(JRUBY) $(GEOIP) vendor-gems
|
||||
prepare-tarball:
|
||||
@echo "=> Preparing tarball"
|
||||
$(QUIET)$(MAKE) $(WORKDIR)
|
||||
$(QUIET)rsync -a --relative bin lib locales vendor/bundle/jruby LICENSE README.md $(WORKDIR)
|
||||
$(QUIET)sed -i -e 's/^LOGSTASH_VERSION = .*/LOGSTASH_VERSION = "$(VERSION)"/' $(WORKDIR)/lib/logstash/version.rb
|
||||
|
||||
.PHONY: tarball
|
||||
tarball: | build/logstash-$(VERSION).tar.gz
|
||||
build/logstash-$(VERSION).tar.gz: | prepare-tarball
|
||||
$(QUIET)tar -C $$(dirname $(WORKDIR)) -zcf $@ $$(basename $(WORKDIR))
|
||||
@echo "=> tarball ready: $@"
|
||||
|
||||
|
||||
|
|
30
bin/logstash
30
bin/logstash
|
@ -18,30 +18,30 @@
|
|||
basedir=$(cd `dirname $0`/..; pwd)
|
||||
export RUBYLIB="$basedir/lib"
|
||||
|
||||
# Setup will configure any environmental settings necessary to
|
||||
# help logstash run.
|
||||
setup() {
|
||||
if [ -d "$basedir/.git" ] ; then
|
||||
if [ "$1" = "jruby" ] ; then
|
||||
RUBY=${RUBY=jruby}
|
||||
else
|
||||
RUBY=${RUBY=$(ruby -e 'puts RUBY_ENGINE')}
|
||||
fi
|
||||
RUBYVER=${RUBYVER=1.9}
|
||||
export GEM_HOME="$basedir/vendor/bundle/${RUBY}/${RUBYVER}"
|
||||
export GEM_PATH=
|
||||
if [ ! -z "$USE_RUBY" ] ; then
|
||||
eval $(ruby -e 'puts "RUBYVER=#{RUBY_VERSION.split(".")[0..1].join(".")}"; puts "RUBY=#{RUBY_ENGINE}"')
|
||||
else
|
||||
RUBYVER=1.9
|
||||
RUBY=jruby
|
||||
fi
|
||||
|
||||
export GEM_HOME="$basedir/vendor/bundle/${RUBY}/${RUBYVER}"
|
||||
export GEM_PATH=
|
||||
}
|
||||
|
||||
if [ "$1" = "deps" ] ; then
|
||||
program="$basedir/gembag.rb"
|
||||
set -- "$basedir/logstash.gemspec"
|
||||
if [ -f "$basedir/logstash.gemspec" ] ; then
|
||||
program="$basedir/gembag.rb"
|
||||
set -- "$basedir/logstash.gemspec"
|
||||
else
|
||||
echo "Cannot install dependencies; missing logstash.gemspec. This 'deps' command only works from a logstash git clone."
|
||||
fi
|
||||
else
|
||||
program="$basedir/lib/logstash/runner.rb"
|
||||
fi
|
||||
|
||||
which ruby > /dev/null 2>&1
|
||||
if [ "$?" -eq 0 -a -z "$USE_JRUBY" ] ; then
|
||||
if [ ! -z "$USE_RUBY" ] ; then
|
||||
set -- ruby "$program" "$@"
|
||||
setup
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue