From 20ac3dd80edf69f3c2dcbb53c2b8f6fbff7fd087 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?=
Date: Tue, 16 Apr 2019 01:05:03 +0200
Subject: [PATCH] Fix line endings of
Hello community,
here is the log from the commit of package rubygem-winrm-2_1 for openSUSE:Factory checked in at 2019-04-17 10:10:36
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-winrm-2_1 (Old)
and /work/SRC/openSUSE:Factory/.rubygem-winrm-2_1.new.17052 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-winrm-2_1"
Wed Apr 17 10:10:36 2019 rev:3 rq:694891 version:2.1.3
Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-winrm-2_1/rubygem-winrm-2_1.changes 2019-03-04 09:24:44.588553822 +0100
+++ /work/SRC/openSUSE:Factory/.rubygem-winrm-2_1.new.17052/rubygem-winrm-2_1.changes 2019-04-17 10:11:18.234973899 +0200
@@ -1,0 +2,7 @@
+Tue Apr 16 09:00:58 UTC 2019 - Dan Čermák
+
+- Cleanup RPM warnings
+ Add 0001-Fix-line-endings-of-lib-winrm-psrp-powershell_output.patch:
+ upstream fix for the end of line issues
+
+-------------------------------------------------------------------
New:
----
0001-Fix-line-endings-of-lib-winrm-psrp-powershell_output.patch
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ rubygem-winrm-2_1.spec ++++++
--- /var/tmp/diff_new_pack.OOtQRz/_old 2019-04-17 10:11:19.806975574 +0200
+++ /var/tmp/diff_new_pack.OOtQRz/_new 2019-04-17 10:11:19.806975574 +0200
@@ -38,6 +38,9 @@
Url: https://github.com/WinRb/WinRM
Source: https://rubygems.org/gems/%{mod_full_name}.gem
Source1: gem2rpm.yml
+# MANUAL
+Patch0: 0001-Fix-line-endings-of-lib-winrm-psrp-powershell_output.patch
+# /MANUAL
Summary: Ruby library for Windows Remote Management
License: Apache-2.0
Group: Development/Languages/Ruby
@@ -48,20 +51,21 @@
%prep
%gem_unpack
-# MANUAL
-# fix Windows end of file or rdoc will fail
-sed -i 's/\r//g' lib/winrm/psrp/powershell_output_decoder.rb
-# /MANUAL
+%patch0 -p1
+find -type f -print0 | xargs -0 touch -r %{S:0}
+%gem_build
%build
-%gem_build
%install
%gem_install \
- --no-rdoc --no-ri \
--symlink-binaries \
--doc-files="LICENSE README.md changelog.md" \
-f
+# MANUAL
+find %{buildroot}/%{_libdir}/ruby/gems/ \( -name '.rubocop.yml' -o -name '.travis.yml' -o -name '.gitignore' \) | xargs rm
+find %{buildroot}/%{_libdir}/ruby/gems -name rwinrm | xargs sed -i 's/\r//g'
+# /MANUAL
%gem_packages
++++++ 0001-Fix-line-endings-of-lib-winrm-psrp-powershell_output.patch ++++++
lib/winrm/psrp/powershell_output_decoder.rb
This fixes #299
---
lib/winrm/psrp/powershell_output_decoder.rb | 284 ++++++++++----------
1 file changed, 142 insertions(+), 142 deletions(-)
diff --git a/lib/winrm/psrp/powershell_output_decoder.rb b/lib/winrm/psrp/powershell_output_decoder.rb
index c02b7f8..35f540a 100644
--- a/lib/winrm/psrp/powershell_output_decoder.rb
+++ b/lib/winrm/psrp/powershell_output_decoder.rb
@@ -1,142 +1,142 @@
-# Copyright 2016 Matt Wrock
-#
-# Licensed 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.
-
-require 'base64'
-require_relative 'message'
-require_relative 'message_data/pipeline_state'
-
-module WinRM
- module PSRP
- # Handles decoding a raw powershell output response
- class PowershellOutputDecoder
- # rubocop:disable Metrics/CyclomaticComplexity
- # Decode the raw SOAP output into decoded PSRP message,
- # Removes BOM and replaces encoded line endings
- # @param raw_output [String] The raw encoded output
- # @return [String] The decoded output
- def decode(message)
- case message.type
- when WinRM::PSRP::Message::MESSAGE_TYPES[:pipeline_output]
- decode_pipeline_output(message)
- when WinRM::PSRP::Message::MESSAGE_TYPES[:runspacepool_host_call]
- decode_host_call(message)
- when WinRM::PSRP::Message::MESSAGE_TYPES[:pipeline_host_call]
- decode_host_call(message)
- when WinRM::PSRP::Message::MESSAGE_TYPES[:error_record]
- decode_error_record(message)
- when WinRM::PSRP::Message::MESSAGE_TYPES[:pipeline_state]
- if message.parsed_data.pipeline_state == WinRM::PSRP::MessageData::PipelineState::FAILED
- decode_error_record(message)
- end
- end
- end
- # rubocop:enable Metrics/CyclomaticComplexity
-
- protected
-
- def decode_pipeline_output(message)
- message.parsed_data.output
- end
-
- def decode_host_call(message)
- text = begin
- case message.parsed_data.method_identifier
- when /WriteLine/, 'WriteErrorLine'
- "#{message.parsed_data.method_parameters[:s]}\r\n"
- when 'WriteDebugLine'
- "Debug: #{message.parsed_data.method_parameters[:s]}\r\n"
- when 'WriteWarningLine'
- "Warning: #{message.parsed_data.method_parameters[:s]}\r\n"
- when 'WriteVerboseLine'
- "Verbose: #{message.parsed_data.method_parameters[:s]}\r\n"
- when /Write[1-2]/
- message.parsed_data.method_parameters[:s]
- end
- end
-
- hex_decode(text)
- end
-
- def decode_error_record(message)
- parsed = message.parsed_data
- text = begin
- if message.type == WinRM::PSRP::Message::MESSAGE_TYPES[:pipeline_state]
- render_exception_as_error_record(parsed.exception_as_error_record)
- else
- case parsed.fully_qualified_error_id
- when 'Microsoft.PowerShell.Commands.WriteErrorException'
- render_write_error_exception(parsed)
- when 'NativeCommandError'
- render_native_command_error(parsed)
- when 'NativeCommandErrorMessage'
- parsed.exception[:message]
- else
- render_exception(parsed)
- end
- end
- end
-
- hex_decode(text)
- end
-
- def render_write_error_exception(parsed)
- <
+#
+# Licensed 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.
+
+require 'base64'
+require_relative 'message'
+require_relative 'message_data/pipeline_state'
+
+module WinRM
+ module PSRP
+ # Handles decoding a raw powershell output response
+ class PowershellOutputDecoder
+ # rubocop:disable Metrics/CyclomaticComplexity
+ # Decode the raw SOAP output into decoded PSRP message,
+ # Removes BOM and replaces encoded line endings
+ # @param raw_output [String] The raw encoded output
+ # @return [String] The decoded output
+ def decode(message)
+ case message.type
+ when WinRM::PSRP::Message::MESSAGE_TYPES[:pipeline_output]
+ decode_pipeline_output(message)
+ when WinRM::PSRP::Message::MESSAGE_TYPES[:runspacepool_host_call]
+ decode_host_call(message)
+ when WinRM::PSRP::Message::MESSAGE_TYPES[:pipeline_host_call]
+ decode_host_call(message)
+ when WinRM::PSRP::Message::MESSAGE_TYPES[:error_record]
+ decode_error_record(message)
+ when WinRM::PSRP::Message::MESSAGE_TYPES[:pipeline_state]
+ if message.parsed_data.pipeline_state == WinRM::PSRP::MessageData::PipelineState::FAILED
+ decode_error_record(message)
+ end
+ end
+ end
+ # rubocop:enable Metrics/CyclomaticComplexity
+
+ protected
+
+ def decode_pipeline_output(message)
+ message.parsed_data.output
+ end
+
+ def decode_host_call(message)
+ text = begin
+ case message.parsed_data.method_identifier
+ when /WriteLine/, 'WriteErrorLine'
+ "#{message.parsed_data.method_parameters[:s]}\r\n"
+ when 'WriteDebugLine'
+ "Debug: #{message.parsed_data.method_parameters[:s]}\r\n"
+ when 'WriteWarningLine'
+ "Warning: #{message.parsed_data.method_parameters[:s]}\r\n"
+ when 'WriteVerboseLine'
+ "Verbose: #{message.parsed_data.method_parameters[:s]}\r\n"
+ when /Write[1-2]/
+ message.parsed_data.method_parameters[:s]
+ end
+ end
+
+ hex_decode(text)
+ end
+
+ def decode_error_record(message)
+ parsed = message.parsed_data
+ text = begin
+ if message.type == WinRM::PSRP::Message::MESSAGE_TYPES[:pipeline_state]
+ render_exception_as_error_record(parsed.exception_as_error_record)
+ else
+ case parsed.fully_qualified_error_id
+ when 'Microsoft.PowerShell.Commands.WriteErrorException'
+ render_write_error_exception(parsed)
+ when 'NativeCommandError'
+ render_native_command_error(parsed)
+ when 'NativeCommandErrorMessage'
+ parsed.exception[:message]
+ else
+ render_exception(parsed)
+ end
+ end
+ end
+
+ hex_decode(text)
+ end
+
+ def render_write_error_exception(parsed)
+ <