[arch-commits] Commit in (5 files)

Andreas Schleifer segaja at gemini.archlinux.org
Sun Feb 13 17:03:46 UTC 2022


    Date: Sunday, February 13, 2022 @ 17:03:46
  Author: segaja
Revision: 1133066

create package ruby-puma 5.6.2-1

Added:
  ruby-puma/
  ruby-puma/repos/
  ruby-puma/trunk/
  ruby-puma/trunk/PKGBUILD
  ruby-puma/trunk/tests.patch

-------------+
 PKGBUILD    |   77 +++++++++++++
 tests.patch |  322 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 399 insertions(+)

Added: ruby-puma/trunk/PKGBUILD
===================================================================
--- ruby-puma/trunk/PKGBUILD	                        (rev 0)
+++ ruby-puma/trunk/PKGBUILD	2022-02-13 17:03:46 UTC (rev 1133066)
@@ -0,0 +1,77 @@
+# Maintainer: Andreas 'Segaja' Schleifer <archlinux at segaja dot de>
+
+_gemname='puma'
+pkgname="ruby-$_gemname"
+pkgver=5.6.2
+pkgrel=1
+pkgdesc='A Ruby/Rack web server built for concurrency'
+arch=('x86_64')
+url='https://puma.io/'
+license=('BSD-3-CLAUSE')
+options=(!emptydirs)
+depends=('ruby' 'ruby-nio4r' 'ruby-sd_notify')
+makedepends=('ruby-bundler' 'ruby-minitest' 'ruby-minitest-proveit' 'ruby-minitest-retry' 'ruby-minitest-stub-const' 'ruby-rack' 'ruby-rake' 'ruby-rake-compiler' 'ruby-rdoc')
+source=("https://github.com/puma/puma/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz"
+        tests.patch)
+sha512sums=('e08ebb968cb139136d11cfb12f7ebef7f4cafcbf3f26cf229c063aa0e55769ba8c4bc1df1dd9e04a4969d6f423cae1a09ce87e154315c9df80d61ec56b6f96e7'
+            '1a81082dd3e8722d6da4cdbec958d8dee38ba0c89478f29e837903094d84777d6c00460612d4915399aec53b8c6534b31ae39eb71ca562b1bfb5a9b7d631bacf')
+
+prepare() {
+  cd "${_gemname}-${pkgver}"
+
+  # remove some tests and fix others
+  patch --verbose --strip=1 --input=../tests.patch
+
+  # we built based on a tar archive, not a git repo
+  sed --in-place 's/git ls-files/find/' "${_gemname}.gemspec"
+
+  # update gemspec/Gemfile to allow newer version of the deps
+  sed --in-place --regexp-extended 's|~>|>=|g' "${_gemname}.gemspec" Gemfile
+
+  # disable rubocop, we don't have that in our repos and it doesn't provide any benefits during building
+  sed --in-place '/rubocop/Id' Rakefile Gemfile
+
+  # disable m. Only required for debugging during development
+  sed --in-place "/'m'/d" Gemfile
+
+  # disable localhost. Only required for self-signed certificates during development
+  sed --in-place "/localhost/d" Gemfile
+}
+
+build() {
+  cd "${_gemname}-${pkgver}"
+
+  rake compile
+  rake build
+}
+
+check() {
+  cd "${_gemname}-${pkgver}"
+
+  # https://github.com/puma/puma/blob/master/CONTRIBUTING.md#file-limits
+  ulimit -Sn 5000
+
+  # some seeds cause random errors ( https://github.com/puma/puma/issues/2825 ) so we use a fixed seed
+  export TESTOPTS="--seed=21082"
+
+  rake test:all
+}
+
+package() {
+  cd "${_gemname}-${pkgver}"
+
+  local _gemdir="$(gem env gemdir)"
+  local _platform="$(gem env platform | cut -d':' -f2)"
+  local _extension_api_version="$(ruby -e'puts Gem.extension_api_version')"
+
+  gem install --ignore-dependencies --no-user-install --install-dir "${pkgdir}/${_gemdir}" --bindir "${pkgdir}/usr/bin" "pkg/${_gemname}-${pkgver}.gem"
+
+  rm "${pkgdir}/${_gemdir}/cache/${_gemname}-${pkgver}.gem" \
+      "${pkgdir}/${_gemdir}/gems/${_gemname}-${pkgver}/ext/puma_http11/Makefile" \
+      "${pkgdir}/${_gemdir}/extensions/${_platform}/${_extension_api_version}/${_gemname}-${pkgver}/mkmf.log" \
+      "${pkgdir}/${_gemdir}/extensions/${_platform}/${_extension_api_version}/${_gemname}-${pkgver}/gem_make.out" \
+      "${pkgdir}/${_gemdir}/doc/${_gemname}-${pkgver}/ri/ext/puma_http11/page-Makefile.ri"
+
+  install -D --mode=644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
+  install -D --mode=644 *.md --target-directory "${pkgdir}/usr/share/doc/${pkgname}"
+}

Added: ruby-puma/trunk/tests.patch
===================================================================
--- ruby-puma/trunk/tests.patch	                        (rev 0)
+++ ruby-puma/trunk/tests.patch	2022-02-13 17:03:46 UTC (rev 1133066)
@@ -0,0 +1,322 @@
+diff --git a/test/config/ssl_self_signed_config.rb b/test/config/ssl_self_signed_config.rb
+deleted file mode 100644
+index d70b51d1..00000000
+--- a/test/config/ssl_self_signed_config.rb
++++ /dev/null
+@@ -1,7 +0,0 @@
+-require "localhost"
+-
+-ssl_bind "0.0.0.0", 9292
+-
+-app do |env|
+-  [200, {}, ["self-signed certificate app"]]
+-end
+diff --git a/test/test_config.rb b/test/test_config.rb
+index d2ced63f..90ace92c 100644
+--- a/test/test_config.rb
++++ b/test/test_config.rb
+@@ -58,22 +58,6 @@ class TestConfigFile < TestConfigFileBase
+     assert_equal [200, {}, ["embedded app"]], app.call({})
+   end
+ 
+-  def test_ssl_self_signed_configuration_from_DSL
+-    skip_if :jruby
+-    skip_unless :ssl
+-    conf = Puma::Configuration.new do |config|
+-      config.load "test/config/ssl_self_signed_config.rb"
+-    end
+-
+-    conf.load
+-
+-    bind_configuration = conf.options.file_options[:binds].first
+-    app = conf.app
+-
+-    ssl_binding = "ssl://0.0.0.0:9292?cert=&key=&verify_mode=none"
+-    assert_equal [ssl_binding], conf.options[:binds]
+-  end
+-
+   def test_ssl_bind
+     skip_if :jruby
+     skip_unless :ssl
+diff --git a/test/test_integration_ssl.rb b/test/test_integration_ssl.rb
+index 07dc0972..9c3409a7 100644
+--- a/test/test_integration_ssl.rb
++++ b/test/test_integration_ssl.rb
+@@ -108,30 +108,6 @@ RUBY
+ 
+ activate_control_app 'tcp://#{HOST}:#{control_tcp_port}', { auth_token: '#{TOKEN}' }
+ 
+-app do |env|
+-  [200, {}, [env['rack.url_scheme']]]
+-end
+-RUBY
+-
+-    with_server(config) do |http|
+-      body = nil
+-      http.start do
+-        req = Net::HTTP::Get.new '/', {}
+-        http.request(req) { |resp| body = resp.body }
+-      end
+-      assert_equal 'https', body
+-    end
+-  end
+-
+-  def test_ssl_run_with_localhost_authority
+-    skip_if :jruby
+-
+-    config = <<RUBY
+-  require 'localhost'
+-  ssl_bind '#{HOST}', '#{bind_port}'
+-
+-activate_control_app 'tcp://#{HOST}:#{control_tcp_port}', { auth_token: '#{TOKEN}' }
+-
+ app do |env|
+   [200, {}, [env['rack.url_scheme']]]
+ end
+diff --git a/test/test_launcher.rb b/test/test_launcher.rb
+index 370e0c38..05257020 100644
+--- a/test/test_launcher.rb
++++ b/test/test_launcher.rb
+@@ -13,9 +13,9 @@ class TestLauncher < Minitest::Test
+     dirs = launcher.send(:files_to_require_after_prune)
+ 
+     assert_equal(2, dirs.length)
+-    assert_match(%r{puma/lib$}, dirs[0]) # lib dir
+-    assert_match(%r{puma-#{Puma::Const::PUMA_VERSION}$}, dirs[1]) # native extension dir
+-    refute_match(%r{gems/rdoc-[\d.]+/lib$}, dirs[2])
++    assert_match(%r{/build/ruby-puma/src/puma-#{Puma::Const::PUMA_VERSION}/lib$}, dirs[0]) # lib dir
++    assert_match(%r{/build/ruby-puma/src/extensions/x86_64-linux/3.0.0/puma-#{Puma::Const::PUMA_VERSION}$}, dirs[1]) # native extension dir
++    refute_match(%r{/usr/lib/ruby/gems/3.0.0/gems/rdoc-[\d.]+/lib$}, dirs[2])
+   end
+ 
+   def test_files_to_require_after_prune_is_correctly_built_with_extra_deps
+@@ -27,9 +27,9 @@ class TestLauncher < Minitest::Test
+     dirs = launcher(conf).send(:files_to_require_after_prune)
+ 
+     assert_equal(3, dirs.length)
+-    assert_match(%r{puma/lib$}, dirs[0]) # lib dir
+-    assert_match(%r{puma-#{Puma::Const::PUMA_VERSION}$}, dirs[1]) # native extension dir
+-    assert_match(%r{gems/rdoc-[\d.]+/lib$}, dirs[2]) # rdoc dir
++    assert_match(%r{/build/ruby-puma/src/puma-#{Puma::Const::PUMA_VERSION}/lib$}, dirs[0]) # lib dir
++    assert_match(%r{/build/ruby-puma/src/extensions/x86_64-linux/3.0.0/puma-#{Puma::Const::PUMA_VERSION}$}, dirs[1]) # native extension dir
++    assert_match(%r{/usr/lib/ruby/gems/3.0.0/gems/rdoc-[\d.]+/lib$}, dirs[2])
+   end
+ 
+   def test_extra_runtime_deps_directories_is_empty_for_no_config
+diff --git a/test/test_preserve_bundler_env.rb b/test/test_preserve_bundler_env.rb
+deleted file mode 100644
+index 2a2692ea..00000000
+--- a/test/test_preserve_bundler_env.rb
++++ /dev/null
+@@ -1,110 +0,0 @@
+-require_relative "helper"
+-require_relative "helpers/integration"
+-
+-class TestPreserveBundlerEnv < TestIntegration
+-  def setup
+-    skip_unless :fork
+-    super
+-  end
+-
+-  def teardown
+-    return if skipped?
+-    FileUtils.rm current_release_symlink, force: true
+-    super
+-  end
+-
+-  # It does not wipe out BUNDLE_GEMFILE et al
+-  def test_usr2_restart_preserves_bundler_environment
+-    skip_unless_signal_exist? :USR2
+-
+-    @tcp_port = UniquePort.call
+-    env = {
+-      # Intentionally set this to something we wish to keep intact on restarts
+-      "BUNDLE_GEMFILE" => "Gemfile.bundle_env_preservation_test",
+-      # Don't allow our (rake test's) original env to interfere with the child process
+-      "BUNDLER_ORIG_BUNDLE_GEMFILE" => nil
+-    }
+-    # Must use `bundle exec puma` here, because otherwise Bundler may not be defined, which is required to trigger the bug
+-    cmd = "bundle exec puma -q -w 1 --prune-bundler -b tcp://#{HOST}:#{@tcp_port}"
+-    Dir.chdir(File.expand_path("bundle_preservation_test", __dir__)) do
+-      @server = IO.popen(env, cmd.split, "r")
+-    end
+-    wait_for_server_to_boot
+-    @pid = @server.pid
+-    connection = connect
+-    initial_reply = read_body(connection)
+-    assert_match("Gemfile.bundle_env_preservation_test", initial_reply)
+-    restart_server connection
+-    new_reply = read_body(connection)
+-    assert_match("Gemfile.bundle_env_preservation_test", new_reply)
+-  end
+-
+-  def test_worker_forking_preserves_bundler_config_path
+-    skip_unless_signal_exist? :TERM
+-
+-    @tcp_port = UniquePort.call
+-    env = {
+-      # Disable the .bundle/config file in the bundle_app_config_test directory
+-      "BUNDLE_APP_CONFIG" => "/dev/null",
+-      # Don't allow our (rake test's) original env to interfere with the child process
+-      "BUNDLE_GEMFILE" => nil,
+-      "BUNDLER_ORIG_BUNDLE_GEMFILE" => nil
+-    }
+-    cmd = "bundle exec puma -q -w 1 --prune-bundler -b tcp://#{HOST}:#{@tcp_port}"
+-    Dir.chdir File.expand_path("bundle_app_config_test", __dir__) do
+-      @server = IO.popen(env, cmd.split, "r")
+-    end
+-    wait_for_server_to_boot
+-    @pid = @server.pid
+-    reply = read_body(connect)
+-    assert_equal("Hello World", reply)
+-  end
+-
+-  def test_phased_restart_preserves_unspecified_bundle_gemfile
+-    skip_unless_signal_exist? :USR1
+-
+-    @tcp_port = UniquePort.call
+-    env = {
+-      "BUNDLE_GEMFILE" => nil,
+-      "BUNDLER_ORIG_BUNDLE_GEMFILE" => nil
+-    }
+-    set_release_symlink File.expand_path("bundle_preservation_test/version1", __dir__)
+-    cmd = "bundle exec puma -q -w 1 --prune-bundler -b tcp://#{HOST}:#{@tcp_port}"
+-    Dir.chdir(current_release_symlink) do
+-      @server = IO.popen(env, cmd.split, "r")
+-    end
+-    wait_for_server_to_boot
+-    @pid = @server.pid
+-    connection = connect
+-
+-    # Bundler itself sets ENV['BUNDLE_GEMFILE'] to the Gemfile it finds if ENV['BUNDLE_GEMFILE'] was unspecified
+-    initial_reply = read_body(connection)
+-    expected_gemfile = File.expand_path("bundle_preservation_test/version1/Gemfile", __dir__).inspect
+-    assert_equal(expected_gemfile, initial_reply)
+-
+-    set_release_symlink File.expand_path("bundle_preservation_test/version2", __dir__)
+-    start_phased_restart
+-
+-    connection = connect
+-    new_reply = read_body(connection)
+-    expected_gemfile = File.expand_path("bundle_preservation_test/version2/Gemfile", __dir__).inspect
+-    assert_equal(expected_gemfile, new_reply)
+-  end
+-
+-  private
+-
+-  def current_release_symlink
+-    File.expand_path "bundle_preservation_test/current", __dir__
+-  end
+-
+-  def set_release_symlink(target_dir)
+-    FileUtils.rm current_release_symlink, force: true
+-    FileUtils.symlink target_dir, current_release_symlink, force: true
+-  end
+-
+-  def start_phased_restart
+-    Process.kill :USR1, @pid
+-
+-    true while @server.gets !~ /booted in [.0-9]+s, phase: 1/
+-  end
+-end
+diff --git a/test/test_puma_localhost_authority.rb b/test/test_puma_localhost_authority.rb
+deleted file mode 100644
+index 8599980b..00000000
+--- a/test/test_puma_localhost_authority.rb
++++ /dev/null
+@@ -1,95 +0,0 @@
+-# Nothing in this file runs if Puma isn't compiled with ssl support
+-#
+-# helper is required first since it loads Puma, which needs to be
+-# loaded so HAS_SSL is defined
+-require_relative "helper"
+-require "localhost/authority"
+-
+-if ::Puma::HAS_SSL && !Puma::IS_JRUBY
+-  require "puma/minissl"
+-  require "net/http"
+-
+-  # net/http (loaded in helper) does not necessarily load OpenSSL
+-  require "openssl" unless Object.const_defined? :OpenSSL
+-end
+-
+-class TestPumaLocalhostAuthority < Minitest::Test
+-  parallelize_me!
+-  def setup
+-    @http = nil
+-    @server = nil
+-  end
+-
+-  def teardown
+-    @http.finish if @http && @http.started?
+-    @server.stop(true) if @server
+-  end
+-
+-  # yields ctx to block, use for ctx setup & configuration
+-  def start_server
+-    @host = "localhost"
+-    app = lambda { |env| [200, {}, [env['rack.url_scheme']]] }
+-
+-    @events = SSLEventsHelper.new STDOUT, STDERR
+-    @server = Puma::Server.new app, @events
+-    @server.app = app
+-    @server.add_ssl_listener @host, 0,nil
+-    @http = Net::HTTP.new @host, @server.connected_ports[0]
+-
+-    @http.use_ssl = true
+-    # Disabling verification since its self signed
+-    @http.verify_mode = OpenSSL::SSL::VERIFY_NONE
+-    # @http.verify_mode = OpenSSL::SSL::VERIFY_NONE
+-
+-    @server.run
+-  end
+-
+-  def test_localhost_authority_file_generated
+-    # Initiate server to create localhost authority
+-    unless File.exist?(File.join(Localhost::Authority.path,"localhost.key"))
+-      start_server
+-    end
+-    assert_equal(File.exist?(File.join(Localhost::Authority.path,"localhost.key")), true)
+-    assert_equal(File.exist?(File.join(Localhost::Authority.path,"localhost.crt")), true)
+-  end
+-
+-end if ::Puma::HAS_SSL &&  !Puma::IS_JRUBY
+-
+-class TestPumaSSLLocalhostAuthority < Minitest::Test
+-  def test_self_signed_by_localhost_authority
+-    @host = "localhost"
+-
+-    app = lambda { |env| [200, {}, [env['rack.url_scheme']]] }
+-
+-    @events = SSLEventsHelper.new STDOUT, STDERR
+-
+-    @server = Puma::Server.new app, @events
+-    @server.app = app
+-
+-    @server.add_ssl_listener @host, 0,nil
+-
+-    @http = Net::HTTP.new @host, @server.connected_ports[0]
+-    @http.use_ssl = true
+-
+-    OpenSSL::PKey::RSA.new File.read(File.join(Localhost::Authority.path,"localhost.key"))
+-    local_authority_crt = OpenSSL::X509::Certificate.new File.read(File.join(Localhost::Authority.path,"localhost.crt"))
+-
+-    @http.verify_mode = OpenSSL::SSL::VERIFY_NONE
+-    @server.run
+-    @cert = nil
+-    begin
+-      @http.start do
+-        req = Net::HTTP::Get.new "/", {}
+-        @http.request(req)
+-        @cert = @http.peer_cert
+-      end
+-    rescue OpenSSL::SSL::SSLError, EOFError, Errno::ECONNRESET
+-      # Errno::ECONNRESET TruffleRuby
+-      # closes socket if open, may not close on error
+-      @http.send :do_finish
+-    end
+-    sleep 0.1
+-
+-    assert_equal(@cert.to_pem, local_authority_crt.to_pem)
+-  end
+-end  if ::Puma::HAS_SSL && !Puma::IS_JRUBY



More information about the arch-commits mailing list