added tests for RT#63709
[dbsrgits/DBIx-Class.git] / maint / Makefile.PL.inc / 29_handle_version.pl
CommitLineData
acdfdae0 1
e56f8014 2my $dbic_ver_re = qr/ 0 \. (\d{2}) (\d{2}) (\d{2}) (?: _ (\d{2}) )? /x; # not anchored!!!
acdfdae0 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 (
e56f8014 9 "Invalid version %s (as specified in %s)\nCurrently valid version formats are 0.MMVVPP or 0.MMVVPP_DD\n",
acdfdae0 10 $version_string,
11 Meta->{values}{version_from} || Meta->{values}{all_from} || 'Makefile.PL',
12 )
13;
14
e56f8014 15if ($v_maj > 8) {
acdfdae0 16 die "Illegal version $version_string - we are still in the 0.08 cycle\n"
17}
18
9ff52272 19Meta->makemaker_args->{DISTVNAME} = Meta->name . "-$version_string-TRIAL" if (
e56f8014 20 # all odd releases *after* 0.089x generate a -TRIAL, no exceptions
21 ( $v_point > 89 )
9ff52272 22);
acdfdae0 23
24
25my $tags = { map { chomp $_; $_ => 1} `git tag` };
26# git may not be available
27if (keys %$tags) {
28 my $shipped_versions;
29 my $shipped_dev_versions;
30
e56f8014 31 my $legacy_re = qr/^ v 0 \. (\d{2}) (\d{2}) (\d) (?: _ (\d{2}) )? $/x;
32
acdfdae0 33 for (keys %$tags) {
e56f8014 34 if ($_ =~ /^v$dbic_ver_re$/ or $_ =~ $legacy_re ) {
acdfdae0 35 if (defined $4) {
e56f8014 36 $shipped_dev_versions->{"0.$1$2$3$4"} = 1;
acdfdae0 37 }
38 else {
e56f8014 39 $shipped_versions->{"0.$1$2$3"} = 1;
acdfdae0 40 }
41 delete $tags->{$_};
42 }
43 }
44
45 die sprintf "Tags in unknown format found: %s\n", join ', ', keys %$tags
46 if keys %$tags;
47}
48
49# keep the Makefile.PL eval happy
501;