EXPERIMENTAL Release 0.08240
[dbsrgits/DBIx-Class.git] / maint / Makefile.PL.inc / 29_handle_version.pl
1
2 my $dbic_ver_re = qr/ (\d) \. (\d{2}) (\d{3}) (?: _ (\d{2}) )? /x; # not anchored!!!
3
4 my $version_string = Meta->version;
5 my $version_value = eval $version_string;
6
7 my ($v_maj, $v_min, $v_point, $v_dev) = $version_string =~ /^$dbic_ver_re$/
8   or die sprintf (
9     "Invalid version %s (as specified in %s)\nCurrently valid version formats are M.VVPPP or M.VVPPP_DD\n",
10     $version_string,
11     Meta->{values}{version_from} || Meta->{values}{all_from} || 'Makefile.PL',
12   )
13 ;
14
15 if ($v_maj != 0 or $v_min > 8) {
16   die "Illegal version $version_string - we are still in the 0.08 cycle\n"
17 }
18
19 if ($v_point >= 300) {
20   die "Illegal version $version_string - we are still in the 0.082xx cycle\n"
21 }
22
23 Meta->makemaker_args->{DISTVNAME} = Meta->name . "-$version_string-TRIAL" if (
24   # 0.08240 ~ 0.08249 shall be TRIALs for the collapser rewrite
25   ( $v_point >= 240  and $v_point <= 249 )
26     or
27   # all odd releases *after* 0.08200 generate a -TRIAL, no exceptions
28   ( $v_point > 200 and int($v_point / 100) % 2 )
29 );
30
31
32 my $tags = { map { chomp $_; $_ => 1} `git tag` };
33 # git may not be available
34 if (keys %$tags) {
35   my $shipped_versions;
36   my $shipped_dev_versions;
37
38   for (keys %$tags) {
39     if ($_ =~ /^v$dbic_ver_re$/) {
40       if (defined $4) {
41         $shipped_dev_versions->{"$1.$2$3$4"} = 1;
42       }
43       else {
44         $shipped_versions->{"$1.$2$3"} = 1;
45       }
46       delete $tags->{$_};
47     }
48   }
49
50   die sprintf "Tags in unknown format found: %s\n", join ', ', keys %$tags
51     if keys %$tags;
52 }
53
54 # keep the Makefile.PL eval happy
55 1;