Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 643922 - dev-ruby/netrc update ruby versions
Summary: dev-ruby/netrc update ruby versions
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Ruby Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-01-08 18:37 UTC by OzTiram
Modified: 2018-03-02 10:18 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description OzTiram 2018-01-08 18:37:44 UTC
Description : The package ebuild includes old ruby versions,
these (ruby20, ruby21) are no longer found in Gentoo.

Also ruby24 is missing.
Comment 1 Hans de Graaff gentoo-dev Security 2018-01-10 07:30:10 UTC
(In reply to OzTiram from comment #0)
> Description : The package ebuild includes old ruby versions,
> these (ruby20, ruby21) are no longer found in Gentoo.

There is no need to file pull requests for these. Leaving the old targets in the ebuild is harmless and in general we clean them up as we go, e.g. on version bumps.

> Also ruby24 is missing.

Did you run tests with ruby24? If so please append the test run. Passing tests is mandatory before we can add new ruby targets. In this case I see a test failure for ruby24.
Comment 2 OzTiram 2018-01-10 12:23:10 UTC
I ran the tests, and indeed the tests are failing.

The following patch is an attempt to fix the tests, but I could not get it to apply within the ebuild:

--- test_netrc.rb	2018-01-10 12:30:22.912427744 +0100
+++ test_netrc.rb	2018-01-10 12:30:17.384427516 +0100
@@ -166,7 +166,7 @@
 
   def test_get_missing
     n = Netrc.read("data/sample.netrc")
-    assert_equal(nil, n["x"])
+    assert_nil(n["x"])
   end
 
   def test_save
@@ -199,8 +199,8 @@
 
   def test_missing_environment
     nil_home = nil
-    ENV["HOME"], nil_home = nil_home, ENV["HOME"]
-    assert_equal File.join(Dir.pwd, '.netrc'), Netrc.default_path
+    ENV["NETRC"], nil_home = nil_home, ENV["HOME"]
+    assert_equal File.join(ENV["HOME"], '.netrc'), Netrc.default_path
   ensure
     ENV["HOME"], nil_home = nil_home, ENV["HOME"]
   end
Comment 3 OzTiram 2018-01-10 14:02:04 UTC
I could apply the patch with a series of sed commands, as already done in the ebuild. Here is the test output:

#  USE="ruby_targets_ruby24 ruby_targets_ruby22 ruby_targets_ruby23"  FEATURES="test" emerge -1 =dev-ruby/netrc-0.11.0-r1
Calculating dependencies... done!

>>> Verifying ebuild manifests

>>> Emerging (1 of 1) dev-ruby/netrc-0.11.0-r1::local
 * netrc-0.11.0.gem SHA256 SHA512 WHIRLPOOL size ;-) ...                                                                                             [ ok ]
>>> Unpacking source...
 * Running unpack phase for all ...
 * Unpacking .gem file... ...                                                                                                                        [ ok ]
 * Uncompressing metadata ...                                                                                                                        [ ok ]
 * Unpacking data.tar.gz ...                                                                                                                         [ ok ]
>>> Source unpacked in /var/tmp/portage/dev-ruby/netrc-0.11.0-r1/work
>>> Preparing source in /var/tmp/portage/dev-ruby/netrc-0.11.0-r1/work ...
 * Running prepare phase for all ...
 * Running source copy phase for ruby22 ...
 * Running source copy phase for ruby23 ...
 * Running source copy phase for ruby24 ...
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/dev-ruby/netrc-0.11.0-r1/work ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/dev-ruby/netrc-0.11.0-r1/work ...
 * Running compile phase for all ...
>>> Source compiled.
>>> Test phase: dev-ruby/netrc-0.11.0-r1
 * Running test phase for ruby22 ...
Run options: --seed 784

# Running:

.........................................

Finished in 0.014445s, 2838.3249 runs/s, 4084.4187 assertions/s.

41 runs, 59 assertions, 0 failures, 0 errors, 0 skips
 * Running test phase for ruby23 ...
Run options: --seed 41771

# Running:

.........................................

Finished in 0.013103s, 3128.9477 runs/s, 4502.6320 assertions/s.

41 runs, 59 assertions, 0 failures, 0 errors, 0 skips
 * Running test phase for ruby24 ...
Run options: --seed 61483

# Running:

.........................................

Finished in 0.013335s, 3074.6203 runs/s, 4424.4536 assertions/s.

41 runs, 59 assertions, 0 failures, 0 errors, 0 skips
>>> Completed testing dev-ruby/netrc-0.11.0-r1

>>> Install netrc-0.11.0-r1 into /var/tmp/portage/dev-ruby/netrc-0.11.0-r1/image/ category dev-ruby
 * Running install phase for ruby22 ...
 * Running install phase for ruby23 ...
 * Running install phase for ruby24 ...
 * Running install phase for all ...
 * Running check install phase for ruby22 ...
 * Running check install phase for ruby23 ...
 * Running check install phase for ruby24 ...
>>> Completed installing netrc-0.11.0-r1 into /var/tmp/portage/dev-ruby/netrc-0.11.0-r1/image/

 * Final size of build directory: 172 KiB
 * Final size of installed tree:  136 KiB

ecompressdir: bzip2 -9 /usr/share/doc
>>> Done.

>>> Installing (1 of 1) dev-ruby/netrc-0.11.0-r1::local
>>> Auto-cleaning packages...

>>> No outdated packages were found on your system.

 * GNU info directory index is up-to-date.
Comment 4 OzTiram 2018-01-10 14:09:48 UTC
The updated ebuild is found in the PR.
Comment 5 Hans de Graaff gentoo-dev Security 2018-01-20 07:05:52 UTC
(In reply to OzTiram from comment #2)
> I ran the tests, and indeed the tests are failing.
> 
> The following patch is an attempt to fix the tests, but I could not get it
> to apply within the ebuild:

What did you try and how did this not work?


> --- test_netrc.rb	2018-01-10 12:30:22.912427744 +0100
> +++ test_netrc.rb	2018-01-10 12:30:17.384427516 +0100
> @@ -166,7 +166,7 @@
>  
>    def test_get_missing
>      n = Netrc.read("data/sample.netrc")
> -    assert_equal(nil, n["x"])
> +    assert_nil(n["x"])
>    end

This looks fine and could be reported upstream.


>    def test_missing_environment
>      nil_home = nil
> -    ENV["HOME"], nil_home = nil_home, ENV["HOME"]
> -    assert_equal File.join(Dir.pwd, '.netrc'), Netrc.default_path
> +    ENV["NETRC"], nil_home = nil_home, ENV["HOME"]
> +    assert_equal File.join(ENV["HOME"], '.netrc'), Netrc.default_path
>    ensure
>      ENV["HOME"], nil_home = nil_home, ENV["HOME"]
>    end

This does not look correct to me. The point of the test seems to be to reset HOME and validate the default_path. Subsituting NETRC makes this test a no-op. Can you explain why you believe this is the right fix?
Comment 6 OzTiram 2018-01-20 17:54:41 UTC
> This does not look correct to me. The point of the test seems to be to reset
> HOME and validate the default_path. Subsituting NETRC makes this test a no-op.
> Can you explain why you believe this is the right fix?

Honestly speaking, it seemed right, but I am not much of a good ruby programmer.
Comment 7 Hans de Graaff gentoo-dev Security 2018-03-02 10:17:07 UTC
(In reply to OzTiram from comment #6)
> > This does not look correct to me. The point of the test seems to be to reset
> > HOME and validate the default_path. Subsituting NETRC makes this test a no-op.
> > Can you explain why you believe this is the right fix?
> 
> Honestly speaking, it seemed right, but I am not much of a good ruby
> programmer.

I finally had the time to look at this in more detail. It turns out that the test is broken because it does not test the netrc code, but rather internal ruby code. That implementation changed slightly in ruby24, leading to the failure. The test creates a situation that is never triggered in the netrc code.

Specifically Netrc.home_path will always call Dir.home which already handles ENV['HOME'] but in a different way than the test expects.
Comment 8 Larry the Git Cow gentoo-dev 2018-03-02 10:18:50 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d07df5c7fe5f0efaed259fdbb5d5b0ceffd76713

commit d07df5c7fe5f0efaed259fdbb5d5b0ceffd76713
Author:     Hans de Graaff <graaff@gentoo.org>
AuthorDate: 2018-03-02 10:17:32 +0000
Commit:     Hans de Graaff <graaff@gentoo.org>
CommitDate: 2018-03-02 10:18:40 +0000

    dev-ruby/netrc: add ruby24, ruby25
    
    Closes: https://bugs.gentoo.org/643922
    Package-Manager: Portage-2.3.19, Repoman-2.3.6

 dev-ruby/netrc/netrc-0.11.0.ebuild | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)