File 0002-Use-installed-jruby.patch of Package logstash6
From 75d915afb5657f7d5b360937938eec153f1c948a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Klaus=20K=C3=A4mpf?= <kkaempf@suse.de>
Date: Mon, 30 Jan 2017 21:15:09 +0100
Subject: [PATCH 02/11] Use installed jruby
---
bin/cpdump | 2 +-
bin/logstash.lib.sh | 2 +-
build.gradle | 99 +-------------------------------------
buildSrc/build.gradle | 4 --
logstash-core/build.gradle | 14 +-----
rakelib/z_rubycheck.rake | 8 +--
6 files changed, 9 insertions(+), 120 deletions(-)
diff --git a/bin/cpdump b/bin/cpdump
index dd5f09b5c9ba..28435c5fa777 100755
--- a/bin/cpdump
+++ b/bin/cpdump
@@ -1,4 +1,4 @@
-#!/usr/bin/env bin/ruby
+#!/usr/bin/env /usr/bin/jruby
require_relative "../lib/bootstrap/environment"
LogStash::Bundler.setup!({:without => [:build, :development]})
diff --git a/bin/logstash.lib.sh b/bin/logstash.lib.sh
index dccc06894e99..3b231b2e9f4f 100755
--- a/bin/logstash.lib.sh
+++ b/bin/logstash.lib.sh
@@ -127,7 +127,7 @@ setup_java() {
}
setup_vendored_jruby() {
- JRUBY_BIN="${LOGSTASH_HOME}/vendor/jruby/bin/jruby"
+ JRUBY_BIN="/usr/bin/jruby"
if [ ! -f "${JRUBY_BIN}" ] ; then
echo "Unable to find JRuby."
diff --git a/build.gradle b/build.gradle
index b6ff5a82250c..7f65c7e5abba 100644
--- a/build.gradle
+++ b/build.gradle
@@ -92,26 +92,6 @@ subprojects {
}
}
-// fetch version from Logstash's master versions.yml file
-def versionMap = (Map) (new Yaml()).load(new File("${projectDir}/versions.yml").text)
-version = versionMap['logstash-core']
-
-String jRubyURL
-String jRubyVersion
-String jRubySha1
-Boolean doChecksum
-
-if (versionMap["jruby-runtime-override"]) {
- jRubyVersion = versionMap["jruby-runtime-override"]["version"]
- jRubyURL = versionMap["jruby-runtime-override"]["url"]
- doChecksum = false
-} else {
- jRubyVersion = versionMap["jruby"]["version"]
- jRubySha1 = versionMap["jruby"]["sha1"]
- jRubyURL = "https://repo1.maven.org/maven2/org/jruby/jruby-dist/${jRubyVersion}/jruby-dist-${jRubyVersion}-bin.tar.gz"
- doChecksum = true
-}
-
// Tasks
clean {
@@ -137,82 +117,7 @@ project(":logstash-core") {
}
}
-def jrubyTarPath = "${projectDir}/vendor/_/jruby-dist-${jRubyVersion}-bin.tar.gz"
-
-def customJRubyDir = project.hasProperty("custom.jruby.path") ? project.property("custom.jruby.path") : ""
-def customJRubyVersion = customJRubyDir == "" ? "" : Files.readAllLines(Paths.get(customJRubyDir, "VERSION")).get(0).trim()
-def customJRubyTar = customJRubyDir == "" ? "" : (customJRubyDir + "/maven/jruby-dist/target/jruby-dist-${customJRubyVersion}-bin.tar.gz")
-
-task downloadJRuby(type: Download) {
- description "Download JRuby artifact from this specific URL: ${jRubyURL}"
- src jRubyURL
- onlyIfNewer true
- inputs.file("${projectDir}/versions.yml")
- outputs.file(jrubyTarPath)
- dest new File("${projectDir}/vendor/_", "jruby-dist-${jRubyVersion}-bin.tar.gz")
-}
-
-downloadJRuby.onlyIf { customJRubyDir == "" }
-
-task verifyFile(dependsOn: downloadJRuby, type: Verify) {
- description "Verify the SHA1 of the download JRuby artifact"
- inputs.file(jrubyTarPath)
- outputs.file(jrubyTarPath)
- src new File(jrubyTarPath)
- algorithm 'SHA-1'
- checksum jRubySha1
-}
-
-verifyFile.onlyIf { customJRubyDir == "" }
-
-task buildCustomJRuby(type: Exec) {
- description "Build tar.gz and .jar artifacts from JRuby source directory"
- workingDir (customJRubyDir == "" ? "./" : customJRubyDir)
- commandLine './mvnw', 'clean', 'install', '-Pdist', '-Pcomplete'
- standardOutput = new ByteArrayOutputStream()
- errorOutput = new ByteArrayOutputStream()
- ext.output = {
- standardOutput.toString() + errorOutput.toString()
- }
-}
-
-buildCustomJRuby.onlyIf { customJRubyDir != "" }
-
-task installCustomJRuby(dependsOn: buildCustomJRuby, type: Copy) {
- description "Install custom built JRuby in the vendor directory"
- inputs.file(customJRubyTar)
- outputs.dir("${projectDir}/vendor/jruby")
- from tarTree(customJRubyTar == "" ? jrubyTarPath : customJRubyTar)
- eachFile { f ->
- f.path = f.path.replaceFirst("^jruby-${customJRubyVersion}", '')
- }
- exclude "**/stdlib/rdoc/**"
- includeEmptyDirs = false
- into "${projectDir}/vendor/jruby"
-}
-
-installCustomJRuby.onlyIf { customJRubyDir != "" }
-
-task downloadAndInstallJRuby(dependsOn: [verifyFile, installCustomJRuby], type: Copy) {
- description "Install JRuby in the vendor directory"
- inputs.file(jrubyTarPath)
- outputs.dir("${projectDir}/vendor/jruby")
- from tarTree(downloadJRuby.dest)
- eachFile { f ->
- f.path = f.path.replaceFirst("^jruby-${jRubyVersion}", '')
- }
- exclude "**/stdlib/rdoc/**"
- includeEmptyDirs = false
- into "${projectDir}/vendor/jruby"
- doLast {
- rubyGradleUtils.gem("rake", "12.3.1", "${projectDir}/vendor/bundle/jruby/2.5.0")
- rubyGradleUtils.gem("json", "1.8.6", "${projectDir}/vendor/bundle/jruby/2.5.0")
- }
-}
-
-downloadAndInstallJRuby.onlyIf { customJRubyDir == "" }
-
-task installDefaultGems(dependsOn: downloadAndInstallJRuby) {
+task installDefaultGems() {
inputs.files file("${projectDir}/Gemfile.template")
inputs.files fileTree("${projectDir}/rakelib")
inputs.files file("${projectDir}/versions.yml")
@@ -227,7 +132,7 @@ task installDefaultGems(dependsOn: downloadAndInstallJRuby) {
}
}
-def assemblyDeps = [downloadAndInstallJRuby, assemble] + subprojects.collect {
+def assemblyDeps = [assemble] + subprojects.collect {
it.tasks.findByName("assemble")
}
diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle
index a17d52f3856a..8f090798c79f 100644
--- a/buildSrc/build.gradle
+++ b/buildSrc/build.gradle
@@ -6,7 +6,3 @@ group = 'org.logstash.gradle'
repositories {
mavenLocal()
}
-
-dependencies {
- compile group: 'org.jruby', name: 'jruby-complete', version: '9.2.6.0'
-}
diff --git a/logstash-core/build.gradle b/logstash-core/build.gradle
index 21142dd96ffb..badc454b0aaa 100644
--- a/logstash-core/build.gradle
+++ b/logstash-core/build.gradle
@@ -7,7 +7,6 @@ def versionMap = (Map) (new Yaml()).load(new File("$projectDir/../versions.yml")
description = """Logstash Core Java"""
version = versionMap['logstash-core']
-String jrubyVersion = versionMap['jruby']['version']
String jacksonVersion = versionMap['jackson']
repositories {
@@ -96,10 +95,6 @@ artifacts {
}
}
-configurations {
- provided
-}
-
project.sourceSets {
main.compileClasspath += project.configurations.provided
main.runtimeClasspath += project.configurations.provided
@@ -114,9 +109,6 @@ idea {
}
}
-def customJRubyDir = project.hasProperty("custom.jruby.path") ? project.property("custom.jruby.path") : ""
-def customJRubyVersion = customJRubyDir == "" ? "" : Files.readAllLines(Paths.get(customJRubyDir, "VERSION")).get(0).trim()
-
dependencies {
compile 'org.apache.logging.log4j:log4j-api:2.9.1'
compile 'org.apache.logging.log4j:log4j-core:2.9.1'
@@ -128,11 +120,7 @@ dependencies {
compile "com.fasterxml.jackson.core:jackson-annotations:${jacksonVersion}"
compile 'org.codehaus.janino:janino:3.0.8'
compile "com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:${jacksonVersion}"
- if (customJRubyDir == "") {
- compile "org.jruby:jruby-complete:${jrubyVersion}"
- } else {
- compile files(customJRubyDir + "/maven/jruby-complete/target/jruby-complete-${customJRubyVersion}.jar")
- }
+ compile files('/usr/share/jruby/lib/jruby.jar')
compile group: 'com.google.guava', name: 'guava', version: '22.0'
// Do not upgrade this, later versions require GPL licensed code in javac-shaded that is
// Apache2 incompatible
diff --git a/rakelib/z_rubycheck.rake b/rakelib/z_rubycheck.rake
index be782fde6b3d..b3b5bb2dc618 100644
--- a/rakelib/z_rubycheck.rake
+++ b/rakelib/z_rubycheck.rake
@@ -1,11 +1,11 @@
if ENV['USE_RUBY'] != '1'
- if RUBY_ENGINE != "jruby" or Gem.ruby !~ /vendor\/jruby\/bin\/jruby/
- puts "Restarting myself under Vendored JRuby (currently #{RUBY_ENGINE} #{RUBY_VERSION})" if ENV['DEBUG']
+ if RUBY_ENGINE != "jruby" or Gem.ruby !~ /usr\/share\/jruby\/bin\/jruby/
+ puts "Restarting myself under Vendored JRuby (currently #{Gem.ruby} - #{RUBY_ENGINE} #{RUBY_VERSION} )" if ENV['DEBUG']
# Make sure we have JRuby, then rerun ourselves under jruby.
Rake::Task["vendor:jruby"].invoke
- jruby = File.join("bin", "ruby")
- rake = File.join("vendor", "jruby", "bin", "rake")
+ jruby = File.join("/usr", "bin", "jruby")
+ rake = File.join("/usr", "bin", "jrake")
# if required at this point system gems can be installed using the system_gem task, for example:
# Rake::Task["vendor:system_gem"].invoke(jruby, "ffi", "1.9.6")
--
2.26.0