Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Use Makefile.PL to track prereqs #231

Merged
merged 5 commits into from

2 participants

@rwstauner
Owner

instead of dist.ini to lower the barrier for new contributors.

use the bin/unlisted_prereqs.pl to scan for anything not mentioned in there
(but note that not all prereqs are scannable yet).

Could use some clean up, but the Makefile.PL works well enough,
and you can just do cpanm . to install all the deps.

rwstauner added some commits
@rwstauner rwstauner Use Makefile.PL for prereqs instead of dist.ini
It's a lower hurdle for contributors who don't already use dzil.
This Makefile.PL was generated by Dist::Zilla using the old dist.ini.

There is an appropriate 'make test' for all the people
who used to try 'dzil test'.
4568f71
@rwstauner rwstauner Show any scanned prereqs not listed in Makefile.PL a261a95
@rwstauner rwstauner Use File::Find::Rule::Perl to scan for prereqs
It's nicer and catches scripts that don't have file extensions.
c1c42bf
@rwstauner rwstauner Simplify unlisted_prereqs slightly a6542c6
@rwstauner rwstauner Make 'install' a no-op so 'cpanm .' appears successful eebaaf8
@oalders oalders merged commit 3ebaf7d into master
@oalders
Owner

Excellent -- thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 7, 2012
  1. @rwstauner

    Use Makefile.PL for prereqs instead of dist.ini

    rwstauner authored
    It's a lower hurdle for contributors who don't already use dzil.
    This Makefile.PL was generated by Dist::Zilla using the old dist.ini.
    
    There is an appropriate 'make test' for all the people
    who used to try 'dzil test'.
  2. @rwstauner
  3. @rwstauner

    Use File::Find::Rule::Perl to scan for prereqs

    rwstauner authored
    It's nicer and catches scripts that don't have file extensions.
  4. @rwstauner
  5. @rwstauner
This page is out of date. Refresh to see the latest.
Showing with 319 additions and 62 deletions.
  1. +7 −0 .gitignore
  2. +224 −0 Makefile.PL
  3. +88 −0 bin/unlisted_prereqs.pl
  4. +0 −62 dist.ini
View
7 .gitignore
@@ -8,3 +8,10 @@
/t/var/tmp/
/etc/metacpan_local.pl
metacpan_server_local.conf
+
+# generated by Makefile.PL (for instance when doing `cpanm --installdeps .`)
+/Makefile
+/Makefile.old
+/MYMETA.*
+/pm_to_blib
+/blib
View
224 Makefile.PL
@@ -0,0 +1,224 @@
+use strict;
+use warnings;
+
+use 5.010;
+
+use ExtUtils::MakeMaker 6.30 qw( WriteMakefile );
+
+my %WriteMakefileArgs = (
+ ABSTRACT => "A free, open API for everything you want to know about CPAN",
+ AUTHOR => 'Moritz Onken <onken@netcubed.de>, Olaf Alders <olaf@wundercounter.com>',
+
+ # modules required for testing
+ BUILD_REQUIRES => {
+ "App::Prove" => 0,
+ "CPAN::Faker" => 0,
+ "Module::Faker" => "0.010",
+ "Config::General" => 0,
+ "ElasticSearch::TestServer" => 0,
+ "File::Copy" => 0,
+ "Test::Aggregate::Nested" => "0.364",
+ "Test::More" => "0.96",
+ "Test::Most" => 0,
+ },
+
+ CONFIGURE_REQUIRES => {
+ "ExtUtils::MakeMaker" => "6.30"
+ },
+ DISTNAME => "MetaCPAN",
+ LICENSE => "bsd",
+ MIN_PERL_VERSION => "5.010",
+ NAME => "MetaCPAN",
+
+ # runtime dependencies
+ PREREQ_PM => {
+ "Archive::Any" => 0,
+ "Archive::Any::Plugin" => 0,
+ "Archive::Tar" => 0,
+ "CHI" => 0,
+ "CPAN::DistnameInfo" => 0,
+ "CPAN::Meta" => 0,
+ "Captcha::reCAPTCHA" => "0.94",
+ "Catalyst" => "5.90011",
+ "Catalyst::Action::RenderView" => 0,
+ "Catalyst::Authentication::User" => 0,
+ "Catalyst::Controller" => 0,
+ "Catalyst::Controller::REST" => "0.94",
+ "Catalyst::Model" => 0,
+ "Catalyst::Plugin::Authentication" => 0,
+ "Catalyst::Plugin::ConfigLoader" => 0,
+ "Catalyst::Plugin::Session" => 0,
+ "Catalyst::Plugin::Session::State::Cookie" => 0,
+ "Catalyst::Plugin::Session::Store" => 0,
+ "Catalyst::Plugin::Static::Simple" => 0,
+ "Catalyst::Plugin::Unicode::Encoding" => 0,
+ "Catalyst::Utils" => 0,
+ "Catalyst::View" => 0,
+ "Catalyst::View::JSON" => 0,
+ "CatalystX::Component::Traits" => 0,
+ "CatalystX::InjectComponent" => 0,
+ "CatalystX::RoleApplicator" => 0,
+ "Class::MOP" => 0,
+ "Config::JFDI" => 0,
+ "Cwd" => 0,
+ "DBD::SQLite" => "1.33",
+ "DBI" => "1.616",
+ "Data::DPath" => 0,
+ "Data::Dump" => 0,
+ "Data::Dumper" => 0,
+ "DateTime" => 0,
+ "DateTime::Format::ISO8601" => 0,
+ "Devel::ArgNames" => 0,
+ "Digest::MD5" => 0,
+ "Digest::SHA1" => 0,
+ "EV" => 0,
+ "ElasticSearch" => "0.36",
+ "ElasticSearchX::Model" => "0.1.0",
+ "ElasticSearchX::Model::Document" => 0,
+ "ElasticSearchX::Model::Document::Set" => 0,
+ "ElasticSearchX::Model::Document::Types" => 0,
+ "ElasticSearchX::Model::Util" => 0,
+ "Email::Address" => 0,
+ "Email::Sender::Simple" => 0,
+ "Email::Simple" => 0,
+ "Email::Valid" => 0,
+ "Encode" => 0,
+ "Exporter" => 0,
+ "Facebook::Graph" => 0,
+ "File::Basename" => 0,
+ "File::Find" => 0,
+ "File::Find::Rule" => 0,
+ "File::Spec" => 0,
+ "File::Spec::Functions" => 0,
+ "File::Temp" => 0,
+ "File::stat" => 0,
+ "Find::Lib" => 0,
+ "FindBin" => 0,
+ "Graph::Centrality::Pagerank" => 0,
+ "Gravatar::URL" => 0,
+ "HTTP::Request::Common" => 0,
+ "Hash::Merge::Simple" => 0,
+ "IO::All" => 0,
+ "IO::Interactive" => 0,
+ "IO::String" => 0,
+ "IO::Uncompress::Bunzip2" => 0,
+ "IO::Zlib" => 0,
+ "IPC::Run3" => 0,
+ "JSON" => 2,
+ "JSON::XS" => 0,
+ "LWP::Protocol::https" => 0,
+ "LWP::UserAgent" => 0,
+ "List::MoreUtils" => 0,
+ "List::Util" => 0,
+ "Log::Contextual" => 0,
+ "Log::Log4perl" => 0,
+ "Log::Log4perl::Appender::ScreenColoredLevels" => 0,
+ "Module::Metadata" => 0,
+ "Module::Pluggable" => 0,
+ "Moose" => 0,
+ "Moose::Role" => 0,
+ "Moose::Util" => 0,
+ "MooseX::Aliases" => 0,
+ "MooseX::Attribute::Deflator" => "2.1.5",
+ "MooseX::ChainedAccessors" => 0,
+ "MooseX::Getopt" => 0,
+ "MooseX::Getopt::OptionTypeMap" => 0,
+ "MooseX::Types" => 0,
+ "MooseX::Types::Common::String" => 0,
+ "MooseX::Types::ElasticSearch" => 0,
+ "MooseX::Types::Moose" => 0,
+ "MooseX::Types::Path::Class" => 0,
+ "MooseX::Types::Structured" => 0,
+ "Mozilla::CA" => 0,
+ "Net::Twitter" => 0,
+ "Parse::CPAN::Packages::Fast" => "0.04",
+ "Parse::CSV" => 0,
+ "Path::Class" => 0,
+ "PerlIO::gzip" => 0,
+ "Pithub" => 0,
+ "Plack::App::Directory" => 0,
+ "Plack::MIME" => 0,
+ "Plack::Middleware::Header" => 0,
+ "Plack::Middleware::ReverseProxy" => 0,
+ "Plack::Middleware::ServerStatus::Lite" => 0,
+ "Plack::Middleware::Session" => 0,
+ "Plack::Session::Store" => 0,
+ "Plack::Test" => 0,
+ "Plack::Util::Accessor" => 0,
+ "Pod::Coverage::Moose" => "0.02",
+ "Pod::Markdown" => 0,
+ "Pod::POM" => 0,
+ "Pod::Simple::XHTML" => 0,
+ "Pod::Text" => 0,
+ "Regexp::Common" => 0,
+ "Regexp::Common::time" => 0,
+ "Starman" => 0,
+ "Test::More" => 0,
+ "Time::Local" => 0,
+ "Try::Tiny" => 0,
+ "URI" => 0,
+ "URI::Escape" => 0,
+ "WWW::Mechanize" => 0,
+ "WWW::Mechanize::Cached" => 0,
+ "XML::Simple" => 0,
+ "YAML" => 0,
+ "YAML::Syck" => 0,
+ "base" => 0,
+ "feature" => 0,
+ "namespace::autoclean" => 0,
+ "strict" => 0,
+ "strictures" => 1,
+ "utf8" => 0,
+ "version" => 0,
+ "warnings" => 0,
+ },
+
+ # We don't need 'make' or 'make install' but cpanm won't find deps
+ # from WriteEmptyMakefile. To avoid unnecessary bulding (pm_to_blib, etc)
+ # we supply our own 'test' in the postamble.
+ SKIP => [qw( all test install )],
+
+ VERSION => "0.0.1",
+
+ test => {
+ # t/fakecpan.t uses Test::Aggregate to run most of the other tests
+ "TESTS" => "t/*.t"
+ }
+);
+
+
+# backward compatibility with older EUMM's
+unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) {
+ my $br = delete $WriteMakefileArgs{BUILD_REQUIRES};
+ my $pp = $WriteMakefileArgs{PREREQ_PM};
+ for my $mod ( keys %$br ) {
+ if ( exists $pp->{$mod} ) {
+ $pp->{$mod} = $br->{$mod} if $br->{$mod} > $pp->{$mod};
+ }
+ else {
+ $pp->{$mod} = $br->{$mod};
+ }
+ }
+}
+
+delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
+ unless eval { ExtUtils::MakeMaker->VERSION(6.52) };
+
+WriteMakefile(%WriteMakefileArgs);
+
+# stuff to append to the Makefile
+sub MY::postamble {
+ return <<POST
+
+# let install exist but make it a no-op
+# that way 'cpanm .' appears successful
+install:
+
+# the tests should not recurse, t/fakecpan.t does that with Test::Aggregate
+test :
+\t prove -lv t/
+
+POST
+}
+
+1;
View
88 bin/unlisted_prereqs.pl
@@ -0,0 +1,88 @@
+#!/usr/bin/env perl
+# PODNAME: check_prereqs.pl
+
+# TODO: this stuff should be in other modules somewhere
+
+use strict;
+use warnings;
+use Perl::PrereqScanner 1.014;
+use CPAN::Meta::Requirements;
+use File::Find::Rule::Perl;
+use version 0.77;
+
+# TODO: use CPAN::Meta::Prereqs
+
+my @found = File::Find::Rule->not(
+ File::Find::Rule->name(qw(
+ .git
+ t/var/tmp
+ var
+ ))->prune->discard,
+)->perl_file->in('.');
+
+my $local = {};
+my $files = {};
+
+foreach ( @found ){
+ # FIXME: unix slashes
+ my $phase =
+ # beneath t/ or xt/
+ m{^(\./)?x?t/} ? 'build' :
+ 'runtime';
+
+ push @{ $files->{ $phase } }, $_;
+
+ if( m{^(?:\./)?(?:t/)?lib/(.+?)\.pm$} ){
+ (my $pm = $1) =~ s!/!::!g;
+ $local->{ $pm } = $_;
+ }
+}
+
+my $scanner = Perl::PrereqScanner->new(
+ # TODO: extra_scanners => [qw( PlackMiddleware Catalyst )],
+);
+
+my $reqs = {};
+
+foreach my $phase ( keys %$files ){
+ my $pr = CPAN::Meta::Requirements->new;
+ foreach my $file ( @{ $files->{ $phase } } ){
+ $pr->add_requirements( $scanner->scan_file( $file ) );
+ }
+
+ # ignore packages we provide locally
+ $pr->clear_requirement($_)
+ for grep { exists $local->{$_} } $pr->required_modules;
+
+ $reqs->{ $phase } = $pr->as_string_hash;
+}
+
+# don't duplicate runtime deps into build deps
+foreach my $dep ( keys %{ $reqs->{runtime} } ){
+ # TODO: check version
+ delete $reqs->{build}{ $dep };
+}
+
+sub check_prereqs {
+ my ($scanned, $mm) = @_;
+ foreach my $dep ( keys %$scanned ){
+ if( exists($mm->{ $dep }) ){
+ delete $scanned->{ $dep }
+ if version->parse($scanned->{ $dep }) <= version->parse($mm->{ $dep });
+ }
+ }
+}
+
+my ($PREREQ_PM, $BUILD_REQUIRES, $MIN_PERL_VERSION);
+
+my $mm_prereqs = qx{$^X Makefile.PL PREREQ_PRINT=1};
+eval $mm_prereqs;
+
+check_prereqs($reqs->{runtime}, $PREREQ_PM);
+check_prereqs($reqs->{build}, $BUILD_REQUIRES);
+delete $reqs->{runtime}{perl}
+ if version->parse($reqs->{runtime}{perl}) <= version->parse($MIN_PERL_VERSION);
+
+use Data::Dumper;
+$Data::Dumper::Sortkeys = 1;
+print Data::Dumper->Dump([$reqs], ['requires']);
View
62 dist.ini
@@ -1,62 +0,0 @@
-name = MetaCPAN
-version = 0.0.1
-author = Moritz Onken <onken@netcubed.de>
-author = Olaf Alders <olaf@wundercounter.com>
-license = BSD
-copyright_holder = Moritz Onken and Olaf Alders
-copyright_year = 2011
-
-; authordep Dist::Zilla::PluginBundle::JQUELIN
-[@Filter]
--bundle = @JQUELIN
--remove = AutoVersion
--remove = CheckChangelog
-
-[Prereqs]
-Archive::Any = 0
-DateTime::Format::ISO8601 = 0
-Devel::ArgNames = 0
-ElasticSearch = 0.36
-EV = 0
-Gravatar::URL = 0
-Log::Log4perl::Appender::ScreenColoredLevels = 0
-MooseX::Attribute::Deflator = 2.1.5
-MooseX::ChainedAccessors = 0
-Mozilla::CA = 0
-Parse::CSV = 0
-Plack::Middleware::Header = 0
-Plack::Middleware::Session = 0
-Plack::Middleware::ServerStatus::Lite = 0
-Pod::Coverage::Moose = 0.02
-Starman = 0
-WWW::Mechanize::Cached = 0
-LWP::Protocol::https = 0
-Email::Sender::Simple = 0
-DBI = 1.616
-DBD::SQLite = 1.33
-IPC::Run3 = 0
-Parse::CPAN::Packages::Fast = 0.04
-Regexp::Common::time = 0
-PerlIO::gzip = 0
-Pithub = 0
-
-Catalyst = 5.90011
-Catalyst::Plugin::Unicode::Encoding = 0
-Catalyst::Controller::REST = 0.94
-Catalyst::Plugin::Authentication = 0
-Catalyst::Plugin::Session = 0
-Catalyst::Plugin::Session::State::Cookie = 0
-Catalyst::Plugin::Static::Simple = 0
-Catalyst::Action::RenderView = 0
-CHI = 0
-ElasticSearchX::Model = 0.1.0
-CatalystX::InjectComponent = 0
-Captcha::reCAPTCHA = 0.94
-
-strictures = 1
-IO::All = 0
-JSON = 2
-YAML = 0
-Email::Address = 0
-File::Find = 0
-Path::Class = 0
Something went wrong with that request. Please try again.