On 11-Oct-16 14:09, Karen Etheridge wrote: > If I'm understanding correctly, you need to declare a prereq on an > external library -- check out [CheckLib] for that, which inserts code > into your Makefile.PL that calls Devel::CheckLib. > > For OS-specific prereqs, you can use [OSPrereqs]; if you need to do > something fancy or with custom code, [DynamicPrereqs] can make that easy. > > And if none of these provide the level of nuance that you need, you > can fall back to [MakeMaker::Awesome], which lets you customize > Makefile.PL in even more custom ways. > > > good luck! feel free to follow up with more questions, or hit me up on > irc.perl.org <http://irc.perl.org> #distzilla. > Karen,
Thanks - helpful as usual! I think I'm almost there. Still some questions. FYI: Small divot (things build OK after the usual dozen dependencies...): > cpan install Dist::Zilla::Plugin::{DynamicPrereqs,CheckLib,OSPrereqs} > ... > CPAN: Module::CoreList loaded ok (v2.54) > Configuring E/ET/ETHER/Dist-Zilla-Plugin-DynamicPrereqs-0.032.tar.gz > with Makefile.PL > Dist::Zilla already exists in PREREQ_PM -- need to do a sane > metamerge! at Makefile.PL line 140. > Dist::Zilla already exists in FallbackPrereqs -- need to do a sane > metamerge! at Makefile.PL line 144. > Checking if your kit is complete... After following your pointers, it sounds as though [DynamicPrereqs] is closest to what I need. Unfortunately, I can't use CheckLib due to the bizarre packaging of OpenSSL. Plus, the OpenSSL dependency belongs to the modules I depend on/call; I can't become their nanny. I need do something on the order of | my $ok = eval {|| || ||require Crypt::OpenSSL::DSA;|| || my $key = Crypt::OpenSSL::DSA->read_pub_key_str( <<'_long_mess_' ) or die "Can't read public key"; ... _long_mess_ |||| $ok = $key->verify( pack('H*', "Another long mess"), pack('H*', "Still more mess") ) or die "Can't verify";|| || };|| if( $@ || !$ok ) { printf STDERR "You probably need to upgrade OpenSSL\n"; printf STDERR " - $@" if( $@ ); || <tell CPAN_Testing "Insufficient Environment & rate 'NA'"> # << What goes here? }|| | I gather I can put this in a file, then in dist.ini: |[Prereqs / ConfigureRequires] Crypt::OpenSSL::RSA = 0 |||Crypt::OpenSSL::DSA = 0 |CryptX = 0.44 [DynamicPrereqs]|| ||-raw_from_file = myfile.pl|| | Perhaps these are obvious, but I'm neither a MakeMaker nor a CPANTS person, and testing by releasing to cpan is expensive (and slightly embarrassing): * What's the proper magic at "# << "? o die? o exit non-zero? o Unlink Makefile and exit 0? (Is this portable?) o Call some function that's provided in the Makefile? * You set 'dynamic_config', which implies that installers don't know enough to load my dependencies. In this case, actually they do. I'm not adding a prereq, just applying a more stringent test to the environment. So can/should I delete $WriteMakefileArgs{dynamic_config} & delete $FallbackPrereqs{dynamic_config}? Or should there be a "not_really_dynamic = 1" for your plugin :-) I appreciate your patience... On Tue, Oct 11, 2016 at 10:57 AM, tlhackque via Dist::Zilla <distzilla+re...@lists.codesimply.com <mailto:distzilla+re...@lists.codesimply.com>> wrote: > > I have encountered a situation where my module depends on another > module, which depends on a system library (OpenSSL) being at a > reasonably current version. > > Failure to be at a reasonably current version still allows my > dependency > to install/be satisfied. But my tests (correctly) fail. This gets > counted against me on CPAN's automated testers, which I don't like :-( > > I'd be OK if CPAN testers rated those out-of-date systems "NA" rather > than fail. > > The advice I've gotten is to come up with a test and abort the > Makefile.PL > > But I don't write the Makefile.PL; Dist::Zilla does. > > I can write a test as a stand-alone script, or simply a Perl function. > For the sake of an example: > sub someComplexFunction { return int(rand(4)) == 2; } > $^O ne 'MacOS' && someComplexFunction() or ( printf STDERR > ("Environment requires..."), return/exit/die... ); > > My question: How do I get Dist::Zilla to introduce code to run my > test, > and how should it exit to tell CPANTS to rate NA? > > I presume I need to include the test's dependencies with something > like: > > [Prereqs / ConfigureRequires] > Crypt::OpenSSL::RSA = 0 > CryptX = 0.44 > > But how do I package the code? In the simplest way? > > My dist.ini's relevant sections are: > [MetaConfig] > [MetaProvides::Package] > [MinimumPerl] > perl = 5.008008 > [MetaYAML] > [MetaJSON] > [MakeMaker] > static_attribution = 1 > [AutoPrereqs] > [Prereqs] > ... > [Prereqs / DevelopRequires] > Sort::Versions = 1.62 > Pod::Readme = 1.1.2 > [Test::ReportPrereqs] > > Many thanks! > ------------------------------------------- Dist::Zilla Archives: https://www.listbox.com/member/archive/139292/=now RSS Feed: https://www.listbox.com/member/archive/rss/139292/21080831-4b8afa6a Modify Your Subscription: https://www.listbox.com/member/?member_id=21080831&id_secret=21080831-2b0ee212 Powered by Listbox: http://www.listbox.com