From: Jesse Luehrs Date: Mon, 22 Nov 2010 03:47:28 +0000 (-0600) Subject: use dist-checkconflicts X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=refs%2Fheads%2Frfc%2Fcheck-conflicts;p=gitmo%2FClass-MOP.git use dist-checkconflicts --- diff --git a/Makefile.PL b/Makefile.PL index 0b0c7a3..f61a293 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -22,6 +22,7 @@ if ( -d '.git' || $ENV{MAINTAINER_MODE} ) { requires 'Carp'; requires 'Data::OptList'; requires 'Devel::GlobalDestruction'; +requires 'Dist::CheckConflicts'; requires 'Eval::Closure'; requires 'List::MoreUtils' => '0.12'; requires 'MRO::Compat' => '0.05'; @@ -45,6 +46,9 @@ author_requires 'Test::NoTabs'; author_requires 'Test::Output'; author_requires 'Test::Spelling'; +configure_requires 'Dist::CheckConflicts'; +configure_requires 'Package::Stash::Conflicts'; + repository 'git://git.moose.perl.org/Class-MOP.git'; add_metadata(x_authority => 'cpan:STEVAN'); @@ -83,44 +87,31 @@ EOM WriteAll(); -# Use the cpan-smolder-stable script in the Moose svn root to figure -# out what on CPAN will break with the latest Moose, then update this -# before a release. sub check_conflicts { - my %conflicts = ( - 'Moose' => '1.14', - 'namespace::autoclean' => '0.08', - ); - - my $found = 0; - for my $mod ( sort keys %conflicts ) { - eval "require $mod"; - next if $@; - - my $installed = $mod->VERSION(); - if ( $installed le $conflicts{$mod} ) { - - print <<"EOF"; - + if (eval { require 'lib/Class/MOP/Conflicts.pm'; 1; }) { + if (eval { Class::MOP::Conflicts->check_conflicts; 1 }) { + return; + } + else { + my $err = $@; + $err =~ s/^/ /mg; + warn "***\n$err***\n"; + } + } + else { + print <<'EOF'; *** - This version of Class::MOP conflicts with the version of - $mod ($installed) you have installed. - - You will need to upgrade $mod after installing - this version of Class::MOP. + Your toolchain doesn't support configure_requires, so Dist::CheckConflicts + hasn't been installed yet. You should check for conflicting modules + manually using the 'cmop-conflicts' script that is installed with + this distribution once the installation finishes. *** - EOF - - $found = 1; - } } - return unless $found; - # More or less copied from Module::Build return if $ENV{PERL_MM_USE_DEFAULT}; - return unless -t STDIN && ( -t STDOUT || !( -f STDOUT || -c STDOUT ) ); + return unless -t STDIN && (-t STDOUT || !(-f STDOUT || -c STDOUT)); sleep 4; } diff --git a/bin/cmop-conflicts b/bin/cmop-conflicts new file mode 100644 index 0000000..642dac6 --- /dev/null +++ b/bin/cmop-conflicts @@ -0,0 +1,18 @@ +#!/usr/bin/env perl +use strict; +use warnings; + +use Getopt::Long; +use Class::MOP::Conflicts; + +my $verbose; +GetOptions("verbose|v" => \$verbose); + +if ($verbose) { + Class::MOP::Conflicts->check_conflicts; +} +else { + my @conflicts = Class::MOP::Conflicts->calculate_conflicts; + print "$_\n" for map { $_->{package} } @conflicts; + exit @conflicts; +} diff --git a/lib/Class/MOP/Conflicts.pm b/lib/Class/MOP/Conflicts.pm new file mode 100644 index 0000000..0861f6a --- /dev/null +++ b/lib/Class/MOP/Conflicts.pm @@ -0,0 +1,20 @@ +package # hide from PAUSE + Class::MOP::Conflicts; +use strict; +use warnings; + +# Use the xt/author/test-my-dependents.t test in the Moose test suite to figure +# out what on CPAN will break with the latest Moose, then update this before a +# release. + +use Dist::CheckConflicts + -dist => 'Class-MOP', + -conflicts => { + 'Moose' => '1.14', + 'namespace::autoclean' => '0.08', + }, + -also => [ + 'Package::Stash::Conflicts', + ]; + +1;