File: 29_handle_version.pl

package info (click to toggle)
libdbix-class-perl 0.082844-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,320 kB
  • sloc: perl: 27,215; sql: 322; sh: 29; makefile: 16
file content (50 lines) | stat: -rw-r--r-- 1,375 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

my $dbic_ver_re = qr/ 0 \. (\d{2}) (\d{2}) (\d{2}) (?: _ (\d{2}) )? /x; # not anchored!!!

my $version_string = Meta->version;
my $version_value = eval $version_string;

my ($v_maj, $v_min, $v_point, $v_dev) = $version_string =~ /^$dbic_ver_re$/
  or die sprintf (
    "Invalid version %s (as specified in %s)\nCurrently valid version formats are 0.MMVVPP or 0.MMVVPP_DD\n",
    $version_string,
    Meta->{values}{version_from} || Meta->{values}{all_from} || 'Makefile.PL',
  )
;

if ($v_maj > 8) {
  die "Illegal version $version_string - we are still in the 0.08 cycle\n"
}

Meta->makemaker_args->{DISTVNAME} = Meta->name . "-$version_string-TRIAL" if (
  # all odd releases *after* 0.089x generate a -TRIAL, no exceptions
  ( $v_point > 89 )
);


my $tags = { map { chomp $_; $_ => 1} `git tag` };
# git may not be available
if (keys %$tags) {
  my $shipped_versions;
  my $shipped_dev_versions;

  my $legacy_re = qr/^ v 0 \. (\d{2}) (\d{2}) (\d) (?: _ (\d{2}) )? $/x;

  for (keys %$tags) {
    if ($_ =~ /^v$dbic_ver_re$/ or $_ =~ $legacy_re ) {
      if (defined $4) {
        $shipped_dev_versions->{"0.$1$2$3$4"} = 1;
      }
      else {
        $shipped_versions->{"0.$1$2$3"} = 1;
      }
      delete $tags->{$_};
    }
  }

  die sprintf "Tags in unknown format found: %s\n", join ', ', keys %$tags
    if keys %$tags;
}

# keep the Makefile.PL eval happy
1;