Copyright updates:
[exim.git] / release-process / scripts / mk_exim_release
1 #!/usr/bin/env perl
2 # Copyright (c) The Exim Maintainers 2016 - 2023
3
4 use strict;
5 use warnings;
6 use Carp;
7 use Cwd qw'abs_path';
8 use File::Basename;
9 use File::Path qw(make_path remove_tree);
10 use File::Temp;
11 use Getopt::Long;
12 use IO::File;
13 use Pod::Usage;
14 use Digest::SHA;
15 use feature 'state';
16 use if $ENV{DEBUG} => 'Smart::Comments';
17
18 my $ME = basename $0;
19
20
21 my $debug   = undef;
22 my $verbose = 0;
23
24 # MAJOR.MINOR[.SECURITY[.FIXES]][-RCX]
25 # 4    .90    .0        .22      -RC1
26 my $version_pattern = qr/
27     (?<release>
28     (?<target_release>
29            (?<major>\d)         # 4
30          \.(?<minor>\d+)        #  .90 or .105
31       (?:\.(?<security>\d+)     #     .0
32       (?:\.(?<fixes>)\d+)?)?    #       .22
33     )                           # target-release ->|
34        (?:-(?<rc>RC\d+)?)?      #          -RC1
35     )
36 /x;
37
38 my $quick_version_pattern = qr/
39    (?<release>
40    (?<last_tag>
41            (?<major>\d)         # 4
42          \.(?<minor>\d+)        #  .90 or .105
43       (?:\.(?<security>\d+)     #     .0
44       (?:\.(?<fixes>)\d+)?)?    #       .22
45    )                            # last-tag ->|
46        (?:-(?<quick>\d+-g[[:xdigit:]]+))?     #  -3-gdeadbef
47     )
48 /x;
49
50 # ------------------------------------------------------------------
51
52 package Context {
53     use strict;     # not strictly necessary yet, until in an own package
54     use warnings;   # not strictly necessary yet, ...
55     use File::Spec::Functions qw'splitpath catfile catdir splitdir';
56     use File::Path qw'make_path remove_tree';
57     use File::Copy;
58     use Cwd qw'abs_path';
59     use Carp;
60
61     package PWD {
62         use Cwd;
63         sub TIESCALAR { bless do {\my $x} }
64         sub FETCH { cwd }
65     }
66
67     tie my $cwd => 'PWD' or die;    # this returns the current dir now, dynamically
68
69     sub new {
70         my $class = shift;
71         return bless { @_ } => $class;
72     }
73
74     sub check_version {
75         my $context = shift;
76         my $version = shift // 'HEAD';
77
78         #
79         # v => {
80         #   release =>                   4.92-RC4 |    4.92-27-gabcdef
81         #   target_release|last_tag =>   4.92     |    4.92
82         #
83         #   major    =>  4
84         #   minor    =>  92
85         #   security =>
86         #   fixes    =>
87         #
88         #   rc|quick =>   RC4 | 27-gabcdef
89         #   }
90
91         #
92         # v => {
93         #   release =>                   4.92-RC4 |    4.92-27-gabcdef-dirty
94         #   target_release|last_tag =>   4.92     |    4.92
95         #
96         #   major    =>  4
97         #   minor    =>  92
98         #   security =>
99         #   fixes    =>
100         #
101         #   rc|quick =>   RC4 | 27-gabcdef-dirty
102         #   }
103
104         if ($context->{quick}) {
105             # Try to find suitable version description
106             chomp(my $describe = do {   # we wrap it into a open() to avoid hassle with
107                 open(my $fh, '-|',      # strange version descriptions
108                     'git', describe => $version) or die;
109                 <$fh>
110                 } // exit 1);
111             $describe =~ /$quick_version_pattern/;
112
113             %{$context->{v}} = %+;
114             ($context->{commit}) = $version // ($context->{v}{quick} =~ /g([[:xdigit:]]+)/);
115         }
116         else {
117             croak "The given version number does not look right - $version"
118                 if not $version =~ /$version_pattern/;
119             %{$context->{v}} = %+;
120
121             # find a valid vcs tag matching the version
122             my $pattern = "$context->{pkgname}-$context->{v}{release}" =~ s/[-_.]/[-_.]/gr;
123             chomp(my @tags = qx{git tag --list '$pattern'});
124
125             croak "The given version is ambigous, tags: @tags\n" if @tags > 1;
126             croak "The given version does not exist (no such tag: exim-$version)\n" if @tags == 0;
127
128             $context->{commit} = $tags[0];
129             # target_release: the release we aim to reach with release candidates
130             # FIXME: re-construct from the parsed version number
131         }
132
133         die "$ME: This script doesn't work for versions prior 4.92-RCx. "
134            ."Please checkout an older version.\n"
135             if $context->{v}{major} < 4
136             or $context->{v}{major} == 4 && $context->{v}{minor} < 92;
137
138         ### v: $context->{v}
139
140     }
141
142
143     # We prefer gtar to tar if gtar exists in $PATH
144     sub override_tar_cmd {
145         my $context = shift;
146         my $tar = $context->{tar_cmd};
147
148         return unless $tar eq 'tar';
149
150         foreach my $d (File::Spec->path()) {
151             my $p = catfile($d, 'gtar');
152             if (-x $p) {
153                 $context->{tar_cmd} = $p;
154                 print "Switched tar command to: $p\n" if $verbose;
155                 return;
156             }
157         }
158     }
159
160     sub prepare_working_directory {
161         my $context = shift;
162         my $workspace = $context->{workspace};
163
164         if (not defined $workspace) {
165             $workspace = $context->{workspace} = File::Temp->newdir(
166                 TEMPLATE => File::Spec->tmpdir . '/exim-packaging-XXXX',
167                 CLEANUP  => $context->{cleanup});
168         }
169         else {
170             # ensure the working directory is not in place
171             if (-e $workspace) {
172                 if ($context->{delete}) {
173                     print "Deleting existing $workspace\n" if $verbose;
174                     remove_tree $workspace, { verbose => $verbose || $debug };
175                 }
176                 else {
177                     croak "Working directory $workspace exists" if -e $workspace;
178                 }
179             }
180
181             # create base directory
182             make_path( $context->{directory}, { verbose => $verbose || $debug } );
183         }
184
185         # Set(!) and create subdirectories
186         foreach (qw(vcs_export pkg_tars pkg_trees tmp)) {   # {dookbook}
187             make_path(
188                 $context->{d}{$_} = catdir($workspace, $_),
189                 { verbose => $verbose || $debug });
190         }
191     }
192
193     sub export_git_tree {
194         my $context = shift;
195
196         # build git command
197         my $archive_file = $context->{tmp_archive_file} = sprintf'%s/%s-%s.tar', $context->{d}{tmp}, $context->{pkgname}, $context->{v}{release};
198         ### $archive_file
199         my @cmd = ( 'git', 'archive', '--format=tar', "--output=$archive_file", $context->{commit} );
200         ### @cmd
201         # run git command
202         print "[$cwd] Running: @cmd\n" if $verbose;
203         0 == system @cmd or croak "Export failed";
204     }
205
206     sub unpack_tree {
207         # TODO: Why can't we combine the export_git_tree with the
208         # unpack_tree function?
209         my $context = shift;
210
211         ### $context
212         die "Cannot see archive file\n" unless -f $context->{tmp_archive_file};
213         my @cmd = ('tar',
214             xf => $context->{tmp_archive_file},
215             -C => $context->{d}{vcs_export} );
216
217         # run  command
218         print "[$cwd] Running: @cmd\n" if $verbose;
219         system @cmd and croak "Unpack failed\n";
220
221     }
222
223     sub make_version_script {
224         my $context = shift;
225
226         #my $variant = substr( $context->{v}{release}, length($context->{v}{target_release}) );
227         #if ( $context->{v}{release} ne $context->{v}{target_release} . $variant ) {
228         #    die "Broken version numbering, I'm buggy";
229         #}
230
231
232         # Work
233         if (not my $pid = fork // die "$ME: Cannot fork: $!\n") {
234
235             my $source_tree    = catdir($context->{d}{vcs_export}, 'src', 'src');
236             ### $source_tree
237
238             chdir $source_tree or die "chdir $source_tree: $!\n";
239
240             croak "WARNING: version.sh already exists - leaving it in place\n"
241                 if -f 'version.sh';
242
243             # Currently (25. Feb. 2016) the mk_exim_release.pl up to now can't
244             # deal with security releases.!? So we need a current
245             # mk_exim_release.pl. But if we use a current (master), the
246             # reversion script returns wrong version info (it's running inside
247             # the Git tree and uses git --describe, which always returns the
248             # current version of master.) I do not want to change the old
249             # reversion scripts (in 4.86.1, 4.85.1).
250             #
251             # Thus we've to provide the version.sh, based on the info we have
252             # about the release. If reversion finds this, it doesn't try to find
253             # it's own way to get a valid version number from the git.
254             #
255             # 4.89 series: the logic here did not handle _RC<N> thus breaking RC
256             # status in versions.  nb: rc in context should be same as $variant
257             # in local context.
258
259             #my $stamp = $context->{minor} ? '_'.$context->{minor} : '';
260             #$stamp .= $context->{rc} if $context->{rc};
261             my $release = $context->{quick} ? $context->{v}{last_tag}
262                                             : $context->{v}{target_release};
263
264             my $variant =
265                   $context->{v}{rc} ? $context->{v}{rc}
266                 : $context->{v}{quick} ? $context->{v}{quick}
267                 : '';
268
269             print "[$cwd] create version.sh\n" if $verbose;
270             open(my $v, '>', 'version.sh') or die "Can't open version.sh for writing: $!\n";
271             print {$v} <<__;
272 # initial version automatically generated by $0
273 EXIM_RELEASE_VERSION=$release
274 EXIM_VARIANT_VERSION=$variant
275 EXIM_COMPILE_NUMBER=0
276 # echo "[[[ \$EXIM_RELEASE_VERSION | \$EXIM_VARIANT_VERSION | \$EXIM_COMPILE_NUMBER ]]]"
277 __
278             close $v  or die "$0: Can not close $source_tree/version.h: $!\n";
279             unlink 'version.h' or die "$ME: Can not unlink $source_tree/version.h: $!\n"
280                 if -f 'version.h';
281
282             # Later, if we get the reversion script fixed, we can call it again.
283             # For now (25. Feb. 2016) we'll leave it unused.
284             #my @cmd = ('../scripts/reversion', 'release', $context->{commit});
285
286             my @cmd = ('../scripts/reversion', 'release');
287             print "[$cwd] Running: @cmd\n" if $verbose;
288             system(@cmd) and croak "reversion failed";
289
290             die "$ME: failed to create version.sh"
291                 unless -f 'version.sh';
292
293             exit 0;
294         }
295         else {
296             $pid == waitpid($pid, 0) or die "$0: waidpid: $!\n";
297             exit $? >> 8 if $?;
298         }
299     }
300
301     sub build_documentation {
302         my $context = shift;
303         my $docdir = catdir $context->{d}{vcs_export}, 'doc', 'doc-docbook';
304
305         # documentation building does a chdir, so we'll do it in a
306         # subprocess
307         if (not my $pid = fork // die "$ME: Can't fork: $!\n") {
308             chdir $docdir or die "$ME: Can't chdir to $docdir: $!\n";
309             system('./OS-Fixups') == 0 or exit $?;
310             exec $context->{make_cmd},
311                 "EXIM_VER=$context->{v}{release}", 'everything'
312                 or die "$ME: [$cwd] Cannot exec $context->{make_cmd}: $!\n";
313         }
314         else {
315             waitpid($pid, 0);
316             exit $? >> 8 if $?;
317         }
318
319         $context->copy_docbook_files;
320     }
321
322     sub copy_docbook_files {
323         my $context = shift;
324
325         # where the generated docbook files can be found
326         my $docdir = catdir $context->{d}{vcs_export}, 'doc', 'doc-docbook';
327
328         foreach ('spec.xml', 'filter.xml') {
329             my $from = catfile $docdir, $_;
330             my $to = catdir $context->{d}{tmp}; # {dookbook}
331             copy $from => $to    or die $@;
332         }
333     }
334
335     sub build_html_documentation {
336         my $context = shift;
337
338         # where the website docbook source dir is - push the generated
339         # files there
340         {
341             my $webdir = catdir $context->{website_base}, 'docbook', $context->{v}{target_release};
342             make_path $webdir, { verbose => $verbose || $debug };
343             copy catfile($context->{d}{vcs_export}, 'doc', 'doc-docbook', $_)
344                 => $webdir or die $@
345                 for 'spec.xml', 'filter.xml';
346         }
347
348         my $gen    = catfile $context->{website_base}, 'script/gen';
349         my $outdir = catdir $context->{d}{pkg_trees}, "exim-html-$context->{v}{release}";
350
351         make_path $outdir, { verbose => $verbose || $debug };
352
353         my @cmd = (
354             $gen,
355             '--spec'    => catfile($context->{d}{tmp}, 'spec.xml'),     # {dookbook}
356             '--filter'  => catfile($context->{d}{tmp}, 'filter.xml'),   # {dookbok}
357             '--latest'  => $context->{v}{target_release},
358             '--docroot' => $outdir,
359             '--localstatic',
360             ($verbose || $debug ? '--verbose' : ()),
361         );
362
363         print "[$cwd] Executing @cmd\n";
364         0 == system @cmd or exit $? >> 8;
365
366     }
367
368     sub sign {
369         my $context = shift;
370         foreach my $tar (glob "$context->{d}{pkg_tars}/*") {
371             system gpg =>
372             '--quiet', '--batch',
373             defined $context->{gpg}{key}
374                 ? ('--local-user' => $context->{gpg}{key})
375                 : (),
376             '--detach-sig', '--armor', $tar;
377         }
378     }
379
380     sub move_to_outdir {
381         my $context = shift;
382         make_path $context->{OUTDIR}, { verbose => $verbose || $debug };
383         move $_ => $context->{OUTDIR} or die $@
384             for glob "$context->{d}{pkg_tars}/*";
385     }
386
387     sub build_src_package_directory {
388         my $context = shift;
389
390         # build the exim package directory path
391         $context->{d}{src} = catdir $context->{d}{pkg_trees}, "exim-$context->{v}{release}";
392
393         # initially we move the exim-src directory to the new directory name
394         move
395             catdir( $context->{d}{vcs_export}, 'src')
396             => $context->{d}{src}
397         or croak "Move of src dir failed - $!";
398
399         # add Local subdirectory
400         make_path( catdir( $context->{d}{src}, 'Local' ), { verbose => $verbose || $debug } );
401
402         # now add the text docs
403         $context->move_text_docs_into_pkg;
404     }
405
406     sub build_doc_packages_directory {
407         my $context = shift;
408
409         ##foreach my $format (qw/pdf postscript texinfo info/) {
410         foreach my $format (qw/pdf postscript/) {
411             my $target = catdir $context->{d}{pkg_trees}, "exim-$format-$context->{v}{release}", 'doc';
412             make_path( $target, { verbose => $verbose || $debug } );
413
414             # move documents across
415             foreach my $file (
416                 glob(
417                     catfile(
418                         $context->{d}{vcs_export},
419                         'doc',
420                         'doc-docbook',
421                         (
422                             ( $format eq 'postscript' )
423                             ? '*.ps'
424                             : ( '*.' . $format )
425                         )
426                     )
427                 )
428             )
429             {
430                 move( $file, catfile( $target, ( splitpath($file) )[2] ) );
431             }
432         }
433     }
434
435     sub move_text_docs_into_pkg {
436         my $context = shift;
437
438         my $old_docdir = catdir( $context->{d}{vcs_export}, 'doc', 'doc-docbook' );
439         my $old_txtdir = catdir( $context->{d}{vcs_export}, 'doc', 'doc-txt' );
440         my $new_docdir = catdir( $context->{d}{src}, 'doc' );
441         make_path( $new_docdir, { verbose => $verbose || $debug } );
442
443         # move generated documents from docbook stuff
444         foreach my $file (qw/exim.8 spec.txt filter.txt/) {
445             die "Empty file \"$file\"\n" if -z catfile( $old_docdir, $file );
446             move( catfile( $old_docdir, $file ), catfile( $new_docdir, $file ) );
447         }
448
449         # move text documents across
450         foreach my $file ( glob( catfile( $old_txtdir, '*' ) ) ) {
451
452             # skip a few we dont want
453             my $fn = ( splitpath($file) )[2];
454             next
455             if ( ( $fn eq 'ABOUT' )
456                 || ( $fn eq 'ChangeLog.0' )
457                 || ( $fn eq 'test-harness.txt' )
458                 # Debian issue re licensing of RFCs
459                 || ( $fn =~ /^draft-ietf-.*/ )
460                 || ( $fn =~ /^rfc.*/ )
461                 );
462             move( $file, catfile( $new_docdir, $fn ) );
463         }
464     }
465
466     sub create_tar_files {
467         my $context = shift;
468
469         my $pkg_tars    = $context->{d}{pkg_tars};
470         my $pkg_trees = $context->{d}{pkg_trees};
471         my $tar     = $context->{tar_cmd};
472         if ($verbose) {
473             foreach my $c (keys %{ $context->{compressors} }) {
474                 print "Compression: $c\t$context->{compressors}{$c}\n";
475             }
476         }
477
478         # We ideally do not want local system user information in release tarballs;
479         # those are artifacts of use of tar for backups and have no place in
480         # software release packaging; if someone extracts as root, then they should
481         # get sane file ownerships.
482         my @ownership = (
483             '--owner' => $context->{tar_perms}{user},
484             '--group' => $context->{tar_perms}{group},
485             # on this GNU tar, --numeric-owner works during creation too
486             '--numeric-owner'
487         ) if qx/tar --help 2>&1/ =~ /^\s*--owner=/m;
488
489         # See also environment variables set in main, tuning compression levels
490
491         my (%size, %sha256, %sha512);
492
493         foreach my $dir ( glob( catdir( $pkg_trees, ( 'exim*-' . $context->{v}{release} ) ) ) ) {
494             my $dirname = ( splitdir($dir) )[-1];
495             foreach my $comp (keys %{$context->{compressors}}) {
496                 my %compressor = %{$context->{compressors}{$comp}};
497                 next unless $compressor{use};
498
499                 my $basename = "$dirname.tar.$compressor{extension}";
500                 my $outfile = catfile $pkg_tars, $basename;
501
502                 print "Creating: $outfile\n" if $verbose || $debug;
503                 0 == system($tar,
504                     cf => $outfile,
505                         $compressor{flags},
506                         @ownership, -C => $pkg_trees, $dirname)
507                     or exit $? >> 8;
508
509                 # calculate size and md5sum
510                 $size{$basename} = -s $outfile;
511                 $sha256{$basename} = Digest::SHA->new(256)->addfile($outfile)->hexdigest;
512                 $sha512{$basename} = Digest::SHA->new(512)->addfile($outfile)->hexdigest;
513             }
514         }
515
516         # write the sizes file
517         if ($context->{sizes}) {
518             for ([ sizes => 'SIZE' => \%size ],
519                  [ sha256sums => 'SHA256' => \%sha256 ],
520                  [ sha512sums => 'SHA512' => \%sha512 ]) {
521
522                 my $outfile = catfile $pkg_tars, "00-$_->[0].txt";
523                 my $tag = $_->[1];
524                 my $sizes = $_->[2];
525
526                 open my $out, '>', $outfile
527                     or die "$ME: Can't open `$outfile': $!\n";
528
529                 print $out join "\n",
530                     (map { "$tag ($_) = $sizes->{$_}" } sort keys %$sizes),
531                     '';
532
533                 close($out) or die "$ME: Can't close $outfile: $!\n";
534             }
535         }
536     }
537
538     sub do_cleanup {
539         my $context = shift;
540
541         print "Cleaning up\n" if $verbose;
542         remove_tree $context->{d}{tmp}, { verbose => $verbose || $debug };
543     }
544
545 }
546
547 # Check, if tar understands --use-compress-program and use this, as
548 # at least gzip deprecated passing options via the environment.
549 sub compressor {
550     my ($compressor, $fallback) = @_;
551     state $use_compress_option  =
552         0 == system("tar c -f /dev/null -C / --use-compress-program=cat dev/null 2>/dev/null");
553     return $use_compress_option
554         ? "--use-compress-program=$compressor"
555         : ref $fallback eq ref sub {} ? $fallback->() : $fallback;
556 }
557
558 MAIN: {
559
560     # some of these settings are useful only if we're in the
561     # exim-projekt-root, but the check, if we're, is deferred
562     my $context = Context->new(
563         pkgname     => 'exim',
564         website_base => abs_path('../exim-website'),
565         tar_cmd     => 'tar',
566         tar_perms   => {
567                 user    => '0',
568                 group   => '0',
569         },
570         make_cmd    => 'make',  # for 'make'ing the docs
571         sizes       => 1,
572         compressors => {
573             gzip  => { use => 1, extension => 'gz',  flags => compressor('gzip -9', sub { $ENV{GZIP} = '-9'; '--gzip' }) },
574             bzip2 => { use => 1, extension => 'bz2', flags => compressor('bzip2 -9', sub { $ENV{BZIP2} = '-9'; '--bzip2' }) },
575             xz    => { use => 1, extension => 'xz',  flags => compressor('xz -9', sub { $ENV{XZ_OPT} = '-9'; '--xz' }) },
576             lzip  => { use => 0, extension => 'lz',  flags => compressor('lzip -9', '--lzip') },
577         },
578         docs         => 1,
579         web          => 1,
580         delete       => 0,
581         cleanup      => 1,
582         gpg => {
583             sign         => 1,
584             key          => undef,
585         },
586         quick => 0,
587     );
588
589     ##$ENV{'PATH'} = '/opt/local/bin:' . $ENV{'PATH'};
590
591     GetOptions(
592         $context,
593         qw(workspace|tmp=s website_base|webgen_base=s tar_cmd|tar-cmd=s make_cmd|make-cmd=s
594            docs|build-docs! web|build-web! sizes!
595            delete! cleanup! quick|quick-release! minimal),
596         'sign!'         => \$context->{gpg}{sign},
597         'key=s'         => \$context->{gpg}{key},
598         'verbose!'      => \$verbose,
599         'compressors=s@' => sub {
600             die "$0: can't parse compressors string `$_[1]'\n" unless $_[1] =~ /^[+=-]?\w+(?:[+=-]\w+)*$/;
601             while ($_[1] =~ /(?<act>[+=-])?(?<name>\w+)\b/g) {
602                 die "$0: Unknown compressor $+{name}"
603                     unless $context->{compressors}{$+{name}};
604                 if (not defined $+{act} or $+{act} eq '=') {
605                     $_->{use} = 0
606                         for values %{$context->{compressors}};
607                     $context->{compressors}{$+{name}}{use}++;
608                 }
609                 elsif ($+{act} eq '+') { $context->{compressors}{$+{name}}{use}++; }
610                 elsif ($+{act} eq '-') { $context->{compressors}{$+{name}}{use}--; }
611             }
612         },
613         'debug:s'       => \$debug,
614         'quick'         => sub { $context->{web}--; $context->{quick} = 1 },
615         'help|?'        => sub { pod2usage(-verbose => 1, -exit => 0) },
616         'man!'          => sub { pod2usage(-verbose => 2, -exit => 0, -noperldoc => system('perldoc -V >/dev/null 2>&1')) },
617     ) and (@ARGV == 2 or ($context->{quick} and @ARGV >= 1))
618         or pod2usage;
619
620     -f '.exim-project-root'
621         or die "$ME: please call this script from the root of the Exim project sources\n";
622
623     $context->{OUTDIR} = pop @ARGV;
624
625     if ($context->{gpg}{sign}) {
626         $context->{gpg}{key} //= do { chomp($_ = qx/git config user.signingkey/); $_ }
627             || $ENV{EXIM_KEY}
628             || do {
629                 warn "$ME: No GPG key, using default\n";
630                 undef;
631             }
632     }
633
634
635     warn "$ME: changed umask to 022\n" if umask(022) != 022;
636
637     $context->check_version(shift); # may be undef for a quick release
638
639     if ($debug//'' eq 'version') {
640         for (sort keys %{$context->{v}}) {
641             print "version $_: $context->{v}{$_}\n";
642         }
643         print "git commit: $context->{commit}\n";
644         exit 0;
645     }
646     $context->override_tar_cmd;
647     $context->prepare_working_directory;
648     $context->export_git_tree;
649     $context->unpack_tree;
650     $context->make_version_script;
651
652     $context->build_documentation if $context->{docs};
653     $context->build_html_documentation if $context->{docs} && $context->{web};
654
655     $context->build_src_package_directory;
656     $context->build_doc_packages_directory if $context->{docs};
657
658     $context->create_tar_files;
659     $context->sign if $context->{gpg}{sign};
660     $context->move_to_outdir;
661     $context->do_cleanup if $context->{cleanup};
662
663     ### $context
664 }
665
666 1;
667
668 __END__
669
670 =head1 NAME
671
672 mk_exim_release - Build an exim release
673
674 =head1 SYNOPSIS
675
676  mk_exim_release [options] version PKG-DIRECTORY
677  mk_exim_release [options] --quick [version] PKG-DIRECTORY
678
679 =head1 DESCRIPTION
680
681 B<mk_exim_release> builds an exim release.
682
683 Starting in a populated git repo that has already been tagged for
684 release it builds docs, packages etc.  Parameter is the version number
685 to build as - ie 4.72 4.72-RC1, 4.86.1, etc, without any prefix.
686
687 This scripts expects to find a tag "exim-<version>".
688
689 After creating the release files, they should be signed. There is another
690 helper for creating the signatures:
691 F<release-process/scripts/sign_exim_packages>.
692
693 Call B<mk_exim_release> about like this:
694
695     release-process/scripts/mk_exim_release 4.99 OUT-DIR
696
697
698 =head1 OPTIONS
699
700 =over 4
701
702 =item B<--[no]cleanup>
703
704 Do (or do not) cleanup the tmp directory at exit (default: do cleanup)
705
706 =item B<--compressors> [I<action>]I<compressor[I<action>$<compressor>]...
707
708 A list of compressors to use. Currently the default list is
709 B<gzip>, B<xz>, and B<bzip2>, with B<lzip> optionally to be enabled.
710
711 I<action> can be "+" (add), "-" (remove), and "=" (set).
712
713 =item B<--debug[=I<item>]>
714
715 Forces debug mode. If (default: no debug info)
716
717 =over 4
718
719 =item item: B<version>
720
721 Output the parsed/found version number and exit.
722
723 =back
724
725 =item B<--[no]delete>
726
727 Delete a pre-existing tmp- and package-directory at start. (default: don't delete)
728
729 =item B<--[no]doc>
730
731 Do (not) build the documentation. This needs C<gnu-make> (default: build the docs)
732
733 =item B<--[no]help>
734
735 Display short help and exit cleanly. (default: don't do that)
736
737 =item B<--key> I<GPG key>
738
739 Use this GPG key for signing. If nothing is specified the first one of this list
740 is used:
741
742 =over 8
743
744 =item - git config user.signingkey
745
746 =item - environment C<EXIM_KEY>
747
748 =item - default GPG key
749
750 =back
751
752 =item B<--make-cmd> I<cmd>
753
754 Force the use of a specific C<make> command. This may be necessary if C<make> is not
755 C<gmake>. This is necessary to build the docs. (default: C<make>)
756
757 =item B<--[no]man>
758
759 Display man page and exit cleanly. (default: don't do that)
760
761 =item B<--quick>
762
763 Create a quick release. The I<version> mandatory argument needs to be a git commit-ish.
764 (try I<master> or I<HEAD> or similar). This mode switches off the
765 website creation (which can be enabled by B<--web> again).
766
767 =item B<--[no]sign>
768
769 Sign the created archive files (and the sizes.txt). (default: sign)
770
771 =item B<--[no]sizes>
772
773 Write the sizes information to F<sizes.txt>. (default: write sizes)
774
775 =item B<--tar-cmd> I<cmd>
776
777 Use to override the path to the C<tar> command.  Need GNU tar in case
778 I<lzip> is selected. (default: C<gtar>, if not found, use C<tar>).
779
780 =item B<--tmpdir> I<dir>
781
782 Change the name of the tmp directory (default: temporary directory)
783
784 =item B<--verbose>
785
786 Force verbose mode. (default: no verbosity)
787
788 =item B<--[no]web>
789
790 Control the creation of the website. For creation of the website, the F<../exim-website>
791 (but see the B<website-base> option) directory must exist. (default: create the website, except when
792 in B<quick> mode)
793
794 =item B<--website-base> I<dir>
795
796 Base directory for the web site generation (default: F<../exim-website>)
797
798 =item B<-workspace>|B<--tmp> I<directory>
799
800 During release gerneration temporary storage is necessary. (default: F<exim-packaging-XXXX>
801 under your system's default temporary directory (typically this is F</tmp>)).
802
803 =back
804
805 =head1 AUTHOR
806
807 Nigel Metheringham <Nigel.Metheringham@dev.intechnology.co.uk>,
808 some changes by Heiko Schlittermann <hs@schlittermann.de>
809
810 =head1 COPYRIGHT
811
812 Copyright 2010-2016 Exim Maintainers. All rights reserved.
813
814 =cut
815 # vim: set sw=4 et :