X-Git-Url: https://git.exim.org/users/heiko/exim.git/blobdiff_plain/6bfa380e184f130bc397a1f8df258a6c6cc15ca6..856d1e16b3386ce51b73986b9d7aaf1fbf95aba9:/release-process/scripts/mk_exim_release?ds=sidebyside diff --git a/release-process/scripts/mk_exim_release b/release-process/scripts/mk_exim_release index cfe982add..6e4767bd2 100755 --- a/release-process/scripts/mk_exim_release +++ b/release-process/scripts/mk_exim_release @@ -24,12 +24,13 @@ sub get_and_check_version { # make sure this looks like a real release version # which should (currently) be 4.xx[.y] or 4.xx[.y]_RCx - unless ( $release =~ /^(?(?4\.\d\d)(?:\.(?\d+))?(?:_RC\d+)?)$/ ) { + unless ( $release =~ /^(?(?4\.\d\d)(?:\.(?\d+))?(?_RC\d+)?)$/ ) { croak "The given version number does not look right - $release"; } $context->{release} = $+{release}; $context->{major} = $+{major}; $context->{minor} = $+{minor}; + $context->{candidatev} = $+{rc}; ($context->{trelease} = $+{release}) =~ s/_RC\d+//; } @@ -134,11 +135,18 @@ sub make_version_script { # Thus we've to provide the version.sh, based on the info we have # about the release. If reversion finds this, it doesn't try to find # it's own way to get a valid version number from the git. + # + # 4.89 series: the logic here did not handle _RC thus breaking RC + # status in versions. nb: candidatev in context should be same as $variant + # in local context. + my $stamp = $context->{minor} ? '_'.$context->{minor} : ''; + $stamp .= $context->{candidatev} if $context->{candidatev}; + # open(my $v, '>', 'version.sh') or die "Can't open '>version.sh' $!\n"; print {$v} <<__; # initial version automatically generated from $0 EXIM_RELEASE_VERSION=$context->{major} -EXIM_VARIANT_VERSION=@{[$context->{minor}?'_'.$context->{minor}:'']} +EXIM_VARIANT_VERSION=$stamp EXIM_COMPILE_NUMBER=0 __ close($v); @@ -235,6 +243,7 @@ sub move_text_docs_into_pkg { # move generated documents from docbook stuff foreach my $file (qw/exim.8 spec.txt filter.txt/) { + die "Empty file \"$file\"\n" if -z File::Spec->catfile( $old_docdir, $file ); move( File::Spec->catfile( $old_docdir, $file ), File::Spec->catfile( $new_docdir, $file ) ); } @@ -360,37 +369,59 @@ sub create_tar_files { } } + # We ideally do not want local system user information in release tarballs; + # those are artifacts of use of tar for backups and have no place in + # software release packaging; if someone extracts as root, then they should + # get sane file ownerships. + my $ownership = ""; + if (`tar --help 2>&1` =~ /^\s*--owner=/m) { + $ownership .= " --owner=$context->{tar_perms}{user} --group=$context->{tar_perms}{group}"; + # on this GNU tar, --numeric-owner works during creation too + $ownership .= " --numeric-owner"; + } + + # See also environment variables set in main, tuning compression levels + my @COMPRESSIONS = ( + # compressors-dict-key, file-extension, flags-as-string + [ "gzip", "gz", "--gzip" ], + [ "bzip2", "bz2", "--bzip2" ], + [ "lzip", "lz", "--lzip" ], + [ "xz", "xz", "--xz" ], + ); + foreach my $dir ( glob( File::Spec->catdir( $pkgdirs, ( 'exim*-' . $context->{release} ) ) ) ) { my $dirname = ( File::Spec->splitdir($dir) )[-1]; - if ($context->{compressors}{gzip}) { - print "Creating: ${pkgs}/${dirname}.tar.gz\n" if ($verbose || $debug); - system("$tar cf ${pkgs}/${dirname}.tar.gz --gzip -C ${pkgdirs} ${dirname}") - } - if ($context->{compressors}{bzip2}) { - print "Creating: ${pkgs}/${dirname}.tar.bz2\n" if ($verbose || $debug); - system("$tar cf ${pkgs}/${dirname}.tar.bz2 --bzip2 -C ${pkgdirs} ${dirname}") - } - if ($context->{compressors}{lzip}) { - print "Creating: ${pkgs}/${dirname}.tar.lz\n" if ($verbose || $debug); - system("$tar cf ${pkgs}/${dirname}.tar.lz --lzip -C ${pkgdirs} ${dirname}") + foreach my $comp (@COMPRESSIONS) { + my ($compkey, $extension, $flags) = @{$comp}; + next unless $context->{compressors}{$compkey}; + print "Creating: ${pkgs}/${dirname}.tar.${extension}\n" if ($verbose || $debug); + system("$tar cf ${pkgs}/${dirname}.tar.${extension} ${flags} ${ownership} -C ${pkgdirs} ${dirname}"); } } + } # ------------------------------------------------------------------ -{ - my $man; - my $help; +MAIN: { + + $0 =~ m|^(?:\./)?release-process/scripts/| + or die "$0: please call this script from the root of the Exim project sources\n"; + my $context = { pkgname => 'exim', orig_dir => File::Spec->curdir(), tmp_dir => File::Temp->newdir(), webgen_base => "$FindBin::Bin/../../../exim-website", tar_cmd => 'tar', + tar_perms => { + user => '0', + group => '0', + }, make_cmd => 'make', compressors => { gzip => 1, bzip2 => 1, + xz => 1, lzip => 0, }, build_docs => 1, @@ -399,30 +430,31 @@ sub create_tar_files { my $delete; my $cleanup = 1; ##$ENV{'PATH'} = '/opt/local/bin:' . $ENV{'PATH'}; - - unless ( - GetOptions( - 'directory=s' => \$context->{directory}, - 'webgen_base=s' => \$context->{webgen_base}, - 'tar=s' => \$context->{tar_cmd}, - 'make=s' => \$context->{make_cmd}, - 'lzip!' => \$context->{compressors}{lzip}, - 'verbose!' => \$verbose, - 'debug!' => \$debug, - 'help|?' => \$help, - 'man!' => \$man, - 'delete!' => \$delete, - 'cleanup!' => \$cleanup, - 'build-docs!' => \$context->{build_docs}, - 'web!' => \$context->{web}, - ) - ) - { - pod2usage( -exitval => 1, -verbose => 0 ); - } - pod2usage(0) if $help; - pod2usage( -verbose => 2 ) if $man; - + # We are creating files for mass distribution, so work harder to make smaller files. + $ENV{'GZIP'} = '-9'; + $ENV{'BZIP2'} = '-9'; + # xz documents minimum file sizes for levels higher than -6 to be useful and each + # requires more RAM on the decompressing system. Exim tarball currently 24MiB so + # using -8. + $ENV{'XZ_DEFAULTS'} = '-8'; + + GetOptions( + 'directory=s' => \$context->{directory}, + 'webgen_base=s' => \$context->{webgen_base}, + 'tar=s' => \$context->{tar_cmd}, + 'make=s' => \$context->{make_cmd}, + 'lzip!' => \$context->{compressors}{lzip}, + 'verbose!' => \$verbose, + 'debug!' => \$debug, + 'help|?' => sub { pod2usage(-verbose => 1, -exit => 0) }, + 'man!' => sub { pod2usage(-verbose => 2, -exit => 0, -noperldoc => system('perldoc -V >/dev/null 2>&1')) }, + 'delete!' => \$delete, + 'cleanup!' => \$cleanup, + 'build-docs!' => \$context->{build_docs}, + 'web!' => \$context->{web}, + ) and @ARGV == 1 or pod2usage; + + umask(022); get_and_check_version( shift, $context ); fix_paths_tar($context); $context->{tag} = build_tag($context); @@ -447,73 +479,82 @@ mk_exim_release - Build an exim release =head1 SYNOPSIS -mk_exim_release [options] version + mk_exim_release [options] version + +=head1 DESCRIPTION + +B builds an exim release. + +Starting in a populated git repo that has already been tagged for +release it builds docs, packages etc. Parameter is the version number +to build as - ie 4.72 4.72RC1, 4.86.1, etc + +After creating the release files, they should be signed. There is another +helper for creating the signatures: +F. + +Call B about like this: + + release-process/scripts/mk_exim_release 4.99 - Options: - --debug force debug mode - --verbose force verbose mode - --help display this help and exits - --man displays man page - --tar=cmd command to use for tar - --make=cmd command to use for make - --directory=dir dir to package - --no-lzip do not create .tar.lz files - --delete Delete packaging directory at start - --no-web skip the website generation =head1 OPTIONS =over 4 -=item B<--debug> +=item B<--[no]debug> -Forces debug mode. +Forces debug mode. (default: no debug info) -=item B<--tar> +=item B<--[no]delete> -Use to override the path to the tar command; without this, will search for -gtar, and if not found use tar. Need GNU tar for lzip, unless --no-lzip is -used. +Delete a pre-existing package directory at start. (default: don't delete) -=item B<--make> +=item B<--directory> I -Use to override the path/name of the make command. -Useful sometimes to force gmake. +Change the name of the package directory (default: F<< exim-packaging- >>) -=item B<--lzip> +=item B<--[no]help> -Build the lzip tarballs. +Display short help and exit cleanly. (default: don't do that) -=item B<--verbose> +=item B<--[no]lzip> -Force verbose mode +Control the creation of B tarballs. (default: do not use lzip) -=item B<--help> +=item B<--make> I -Display help and exits +Force the use of a specific C command. This may be necessary if C is not +C (default: C) -=item B<--man> +=item B<--[no]man> -Display man page +Display man page and exit cleanly. (default: don't do that) -=back +=item B<--tar> I -=head1 DESCRIPTION +Use to override the path to the C command. Need GNU tar in case +I is selected. (default: C, if not found, use C) -Builds an exim release. +=item B<--[no]web> -Starting in a populated git repo that has already been tagged for -release, build docs, build packages etc. +Control the creation of the website. For creation of the website, the F<../exim-website> +directory must exist. (default: create the website) -Parameter is the version number to build as - ie 4.72 4.72RC1, 4.86.1, etc +=item B<--verbose> + +Force verbose mode. (default: no verbosity) + +=back =head1 AUTHOR -Nigel Metheringham +Nigel Metheringham , +some changes by Heiko Schlittermann =head1 COPYRIGHT -Copyright 2010 Exim Maintainers. All rights reserved. +Copyright 2010-2016 Exim Maintainers. All rights reserved. =cut # vim: set sw=4 et :