From: Peter Rabbitson Date: Thu, 10 Jan 2013 18:32:19 +0000 (+0100) Subject: Ensure the testddl is regenerated at Makefile and distdir times X-Git-Tag: v0.08205~14 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e01862e481716a38079f38aa688f9a5c6317c449;p=dbsrgits%2FDBIx-Class.git Ensure the testddl is regenerated at Makefile and distdir times This will stop things constantly getting out of sync --- diff --git a/Makefile.PL b/Makefile.PL index df1da83..1975940 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -152,6 +152,10 @@ if ($Module::Install::AUTHOR and ! $ENV{MAKELEVEL}) { NAME => Meta->name || die 'The Module::Install metadata must be available at this point but is not - did you rearrange the Makefile.PL...?', }); + # we are in the process of (re)writing the makefile - some things we + # call below very well may fail + local $ENV{DBICTEST_NO_MAKEFILE_VERIFICATION} = 1; + require File::Spec; # string-eval, not do(), because we need to provide the # $mm_proto, $reqs and $*_requires lexicals to the included file diff --git a/maint/Makefile.PL.inc/56_autogen_testddl.pl b/maint/Makefile.PL.inc/56_autogen_testddl.pl new file mode 100644 index 0000000..d86cae5 --- /dev/null +++ b/maint/Makefile.PL.inc/56_autogen_testddl.pl @@ -0,0 +1,25 @@ +require File::Spec; +my $ddl_fn = File::Spec->catfile(qw(t lib sqlite.sql)); + +# If the author doesn't have the prereqs, we will end up obliterating +# the ddl file, and all tests will fail, therefore don't do anything +# on error +# The EUMM build-stage generation will run unconditionally and +# errors will not be trapped +if (my $out = ` "$^X" -Ilib maint/gen_schema `) { + open (my $fh, '>:unix', $ddl_fn) or die "Unable to open $ddl_fn: $!"; + print $fh $out; + close $fh; +} + +postamble <<"EOP"; + +clonedir_generate_files : dbic_clonedir_regen_test_ddl + +dbic_clonedir_regen_test_ddl : +\t\$(ABSPERLRUN) -Ilib -- maint/gen_schema > @{[ $mm_proto->quote_literal($ddl_fn) ]} + +EOP + +# keep the Makefile.PL eval happy +1;