extract gzip files

Mark Brethen mark.brethen at gmail.com
Sun Dec 2 21:20:58 UTC 2018


This works, avoids overriding extract, but is less direct:

    extract.cmd		    cp
    extract.pre_args
    extract.post_args	${workpath}/.

    destroot {
        xinstall -d ${destroot}${prefix}/share/doc/${name}
        foreach f ${distfiles} {
            set stem [file rootname [file tail ${f}]]
            system -W ${workpath} "gunzip -c ${f} > ${destroot}${prefix}/share/doc/${name}/${stem}"
        }
    }

Preference?


Mark Brethen
mark.brethen at gmail.com



> On Dec 2, 2018, at 2:32 PM, Mark Brethen <mark.brethen at gmail.com> wrote:
> 
> Abiword used this solution:
> 
> distname AbiWord-${version}-10.2
> extract.suffix .dmg.gz
> extract.post_args > ${workpath}/${distname}.dmg
> 
> but I seven files, all .ps.gz, will this work with distfiles instead?
> 
> Alternatively, I could use extract {} and then change destroot to
> 
> destroot {
>         xinstall -d ${destroot}${prefix}/share/doc/${name}
>         foreach f ${distfiles} {
>             set stem [file rootname [file tail ${f}]]
>             system -W ${distpath} "gunzip -c ${f} > ${destroot}${prefix}/share/doc/${name}//${stem}"
>         }
> }
> 
> Mark Brethen
> mark.brethen at gmail.com <mailto:mark.brethen at gmail.com>
> 
> 
> 
>> On Dec 2, 2018, at 1:57 PM, Ryan Schmidt <ryandesign at macports.org <mailto:ryandesign at macports.org>> wrote:
>> 
>> 
>> 
>> 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 <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.
>> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-dev/attachments/20181202/e865d3b5/attachment-0001.html>


More information about the macports-dev mailing list