diff options
Diffstat (limited to 'dev-ruby/net-scp')
9 files changed, 268 insertions, 0 deletions
diff --git a/dev-ruby/net-scp/Manifest b/dev-ruby/net-scp/Manifest index 927f199a393a..abb5158645ce 100644 --- a/dev-ruby/net-scp/Manifest +++ b/dev-ruby/net-scp/Manifest @@ -1,5 +1,13 @@ +AUX net-scp-1.2.1-fix-common.path 674 BLAKE2B c3ae5c5b5773855ad0fb20211cec90399e065be5dc6741b948304cd4d19a4ed70bd59bc3723cc82ea1455e18440eaeebbbe368939a39cc96075c517162878921 SHA512 4f1c3e747ff7e9cb9777706989e5e1dd9fca9a9326ff3a586356e8b8227c6d72e636f07e7ecabd483d01e7cbb215d2d3feebcecff8904aeee5643eff26739692 +AUX net-scp-1.2.1-fix-download_test.patch 621 BLAKE2B dc6604f8586948f27fce437a0d88a27e361fced5590c08ad49200ac96549688c43b5deedfc3be26433dac77a883cc0d1fa5b0f9182c6e344c54deb996cf222b3 SHA512 9f43d8f26053017c498f5927b00611a1aa45b892eca199bb964e1473e119591a97b325628e5904a92b25c2d433da105a00b7ba18aebaa96e471610ecb4f99ea9 +AUX net-scp-1.2.1-fix-download_test_2.patch 997 BLAKE2B 46d00f3fcd5b8ceb7f6925d0af5ea9e09ecdf83bc8f73626e7933a16ea2fa89e9a190b85e912a2bfa58f7a10dcb17f73bc19f568a3ce330036b703a37387fa68 SHA512 4540f52db9dfd2e549b7f98f7f3bbfeabde448fcdde4a801c16ad0e07e82f8e49acb0e753f8e43909487347d359047d91f1f8f963fe94ae20e929e2770e29d8f +AUX net-scp-1.2.1-fix-download_test_3.patch 559 BLAKE2B 94ac112439548e66a9d1cb2a5ea6e83184aa298510d7022823e828317069faadabc74cdd80e684869b4ad2ad628fd97b43cb7e521dc5e15331a80632a6f93641 SHA512 a5de2e35c73cbfe3204c3ed1d1148fe124da8115a9662d3a942433001202cc5ba35f215090b3bc77dab7871aa0a0244e8a41727fa6237eb462b233ffc56ac70c +AUX net-scp-1.2.1-fix-upload_tests.patch 562 BLAKE2B d6f6aaad4dca5c54158219f1a36bd20b5225280c36b90095b6f7d37ecf789465fd348c4a96bc8f5e298f40f4fcaacf224b0d680a62eed901101976293947a24c SHA512 9cbdafe10d985e7fec3368e344df526e51179db8fe24e172d367fe506de8c733c05fee8ca90e9d6d9d91b900fb056cc245146a4b4e7eaa8ad5021db6992994bd +AUX net-scp-1.2.1-raise-correct-errors-net-ssh-4.0-compat.patch 1230 BLAKE2B 52d3657f71b06a5561e44e8d408127fefc83bf1e05097f835522719bdab0bec1139fa3332fa55d23d386ae4528318f8cded62222a8ddf39dfe216369e510839c SHA512 45b93d1a197776ee6afde01292e9b87d24d66685a72fc5311fbd504ca429f0cfb14fb9fc1f21dd9092024de17e78e26d71e8928448bdeed279eba14393949c26 +AUX net-scp-1.2.1-raise-correct-errors.patch 3046 BLAKE2B aa0e36edfdc85c944d3ba34d351abe93a7ade694e81240c47956b5767ac6491b954755ea05de27dfaaefa7ea1d628c632aeaaef6061f8017e9b2c114d923382b SHA512 0ff40b546aff5d0bec7245325d5e076de06f719512e51aadfd2f3b66f727c97164629e37b85fc0073eb7134cee3de43b4a0287e965012758c5fd997eebf9ec6e DIST net-scp-1.1.2.gem 32256 BLAKE2B f855903ce626b370d9fedd9bf7ec4a39898fd2188b09b7dd7d537c92ec21e5f2ff25cfa06af934fecf9aa99e95924d8c3ba9acc8aacf87fe07a1f37a372f862b SHA512 5ba49a994a816b54aee32b5c3e708bed69fc22d7e688f60e93a1e2d29d086ed17f3685ea819d5db23a27abf8ba64fbd418204e1a1702fb0d2702607016febc09 DIST net-scp-1.2.1.gem 32768 BLAKE2B 67abf0b66aa6e8f28bdfa314a20f594eedafc5aeaf5d0ae8884cb7e27203699a791623968da98aaebda1630d47bf5859cc3e38875fe17dc8c7ce7926b50848a5 SHA512 64645a4517d6e408e3acfdb24576c8ded3b6ff981035ca10a2e081f9e3ab093f97b4848da4acca03ade364483766677e31296d09a31db4c81eb40123fc966829 EBUILD net-scp-1.1.2-r1.ebuild 713 BLAKE2B 773b45ca7b3693804b11aba0a7affc3d87af112d9520103dc867994e4cf42c5696ae816caaaef6f7a7fc7d0316d692f64c29ab04d69b1b652db6fe641ae1e811 SHA512 684a857564e9c34ccd91586b5824c3d123b7f259892af320f693eaa72dd7cf09a41cf16547fc0b3d64c7ddfa84315334dfa03dda50f26c0ce8af3f85ac4c3d18 +EBUILD net-scp-1.2.1-r1.ebuild 1055 BLAKE2B e7a05fb365c56bc2014312c568c6714511953fbcd204aef97070b7f6a6df6756afc09e474bafc489b1855d1dbc9dac8ce8f604a6d3475ce5a67fc12fa2127ec5 SHA512 920574dc5704aee182ea7dd4a10b2508a398fd647b5f5885db661f00c95817275cbd32d9384ef8f28916a34f68615d11440d9b1a188e8ba2319c72699b01ed07 EBUILD net-scp-1.2.1.ebuild 830 BLAKE2B fad9c860fad2167c37c90ea7bee052d02ef01190c7465b72e6cb30770f9a20aa921c56a3073795a1d130bd3e6d8a091bf62ac31c49b1702cc54b7fa89413b850 SHA512 ffa9c5defcabb146c710ad2b36e07926de1faf6c5cdc03c5534dfda36fe5f6f05dbe8e475551eb509ce30b05d57200cf989c778cad465c926387c40a7416576d MISC metadata.xml 341 BLAKE2B aec6f820a216a818e7f6a82ffe48f73a01cc662d9a5e10a5dee98885f564560644e377158ccd5c4cb6e914205fa5aa6753aaf5dcd52e1849437955553f3c268c SHA512 bbb71a6668f329ca9b1f5636aa71720a8234a7683fe374b2fde4113ff56d3a5c2242bcba7e3023090a7955870715e0040d990326942def6d3be7e31d5f07d39c diff --git a/dev-ruby/net-scp/files/net-scp-1.2.1-fix-common.path b/dev-ruby/net-scp/files/net-scp-1.2.1-fix-common.path new file mode 100644 index 000000000000..ee262d238cbf --- /dev/null +++ b/dev-ruby/net-scp/files/net-scp-1.2.1-fix-common.path @@ -0,0 +1,28 @@ +--- test/common.rb 2018-01-21 16:23:07.384173147 +0100 ++++ test/common.rb 2018-01-21 16:20:34.084172782 +0100 +@@ -1,11 +1,11 @@ + require 'test/unit' + require 'mocha/setup' + +-begin +- gem 'net-ssh', ">= 2.0.0" +- require 'net/ssh' +-rescue LoadError +- $LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../../net-ssh/lib" ++#begin ++# #gem 'net-ssh', ">= 2.0.0" ++# require 'net/ssh' ++#rescue LoadError ++# $LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../../net-ssh/lib" + + begin + require 'net/ssh' +@@ -14,7 +14,7 @@ + rescue LoadError => e + abort "could not load net/ssh v2 (#{e.inspect})" + end +-end ++#end + + $LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib" + diff --git a/dev-ruby/net-scp/files/net-scp-1.2.1-fix-download_test.patch b/dev-ruby/net-scp/files/net-scp-1.2.1-fix-download_test.patch new file mode 100644 index 000000000000..a138fcdb5573 --- /dev/null +++ b/dev-ruby/net-scp/files/net-scp-1.2.1-fix-download_test.patch @@ -0,0 +1,21 @@ +--- test/test_download.rb 2018-01-22 02:08:00.000013728 +0100 ++++ test/test_download.rb.1 2018-01-22 02:11:49.820014276 +0100 +@@ -70,12 +70,12 @@ + end + + error = nil +- assert_scripted do +- begin +- scp.download!("/path/to/remote.txt") +- rescue +- error = $! +- end ++ Net::SSH::Test::Extensions::IO.with_test_extension do ++ begin ++ scp.download!("/path/to/remote.txt") ++ rescue ++ error = $! ++ end + end + assert_equal Net::SCP::Error, error.class + assert_equal "SCP did not finish successfully (1): File not found: /path/to/remote.txt\n", error.message diff --git a/dev-ruby/net-scp/files/net-scp-1.2.1-fix-download_test_2.patch b/dev-ruby/net-scp/files/net-scp-1.2.1-fix-download_test_2.patch new file mode 100644 index 000000000000..55a8e5f16bcd --- /dev/null +++ b/dev-ruby/net-scp/files/net-scp-1.2.1-fix-download_test_2.patch @@ -0,0 +1,25 @@ +--- test/test_download.rb 2018-01-22 02:26:56.440016436 +0100 ++++ test/test_download.rb 2018-01-22 02:32:46.076017270 +0100 +@@ -116,7 +116,9 @@ + + def test_download_io_with_recursive_should_raise_error + expect_scp_session "-f -r /path/to/remote.txt" +- assert_raises(Net::SCP::Error) { scp.download!("/path/to/remote.txt", StringIO.new, :recursive => true) } ++ Net::SSH::Test::Extensions::IO.with_test_extension do ++ assert_raises(Net::SCP::Error) { scp.download!("/path/to/remote.txt", StringIO.new, :recursive => true) } ++ end + end + + def test_download_io_with_preserve_should_ignore_preserve +@@ -154,8 +156,9 @@ + channel.sends_ok + channel.gets_data "D0755 0 remote\n" + end +- +- assert_raises(Net::SCP::Error) { scp.download!("/path/to/remote") } ++ Net::SSH::Test::Extensions::IO.with_test_extension do ++ assert_raises(Net::SCP::Error) { scp.download!("/path/to/remote") } ++ end + end + + def test_download_should_raise_error_if_gets_not_ok diff --git a/dev-ruby/net-scp/files/net-scp-1.2.1-fix-download_test_3.patch b/dev-ruby/net-scp/files/net-scp-1.2.1-fix-download_test_3.patch new file mode 100644 index 000000000000..12df02c1f00e --- /dev/null +++ b/dev-ruby/net-scp/files/net-scp-1.2.1-fix-download_test_3.patch @@ -0,0 +1,15 @@ +--- test/test_download.rb 2018-01-22 02:35:45.200017696 +0100 ++++ test/test_download.rb.1 2018-01-22 02:38:40.000018113 +0100 +@@ -217,8 +217,10 @@ + channel.gets_data "E\n" + channel.sends_ok + end +- +- scp.download!("/path/to/remote", "/path/to/local", :recursive => true, :ssh => { :verbose => :debug }) ++ ++ Net::SSH::Test::Extensions::IO.with_test_extension do ++ scp.download!("/path/to/remote", "/path/to/local", :recursive => true, :ssh => { :verbose => :debug }) ++ end + assert_equal "a" * 1234, file.io.string + end + diff --git a/dev-ruby/net-scp/files/net-scp-1.2.1-fix-upload_tests.patch b/dev-ruby/net-scp/files/net-scp-1.2.1-fix-upload_tests.patch new file mode 100644 index 000000000000..73c34359afc2 --- /dev/null +++ b/dev-ruby/net-scp/files/net-scp-1.2.1-fix-upload_tests.patch @@ -0,0 +1,14 @@ +--- test/test_upload.rb 2018-01-22 08:15:30.996002204 +0100 ++++ test/test_upload.rb.1 2018-01-22 08:18:09.328002581 +0100 +@@ -155,8 +155,9 @@ + expect_scp_session("-t /path/to/remote") do |channel| + channel.gets_ok + end +- +- assert_raises(Net::SCP::Error) { scp.upload!("/path/to/local", "/path/to/remote") } ++ Net::SSH::Test::Extensions::IO.with_test_extension do ++ assert_raises(Net::SCP::Error) { scp.upload!("/path/to/local", "/path/to/remote") } ++ end + end + + def test_upload_empty_directory_should_create_directory_and_finish diff --git a/dev-ruby/net-scp/files/net-scp-1.2.1-raise-correct-errors-net-ssh-4.0-compat.patch b/dev-ruby/net-scp/files/net-scp-1.2.1-raise-correct-errors-net-ssh-4.0-compat.patch new file mode 100644 index 000000000000..3431f06b7cff --- /dev/null +++ b/dev-ruby/net-scp/files/net-scp-1.2.1-raise-correct-errors-net-ssh-4.0-compat.patch @@ -0,0 +1,30 @@ +--- test/test_download.rb 2018-01-22 01:47:38.932010818 +0100 ++++ test/test_download.rb.1 2018-01-22 01:49:14.552011046 +0100 +@@ -205,9 +205,11 @@ + channel.sends_ok + channel.gets_data "\1" + end +- +- e = assert_raises(Net::SCP::Error) { scp.download!("/path/to/remote.txt", "/path/to/local.txt") } +- assert_equal("\1", e.message) ++ ++ Net::SSH::Test::Extensions::IO.with_test_extension do ++ e = assert_raises(Net::SCP::Error) { scp.download!("/path/to/remote.txt", "/path/to/local.txt") } ++ assert_equal("\1", e.message) ++ end + end + + def test_download_directory_should_raise_error_if_local_exists_and_is_not_directory +@@ -223,8 +225,10 @@ + channel.sends_ok + end + +- e = assert_raises(Net::SCP::Error) { scp.download!("/path/to/remote", "/path/to/local", :recursive => true) } +- assert_match(/exists and is not a directory/, e.message) ++ Net::SSH::Test::Extensions::IO.with_test_extension do ++ e = assert_raises(Net::SCP::Error) { scp.download!("/path/to/remote", "/path/to/local", :recursive => true) } ++ assert_match(/exists and is not a directory/, e.message) ++ end + end + + def test_download_directory_should_create_directory_and_files_locally diff --git a/dev-ruby/net-scp/files/net-scp-1.2.1-raise-correct-errors.patch b/dev-ruby/net-scp/files/net-scp-1.2.1-raise-correct-errors.patch new file mode 100644 index 000000000000..a23164ef8185 --- /dev/null +++ b/dev-ruby/net-scp/files/net-scp-1.2.1-raise-correct-errors.patch @@ -0,0 +1,80 @@ +--- README.rdoc ++++ README.rdoc +@@ -42,7 +42,7 @@ In a nutshell: + data = Net::SCP::download!("remote.host.com", "username", "/remote/path") + + # use a persistent connection to transfer files +- Net::SCP.start("remote.host.com", "username", :ssh => { :password => "password" }) do |scp| ++ Net::SCP.start("remote.host.com", "username", :password => "password") do |scp| + # upload a file to a remote server + scp.upload! "/local/path", "/remote/path" + +--- lib/net/scp.rb ++++ lib/net/scp.rb +@@ -395,7 +395,7 @@ module Net + def await_response_state(channel) + return if channel[:buffer].available == 0 + c = channel[:buffer].read_byte +- raise "#{c.chr}#{channel[:buffer].read}" if c != 0 ++ raise Net::SCP::Error, "#{c.chr}#{channel[:buffer].read}" if c != 0 + channel[:next], channel[:state] = nil, channel[:next] + send("#{channel[:state]}_state", channel) + end +--- lib/net/scp/download.rb ++++ lib/net/scp/download.rb +@@ -129,7 +129,7 @@ module Net; class SCP + channel[:local] = File.join(channel[:local], directive[:name]) + + if File.exists?(channel[:local]) && !File.directory?(channel[:local]) +- raise "#{channel[:local]} already exists and is not a directory" ++ raise Net::SCP::Error, "#{channel[:local]} already exists and is not a directory" + elsif !File.exists?(channel[:local]) + Dir.mkdir(channel[:local], directive[:mode] | 0700) + end +@@ -162,4 +162,4 @@ module Net; class SCP + end + end + +-end; end +\ No newline at end of file ++end; end +--- test/test_download.rb ++++ test/test_download.rb +@@ -158,6 +158,37 @@ class TestDownload < Net::SCP::TestCase + assert_raises(Net::SCP::Error) { scp.download!("/path/to/remote") } + end + ++ def test_download_should_raise_error_if_gets_not_ok ++ prepare_file("/path/to/local.txt", "") ++ ++ expect_scp_session "-f /path/to/remote.txt" do |channel| ++ channel.sends_ok ++ channel.gets_data "C0666 0 remote.txt\n" ++ channel.sends_ok ++ channel.gets_data "\1" ++ end ++ ++ e = assert_raises(Net::SCP::Error) { scp.download!("/path/to/remote.txt", "/path/to/local.txt") } ++ assert_equal("\1", e.message) ++ end ++ ++ def test_download_directory_should_raise_error_if_local_exists_and_is_not_directory ++ File.stubs(:exists?).with("/path/to/local").returns(true) ++ File.stubs(:exists?).with("/path/to/local/remote").returns(true) ++ File.stubs(:directory?).with("/path/to/local/remote").returns(false) ++ ++ expect_scp_session "-f -r /path/to/remote" do |channel| ++ channel.sends_ok ++ channel.gets_data "D0755 0 remote\n" ++ channel.sends_ok ++ channel.gets_data "E\n" ++ channel.sends_ok ++ end ++ ++ e = assert_raises(Net::SCP::Error) { scp.download!("/path/to/remote", "/path/to/local", :recursive => true) } ++ assert_match(/exists and is not a directory/, e.message) ++ end ++ + def test_download_directory_should_create_directory_and_files_locally + file = nil + prepare_directory "/path/to/local" do |dir| diff --git a/dev-ruby/net-scp/net-scp-1.2.1-r1.ebuild b/dev-ruby/net-scp/net-scp-1.2.1-r1.ebuild new file mode 100644 index 000000000000..04ccb4f7412f --- /dev/null +++ b/dev-ruby/net-scp/net-scp-1.2.1-r1.ebuild @@ -0,0 +1,47 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=5 + +USE_RUBY="ruby22 ruby23 ruby24" + +RUBY_FAKEGEM_EXTRADOC="CHANGES.txt README.rdoc" + +RUBY_FAKEGEM_TASK_TEST="" + +inherit ruby-fakegem + +DESCRIPTION="A pure Ruby implementation of the SCP client protocol" +HOMEPAGE="https://github.com/net-ssh/net-scp" + +LICENSE="GPL-2" +SLOT="2" +KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris" +IUSE="" + +RUBY_PATCHES=( + ${P}-raise-correct-errors.patch + ${P}-fix-common.path + ${P}-fix-download_test.patch + ${P}-fix-download_test_2.patch + ${P}-fix-download_test_3.patch + ${P}-fix-upload_tests.patch + ${P}-raise-correct-errors-net-ssh-4.0-compat.patch + ) + +ruby_add_bdepend " + doc? ( >=dev-ruby/net-ssh-4.0:4 ) + test? ( + >=dev-ruby/net-ssh-4.0:4 + dev-ruby/mocha + )" + +ruby_add_rdepend ">=dev-ruby/net-ssh-4.0:4" + +all_ruby_prepare() { + sed -i -e 's/>= 2.0.0/~> 2.0/' test/common.rb || die +} + +each_ruby_test() { + ${RUBY} -Ilib:test test/test_all.rb || die +} |