Skip to content

Commit

Permalink
Fix the Ruby win32 warning patch to work on Ruby 2.5
Browse files Browse the repository at this point in the history
The warning text code changed in Ruby 2.6 so we need a patch that works in Ruby 2.5 since we still ship apps that use Ruby 2.5.

Signed-off-by: Tim Smith <tsmith@chef.io>
  • Loading branch information
tas50 committed Jan 15, 2020
1 parent f651ce4 commit dbfcb71
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
12 changes: 12 additions & 0 deletions config/patches/ruby/ruby-win32_warning_removal_25_and_below.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--- a/ext/win32/lib/Win32API.rb
+++ b/ext/win32/lib/Win32API.rb
@@ -1,9 +1,6 @@
# -*- ruby -*-
# frozen_string_literal: true

-# for backward compatibility
-warn "Warning:#{caller[0].sub(/:in `.*'\z/, '')}: Win32API is deprecated after Ruby 1.9.1; use fiddle directly instead" if $VERBOSE
-
require 'fiddle/import'

class Win32API
8 changes: 6 additions & 2 deletions config/software/ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,13 @@
patch_env = env.dup
patch_env["PATH"] = "/opt/freeware/bin:#{env["PATH"]}" if aix?

# remove the warning that the win32 api is going away.
if windows?
# remove the warning that the win32 api is going away.
patch source: "ruby-win32_warning_removal.patch", plevel: 1, env: patch_env
if version.satisfies?(">= 2.6")
patch source: "ruby-win32_warning_removal_26plus.patch", plevel: 1, env: patch_env
else
patch source: "ruby-win32_warning_removal_25_and_below.patch", plevel: 1, env: patch_env
end
end

# wrlinux7/ios_xr build boxes from Cisco include libssp and there is no way to
Expand Down

0 comments on commit dbfcb71

Please sign in to comment.