openSUSE / obs-service-tar_scm

An OBS source service: fetches code from any SCM and archives it
GNU General Public License v2.0
31 stars 105 forks source link

Feat add gzip compression option for tarball creation #468

Open arsenalpoll opened 1 year ago

arsenalpoll commented 1 year ago

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.

arsenalpoll commented 1 year ago

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

adrianschroeter commented 11 months ago

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 commented 11 months ago

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 commented 7 months ago

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>