Only support zstd-compressed tarballs

main
Jef Roosens 2022-01-14 21:50:43 +01:00
parent 1bd3ed3523
commit e13081a4aa
Signed by untrusted user: Jef Roosens
GPG Key ID: 955C0660072F691F
4 changed files with 10 additions and 4 deletions

View File

@ -25,4 +25,5 @@ pipeline:
- make prod - make prod
# Make sure the binary is actually static # Make sure the binary is actually static
- readelf -d pvieter - readelf -d pvieter
- du -h pvieter
- '[ "$(readelf -d pvieter | grep NEEDED | wc -l)" = 0 ]' - '[ "$(readelf -d pvieter | grep NEEDED | wc -l)" = 0 ]'

View File

@ -25,4 +25,5 @@ pipeline:
- make prod - make prod
# Make sure the binary is actually static # Make sure the binary is actually static
- readelf -d pvieter - readelf -d pvieter
- du -h pvieter
- '[ "$(readelf -d pvieter | grep NEEDED | wc -l)" = 0 ]' - '[ "$(readelf -d pvieter | grep NEEDED | wc -l)" = 0 ]'

View File

@ -12,8 +12,10 @@ pub fn pkg_info(pkg_path string) ?(string, []string) {
entry := C.archive_entry_new() entry := C.archive_entry_new()
mut r := 0 mut r := 0
C.archive_read_support_filter_all(a) // Sinds 2020, all newly built Arch packages use zstd
C.archive_read_support_format_all(a) C.archive_read_support_filter_zstd(a)
// The content should always be a tarball
C.archive_read_support_format_tar(a)
// TODO find out where does this 10240 come from // TODO find out where does this 10240 come from
r = C.archive_read_open_filename(a, &char(pkg_path.str), 10240) r = C.archive_read_open_filename(a, &char(pkg_path.str), 10240)

View File

@ -8,8 +8,10 @@ struct C.archive {}
// Create a new archive struct // Create a new archive struct
fn C.archive_read_new() &C.archive fn C.archive_read_new() &C.archive
fn C.archive_read_support_filter_all(&C.archive) // Configure the archive to work with zstd compression
fn C.archive_read_support_format_all(&C.archive) fn C.archive_read_support_filter_zstd(&C.archive)
// Configure the archive to work with a tarball content
fn C.archive_read_support_format_tar(&C.archive)
// Open an archive for reading // Open an archive for reading
fn C.archive_read_open_filename(&C.archive, &char, int) int fn C.archive_read_open_filename(&C.archive, &char, int) int