account for coderefs partially
[dbsrgits/DBIx-Class.git] / maint / Makefile.PL.inc / 29_handle_version.pl
CommitLineData
acdfdae0 1
2my $dbic_ver_re = qr/ (\d) \. (\d{2}) (\d{3}) (?: _ (\d{2}) )? /x; # not anchored!!!
3
4my $version_string = Meta->version;
5my $version_value = eval $version_string;
6
7my ($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
15if ($v_maj != 0 or $v_min > 8) {
16 die "Illegal version $version_string - we are still in the 0.08 cycle\n"
17}
18
9ff52272 19if ($v_point >= 300) {
20 die "Illegal version $version_string - we are still in the 0.082xx cycle\n"
21}
acdfdae0 22
9ff52272 23Meta->makemaker_args->{DISTVNAME} = Meta->name . "-$version_string-TRIAL" if (
9ff52272 24 # all odd releases *after* 0.08200 generate a -TRIAL, no exceptions
25 ( $v_point > 200 and int($v_point / 100) % 2 )
26);
acdfdae0 27
28
29my $tags = { map { chomp $_; $_ => 1} `git tag` };
30# git may not be available
31if (keys %$tags) {
32 my $shipped_versions;
33 my $shipped_dev_versions;
34
35 for (keys %$tags) {
36 if ($_ =~ /^v$dbic_ver_re$/) {
37 if (defined $4) {
38 $shipped_dev_versions->{"$1.$2$3$4"} = 1;
39 }
40 else {
41 $shipped_versions->{"$1.$2$3"} = 1;
42 }
43 delete $tags->{$_};
44 }
45 }
46
47 die sprintf "Tags in unknown format found: %s\n", join ', ', keys %$tags
48 if keys %$tags;
49}
50
51# keep the Makefile.PL eval happy
521;