8 use File::Temp qw(tempfile);
11 my $BRANCH_PATTERN = qr/^
12 (?<base>(?<name>exim)-
16 )(?:_(?<security>\d+))?
19 sub trim { return join '', shift =~ /^\s*(.*?)\s*$/; }
21 my %o = (edit => 1, dotted => 1, force => 0, auto => 0);
28 'help|h' => sub { pod2usage(-verbose => 1, -exit => 0) },
33 -noperldoc => system('perldoc -V >/dev/null 2>&1')
38 my $branch = trim `git rev-parse --abbrev-ref HEAD`; # exim-4_90+fixes
39 die "$0: Branch `$branch` does not match `$BRANCH_PATTERN`"
40 unless "$branch" =~ /$BRANCH_PATTERN/;
43 my $base = $+{base}; # exim-4_90 (branch base)
45 my $release_legacy = $+{version} . ($+{security} // '_0'); # 4.90_0
46 my $release_dotted = join '.', $+{major}, $+{minor}, $+{security} // 0; # 4.90.0
48 my $distance = trim `git rev-list --count $base..`;
50 my $micro_legacy = "${release_legacy}_$distance"; # 4_90_0_20
51 my $micro_dotted = "${release_dotted}.$distance"; # 4.90.0.20
53 my $tag = "$name-" . ($o{dotted} ? $micro_dotted : $micro_legacy);
55 # my $commit = trim `git show --no-patch --pretty=format:%h`;
57 my ($fh, $filename) = tempfile();
59 Exim fixup release $micro_dotted
60 # Enter a one line tag description. The above is the sensible default.
65 defined $ENV{VISUAL} ? $ENV{VISUAL}
66 : defined $ENV{EDITOR} ? $ENV{EDITOR}
73 print "Commit tag `$tag` to local repository? [Y/n] ";
74 exit 0 unless <STDIN> =~ /^y(?:es)?|$/i;
79 '--sign', ($o{force} ? '--force' : ()),
92 micro-release - tag the current commit on a +fixes branch
96 micro-release [--[no]-edit] [--[no]-dotted] [--force] [TAG]
100 This tools is for internal use only. It tags the current commit
101 of a F<+fixes> branch as a "micro release".
103 The tag is taken from the command line parameter I<TAG> or is calculated from the
104 branch name and the distance to the release tag. The branch name needs
105 to match the branch tag.
107 branch tag: exim-4_90
108 branch name: exim-4_90+fixes
109 resulting tag: exim-4.90.0.<distance> (dotted version)
110 exim-4_90_0_<distance> (classic version)
112 branch tag: exim-4_90_1 (security release)
113 branch name: exim-4_90_1+fixes
114 resulting tag: exim-4.90.1.<distance> (dotted version)
115 exim-4_90_1_<distance> (classic version)
117 The tag will be GPG signed.
125 Spawn or do not spawn an editor. The default message will be "Exim
126 <tagname> fixup release".
130 Generate a dotted tag name. (default: on)
134 (Re)Move an existing tag name. Use with care!
136 =item B<-h>|B<--help>