X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=maint%2FMakefile.PL.inc%2F56_autogen_testddl.pl;h=a9425d3cc8fb6993435827d2d107c11a7a2d7a3c;hb=9d622a1b305581b1024a4dd4d06be7bb9b471bfc;hp=d86cae5644ab1dec345551778dae367200e2a1b4;hpb=e01862e481716a38079f38aa688f9a5c6317c449;p=dbsrgits%2FDBIx-Class.git diff --git a/maint/Makefile.PL.inc/56_autogen_testddl.pl b/maint/Makefile.PL.inc/56_autogen_testddl.pl index d86cae5..a9425d3 100644 --- a/maint/Makefile.PL.inc/56_autogen_testddl.pl +++ b/maint/Makefile.PL.inc/56_autogen_testddl.pl @@ -6,10 +6,18 @@ my $ddl_fn = File::Spec->catfile(qw(t lib sqlite.sql)); # 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; +require DBIx::Class::Optional::Dependencies; +if ( DBIx::Class::Optional::Dependencies->req_ok_for ('deploy') ) { + print "Regenerating t/lib/sqlite.sql\n"; + 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; + + # if we don't do it some git tools (e.g. gitk) get confused that the + # ddl file is modified, when it clearly isn't + system('git status --porcelain >' . File::Spec->devnull); + } } postamble <<"EOP"; @@ -18,7 +26,7 @@ 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) ]} - +@{[ $crlf_fixup->($ddl_fn) ]} EOP # keep the Makefile.PL eval happy