]> git.pld-linux.org Git - packages/chef.git/commitdiff
Apply chef/chef#7994 to fix invalid option: --no-rdoc error auto/th/chef-14.1.36-4
authorElan Ruusamäe <glen@pld-linux.org>
Fri, 8 May 2020 13:59:57 +0000 (16:59 +0300)
committerElan Ruusamäe <glen@pld-linux.org>
Fri, 8 May 2020 14:08:27 +0000 (17:08 +0300)
- https://github.com/chef/chef/issues/8416
- https://github.com/chef/chef/pull/7994

7994.patch [new file with mode: 0644]
chef.spec

diff --git a/7994.patch b/7994.patch
new file mode 100644 (file)
index 0000000..484ccf2
--- /dev/null
@@ -0,0 +1,140 @@
+https://github.com/chef/chef/pull/7994
+
+From 537982312e1034f33e4bc3967f36d8f49bbafb4c Mon Sep 17 00:00:00 2001
+From: Lamont Granquist <lamont@scriptkiddie.org>
+Date: Mon, 26 Nov 2018 23:25:04 -0800
+Subject: [PATCH] gem_package provider supports --no-document and rubygems 3.x
+
+should still maintain backcompat for rubygems < 2.0 for RHEL6 and
+other old platforms.
+
+Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
+---
+ lib/chef/provider/package/rubygems.rb       | 54 ++++++++++++++------
+ spec/unit/provider/package/rubygems_spec.rb | 56 +++++++++++++++++----
+ 2 files changed, 85 insertions(+), 25 deletions(-)
+
+diff --git a/lib/chef/provider/package/rubygems.rb b/lib/chef/provider/package/rubygems.rb
+index d99dce89720..cd595e64f4f 100644
+--- a/lib/chef/provider/package/rubygems.rb
++++ b/lib/chef/provider/package/rubygems.rb
+@@ -1,7 +1,7 @@
+ #
+ # Author:: Adam Jacob (<adam@chef.io>)
+ # Author:: Daniel DeLeo (<dan@chef.io>)
+-# Copyright:: Copyright 2008-2016, 2010-2017, Chef Software Inc.
++# Copyright:: Copyright 2008-2016, 2010-2018, Chef Software Inc.
+ # License:: Apache License, Version 2.0
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License");
+@@ -49,42 +49,44 @@ class GemEnvironment
+           DEFAULT_UNINSTALLER_OPTS = { ignore: true, executables: true }.freeze
+-          ##
+           # The paths where rubygems should search for installed gems.
+           # Implemented by subclasses.
+           def gem_paths
+             raise NotImplementedError
+           end
+-          ##
+           # A rubygems source index containing the list of gemspecs for all
+           # available gems in the gem installation.
+           # Implemented by subclasses
+-          # === Returns
+-          # Gem::SourceIndex
++          #
++          # @return [Gem::SourceIndex]
++          #
+           def gem_source_index
+             raise NotImplementedError
+           end
+-          ##
+           # A rubygems specification object containing the list of gemspecs for all
+           # available gems in the gem installation.
+           # Implemented by subclasses
+           # For rubygems >= 1.8.0
+-          # === Returns
+-          # Gem::Specification
++          #
++          # @return [Gem::Specification]
++          #
+           def gem_specification
+             raise NotImplementedError
+           end
+-          ##
++          def rubygems_version
++            raise NotImplementedError
++          end
++
+           # Lists the installed versions of +gem_name+, constrained by the
+           # version spec in +gem_dep+
+-          # === Arguments
+-          # Gem::Dependency   +gem_dep+ is a Gem::Dependency object, its version
+-          #                   specification constrains which gems are returned.
+-          # === Returns
+-          # [Gem::Specification]  an array of Gem::Specification objects
++          #
++          # @param gem_dep [Gem::Dependency] the version specification that constrains
++          #   which gems are used.
++          # @return [Array<Gem::Specification>]  an array of Gem::Specification objects
++          #
+           def installed_versions(gem_dep)
+             rubygems_version = Gem::Version.new(Gem::VERSION)
+             if rubygems_version >= Gem::Version.new("2.7")
+@@ -266,6 +268,10 @@ def gem_specification
+             Gem::Specification
+           end
++          def rubygems_version
++            Gem::VERSION
++          end
++
+           def candidate_version_from_remote(gem_dependency, *sources)
+             with_gem_sources(*sources) do
+               find_newest_remote_version(gem_dependency, *sources)
+@@ -293,6 +299,10 @@ def initialize(gem_binary_location)
+             @gem_binary_location = gem_binary_location
+           end
++          def rubygems_version
++            @rubygems_version ||= shell_out!("#{@gem_binary_location} --version").stdout.chomp
++          end
++
+           def gem_paths
+             if self.class.gempath_cache.key?(@gem_binary_location)
+               self.class.gempath_cache[@gem_binary_location]
+@@ -557,9 +557,9 @@
+           end
+           src_str = src.empty? ? "" : " #{src.join(" ")}"
+           if !version.nil? && !version.empty?
+-            shell_out_with_timeout!("#{gem_binary_path} install #{name} -q --no-rdoc --no-ri -v \"#{version}\"#{src_str}#{opts}", env: nil)
++            shell_out_with_timeout!("#{gem_binary_path} install #{name} -q #{rdoc_string} --no-ri -v \"#{version}\"#{src_str}#{opts}", env: nil)
+           else
+-            shell_out_with_timeout!("#{gem_binary_path} install \"#{name}\" -q --no-rdoc --no-ri #{src_str}#{opts}", env: nil)
++            shell_out_with_timeout!("#{gem_binary_path} install \"#{name}\" -q #{rdoc_string} --no-ri #{src_str}#{opts}", env: nil)
+           end
+         end
+@@ -585,6 +595,18 @@ def purge_package(name, version)
+         private
++        def rdoc_string
++          if needs_nodocument?
++            "--no-document"
++          else
++            "--no-rdoc --no-ri"
++          end
++        end
++
++        def needs_nodocument?
++          Gem::Requirement.new(">= 3.0.0.beta1").satisfied_by?(Gem::Version.new(gem_env.rubygems_version))
++        end
++
+         def opts
+           expand_options(new_resource.options)
+         end
index de79e336723e5c9b66ba73a31360903ef12ef92e..c727fc87bc509a50b6659be8e89d88c1903245b8 100644 (file)
--- a/chef.spec
+++ b/chef.spec
@@ -8,7 +8,7 @@
 Summary:       A systems integration framework, built to bring the benefits of configuration management to your entire infrastructure
 Name:          chef
 Version:       14.1.36
-Release:       3
+Release:       4
 License:       Apache v2.0
 Group:         Networking/Admin
 Source0:       https://github.com/chef/chef/archive/v%{version}/%{name}-%{version}.tar.gz
@@ -24,6 +24,7 @@ Patch3:               https://github.com/glensc/chef/compare/pld-knife-boostrap.patch
 Patch4:                optional-plist.patch
 Patch5:                gemdeps.patch
 Patch6:                rubygems.patch
+Patch7:                7994.patch
 URL:           https://www.chef.io/
 BuildRequires: rpm-rubyprov
 BuildRequires: rpmbuild(macros) >= 1.673
@@ -103,6 +104,7 @@ subcommand is documented in its own manual page.
 %patch4 -p1
 %patch5 -p1
 %patch6 -p1
+%patch7 -p1
 
 %{__sed} -i -e '1 s,#!.*ruby,#!%{__ruby},' bin/*
 
This page took 0.113637 seconds and 4 git commands to generate.