Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat add gzip compression option for tarball creation #468

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

arsenalpoll
Copy link

This commit introduces the option to create a gzip compressed tarball when the 'tar.gz' extension is selected.
The open mode for the tarfile is determined based on the chosen extension.

If the extension is 'tar.gz', a gzip compressed tarball will be created.
Otherwise, a regular uncompressed tarball will be created.

This allows for greater flexibility when creating tarballs,
without breaking existing setups that do not use gzip compression.

This commit modifies the Tar class in BaseArchive to output gzip-compressed tar files instead of uncompressed tar files. This change improves the efficiency of the archive process by reducing the size of the output files.

This change is backward compatible, as tar and gzip are standard on most systems and gzip decompression is automatically handled by tar when extracting the archive.
This commit introduces the option to create a gzip compressed tarball 
when the 'tar.gz' extension is selected. The open mode for the tarfile is 
determined based on the chosen extension.

If the extension is 'tar.gz', a gzip compressed tarball will be created. 
Otherwise, a regular uncompressed tarball will be created.

This allows for greater flexibility when creating tarballs, 
without breaking existing setups that do not use gzip compression.
TarSCM/archive.py Outdated Show resolved Hide resolved
@arsenalpoll
Copy link
Author

arsenalpoll commented May 27, 2023

@adrianschroeter
Can you help me to take a look at this pull request? Thanks !
Can it be approved?

@adrianschroeter
Copy link
Member

I'd like to keep the compression handling in the compress service to avoid a double implementation.

Is there any reason why we should duplicate the code?

@arsenalpoll
Copy link
Author

I'd like to keep the compression handling in the compress service to avoid a double implementation.

Is there any reason why we should duplicate the code?

@adrianschroeter Hi, thank you very much for your reply.

My project uses the debbuild tool, and debbuild can use the Spec file to build a Ubuntu software package.

During the use of debbuild, using the default TAR method to compress 'tar.gz', an error will be reported during decompression.
After testing, it is found that changing to TAR.GZ can solve the problem. Therefore, the tar.gz compression method is added.

This is my use example: _service

<services>
  <service name="tar_scm">
	<param name="scm">git</param>
	<param name="url">http://gitlab.xx.xx/xxx/xyz.git</param>
	<param name="version">_none_</param>
	<param name="revision">origin/dev</param>
	<param name="filename">abc</param>
	<param name="extension">tar.gz</param>
	<param name="extract">abc.spec</param>
  </service>
</services>

@hramrach
Copy link
Contributor

I'd like to keep the compression handling in the compress service to avoid a double implementation.
Is there any reason why we should duplicate the code?

@adrianschroeter Hi, thank you very much for your reply.

My project uses the debbuild tool, and debbuild can use the Spec file to build a Ubuntu software package.

During the use of debbuild, using the default TAR method to compress 'tar.gz', an error will be reported during decompression. After testing, it is found that changing to TAR.GZ can solve the problem. Therefore, the tar.gz compression method is added.

This is my use example: _service

> <services>
>   <service name="tar_scm">
> 	<param name="scm">git</param>
> 	<param name="url">http://gitlab.xx.xx/xxx/xyz.git</param>
> 	<param name="version">_none_</param>
> 	<param name="revision">origin/dev</param>
> 	<param name="filename">abc</param>
> 	<param name="extension">tar.gz</param>
> 	<param name="extract">abc.spec</param>
>   </service>
  <service name="recompress">
    <param name="file">*.tar</param>
    <param name="compression">gz</param>
  </service>
> </services>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants