Re: CYGPORT: add configurable compressor for GIT class.

Jon Turney via Cygwin-apps <[email protected]>
Newsgroups gmane.os.cygwin.applications
Message-ID <[email protected]>
On 10/06/2025 11:46, Carlo B. via Cygwin-apps wrote:
> Hello,
> I created a patch for implementing this feature inside cygport.
> I did several tests and it worked fine in my opinion.
> I hope that you will find this useful.

Thanks very much. This is great!

In future, if possible, please use patches generated by 'git 
format-patch', since it means there's less work for me to apply them 
with proper commentary and attribution.

> +       local _COMPRESSION_OPT COMPRESSION_EXT;

Seems like _COMPRESSION_EXT is meant here?

> -           TAR_COMPRESSION_OPT="-j"
> +           _COMPRESSION_OPT="${_tar_bz2_flag}"
>             ;;

Since _tar_bz2_flag might evaluate to "-I pbzip -", the comments below 
also apply here.

(And the use of '-j' might actually be deliberate here: long-ago, before 
we switched to xz compression for packages, there were some problems 
where setup would choke on pbzip-compressed packages, but I think that 
was all fixed)

(Indeed, digging into the history of the before-times finds 
56bfaecf0f91fad9174b15e07bf73e65699d3543 :))

> +       zst)
> +               _COMPRESSION_OPT="--zstd -"

Hmmm... embedding the implicit understanding of the option syntax here 
seems like a bad idea. (i.e. where this result is used it will be 
followed by more option letters, so we need a trailing '-')

It seems like a better idea to explicitly have a separate group of 
options after where this is used, with their own '-'?

And indeed, a few lines down, this is used like

> 	TAR_COMPRESSION_OPT=$(__tar_compress_opt ${TAR_COMPRESSION_EXT})
[...]
> 
> 	tar ${TAR_COMPRESSION_OPT} ${TAR_SOURCE_DATE_OPTS} --owner=Guest:501 --group=None:513 -cvf "$@"

which seems like is going to end up with a bare '-' passed to tar when 
zstd is selected...

The new function introduced (__tar_compress_opt) needs adding to the 
list of functions marked readonly at the end of the file (as this is 
seems to be good style for shell scripts)

I tweaked the patch to address those issues and applied it.


Then I generalized this so it applies to the source archives generated 
from bzr/cvs/fossil/hg/mtn/svn as well, so the variable which controls 
this is called 'VCS_COMPRESSION_EXT' now.

However, I left the default as 'bz2', as I have some concerns about 
changing it: If you try to unpack and build an old source package built 
using the old default with a cygport with a new default, it won't work 
unless you explicitly set VCS_COMPRESSION_EXT.

Not sure how that should be designed.

So for the moment, you'll probably want to add VCS_COMPRESSION_EXT=xz to 
your local ~/.cygport.conf file.


Thanks again!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.