Unverified Commit 10c6b24e authored by boklm's avatar boklm
Browse files

Bug 40071: Add an option to create zip files using 7z

parent efd874ab
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -41,6 +41,11 @@ zip::
        and a +zip_args+ arguments which is usually the destination zip
        file, and optionally other zip options. By default, GNU options
        are used in find, but you can disable that with +gnu_utils+.
        The 'zip' command will be used to create the zip file, unless
        +use_7z+ is set, in which case '7z' will be used instead. In this
        case, +7z_bin+ can be used to select the '7z' command (for cases
        where the command is '7zz' instead of '7z') and +7z_opts+ can
        be used to set additional options to the '7z' command.

install_package::
        This option can be used in a script when you need to install a
+11 −1
Original line number Diff line number Diff line
@@ -597,14 +597,24 @@ TAR_END
####
####
####
    '7z_bin' => '7z',
    zip      => <<ZIP_END,
[%- SET src = c('zip_src', { error_if_undef => 1 }) -%]
[% USE date -%]
[% IF c("use_7z") -%]
  tmp7z=\$(mktemp)
[% END -%]
find [% src.join(' ') %] -exec touch -m -t [% date.format(c('timestamp'), format = '%Y%m%d%H%M') %] -- {} +
find [% src.join(' ') %] [% IF c('gnu_utils') %]-executable[% ELSE %]-perm +0111[% END %] -exec chmod 700 {} \\;
find [% src.join(' ') %] ! [% IF c('gnu_utils') %]-executable[% ELSE %]-perm +0111[% END %] -exec chmod 600 {} \\;
find [% src.join(' ') %] | sort | \
[% IF c("use_7z") -%]
        cat > "\$tmp7z"
        [% c('7z_bin') %] a -tzip -spf [% c('7z_opts') %] [% c('zip_args', { error_if_undef => 1 }) %] "@\$tmp7z"
        rm -f "\$tmp7z"
[% ELSE -%]
        zip -q -@ -X [% c('zip_args', { error_if_undef => 1 }) %]
[% END -%]
ZIP_END
####
####