summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2010-11-21 21:34:33 -0600
committerJesse Luehrs <doy@tozt.net>2010-11-21 21:48:08 -0600
commit67caa3cab560fb58ef93e71c7562d89afd3b03f2 (patch)
tree7aa3a89a3219373ff89ea9e6812ecd2ebcda8fe7
parenta20ff0fe7cedb1750b40d04307a1e2f5230758df (diff)
downloadpackage-stash-67caa3cab560fb58ef93e71c7562d89afd3b03f2.tar.gz
package-stash-67caa3cab560fb58ef93e71c7562d89afd3b03f2.zip
use dist-checkconflicts
-rw-r--r--bin/package-stash-conflicts19
-rw-r--r--dist.ini4
-rw-r--r--inc/MMPackageStash.pm44
-rw-r--r--lib/Package/Stash/Conflicts.pm14
4 files changed, 54 insertions, 27 deletions
diff --git a/bin/package-stash-conflicts b/bin/package-stash-conflicts
new file mode 100644
index 0000000..3ebeb3a
--- /dev/null
+++ b/bin/package-stash-conflicts
@@ -0,0 +1,19 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+# PODNAME: package-stash-conflicts
+
+use Getopt::Long;
+use Package::Stash::Conflicts;
+
+my $verbose;
+GetOptions("verbose|v" => \$verbose);
+
+if ($verbose) {
+ Package::Stash::Conflicts->check_conflicts;
+}
+else {
+ my @conflicts = Package::Stash::Conflicts->calculate_conflicts;
+ print "$_\n" for map { $_->{package} } @conflicts;
+ exit @conflicts;
+}
diff --git a/dist.ini b/dist.ini
index 3a79421..5578e88 100644
--- a/dist.ini
+++ b/dist.ini
@@ -10,6 +10,7 @@ awesome = =inc::MMPackageStash
[Prereqs]
perl = 5.8.3
+Dist::CheckConflicts = 0
Package::DeprecationManager = 0
Package::Stash::XS = 0
Scalar::Util = 0
@@ -21,3 +22,6 @@ Test::Requires = 0
[Prereqs / TestRecommends]
Test::LeakTrace = 0
+
+[Prereqs / ConfigureRequires]
+Dist::CheckConflicts = 0
diff --git a/inc/MMPackageStash.pm b/inc/MMPackageStash.pm
index b29aa5e..f90eb99 100644
--- a/inc/MMPackageStash.pm
+++ b/inc/MMPackageStash.pm
@@ -45,39 +45,29 @@ CAN_CC
# copied out of moose
my $check_conflicts = <<'CHECK_CONFLICTS';
sub check_conflicts {
- my %conflicts = (
- 'Class::MOP' => '1.08',
- 'MooseX::Role::WithOverloading' => '0.08',
- 'namespace::clean' => '0.18',
- );
- 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/Package/Stash/Conflicts.pm'; 1; }) {
+ if (eval { Package::Stash::Conflicts->check_conflicts; 1 }) {
+ return;
+ }
+ else {
+ my $err = $@;
+ $err =~ s/^/ /mg;
+ warn "***\n$err***\n";
+ }
+ }
+ else {
+ print <<'EOF';
***
- This version of Package::Stash conflicts with the version of
- $mod ($installed) you have installed.
-
- You will need to upgrade $mod after installing
- this version of Package::Stash.
+ Your toolchain doesn't support configure_requires, so Dist::CheckConflicts
+ hasn't been installed yet. You should check for conflicting modules
+ manually using the 'package-stash-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 if $ENV{PERL_MM_USE_DEFAULT};
return unless -t STDIN && (-t STDOUT || !(-f STDOUT || -c STDOUT));
sleep 4;
diff --git a/lib/Package/Stash/Conflicts.pm b/lib/Package/Stash/Conflicts.pm
new file mode 100644
index 0000000..53e6680
--- /dev/null
+++ b/lib/Package/Stash/Conflicts.pm
@@ -0,0 +1,14 @@
+package # hide from PAUSE
+ Package::Stash::Conflicts;
+use strict;
+use warnings;
+
+use Dist::CheckConflicts
+ -dist => 'Package-Stash',
+ -conflicts => {
+ 'Class::MOP' => '1.08',
+ 'MooseX::Role::WithOverloading' => '0.08',
+ 'namespace::clean' => '0.18',
+ };
+
+1;