Opened 8 years ago

Closed 8 years ago

#52600 closed enhancement (fixed)

swig-ruby needs to use current ruby23 port as dependency

Reported by: mouse07410 (Mouse) Owned by: michaelld (Michael Dickens)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: swig-ruby

Description

swig-ruby requires ruby-1.8.7 instead of being able to use the current ruby-2.3 port.

The Ruby level should either be the currently available version (2.3 for now), or an installation parameter.

Attachments (4)

trac.macports-revoked.png (123.8 KB) - added by mouse07410 (Mouse) 8 years ago.
Chrome screenshot showing CERT_REVOKED error
macports-cert.png (45.7 KB) - added by mouse07410 (Mouse) 8 years ago.
macports.org certificate, as shown by Chrome (invalid issuer)
issuer-cert.png (45.8 KB) - added by mouse07410 (Mouse) 8 years ago.
Issuer certificate (ERR_CERT_REVOKED)
swig_ruby_XY.diff (3.3 KB) - added by michaelld (Michael Dickens) 8 years ago.

Download all attachments as: .zip

Change History (24)

comment:1 Changed 8 years ago by mf2k (Frank Schima)

Cc: michaelld@… removed
Owner: changed from macports-tickets@… to michaelld@…
Type: defectenhancement
Version: 2.3.4

comment:2 Changed 8 years ago by michaelld (Michael Dickens)

Does swig-ruby work with both ruby (1.8) and ruby23 (2.3)? I don't use either ruby or swig-ruby.

I'm hoping we can make this dependency change something like "path:bin/ruby:ruby" ... stick with the "ruby" port unless some other rubyXY port is already installed.

After installing ruby and ruby23, I don't see a common file. Thus, we'll need to move to the +rubyXY variants, like what swig-php has. Do you know enough about Portfile editing to create such a patch & verify that it works as expected? As I said, I don't use ruby.

comment:3 Changed 8 years ago by mouse07410 (Mouse)

Does swig-ruby work with both ruby (1.8) and ruby23 (2.3)?

It should.

I'm hoping we can make this dependency change something like "path:bin/ruby:ruby" ... stick with the "ruby" port unless some other rubyXY port is already installed.

This sounds like the right approach, IMHO.

After installing ruby and ruby23, I don't see a common file

Not sure what you mean. Installing ruby or ruby23, you get /opt/local/bin/ruby (the main interpreter), and bunch of libraries and supporting files. I don't think you can install them both at the same time.

Thus, we'll need to move to the +rubyXY variants, like what swig-php has

I don't know if we need to go that way - but if we do, I see no problem. It's easy enough on the user.

Do you know enough about Portfile editing to create such a patch & verify that it works as expected?

I can't claim this knowledge, but let me take a look...

comment:4 Changed 8 years ago by michaelld (Michael Dickens)

$prefix/bin/ruby is provide by ruby_select. I have both ruby and ruby23 installed right now; they do not overlap in files. There is no common library or the like that I can find (port contents ruby).

comment:5 Changed 8 years ago by mouse07410 (Mouse)

$prefix/bin/ruby is provide by ruby_select. I have both ruby and ruby23 installed right now; they do not overlap in files

Well, so much the better.

Changed 8 years ago by mouse07410 (Mouse)

Attachment: trac.macports-revoked.png added

Chrome screenshot showing CERT_REVOKED error

comment:6 Changed 8 years ago by michaelld (Michael Dickens)

For the REVOKED issue, see also: https://apple.stackexchange.com/questions/257080/how-to-tell-why-macos-thinks-that-a-certificate-is-revoked/257112#257112 . The "DELETE FROM" works for me.

We can't rely on ruby_select to set $prefix/bin/ruby. So that's out. I think the only way is to do this like PHP does it.

Changed 8 years ago by mouse07410 (Mouse)

Attachment: macports-cert.png added

macports.org certificate, as shown by Chrome (invalid issuer)

Changed 8 years ago by mouse07410 (Mouse)

Attachment: issuer-cert.png added

Issuer certificate (ERR_CERT_REVOKED)

comment:7 Changed 8 years ago by mouse07410 (Mouse)

My apologies for cluttering this issue - and thank you for restoring my ability to access trac.macports.org from Safari!!

comment:8 Changed 8 years ago by michaelld (Michael Dickens)

NP. Let's figure out how to do the variants. Seems like the way to go.

Changed 8 years ago by michaelld (Michael Dickens)

Attachment: swig_ruby_XY.diff added

comment:9 Changed 8 years ago by michaelld (Michael Dickens)

I just attached my effort to add +rubyXY variants to swig. Should work, I think. Can you give it a go & see if it works for you?

comment:10 Changed 8 years ago by mouse07410 (Mouse)

Can you give it a go & see if it works for you?

I would love to - but the current swig-ruby port does not seem to have Variants, meaning it does not show/support "+whatever" options...?

$ port info swig-ruby
swig-ruby @3.0.10 (devel)
Variants:             universal

Description:          SWIG is a software development tool that connects programs written in C and C++ with a variety of high-level
                      programming languages. This is the Ruby binding.
Homepage:             http://www.swig.org/

Build Dependencies:   bison, gsed
Library Dependencies: ruby, swig
Platforms:            darwin
License:              GPL-3+ Permissive
Maintainers:          michaelld@macports.org, openmaintainer@macports.org
$ port info swig-php
swig-php @3.0.10 (devel)
Variants:             php52, php53, php54, [+]php55, php56, universal

Description:          SWIG is a software development tool that connects programs written in C and C++ with a variety of high-level
                      programming languages. This is the PHP 5 binding.
Homepage:             http://www.swig.org/

Build Dependencies:   bison, gsed
Library Dependencies: php55, swig
Platforms:            darwin
License:              GPL-3+ Permissive
Maintainers:          michaelld@macports.org, openmaintainer@macports.org
$ 

comment:11 Changed 8 years ago by michaelld (Michael Dickens)

You need to locally patch you MacPorts install to see the variants. let's assume you download the patch to ~/Downloads/swig_ruby_XY.diff; then, you could do:

pushd $(port dir swig)
sudo patch -p0 < ~/Downloads/swig_ruby_XY.diff​
sudo port selfupdate

and, then you should see the variants in place. After testing, you'll want to remove the patch:

pushd $(port dir swig)
sudo patch -R -p0 < ~/Downloads/swig_ruby_XY.diff​

comment:12 Changed 8 years ago by mouse07410 (Mouse)

But does it mean that I have to install the "improper" port (swig-ruby) that downloads the Ruby version that I don't need first? Or having swig-3.0.10 installed is all that's necessary to try your recommendation?

comment:13 Changed 8 years ago by michaelld (Michael Dickens)

No, you get the choice of what to install. I added variants for all of the provided versions of Ruby (1.8.6, 1.8.7, 1.9, 2.0, 2.1, 2.2, 2.3). I think the 1.8.6 port is broken (meaning it does not conform to what ruby_select requires), but the rest seem to be OK. I think I got all the pieces in place correctly for everything to work. I'm just hoping that someone interested can test it out & verify that it works.

comment:14 Changed 8 years ago by mouse07410 (Mouse)

I confess that I don't quite know what I'm doing here. But the above does not seem to work, or is missing some important steps:

$ pushd $(port dir swig)
/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/devel/swig ~
$ sudo patch -p0 < ~/Downloads/swig_ruby_XY.diff 
Password: 
patching file Portfile
$ sudo port selfupdate
--->  Updating MacPorts base sources using rsync
MacPorts base version 2.3.4 installed,
MacPorts base version 2.3.4 downloaded.
--->  Updating the ports tree
--->  MacPorts base is already the latest version

The ports tree has been updated. To upgrade your installed ports, you should run
  port upgrade outdated
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
$ port info swig-ruby
error getting working directory name: no such file or directory
    while executing
"pwd"
    invoked from within
"set current_portdir [pwd]"
    (file "/opt/local/bin/port" line 5260)
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
$ 

comment:15 Changed 8 years ago by mouse07410 (Mouse)

Oh, and

$ port info swig-ruby
swig-ruby @3.0.10 (devel)
Variants:             universal

Description:          SWIG is a software development tool that connects programs written in
                      C and C++ with a variety of high-level programming languages. This is
                      the Ruby binding.
Homepage:             http://www.swig.org/

Build Dependencies:   bison, gsed
Library Dependencies: ruby, swig
Platforms:            darwin
License:              GPL-3+ Permissive
Maintainers:          michaelld@macports.org, openmaintainer@macports.org
$

No variants.

Perhaps it would be better if you just bite the bullet and apply this patch? More likely than not, it would work.

Also, I wonder why checking for a specific version of ruby rather than just making sure that $prefix/bin/ruby is there?

comment:16 Changed 8 years ago by mouse07410 (Mouse)

Sorry, please ignore the above:

$ popd
~
$ pushd $(port dir swig)
/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/devel/swig ~
$ sudo patch -R -p0 < ~/Downloads/swig_ruby_XY.diff 
Password:
patching file Portfile
Unreversed patch detected!  Ignore -R? [n] y
$ port info swig-ruby
swig-ruby @3.0.10_1 (devel)
Variants:             ruby186, [+]ruby187, ruby19, ruby20, ruby21, ruby22, ruby23, universal

Description:          SWIG is a software development tool that connects programs written in
                      C and C++ with a variety of high-level programming languages. This is
                      the Ruby binding.
Homepage:             http://www.swig.org/

Build Dependencies:   bison, gsed
Library Dependencies: ruby, swig
Platforms:            darwin
License:              GPL-3+ Permissive
Maintainers:          michaelld@macports.org, openmaintainer@macports.org
$ sudo port install swig-ruby +ruby23
Portfile changed since last build; discarding previous state.
--->  Computing dependencies for swig-ruby
--->  Fetching archive for swig-ruby
--->  Attempting to fetch swig-ruby-3.0.10_1+ruby23.darwin_16.x86_64.tbz2 from https://packages.macports.org/swig-ruby
--->  Attempting to fetch swig-ruby-3.0.10_1+ruby23.darwin_16.x86_64.tbz2 from http://lil.fr.packages.macports.org/swig-ruby
--->  Attempting to fetch swig-ruby-3.0.10_1+ruby23.darwin_16.x86_64.tbz2 from http://mse.uk.packages.macports.org/sites/packages.macports.org/swig-ruby
--->  Fetching distfiles for swig-ruby
--->  Verifying checksums for swig-ruby
--->  Extracting swig-ruby
--->  Configuring swig-ruby
--->  Building swig-ruby
--->  Staging swig-ruby into destroot
--->  Installing swig-ruby @3.0.10_1+ruby23
--->  Activating swig-ruby @3.0.10_1+ruby23
--->  Cleaning swig-ruby
--->  Updating database of binaries
--->  Scanning binaries for linking errors               
--->  No broken files found.                             
$

comment:17 Changed 8 years ago by mouse07410 (Mouse)

At what point should I reverse that patch, and for what purpose?

comment:18 Changed 8 years ago by michaelld (Michael Dickens)

Great. Looks like it's working for you, too. I'll submit soonish.

You want to remove the patch before updating, once the change is committed. Just makes updating easier / more reliable. If you don't, port should tell you its found an oddity & ask you what to do. Reversing the patch avoids this situation if done correctly.

comment:19 Changed 8 years ago by mouse07410 (Mouse)

Understood, thank you! Standing by to hear that you updated the port, so I can reverse the patch and install a "normal" port. ;)

Thanks again!

comment:20 Changed 8 years ago by michaelld (Michael Dickens)

Resolution: fixed
Status: newclosed

Done in r153959.

Note: See TracTickets for help on using tickets.