From: Peter Rabbitson Date: Sat, 2 Mar 2013 06:16:46 +0000 (+0100) Subject: Do not auto-install dist-building dependencies in author mode X-Git-Tag: v0.08210~35 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=344f1f52e93998d0805fc6d1163817fa6d34c506;p=dbsrgits%2FDBIx-Class.git Do not auto-install dist-building dependencies in author mode Instead only require them for actual make dist/distdir/upload runs --- diff --git a/lib/DBIx/Class/Optional/Dependencies.pm b/lib/DBIx/Class/Optional/Dependencies.pm index e7f7ae3..eb9b476 100644 --- a/lib/DBIx/Class/Optional/Dependencies.pm +++ b/lib/DBIx/Class/Optional/Dependencies.pm @@ -106,19 +106,6 @@ my $rdbms_firebird_odbc = { }; my $reqs = { - dist_upload => { - req => { - 'CPAN::Uploader' => '0.103001', - }, - }, - - dist_podinherit => { - req => { - 'Pod::Inherit' => '0.90', - 'Pod::Tree' => '0', - } - }, - replicated => { req => $replicated, pod => { @@ -622,8 +609,22 @@ my $reqs = { }, }, + dist_dir => { + req => { + 'Pod::Inherit' => '0.90', + 'Pod::Tree' => '0', + } + }, + + dist_upload => { + req => { + 'CPAN::Uploader' => '0.103001', + }, + }, + }; +our %req_availability_cache; sub req_list_for { my ($class, $group) = @_; @@ -638,7 +639,16 @@ sub req_list_for { } -our %req_availability_cache; +sub die_unless_req_ok_for { + my ($class, $group) = @_; + + Carp::croak "die_unless_req_ok_for() expects a requirement group name" + unless $group; + + $class->_check_deps($group)->{status} + or die sprintf( "Required modules missing, unable to continue: %s\n", $class->_check_deps($group)->{missing} ); +} + sub req_ok_for { my ($class, $group) = @_; @@ -870,6 +880,16 @@ The author is expected to prepend the necessary text to this message before returning the actual error seen by the user. EOD + '=head2 die_unless_req_ok_for', + '=over', + '=item Arguments: $group_name', + '=back', + <<'EOD', +Checks if L passes for the supplied C<$group_name>, and +in case of failure throws an exception including the information +from L. +EOD + '=head2 req_errorlist_for', '=over', '=item Arguments: $group_name', diff --git a/maint/Makefile.PL.inc/12_authordeps.pl b/maint/Makefile.PL.inc/12_authordeps.pl index 7068fcb..3a8a2b7 100644 --- a/maint/Makefile.PL.inc/12_authordeps.pl +++ b/maint/Makefile.PL.inc/12_authordeps.pl @@ -36,7 +36,7 @@ EOW # exclude the rdbms_* groups which are for DBIC users $opt_testdeps = { - map { %{$reqs_for_group{$_}} } grep { !/^rdbms_/ } keys %reqs_for_group + map { %{$reqs_for_group{$_}} } grep { !/^rdbms_|^dist_/ } keys %reqs_for_group }; print "Including all optional deps\n"; diff --git a/maint/Makefile.PL.inc/50_redefine_makefile_flow.pl b/maint/Makefile.PL.inc/50_redefine_makefile_flow.pl index 3813e80..c3eb8df 100644 --- a/maint/Makefile.PL.inc/50_redefine_makefile_flow.pl +++ b/maint/Makefile.PL.inc/50_redefine_makefile_flow.pl @@ -7,7 +7,7 @@ return <<"EOM"; $snippet -create_distdir : clonedir_generate_files clonedir_post_generate_files fresh_manifest create_distdir_copy_manifested clonedir_cleanup_generated_files +create_distdir : check_create_distdir_prereqs clonedir_generate_files clonedir_post_generate_files fresh_manifest create_distdir_copy_manifested clonedir_cleanup_generated_files \t\$(NOECHO) \$(NOOP) clonedir_generate_files : @@ -19,10 +19,28 @@ clonedir_post_generate_files : clonedir_cleanup_generated_files : \t\$(NOECHO) \$(NOOP) +check_create_distdir_prereqs : +\t\$(NOECHO) @{[ + $mm_proto->oneliner("DBIx::Class::Optional::Dependencies->die_unless_req_ok_for(q(dist_dir))", [qw/-Ilib -MDBIx::Class::Optional::Dependencies/]) +]} + EOM } } +# add an upload target check as a *preamble* +# will ensure things being assembled in the right order +preamble <<"EOP"; + +upload :: check_create_distdir_prereqs check_upload_dist_prereqs + +check_upload_dist_prereqs : +\t\$(NOECHO) @{[ + $mm_proto->oneliner("DBIx::Class::Optional::Dependencies->die_unless_req_ok_for(q(dist_upload))", [qw/-Ilib -MDBIx::Class::Optional::Dependencies/]) +]} + +EOP + # EU::MM BUG - workaround # somehow the init_PM of EUMM (in MM_Unix) interprets ResultClass.pod.proto # as a valid ResultClass.pod. While this has no effect on dist-building diff --git a/maint/travis-ci_scripts/50_after_success.bash b/maint/travis-ci_scripts/50_after_success.bash index e25d702..9ad53b8 100755 --- a/maint/travis-ci_scripts/50_after_success.bash +++ b/maint/travis-ci_scripts/50_after_success.bash @@ -3,4 +3,7 @@ source maint/travis-ci_scripts/common.bash if [[ -n "$SHORT_CIRCUIT_SMOKE" ]] ; then return ; fi -[[ "$CLEANTEST" = "true" ]] || run_or_err "Attempt to build a dist with all prereqs present" "make dist" +if [[ "$CLEANTEST" != "true" ]] ; then + parallel_installdeps_notest $(perl -Ilib -MDBIx::Class -e 'print join " ", keys %{DBIx::Class::Optional::Dependencies->req_list_for("dist_dir")}') + run_or_err "Attempt to build a dist with all prereqs present" "make dist" +fi