From e13081a4aa6f71e7d133d446db1af00204aaa534 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Fri, 14 Jan 2022 21:50:43 +0100 Subject: [PATCH] Only support zstd-compressed tarballs --- .woodpecker/.build.yml | 1 + .woodpecker/.build_arm64.yml | 1 + src/archive/archive.v | 6 ++++-- src/archive/bindings.v | 6 ++++-- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.woodpecker/.build.yml b/.woodpecker/.build.yml index 83dcb0e..5ece461 100644 --- a/.woodpecker/.build.yml +++ b/.woodpecker/.build.yml @@ -25,4 +25,5 @@ pipeline: - make prod # Make sure the binary is actually static - readelf -d pvieter + - du -h pvieter - '[ "$(readelf -d pvieter | grep NEEDED | wc -l)" = 0 ]' diff --git a/.woodpecker/.build_arm64.yml b/.woodpecker/.build_arm64.yml index 704bc48..3b919b4 100644 --- a/.woodpecker/.build_arm64.yml +++ b/.woodpecker/.build_arm64.yml @@ -25,4 +25,5 @@ pipeline: - make prod # Make sure the binary is actually static - readelf -d pvieter + - du -h pvieter - '[ "$(readelf -d pvieter | grep NEEDED | wc -l)" = 0 ]' diff --git a/src/archive/archive.v b/src/archive/archive.v index 88649ee..c280a42 100644 --- a/src/archive/archive.v +++ b/src/archive/archive.v @@ -12,8 +12,10 @@ pub fn pkg_info(pkg_path string) ?(string, []string) { entry := C.archive_entry_new() mut r := 0 - C.archive_read_support_filter_all(a) - C.archive_read_support_format_all(a) + // Sinds 2020, all newly built Arch packages use zstd + 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 r = C.archive_read_open_filename(a, &char(pkg_path.str), 10240) diff --git a/src/archive/bindings.v b/src/archive/bindings.v index 678d715..f507fac 100644 --- a/src/archive/bindings.v +++ b/src/archive/bindings.v @@ -8,8 +8,10 @@ struct C.archive {} // Create a new archive struct fn C.archive_read_new() &C.archive -fn C.archive_read_support_filter_all(&C.archive) -fn C.archive_read_support_format_all(&C.archive) +// Configure the archive to work with zstd compression +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 fn C.archive_read_open_filename(&C.archive, &char, int) int