Skip Menu |

This queue is for tickets about the Data-SExpression CPAN distribution.

Report information
The Basics
Id: 35047
Status: resolved
Priority: 0/
Queue: Data-SExpression

People
Owner: Nobody in particular
Requestors: ANDK [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.36
Fixed in: (no value)



Subject: [PATCH] Makefile.PL protability suggestion
In my environment the Makefile.PL fails because it doesn't find yapp although Parse::Yapp is installed. May I suggest to replace the requires_external_bin line and calculate the path to yapp manually? This ensures that the perl that builds the Module and the one that tests it are the same. And it helps to find our own yapp even if not in the path. I've left the fallback to the requires_external_bin line in in case we find no yapp in the expected directory. The configure_requires promises that the yapp already is there when Makefile.PL is executed because installers are bound to read the META.yml. What do you think? Here is the patch: --- Makefile.PL~ 2008-04-10 00:37:39.000000000 +0200 +++ Makefile.PL 2008-04-15 05:00:18.000000000 +0200 @@ -1,19 +1,27 @@ use inc::Module::Install; +use Config; +use File::Spec; + name('Data-SExpression'); license('Perl'); version_from('lib/Data/SExpression.pm'); requires('Class::Accessor::Fast'); -requires('Parse::Yapp'); +configure_requires('Parse::Yapp'); build_requires('Test::More'); build_requires('Test::Deep'); -requires_external_bin('yapp'); +# +my $yapp = File::Spec->catfile($Config{scriptdirexp},"yapp"); +unless (-e $yapp) { + requires_external_bin('yapp'); + $yapp = "yapp"; +} -system('yapp -m Data::SExpression::Parser -o lib/Data/SExpression/Parser.pm lib/Data/SExpression/Parser.yp') +system("$yapp -m Data::SExpression::Parser -o lib/Data/SExpression/Parser.pm lib/Data/SExpression/Parser.yp") and die("Failed: Unable to create Data::SExpression::Parser (Is Parse::Yapp appropriately installed on your system?)"); WriteAll; Thanks,
CC: undisclosed-recipients: ;
Subject: Re: [rt.cpan.org #35047] [PATCH] Makefile.PL protability suggestion
Date: Tue, 15 Apr 2008 10:43:37 -0400
To: Andreas Koenig via RT <bug-Data-SExpression [...] rt.cpan.org>
From: Nelson Elhage <nelhage [...] MIT.EDU>
This is interesting. So your system has `yapp' installed outside of $PATH? It seems like this should perhaps be a patch to M::I so that requires_external_bin also looks in $Config{scriptdirexp}. I'm hesitant to trawl specific paths for binaries myself, since I feel that the infrastructure should know how to do that. In any case, the current system of running yapp during Makefile.PL is poor because (1) `make' does not cause changes to Parser.yp to be reflected in Parser.pm, and (2) It breaks automatic dependency following, because if Parse::Yapp is uninstalled, the build fails, rather than M::I trying to install it. The config_requires change may fix that latter, however. Anyways, I was thinking of replacing the requires_external_bin and system() lines with something like: postamble(<<"END_MAKEFILE"); lib/Data/SExpression/Parser.pm: lib/Data/SExpression/Parser.yp \tyapp -m Data::SExpression::Parser -o \$@ \$< END_MAKEFILE which causes a rule to get written to Makefile to generate Parser.pm. I take it that would also not work on your system, however, due to yapp not being in $PATH? - Nelsonx On Mon, Apr 14, 2008 at 11:03:00PM -0400, Andreas Koenig via RT wrote: Show quoted text
> > Mon Apr 14 23:02:59 2008: Request 35047 was acted upon. > Transaction: Ticket created by ANDK > Queue: Data-SExpression > Subject: [PATCH] Makefile.PL protability suggestion > Broken in: 0.36 > Severity: Normal > Owner: Nobody > Requestors: ANDK@cpan.org > Status: new > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=35047 > > > > In my environment the Makefile.PL fails because it doesn't find yapp > although Parse::Yapp is installed. > > May I suggest to replace the requires_external_bin line and calculate > the path to yapp manually? > > This ensures that the perl that builds the Module and the one that tests > it are the same. And it helps to find our own yapp even if not in the path. > > I've left the fallback to the requires_external_bin line in in case we > find no yapp in the expected directory. > > The configure_requires promises that the yapp already is there when > Makefile.PL is executed because installers are bound to read the META.yml. > > What do you think? > > Here is the patch: > > --- Makefile.PL~ 2008-04-10 00:37:39.000000000 +0200 > +++ Makefile.PL 2008-04-15 05:00:18.000000000 +0200 > @@ -1,19 +1,27 @@ > use inc::Module::Install; > > +use Config; > +use File::Spec; > + > name('Data-SExpression'); > license('Perl'); > > version_from('lib/Data/SExpression.pm'); > > requires('Class::Accessor::Fast'); > -requires('Parse::Yapp'); > +configure_requires('Parse::Yapp'); > > build_requires('Test::More'); > build_requires('Test::Deep'); > > -requires_external_bin('yapp'); > +# > +my $yapp = File::Spec->catfile($Config{scriptdirexp},"yapp"); > +unless (-e $yapp) { > + requires_external_bin('yapp'); > + $yapp = "yapp"; > +} > > -system('yapp -m Data::SExpression::Parser -o > lib/Data/SExpression/Parser.pm lib/Data/SExpression/Parser.yp') > +system("$yapp -m Data::SExpression::Parser -o > lib/Data/SExpression/Parser.pm lib/Data/SExpression/Parser.yp") > and die("Failed: Unable to create Data::SExpression::Parser (Is > Parse::Yapp appropriately installed on your system?)"); > > WriteAll; > > > > > Thanks, >
CC: ANDK [...] cpan.org
Subject: Re: [rt.cpan.org #35047] [PATCH] Makefile.PL protability suggestion
Date: Tue, 15 Apr 2008 22:44:27 +0200
To: bug-Data-SExpression [...] rt.cpan.org
From: andreas.koenig.7os6VVqR [...] franz.ak.mind.de (Andreas J. Koenig)
Show quoted text
>>>>> On Tue, 15 Apr 2008 10:44:16 -0400, "Nelson Elhage via RT" <bug-Data-SExpression@rt.cpan.org> said:
Show quoted text
> This is interesting. So your system has `yapp' installed outside of > $PATH?
Yes. My system usually has something like several 100 different perl versions installed. Of course they are not in $PATH. Show quoted text
> It seems like this should perhaps be a patch to M::I so that > requires_external_bin also looks in $Config{scriptdirexp}.
That would be quite complicated because it would have to provide a return value, so it's a major interface change. And progress on MI tends to be slow. Show quoted text
> I'm > hesitant to trawl specific paths for binaries myself, since I feel > that the infrastructure should know how to do that.
I understand your sentiment:) Show quoted text
> In any case, the current system of running yapp during Makefile.PL is > poor because > (1) `make' does not cause changes to Parser.yp > to be reflected in Parser.pm, and
Good point. Show quoted text
> (2) It breaks automatic dependency following, because if Parse::Yapp > is uninstalled, the build fails, rather than M::I trying to > install it. The config_requires change may fix that latter, > however.
Yes, it's always better to not have to die during Makefile.PL. Show quoted text
> Anyways, I was thinking of replacing the requires_external_bin and > system() lines with something like:
Show quoted text
> postamble(<<"END_MAKEFILE"); > lib/Data/SExpression/Parser.pm: lib/Data/SExpression/Parser.yp > \tyapp -m Data::SExpression::Parser -o \$@ \$< > END_MAKEFILE
Very nice but.... Show quoted text
> which causes a rule to get written to Makefile to generate Parser.pm.
Show quoted text
> I take it that would also not work on your system, however, due to > yapp not being in $PATH?
Unfortunately Yes. I have a job that calls "slaymake" like so: `echo $(PERL) | sed -e 's/perl$$/slaymake/'` It seems to be working well. Maybe you could do some equivalent for yapp? Or maybe Parse::Yapp has a shortcut available that is just a $(PERL) -MParse::Yapp -e '...' ??? -- andreas
I just CPAN'd 0.38, which should have a working solution. It uses a script in build/ in the dist to rebuild Parser.pm, using Parse::Yapp's perl API, instead of yapp. (I made it a separate script because it's somewhat longer than a one-liner). In addition, I'm now generating "standalone" parsers, so Data::SExpression no longer has Parse::Yapp as a run-time _or_ build-time dependency, although if you _do_ have it installed, the build will automatically notice and rebuild Parser.pm from Parser.yp when needed. Let me know if this breaks for any other reason in your environment; I've tested it on a couple of machines of my own with a few perls and with and without Parse::Yapp.