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 # check if the tag already exists
57 `git rev-parse --quiet --verify '$tag'`; # ignore stdout
58 die "$0: tag '$tag' exists already\n" if $? == 0;
61 my ($fh, $filename) = tempfile();
63 Exim fixup release $micro_dotted
64 # Enter a one line tag description. The above is the sensible default.
69 defined $ENV{VISUAL} ? $ENV{VISUAL}
70 : defined $ENV{EDITOR} ? $ENV{EDITOR}
77 print "Commit tag `$tag` to local repository? [Y/n] ";
78 exit 0 unless <STDIN> =~ /^(:?y(?:es)?|)$/i;
83 '--sign', ($o{force} ? '--force' : ()),
95 say "\nDo not forget to `git push --follow-tags ...` now."
101 tag-fixes-release - tag the current commit on a +fixes branch
105 tag-fixes-release [--[no]-edit] [--[no]-dotted] [--force]
109 This B<tag-fixes-release> tools is for internal use only. It tags the
110 current commit of a F<+fixes> branch as a "micro release".
112 The tag is calculated from the branch name and the distance to the
113 branch tag. The branch name needs to match the branch tag.
115 branch tag: exim-4_90
116 branch name: exim-4_90+fixes
117 resulting tag: exim-4.90.0.<distance> (dotted version)
118 exim-4_90_0_<distance> (classic version)
120 branch tag: exim-4_90_1 (security release)
121 branch name: exim-4_90_1+fixes
122 resulting tag: exim-4.90.1.<distance> (dotted version)
123 exim-4_90_1_<distance> (classic version)
125 The tag will be GPG signed.
133 Spawn or do not spawn an editor. The default message will be "Exim
134 <tagname> fixup release".
138 Generate a dotted tag name. (default: on)
142 (Re)Move an existing tag name. Use with care!
144 =item B<-h>|B<--help>