diff --git a/.gitignore b/.gitignore index b985d4a..41c927c 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /childprocess-0.3.9.gem /childprocess-0.5.3.gem /childprocess-0.5.9.gem +/childprocess-1.0.1.gem diff --git a/rubygem-childprocess-1.0.1-Rewrite-unix-fork-reopen-to-be-compatible-with-ruby-2.6.patch b/rubygem-childprocess-1.0.1-Rewrite-unix-fork-reopen-to-be-compatible-with-ruby-2.6.patch new file mode 100644 index 0000000..69f3e0a --- /dev/null +++ b/rubygem-childprocess-1.0.1-Rewrite-unix-fork-reopen-to-be-compatible-with-ruby-2.6.patch @@ -0,0 +1,49 @@ +From 21973e113d4e2f6ad603184609f253af27fd1521 Mon Sep 17 00:00:00 2001 +From: Hans de Graaff +Date: Mon, 29 Apr 2019 18:41:35 +0200 +Subject: [PATCH] Rewrite unix fork reopen to be compatible with ruby 2.6 + +On ruby 2.6 the original code would fail specs: + +lib/childprocess/unix/fork_exec_process.rb:32:in `reopen': exclusive +access mode is not supported (ArgumentError) + +The documentation for reopen shows that it has two ways to call it: + + reopen(other_IO) -> ios + reopen(path, mode [,opt]) -> ios + +With ruby 2.4 and 2.5 calling reopen with a path and no mode seems to +work fine, but with ruby 2.6 this triggers the spec failure. + +This commit splits the calls based on stdout/stderr availability so +that both types of reopen calls can get the required parameters. This +fixes the 2.6 specs while being backward compatible with ruby 2.4 and +2.5. +--- + lib/childprocess/unix/fork_exec_process.rb | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/lib/childprocess/unix/fork_exec_process.rb b/lib/childprocess/unix/fork_exec_process.rb +index 5ed2a79..cc7a850 100644 +--- a/lib/childprocess/unix/fork_exec_process.rb ++++ b/lib/childprocess/unix/fork_exec_process.rb +@@ -29,8 +29,16 @@ def launch_process + exec_r.close + set_env + +- STDOUT.reopen(stdout || "/dev/null") +- STDERR.reopen(stderr || "/dev/null") ++ if stdout ++ STDOUT.reopen(stdout) ++ else ++ STDOUT.reopen("/dev/null", "a+") ++ end ++ if stderr ++ STDERR.reopen(stderr) ++ else ++ STDERR.reopen("/dev/null", "a+") ++ end + + if duplex? + STDIN.reopen(reader) diff --git a/rubygem-childprocess.spec b/rubygem-childprocess.spec index 5bd37df..341840f 100644 --- a/rubygem-childprocess.spec +++ b/rubygem-childprocess.spec @@ -1,16 +1,19 @@ %global gem_name childprocess - -Summary: A simple and reliable gem for controlling external programs Name: rubygem-%{gem_name} -Version: 0.5.9 -Release: 6%{?dist} +Version: 1.0.1 +Release: 1%{?dist} +Summary: A gem for controlling external programs running in the background License: MIT -URL: http://github.com/jarib/childprocess -Source0: http://rubygems.org/gems/%{gem_name}-%{version}.gem +URL: http://github.com/enkessler/childprocess +Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem +# Fix Ruby 2.6 compatibility. +# https://github.com/enkessler/childprocess/pull/149 +Patch0: rubygem-childprocess-1.0.1-Rewrite-unix-fork-reopen-to-be-compatible-with-ruby-2.6.patch +BuildRequires: ruby(release) BuildRequires: rubygems-devel +BuildRequires: rubygem(ffi) BuildRequires: rubygem(rspec) >= 3 -#BuildRequires: rubygem(coveralls) BuildArch: noarch %description @@ -24,50 +27,70 @@ Requires: %{name} = %{version}-%{release} BuildArch: noarch %description doc -Documentation for %{name} - +Documentation for %{name}. %prep -%setup -q -c -T -%gem_install -n %{SOURCE0} +%setup -q -n %{gem_name}-%{version} + +%patch0 -p1 + +# Disable windows specific installation of FFI gem. +sed -i "/extensions/ s/^/#/" ../%{gem_name}-%{version}.gemspec +%gemspec_remove_file "ext/mkrf_conf.rb" %build +# Create the gem as gem install only works on a gem file +gem build ../%{gem_name}-%{version}.gemspec + +# %%gem_install compiles any C extensions and installs the gem into ./%%gem_dir +# by default, so that we can move it into the buildroot in %%install +%gem_install %install mkdir -p %{buildroot}%{gem_dir} -cp -a .%{gem_dir}/* %{buildroot}%{gem_dir}/ -rm -f %{buildroot}%{gem_instdir}/.document %{buildroot}%{gem_instdir}/.gitignore -rm -f %{buildroot}%{gem_instdir}/.rspec %{buildroot}%{gem_instdir}/Rakefile -rm -f %{buildroot}%{gem_instdir}/.travis.yml -rm -f %{buildroot}%{gem_instdir}/childprocess.gemspec -rm -f %{buildroot}%{gem_instdir}/Gemfile -chmod 644 %{buildroot}%{gem_libdir}/childprocess/jruby/process.rb -chmod 644 %{buildroot}%{gem_libdir}/childprocess/windows/process.rb -chmod 644 %{buildroot}%{gem_instdir}/spec/*.rb +cp -a .%{gem_dir}/* \ + %{buildroot}%{gem_dir}/ %check pushd .%{gem_instdir} -# Get rid of coverall dependency -sed -i -e '5,6d' spec/spec_helper.rb -rspec spec -popd +# We don't care about code coverage. +sed -i '/[cC]overalls/ s/^/#/' spec/spec_helper.rb + +# Disable validity of .gemspec check, since it requires Git and it is not super +# important. +sed -i "/gemspec.validate/ s/^/#/" spec/childprocess_spec.rb +# We need Unicode support to pass "ChildProcess allows unicode characters +# in the environment" test case. +LC_ALL=C.UTF-8 RUBYOPT=-Ilib rspec spec + +# Test also posix_spawn, which requires FFI. +CHILDPROCESS_POSIX_SPAWN=true LC_ALL=C.UTF-8 RUBYOPT=-Ilib rspec spec +popd %files -%doc %{gem_instdir}/LICENSE -%{gem_libdir} %dir %{gem_instdir} +%exclude %{gem_instdir}/.* +%license %{gem_instdir}/LICENSE +%{gem_libdir} %{gem_cache} %{gem_spec} %files doc +%doc %{gem_docdir} +%doc %{gem_instdir}/CHANGELOG.md +%{gem_instdir}/Gemfile %doc %{gem_instdir}/README.md +%{gem_instdir}/Rakefile +%{gem_instdir}/appveyor.yml +%{gem_instdir}/childprocess.gemspec %{gem_instdir}/spec -%doc %doc %{gem_docdir} - %changelog +* Wed Jun 05 2019 Vít Ondruch - 1.0.1-1 +- Update to childprocess 1.0.1. + * Sat Feb 02 2019 Fedora Release Engineering - 0.5.9-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild diff --git a/sources b/sources index 7042981..ab31c8f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (childprocess-0.5.9.gem) = 5a671e59d19531347438dc149d5309218c7e439cfd0bfcfe201ae8e1099a2608a0170f9a3f3752fb709afc6b68fa3a10dc60d0632af545a9ba71483c7be2c21d +SHA512 (childprocess-1.0.1.gem) = efe61096dd09f6278582763692104fcc3beacfc96065372afdee355b68ef6ed498baf855f911d2a0b3a186d978d6d737519ae189064293af2d756a7356dad30d