[exim-cvs] ReleaseTools: support .lz lzip archives

Inizio della pagina
Delete this message
Reply to this message
Autore: Exim Git Commits Mailing List
Data:  
To: exim-cvs
Oggetto: [exim-cvs] ReleaseTools: support .lz lzip archives
Gitweb: http://git.exim.org/exim.git/commitdiff/9d0311ffda3349b05b57802e2031c6dc94bc20ae
Commit:     9d0311ffda3349b05b57802e2031c6dc94bc20ae
Parent:     57eb9e91fe084ad434fcc286f0135e89b658c213
Author:     Phil Pennock <pdp@???>
AuthorDate: Thu May 24 02:12:53 2012 -0400
Committer:  Phil Pennock <pdp@???>
CommitDate: Thu May 24 02:12:53 2012 -0400


    ReleaseTools: support .lz lzip archives
---
 release-process/scripts/mk_exim_release.pl    |   65 +++++++++++++++++++++++-
 release-process/scripts/sign_exim_packages.sh |    2 +-
 2 files changed, 63 insertions(+), 4 deletions(-)


diff --git a/release-process/scripts/mk_exim_release.pl b/release-process/scripts/mk_exim_release.pl
index 07e99b6..46d63e5 100755
--- a/release-process/scripts/mk_exim_release.pl
+++ b/release-process/scripts/mk_exim_release.pl
@@ -295,15 +295,52 @@ sub do_cleanup {

# ------------------------------------------------------------------

+# We prefer gtar to tar if gtar exists in $PATH
+
+sub fix_paths_tar {
+    my $context = shift;
+    my $tar = $context->{tar_cmd};
+
+    return unless $tar eq 'tar';
+
+    foreach my $d (File::Spec->path()) {
+        my $p = File::Spec->catfile($d, 'gtar');
+        if (-x $p) {
+            $context->{tar_cmd} = $p;
+            print "Switched tar command to: $p\n" if ($verbose);
+            return;
+        }
+    }
+}
+
+# ------------------------------------------------------------------
+
 sub create_tar_files {
     my $context = shift;


     my $pkgs    = $context->{pkgs};
     my $pkgdirs = $context->{pkgdirs};
+    my $tar     = $context->{tar_cmd};
+    if ($verbose) {
+        foreach my $c (keys %{ $context->{compressors} }) {
+            print "Compression: $c\t$context->{compressors}{$c}\n";
+        }
+    }
+
     foreach my $dir ( glob( File::Spec->catdir( $pkgdirs, ( 'exim*-' . $context->{release} ) ) ) ) {
         my $dirname = ( File::Spec->splitdir($dir) )[-1];
-        system("tar cfz ${pkgs}/${dirname}.tar.gz  -C ${pkgdirs} ${dirname}");
-        system("tar cfj ${pkgs}/${dirname}.tar.bz2 -C ${pkgdirs} ${dirname}");
+        if ($context->{compressors}{gzip}) {
+            print "Creating: ${pkgs}/${dirname}.tar.gz\n" if ($verbose);
+            system("$tar cf  ${pkgs}/${dirname}.tar.gz  --gzip  -C ${pkgdirs} ${dirname}")
+        }
+        if ($context->{compressors}{bzip2}) {
+            print "Creating: ${pkgs}/${dirname}.tar.bz2\n" if ($verbose);
+            system("$tar cf  ${pkgs}/${dirname}.tar.bz2 --bzip2 -C ${pkgdirs} ${dirname}")
+        }
+        if ($context->{compressors}{lzip}) {
+            print "Creating: ${pkgs}/${dirname}.tar.lz\n" if ($verbose);
+            system("$tar cf  ${pkgs}/${dirname}.tar.lz  --lzip  -C ${pkgdirs} ${dirname}")
+        }
     }
 }


@@ -316,6 +353,12 @@ sub create_tar_files {
         orig_dir    => File::Spec->curdir(),
         tmp_dir     => File::Temp->newdir(),
         webgen_base => "$FindBin::Bin/../../../exim-website",
+        tar_cmd     => 'tar',
+        compressors => {
+                gzip    => 1,
+                bzip2   => 1,
+                lzip    => 1,
+        },
     };
     my $delete;
     my $cleanup = 1;
@@ -325,6 +368,8 @@ sub create_tar_files {
         GetOptions(
             'directory=s'   => \$context->{directory},
             'webgen_base=s' => \$context->{webgen_base},
+            'tar'           => \$context->{tar_cmd},
+            'lzip!'         => \$context->{compressors}{lzip},
             'verbose!'      => \$verbose,
             'debug!'        => \$debug,
             'help|?'        => \$help,
@@ -340,6 +385,7 @@ sub create_tar_files {
     pod2usage( -verbose => 2 ) if $man;


     get_and_check_version( shift, $context );
+    fix_paths_tar($context);
     $context->{tag} = build_tag($context);
     deal_with_working_directory( $context, $delete );
     export_git_tree($context);
@@ -369,7 +415,9 @@ mk_exim_release.pl [options] version
    --verbose           force verbose mode
    --help              display this help and exits
    --man               displays man page
+   --tar=cmd           command to use for tar
    --directory=dir     dir to package
+   --no-lzip           do not create .tar.lz files
    --delete            Delete packaging directory at start


=head1 OPTIONS
@@ -381,9 +429,19 @@ mk_exim_release.pl [options] version
Forces debug mode cause all SQL statements generated by L<DBIx::Class>
to be output.

+=item B<--tar>
+
+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.
+
+=item B<--no-lzip>
+
+Do not build the lzip tarballs.
+
=item B<--verbose>

-Force verbose mode - currently this has no effect
+Force verbose mode

=item B<--help>

@@ -413,3 +471,4 @@ Nigel Metheringham <Nigel.Metheringham@???>
Copyright 2010 Exim Maintainers. All rights reserved.

=cut
+# vim: set sw=4 et :
diff --git a/release-process/scripts/sign_exim_packages.sh b/release-process/scripts/sign_exim_packages.sh
index 2b542ad..b93865a 100755
--- a/release-process/scripts/sign_exim_packages.sh
+++ b/release-process/scripts/sign_exim_packages.sh
@@ -8,7 +8,7 @@

: ${EXIM_KEY:=nigel@???}

-for file in *.tar.gz *.tar.bz2
+for file in *.tar.gz *.tar.bz2 *.tar.lz
do
gpg --local-user ${EXIM_KEY} --detach-sig --armor $file
done