<div dir="ltr">Just wondering what everyone would think of applying this patch? It enables a runtime test during activation to see if (1) bsdtar is in path and (2) if it supports the --hfsCompression option. (The version from libarchive does.)<div><br></div><div>The --hfsCompression does what you would expect: applies compression to the extracted files. The bsdtar implementation of this automatically becomes a no-op [1] on filesystems that do not support compression, as well as checking to make sure the compression is beneficial [2] and bailing (decompressing) otherwise. As such, we can just pass the flag, and if it can't be used, ~ no harm done.</div><div><br></div><div>For systems where it can be used, however, large savings can be realized (3:1) on some of the largest (e.g. compilers w/ include files) packages. With more macs being sold with non-user-upgradable storage, this seems like a win.</div><div><br></div><div>Since this is a run-time check, similar to the lbzip2 check a few lines later, it won't get tripped up on a 'port upgrade libarchive' action, for example. (By the same token, libarchive itself will never be HFS+ compressed, unless the user explicitly installs yet another modern-enough bsdtar in path. Direction could be given to users to install libarchive before activating ports if space is a concern. (Or perhaps we have a 'macports-extras' port group that installs libarchive and lbzip2; two things that really are nice to have installed, and improve the performance of MacPorts. We could also prompt during 'port upgrade' actions if it is not installed, perhaps with a persistent "don't bother me again" y/n/N option...)</div><div><br></div><div> -- Eric</div><div><br></div><div>[1] <a href="https://github.com/libarchive/libarchive/blob/c10875db78b04fd730bb08245b7032baba906815/libarchive/archive_write_disk_posix.c#L710" target="_blank">https://github.com/libarch<wbr>ive/libarchive/blob/c10875db78<wbr>b04fd730bb08245b7032baba906815<wbr>/libarchive/archive_write_<wbr>disk_posix.c#L710</a></div><div>[2] <a href="https://github.com/libarchive/libarchive/blob/c10875db78b04fd730bb08245b7032baba906815/libarchive/archive_write_disk_posix.c#L1326" target="_blank">https://github.com/libarch<wbr>ive/libarchive/blob/c10875db78<wbr>b04fd730bb08245b7032baba906815<wbr>/libarchive/archive_write_<wbr>disk_posix.c#L1326</a></div><div><br></div><div><div>diff --git a/src/registry2.0/<a href="http://portimage.tc" target="_blank">portimage.tc</a><wbr>l b/src/registry2.0/<a href="http://portimage.tc" target="_blank">portimage.tc</a><wbr>l</div><div>index 72dcdfd3..bdab6f8f 100644</div><div>--- a/src/registry2.0/<a href="http://portimage.tc" target="_blank">portimage.tc</a><wbr>l</div><div>+++ b/src/registry2.0/<a href="http://portimage.tc" target="_blank">portimage.tc</a><wbr>l</div><div>@@ -348,9 +348,18 @@ proc extract_archive_to_tmpdir {location} {</div><div>             t(ar|bz|lz|xz|gz) {</div><div>                 set tar "tar"</div><div>                 if {[catch {set tar [macports::findBinary $tar ${macports::autoconf::tar_path<wbr>}]} errmsg] == 0} {</div><div>-                    ui_debug "Using $tar"</div><div>-                    set unarchive.cmd "$tar"</div><div>-                    set unarchive.pre_args {-xvpf}</div><div>+                    # Opportunistic HFS compression. bsdtar will automatically</div><div>+                    # ignore if on non-HFS filesystem.</div><div>+                    if {![catch {macports::binaryInPath bsdtar}] &&</div><div>+                        ![catch {exec bsdtar -x --hfsCompression < /dev/null >& /dev/null}]} {</div><div>+                        ui_debug "Using bsdtar with HFS+ compression (if valid)"</div><div>+                        set unarchive.cmd "bsdtar"</div><div>+                        set unarchive.pre_args {-xvp --hfsCompression -f}</div><div>+                    } else {</div><div>+                        ui_debug "Using $tar"</div><div>+                        set unarchive.cmd "$tar"</div><div>+                        set unarchive.pre_args {-xvpf}</div><div>+                    }</div><div>                     if {[regexp {z2?$} ${unarchive.type}]} {</div><div>                         set unarchive.args {-}</div><div>                         if {[regexp {bz2?$} ${unarchive.type}]} {</div></div><div><br></div><div><br></div></div>