ready to release 0.1.16
[cpan-testers-parsereport.git] / Makefile.PL
blobce2396d1801dd004a89966cacd960b6d08135e93
1 use strict;
2 use warnings;
3 use ExtUtils::MakeMaker;
4 $ExtUtils::MakeMaker::VERSION =~ s/_//g;
5 my @sign = (MM->can("signature_target") ? (SIGN => 1) : ());
6 my $version_diff = 0; # we'll have to die if this becomes true
7 $::version_from = 'lib/CPAN/Testers/ParseReport.pm';
8 my $mmgenereatedversionfrom = MM->parse_version($::version_from);
9 if ($ARGV[0] && $ARGV[0] eq "--setversion") {
10     die "Your perl is a bit dated[$]].\nDo not make a release with it\n" if $] < 5.008;
11     warn "Your MakeMaker is a bit dated[$ExtUtils::MakeMaker::VERSION].\nYou should get a new one\n"
12         if $ExtUtils::MakeMaker::VERSION < 6.4502;
13     eval {  require $::version_from; }; die $@ if $@;
14     my $makefile = "Makefile";
15     unless (-f $makefile) {
16         $makefile = "Makefile.old";
17     }
18     unless (-f $makefile) {
19         die "no Makefile and no Makefile.old found";
20     }
21     my $dirty = ! system "git status -a > /dev/null";
22     if ($dirty){
23         system "git status -a";
24         die "Not everything checked in?";
25     }
26     open my $fh, "make -f $makefile the-release-name|" or die "Could not fork: $!";
27     local $/;
28     my ($have_version) = <$fh> =~ /^version\s+([\d\._]+)/m;
29     close $fh or die "Could not close: $!";
30     my ($namespace) = $::version_from;
31     $namespace =~ s|^lib/(.+)\.pm$|$1|;
32     $namespace =~ s|/|::|g;
33     eval qq{ if (\$$namespace\::VERSION != \$have_version) {
34         warn "Not equal: CPAN::Testers::ParseReport::VERSION[\$$namespace\::VERSION] Makefile version[\$have_version]";
35         \$version_diff = 1;
36     }};
37     eval qq{ if (\$$namespace\::VERSION != \$mmgenereatedversionfrom) {
38         warn "Not equal: CPAN::Testers::ParseReport::VERSION[\$$namespace\::VERSION] MM generated version[\$mmgenereatedversionfrom]";
39         \$version_diff = 1;
40     }};
43 my %indirect_dependencies =
44     (
45      'Class::ISA' => 0,
46      'DateTime'   => 0,
47     );
48 WriteMakefile
49     (
50      'NAME' => 'CPAN::Testers::ParseReport',
51      'VERSION_FROM' => $::version_from,
52      'PREREQ_PM' => {
53                      %indirect_dependencies,
54                      'Config::Perl::V'             => 0,
55                      'DateTime::Format::Strptime'  => 0,
56                      'File::Path'                  => 1.08,
57                      'Getopt::Long'                => 0,
58                      'HTML::Entities'              => 0,
59                      'Hash::Util'                  => 0,
60                      'IO::Prompt'                  => 0,
61                      'LWP::UserAgent'              => 0,
62                      'List::Util'                  => 0,
63                      'MIME::QuotedPrint'           => 3.07,
64                      'Pod::Usage'                  => 1.33,
65                      'Statistics::Regression'      => 0,
66                      'Test::More'                  => 0,
67                      'Test::Pod'                   => 0,
68                      'Time::Local'                 => 1.11,
69                      'XML::LibXML'                 => 0,
70                      'XML::LibXML::XPathContext'   => 0,
71                      'YAML::Syck'                  => 0,
72                     },
73      'INSTALLDIRS' => 'site',
74      'EXE_FILES' => [
75                      'bin/ctgetreports',
76                     ],
77      LICENSE => "perl",
78      ABSTRACT => "parse reports to www.cpantesters.org from various sources",
79      'PL_FILES' => {},
80      dist => {
81               DIST_DEFAULT => join(" ", # note: order matters!
82                                    "verify-changes-date",
83                                    "Makefile",
84                                    "META.yml",
85                                    "setversion",
86                                    "all",
87                                    "tardist",
88                                   ),
89               COMPRESS => 'bzip2 -9f',
90               SUFFIX => ".bz2",
91              },
92      ($ExtUtils::MakeMaker::VERSION >= 6.4502 ?
93       (META_ADD => {
94                     # write: git push git+ssh://repo.or.cz/srv/git/cpan-testers-parsereport.git master
95                     repository => "git://repo.or.cz/cpan-testers-parsereport.git",
96                     provides => { "CPAN::Testers::ParseReport" => { version => $mmgenereatedversionfrom, file => $::version_from }},
97                    }) : ()),
98      @sign,
99     );
101 if ($version_diff){
102   die "
103 ==> I had to update some \$VERSIONs <==
104 ==> Your Makefile has been rebuilt. <==
105 ==> Please rerun the make command.  <==
109 package MY;
110 sub postamble {
111   my @m;
112   push @m, q{
113 # the subdirs on MY OWN BOX are allowed here (only used for make dist!)
114 OKDIRS=DIST|bin|blib|cover_db\
115        |lib|t
117 Makefile: }.$::version_from.q{
119 META.yml: metafile
120         $(CP) $(DISTVNAME)/META.yml  ./META.yml
122 setversion:
123         $(PERL) Makefile.PL --setversion
125 verify-changes-date:
126         @$(PERL) -ne 'BEGIN{my@t=(localtime)[5,4,3];$$t[0]+=1900;$$t[1]++;$$t=sprintf"%04d-%02d-%02d",@t}' \
127                 -e '$$ok++,exit if /^$$t\s/; END{die "Alert: did not find <$$t> in Changes file" unless $$ok}' Changes
129 verify-no-subdir:
130         @$(PERL) -e 'my$$s=join",",grep{!/^($(OKDIRS))\z/x&&-d($$_)}glob"*";' \
131                 -e 'die"unexpected dir:$$s"if$$s'
133 the-release-name :
134         $(NOECHO) $(ECHO) 'version ' $(VERSION)
135         $(NOECHO) $(ECHO) 'release-name ' $(DISTVNAME).tar$(SUFFIX)
137 release :: disttest
138         git tag -m 'This is $(VERSION)' $(VERSION)
139         ls -l $(DISTVNAME).tar$(SUFFIX)
140         rm -rf $(DISTVNAME)
142 sign:
143         cpansign -s
145   join "", @m;
148 sub dist_test {
149   return q{
150 # if we depend on $(DISTVNAME).tar$(SUFFIX), then the rest of the
151 # Makefile breaks our intent to NOT remake dist
152 disttest :
153         rm -rf $(DISTVNAME)
154         tar xvjf $(DISTVNAME).tar$(SUFFIX)
155         cd $(DISTVNAME) && $(ABSPERLRUN) Makefile.PL
156         cd $(DISTVNAME) && $(MAKE) $(PASTHRU)
157         cd $(DISTVNAME) && $(MAKE) test $(PASTHRU)
159 distdir ::
160         touch $(DISTVNAME)/SIGNATURE && $(CP) $(DISTVNAME)/SIGNATURE ./SIGNATURE
161         $(CP) $(DISTVNAME)/META.yml  ./META.yml
162         $(CP) $(DISTVNAME)/MANIFEST  ./MANIFEST
167 sub distdir {
168   my $self = shift;
169   my $out = $self->SUPER::distdir;
170   $out =~ s/distdir :/distdir ::/g;
171   return $out;
174 # dist_dir was the name in very old MakeMaker as of 5.005_04
175 sub dist_dir {
176   my $self = shift;
177   my $out = $self->SUPER::dist_dir;
178   $out =~ s/distdir :/distdir ::/g;
179   return $out;