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 <[email protected]> + +- 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 ++++++ >From 20ac3dd80edf69f3c2dcbb53c2b8f6fbff7fd087 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= <[email protected]> Date: Tue, 16 Apr 2019 01:05:03 +0200 Subject: [PATCH] Fix line endings of 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 <[email protected]> -# -# 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) - <<EOH -#{parsed.invocation_info[:line]} : #{parsed.exception[:message]} - + CategoryInfo : #{parsed.error_category_message} - + FullyQualifiedErrorId : #{parsed.fully_qualified_error_id} -EOH - end - - def render_exception(parsed) - <<EOH -#{parsed.exception[:message]} -#{parsed.invocation_info[:position_message]} - + CategoryInfo : #{parsed.error_category_message} - + FullyQualifiedErrorId : #{parsed.fully_qualified_error_id} -EOH - end - - def render_native_command_error(parsed) - <<EOH -#{parsed.invocation_info[:my_command]} : #{parsed.exception[:message]} - + CategoryInfo : #{parsed.error_category_message} - + FullyQualifiedErrorId : #{parsed.fully_qualified_error_id} -EOH - end - - def render_exception_as_error_record(parsed) - <<EOH -#{parsed.exception[:message]} - + CategoryInfo : #{parsed.error_category_message} - + FullyQualifiedErrorId : #{parsed.fully_qualified_error_id} -EOH - end - - private - - def hex_decode(text) - return unless text - - text.gsub(/_x(\h\h\h\h)_/) do - decoded_text = Regexp.last_match[1].hex.chr.force_encoding('utf-8') - if decoded_text.respond_to?(:scrub) - decoded_text.scrub - else - decoded_text.encode('utf-16', invalid: :replace, undef: :replace).encode('utf-8') - end - end - end - end - end -end +# Copyright 2016 Matt Wrock <[email protected]> +# +# 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) + <<EOH +#{parsed.invocation_info[:line]} : #{parsed.exception[:message]} + + CategoryInfo : #{parsed.error_category_message} + + FullyQualifiedErrorId : #{parsed.fully_qualified_error_id} +EOH + end + + def render_exception(parsed) + <<EOH +#{parsed.exception[:message]} +#{parsed.invocation_info[:position_message]} + + CategoryInfo : #{parsed.error_category_message} + + FullyQualifiedErrorId : #{parsed.fully_qualified_error_id} +EOH + end + + def render_native_command_error(parsed) + <<EOH +#{parsed.invocation_info[:my_command]} : #{parsed.exception[:message]} + + CategoryInfo : #{parsed.error_category_message} + + FullyQualifiedErrorId : #{parsed.fully_qualified_error_id} +EOH + end + + def render_exception_as_error_record(parsed) + <<EOH +#{parsed.exception[:message]} + + CategoryInfo : #{parsed.error_category_message} + + FullyQualifiedErrorId : #{parsed.fully_qualified_error_id} +EOH + end + + private + + def hex_decode(text) + return unless text + + text.gsub(/_x(\h\h\h\h)_/) do + decoded_text = Regexp.last_match[1].hex.chr.force_encoding('utf-8') + if decoded_text.respond_to?(:scrub) + decoded_text.scrub + else + decoded_text.encode('utf-16', invalid: :replace, undef: :replace).encode('utf-8') + end + end + end + end + end +end -- 2.21.0 ++++++ gem2rpm.yml ++++++ --- /var/tmp/diff_new_pack.OOtQRz/_old 2019-04-17 10:11:19.990975770 +0200 +++ /var/tmp/diff_new_pack.OOtQRz/_new 2019-04-17 10:11:20.010975792 +0200 @@ -11,7 +11,7 @@ # ## used by gem2rpm and gem_packages :version_suffix: "-2_1" # ## used by gem2rpm and gem_packages -:disable_docs: true +# :disable_docs: false # ## used by gem2rpm # :disable_automatic_rdoc_dep: true # ## used by gem2rpm @@ -19,7 +19,9 @@ # BuildRequires: foobar # Requires: foobar # ## used by gem2rpm -# :patches: +:patches: + # FIXME: drop this before the next release + 0001-Fix-line-endings-of-lib-winrm-psrp-powershell_output.patch: -p1 # foo.patch: -p1 # bar.patch: # :post_patch: @@ -35,12 +37,15 @@ # export USE_VENDORED_LIBEV="no" # %endif # ## used by gem2rpm -# :post_install: |- -# # delete custom files here or do other fancy stuff -# install -D -m 0644 %{S:1} %{buildroot}%{_bindir}/gem2rpm-opensuse +:post_install: |- + # drop files from the git repository + find %{buildroot}/%{_libdir}/ruby/gems/ \( -name '.rubocop.yml' -o -name '.travis.yml' -o -name '.gitignore' \) | xargs rm + # fix wrong line ends of bin/rwinrm + find %{buildroot}/%{_libdir}/ruby/gems -name rwinrm | xargs sed -i 's/\r//g' # ## used by gem2rpm +# TODO: make the test suite pass, needs further patching like removal of the git dependency # :testsuite_command: |- -# (pushd %{buildroot}%{gem_base}/gems/%{mod_full_name} && rake test) +# (pushd %{buildroot}%{gem_base}/gems/%{mod_full_name} && rake integration) # ## used by gem2rpm # :filelist: |- # /usr/bin/gem2rpm-opensuse
