Opened 6 years ago

Closed 5 years ago

#56635 closed defect (fixed)

nytprofhtml can't find scripts renamed by mp

Reported by: chrstphrchvz (Christopher Chavez) Owned by: chrstphrchvz (Christopher Chavez)
Priority: Normal Milestone:
Component: ports Version: 2.5.2
Keywords: Cc:
Port: p5-devel-nytprof

Description

nytprofhtml is hardcoded to look for scripts named nytprofcalls and flamegraph.pl:

my $nytprofcalls = File::Spec->catfile($Config{'bin'}, 'nytprofcalls');
$nytprofcalls    = which 'nytprofcalls' if not -e $nytprofcalls;
 
die "Unable to find nytprofcalls in $Config{bin} or on the PATH"
    unless $nytprofcalls;
 
my $flamegraph   = File::Spec->catfile($Config{'bin'}, 'flamegraph') . $script_ext;
$flamegraph      = which "flamegraph$script_ext" if not -e $flamegraph;
 
die "Unable to find flamegraph$script_ext in $Config{bin} or on the PATH"
    unless $flamegraph;

However MacPorts appends the Perl version (e.g. -5.26) to all of the scripts, so running nytprofhtml fails with the error:

Unable to find nytprofcalls in /opt/local/bin or on the PATH at /opt/local/bin/nytprofhtml-5.26 line 78.

Is this something the port should adjust, or is it potentially something the module itself should address?

Change History (5)

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

Cc: michael@… removed
Owner: set to michael@…
Status: newassigned

comment:2 Changed 6 years ago by chrstphrchvz (Christopher Chavez)

Is this something the port should adjust, or is it potentially something the module itself should address?

More specific ideas:

  • Use a _select port to specify a default. At least that's how something like this would be handled for end users being able to invoke binaries. But (1) it would have to enforce at least one version being selected somehow, and (2) I don't really think it's appropriate here since it opens up the possibility of running nytprofhtml-5.xx with nytprofcalls-5.yy and flamegraph.pl-5.zz.
  • Ask the developer to use modules from scripts instead of other scripts (under some vague notion that "scripts are for end-users, not other scripts in the same distribution"; I don't know that it's inherently bad for a CPAN distribution to use its own scripts nor that it's universally better that it use modules instead). That way when nytprofhtml wants to use nytprofcalls or flamegraph functionality, there's no confusion over names or versions; it gets the same nytprofcalls or flamegraph for the Perl version and distribution version it was installed with.

These are sort of the extremes. Maybe there's something more of a compromise to work out here, or some other MacPorts feature I'm not aware of.

comment:3 Changed 6 years ago by chrstphrchvz (Christopher Chavez)

Another idea: patch/reinplace the two lines with . "-p${perl5.major}" somehow. That might have fewer downsides.

comment:4 Changed 6 years ago by mf2k (Frank Schima)

Owner: michael@… deleted

See #56660

comment:5 Changed 5 years ago by chrstphrchvz (Christopher Chavez)

Owner: set to chrstphrchvz
Resolution: fixed
Status: assignedclosed

In 13e69e63aa404f9dce5b931f2614c714fec3c9f7/macports-ports (master):

p5-devel-nytprof: use MacPorts-installed scripts

Closes: #56635

Note: See TracTickets for help on using tickets.