update fpm to allow pkg creation on jdk11+jruby 9.2 (#13005)

* fpm to 1.13.0 which allows building packages with java 11 + jruby 9.2
* childprocess to 4.x + remove monkey patches
* clamp to 1.x to unlock fpm 1.13.0
This commit is contained in:
João Duarte 2021-06-21 14:39:27 +01:00 committed by GitHub
parent a5f3153a8f
commit 7390b64a93
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 4 additions and 84 deletions

View file

@ -11,8 +11,8 @@ gem "pleaserun", "~>0.0.28"
gem "rake", "~> 12" gem "rake", "~> 12"
gem "ruby-progressbar", "~> 1" gem "ruby-progressbar", "~> 1"
gem "logstash-output-elasticsearch", ">= 10.4.2" gem "logstash-output-elasticsearch", ">= 10.4.2"
gem "childprocess", "~> 0.9", :group => :build gem "childprocess", "~> 4", :group => :build
gem "fpm", "~> 1.3.3", :group => :build gem "fpm", "~> 1.13", :group => :build
gem "gems", "~> 1", :group => :build gem "gems", "~> 1", :group => :build
gem "octokit", "~> 4", :group => :build gem "octokit", "~> 4", :group => :build
gem "rubyzip", "~> 1", :group => :build gem "rubyzip", "~> 1", :group => :build

View file

@ -49,7 +49,7 @@ Gem::Specification.new do |gem|
gem.add_runtime_dependency "pry", "~> 0.12" #(Ruby license) gem.add_runtime_dependency "pry", "~> 0.12" #(Ruby license)
gem.add_runtime_dependency "stud", "~> 0.0.19" #(Apache 2.0 license) gem.add_runtime_dependency "stud", "~> 0.0.19" #(Apache 2.0 license)
gem.add_runtime_dependency "clamp", "~> 0.6" #(MIT license) for command line args/flags gem.add_runtime_dependency "clamp", "~> 1" #(MIT license) for command line args/flags
gem.add_runtime_dependency "filesize", "~> 0.2" #(MIT license) for :bytes config validator gem.add_runtime_dependency "filesize", "~> 0.2" #(MIT license) for :bytes config validator
gem.add_runtime_dependency "gems", "~> 1" #(MIT license) gem.add_runtime_dependency "gems", "~> 1" #(MIT license)
gem.add_runtime_dependency "concurrent-ruby", "~> 1" gem.add_runtime_dependency "concurrent-ruby", "~> 1"

View file

@ -1,38 +0,0 @@
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# Implementation of ChildProcess::JRuby::Process#pid depends heavily on
# what Java SDK is being used; here, we look it up once at load, then
# override that method with an implementation that works on modern Javas
# if necessary.
#
# This patch can be removed when the upstream childprocess gem supports Java 9+
# https://github.com/enkessler/childprocess/pull/141
normalised_java_version_major = java.lang.System.get_property("java.version")
.slice(/^(1\.)?([0-9]+)/, 2)
.to_i
if normalised_java_version_major >= 9
$stderr.puts("patching childprocess for Java9+ support...")
ChildProcess::JRuby::Process.class_exec do
def pid
@process.pid
rescue java.lang.UnsupportedOperationException => e
raise NotImplementedError, "pid is not supported on this platform: #{e.message}"
end
end
end

View file

@ -18,7 +18,6 @@
require_relative "monitoring_api" require_relative "monitoring_api"
require "childprocess" require "childprocess"
require_relative "../patch/childprocess-modern-java"
require "bundler" require "bundler"
require "socket" require "socket"
require "tempfile" require "tempfile"

View file

@ -507,10 +507,6 @@ namespace "artifact" do
require "fpm/errors" # TODO(sissel): fix this in fpm require "fpm/errors" # TODO(sissel): fix this in fpm
require "fpm/package/dir" require "fpm/package/dir"
require "fpm/package/gem" # TODO(sissel): fix this in fpm; rpm needs it. require "fpm/package/gem" # TODO(sissel): fix this in fpm; rpm needs it.
require "childprocess/jruby/pump"
# TODO(ph): Cabin is closing the fd when it reach EOF, childprocess will attempt to write to it and hit an IOError.
# This will make a the thread dies, in 1.7.25 we had a Thread Death
require_relative "childprocess_patch"
basedir = File.join(File.dirname(__FILE__), "..") basedir = File.join(File.dirname(__FILE__), "..")
dir = FPM::Package::Dir.new dir = FPM::Package::Dir.new
@ -609,7 +605,7 @@ namespace "artifact" do
out.license = license out.license = license
out.attributes[:deb_user] = "root" out.attributes[:deb_user] = "root"
out.attributes[:deb_group] = "root" out.attributes[:deb_group] = "root"
out.attributes[:deb_suggests] = "java8-runtime-headless" unless bundle_jdk out.attributes[:deb_suggests] = ["java11-runtime-headless"] unless bundle_jdk
out.config_files << "/etc/logstash/startup.options" out.config_files << "/etc/logstash/startup.options"
out.config_files << "/etc/logstash/jvm.options" out.config_files << "/etc/logstash/jvm.options"
out.config_files << "/etc/logstash/log4j2.properties" out.config_files << "/etc/logstash/log4j2.properties"

View file

@ -1,37 +0,0 @@
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# This is a patch for childprocess and this is due to ruby-cabin/fpm interaction.
# When we use the logger.pipe construct and the IO reach EOF we close the IO.
# The problem Childprocess will try to flush to it and hit an IOError making the software crash in JRuby 9k.
#
# In JRuby 1.7.25 we hit a thread death.
#
module ChildProcess
module JRuby
class Pump
alias_method :old_pump, :pump
def ignore_close_io
old_pump
rescue IOError
end
alias_method :pump, :ignore_close_io
end
end
end