Opened 12 years ago

Closed 12 years ago

#37808 closed enhancement (wontfix)

RFE: Add a "minor" variable to the perl portgroup

Reported by: cooljeanius (Eric Gallager) Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 2.1.2
Keywords: Cc:
Port:

Description

So that in a portfile, I can use something like this:

${perl5.major.minor}

to get an output of something like this:

5.12.4

Change History (6)

comment:1 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

The portgroup cannot know the actual version number of perl, since perl might not be installed yet at the time that the portgroup is being included into a portfile.

What is the use case for which you need to know this?

comment:2 in reply to:  1 Changed 12 years ago by cooljeanius (Eric Gallager)

Replying to ryandesign@…:

The portgroup cannot know the actual version number of perl, since perl might not be installed yet at the time that the portgroup is being included into a portfile.

What is the use case for which you need to know this?

Well this might just be me being bad/new at writing portfiles, but I was trying to write a portfile for cpan2port, and for some reason it gave me the following error during the destroot phase:

    Error: org.macports.destroot for port p5.12-cpan2port returned: /opt/local/var/macports/build/_opt_local_var_macports_sources_local_perl_p5-cpan2port/p5.12-cpan2port/work/destroot/opt/local/lib/perl5/vendor_perl/5.12.4: no such file or directory

Now I didn't know why it was trying to do that, as I never asked it to make such a directory (I'm assuming the perl portgroup did?), but anyway, I tried to get around it by adding the following line of code:

    xinstall -d ${destroot}${prefix}/lib/perl5/vendor_perl/${perl5.major.minor}

And of course that errorred out because "minor" isn't actually a thing. idk, maybe I shouldn't even be using the perl portgroup at all for this port, but still, I think it'd be useful to have a "minor" variable anyway regardless of this use case. I can understand if it's not feasible though. Although then again, one thing I'm wondering, is why is the value of the variable being determined at include time? Couldn't it be determined at runtime? I don't really know that much about Tcl or MacPorts's internals, so forgive me if that's a stupid question...

comment:3 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

I can't explain right now why that problem is happening to you with your cpan2port port, but I have a feeling the solution isn't just to create that directory.

Note that the period is not a special character in variable names. So we have a variable called "perl5.major" and you're asking to create variable called "perl5.major.minor" (not just "minor").

If there is to be a port for cpan2port (which is a good idea) it should just be called cpan2port. We do not need versions of cpan2port for each perl version, because cpan2port is not a perl module; it's just a program that happens to use perl.

I glanced at the cpan2port script for a few seconds and didn't immediately see a reason why it would need to use the perl5 portgroup to be installed. Am I missing something?

comment:4 in reply to:  3 Changed 12 years ago by cooljeanius (Eric Gallager)

Replying to ryandesign@…:

I can't explain right now why that problem is happening to you with your cpan2port port, but I have a feeling the solution isn't just to create that directory.

Note that the period is not a special character in variable names. So we have a variable called "perl5.major" and you're asking to create variable called "perl5.major.minor" (not just "minor").

Oh, I didn't realize that. I thought something C#-like was going on...

If there is to be a port for cpan2port (which is a good idea) it should just be called cpan2port. We do not need versions of cpan2port for each perl version, because cpan2port is not a perl module; it's just a program that happens to use perl.

I glanced at the cpan2port script for a few seconds and didn't immediately see a reason why it would need to use the perl5 portgroup to be installed. Am I missing something?

No, it probably doesn't need the perl5 portgroup... I originally was going to try to do it without, but no one on irc had any ideas of a perl port that doesn't use the perl5 portgroup that I could use as an example to work from, so instead I just used portfile-gen with the -g perl5 flag set to give me a starting spot, as that seemed easier at the time...

comment:5 Changed 12 years ago by cooljeanius (Eric Gallager)

Anyway we can move the discussion for a cpan2port port to ticket #37823 now, as I now have a working portfile for it that doesn't use the perl5 portgroup after all.

comment:6 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: wontfix
Status: newclosed

Ok. Let's call this "wontfix".

Note: See TracTickets for help on using tickets.