Hello, my cygport script for building aarch64-w64-mingw32 cross compiler needs to download the sources with GIT. Then, those sources are compressed as a tar.bz2 archive by the git class.
While the process itself is working fine, the final tar.bz2 file of GCC sources is about 123MB. Instead, if the sources are compresses with lzma, the resulting tar.xz file of the same files will be only 95MB. So, I would like to suggest a solution for making a configurable way for compressing the source files that cygport can download from a GIT repository. The primary reason because I need this is because I'm usually sharing my packages on GITHUB, but unfortunately it is not possible to upload files larger than 100MB. Having the chance to use a different compressor allows to fall again into the allowed limits, although 95MB is pretty near to the maximum size. I would like to suggest a way for implementing this stuff in a pretty easier manner, at least in my opinion. I attached a simple script for testing a bash function that I called __tar_compress_opt(). This function will be placed in a common place, so that every cygclass could use it, if it will be needed. This function uses a piece of the __tar() function from lib/pkg_pkg.cygpart If this function is used without parameters, it assumes to use lzma by default. Otherwise, the first parameters tells the type of the compression to be used. 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. What do you think? Actually, this is first solution that entered in my head and perhaps it could not be the best one. I hope that you will find it useful. Sincerely, Carlo Bramini.
tar_test.sh
Description: Binary data