Permalink
Browse files

Do not auto-install dist-building dependencies in author mode

Instead only require them for actual make dist/distdir/upload runs
  • Loading branch information...
1 parent a0acdea commit 344f1f52e93998d0805fc6d1163817fa6d34c506 @ribasushi ribasushi committed Mar 2, 2013
@@ -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</req_ok_for> passes for the supplied C<$group_name>, and
+in case of failure throws an exception including the information
+from L</req_missing_for>.
+EOD
+
'=head2 req_errorlist_for',
'=over',
'=item Arguments: $group_name',
@@ -36,7 +36,7 @@
# 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";
@@ -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_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
@@ -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

0 comments on commit 344f1f5

Please sign in to comment.