extract gzip files

Ryan Schmidt ryandesign at macports.org
Sun Dec 2 19:57:12 UTC 2018



On Nov 30, 2018, at 08:13, Mark Brethen wrote:

> For *.gz files (no tar), what’s the proper way to extract them to extract_dir? 

MacPorts doesn't have specific support for this built-in, I guess because it wasn't thought to be a common enough use case. But there are several ports in the tree that do this manually; you can probably find them by grepping for "extract.suffix .gz".

Just as we recently added a use_tar option to handle uncompressed tarballs, even though that is uncommon, we could add an option to handle gz-/bz2-/xz-/etc. compressed non-tar files. But there might be some confusion about what to call the options. We already have options use_bzip2 and use_xz, for example, which handle bz2- and xz-compressed tarballs, respectively; there is no use_gz or use_gzip, but if there were one, for consistency it would have to mean a gz-compressed tarball; there is no such option because that is the default behavior.

Ultimately, I would like MacPorts to be able to automatically extract almost any file, without needing to be told what compression format was used. See https://lists.macports.org/pipermail/macports-dev/2016-March/032671.html . But every port that provides custom extract phase settings is an obstacle to that (i.e. is something that might break if we release a new version of MacPorts with that functionality, depending on how it's implemented), hence my desire to first provide options to accommodate most ports' extraction needs without the need to override any extract phase settings.



More information about the macports-dev mailing list