On 29/04/2025 16:42, Carlo B. via Cygwin-apps wrote:
[...]
I can see these possible improvements into the code:
1)
The __tar() function inside lib/pkg_pkg.cygpart could be simplified by
writing just this:
TAR_COMPRESSION_OPT=$(__tar_compress_opt ${TAR_COMPRESSION_EXT})
and removing duplicated code now moved inside __tar_compress_opt()
2)
For adding the selection of the type of compression, I suggest to add
a new identifier called GIT_COMPRESSION_EXT. This will be used in a
similar manner of existing TAR_COMPRESSION_EXT.
Inside cygclass/git.cygclass, we can add this:
if ! defined GIT_COMPRESSION_EXT
then
GIT_COMPRESSION_EXT="bz2"
fi
which forces the default extension to bz2 for compatibility (I don't
know if it is useful or not).
Next, git_tarball symbol can be modified like this:
git_tarball="${GIT_MODULE}-${PV}.tar.${GIT_COMPRESSION_EXT}"
and finally, the call to tar will be:
tar $(__tar_compress_opt ${GIT_COMPRESSION_EXT})cf
${top}/${git_tarball} --exclude-vcs ${GIT_MODULE}/${GIT_SUBDIR}
3)
The same logic can be replicated if somebody will want to add the same
feature for selecting the compressor for other revision control
system: subversion, bazaar, cvs, mercurial.
Thanks very much for looking into this.
I think I would take a patch which just changes the compression used for
archives made from git to lzma.
(I can't see any particular use the ability to force the previous
behavior of bz2 compression, but the more elaborate changes you propose
seem like the right approach for doing that)
What do you think? Actually, this is first solution that entered in my
head and perhaps it could not be the best one.
Give yourself a pat on the back for demonstrating an awareness of
cognitive biases!