Commit Graph

9 Commits

Author SHA1 Message Date
Mario Loriedo 82597144b6 Machine decompress.go refactoring follow-up
1. Added the xz decompression unit tests

2. Removed the xz implementation to use the one from c/images

3. Removed the specific macos gzip, zstd compressor and use
   the generic compressor but with SparseWriter if GOOS == darwin

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2024-03-13 00:58:50 +01:00
Mario Loriedo 8f02822c12 Remove xz unit tests as they are flaky
Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2024-02-28 15:37:15 +01:00
Mario Loriedo f099250beb Better file close and err handling
Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2024-02-25 22:29:03 +01:00
Mario Loriedo fa99b9be93 renamed testfiles as testdata
Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2024-02-25 22:29:02 +01:00
Mario Loriedo 0b3f3f0ef1 Use faster gzip reader
Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2024-02-25 22:29:02 +01:00
Mario Loriedo 95aa2c4e68 Use github.com/stretchr/testify assert in compression_test.go
Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2024-02-25 22:29:02 +01:00
Mario Loriedo 88af8852db Refactor machine decompress.go
Added some tests to verify that files extractions works
with different compression format.

Created a decompressor interface with 2 main methods:
  reader(): returns an io.Reader for the specific compression algorithm
  copy(): extracts the compressed file into the file provided as param

Created 5 decompressor types:
- gzip: extract gzip files
- xz: extract xz files
- zip: extract zip files
- generic: extract any other file using github.com/containers/image/v5/pkg/compression
- uncompressed: only do a copy of the file

Minor fix to the progress bar instances: added a call to bar.Abort(false)
that happens before Progress.Wait() to avoid that it hangs when a bar is
not set as completed although extraction is done.

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2024-02-25 22:29:02 +01:00
Brent Baude a31e8d2a23 zstd now default compression for podman machine
given that we are moving to building our own machine images, we have
decided to use zstd compression as it is superior in speed to the
alternatives.  as such, this pr adds zstd to our machine code; and also
has to account for dealing with sparseness on darwin; which the default
zstd golang library does not.

[NO NEW TESTS NEEDED]

Signed-off-by: Brent Baude <bbaude@redhat.com>
2024-02-20 14:26:41 -06:00
Brent Baude a45ba06d02 Refactor key machine objects
In #20538, I was asked to consider refactoring the new OCI pull code
from within the generic machine directory.  This is something I had
tried when originally coding it but it became apparent that a much
larger refactor to prevent circular deps was needed.  Because I did not
want to pollute the initial PR with that refactor, I asked for the PR to
merge first.  This is the refactor that needed to be done.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2023-11-07 08:30:44 -06:00