[tbb-commits] [Git][tpo/applications/rbm][main] Bug 40071: Add an option to create zip files using 7z

boklm (@boklm) git at gitlab.torproject.org
Fri Feb 9 09:08:58 UTC 2024



boklm pushed to branch main at The Tor Project / Applications / RBM


Commits:
10c6b24e by Nicolas Vigier at 2024-02-08T13:26:40+01:00
Bug 40071: Add an option to create zip files using 7z

- - - - -


2 changed files:

- doc/options_misc.asc
- lib/RBM/DefaultConfig.pm


Changes:

=====================================
doc/options_misc.asc
=====================================
@@ -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


=====================================
lib/RBM/DefaultConfig.pm
=====================================
@@ -597,14 +597,24 @@ TAR_END
 ####
 ####
 ####
-    zip    => <<ZIP_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
 ####
 ####



View it on GitLab: https://gitlab.torproject.org/tpo/applications/rbm/-/commit/10c6b24e90e3dc9c2578290a7d82a87b7f4eb9a3

-- 
View it on GitLab: https://gitlab.torproject.org/tpo/applications/rbm/-/commit/10c6b24e90e3dc9c2578290a7d82a87b7f4eb9a3
You're receiving this email because of your account on gitlab.torproject.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.torproject.org/pipermail/tbb-commits/attachments/20240209/65385d32/attachment-0001.htm>


More information about the tbb-commits mailing list