From 218b95a5ca05fd5d46a3a4ebe3a738f0a89769ec Mon Sep 17 00:00:00 2001 From: tannevaled Date: Sat, 30 May 2026 18:51:21 +0200 Subject: [PATCH 1/2] new(github.com/zchunk/zchunk): reference C zchunk tooling Adds the reference C implementation of the zchunk container format (used by Fedora's DNF/librepo for delta-downloaded repo metadata), with its build-time dependency argp-standalone for non-glibc systems. zchunk ships zck/unzck/zck_delta_size/zck_gen_zdict/zck_read_header/zckdl; runtime deps are openssl, zstd and libcurl. argp-standalone is a tiny meson/static-lib port of GNU argp for systems whose libc lacks argp.h (macOS, *BSD); on glibc Linux zchunk falls back to libc's argp and the extra dep is unused. Refs zchunk/zchunk and argp-standalone/argp-standalone. --- .../argp-standalone/package.yml | 29 +++++++++++ .../argp-standalone/argp-standalone/test.c | 10 ++++ projects/github.com/zchunk/zchunk/package.yml | 48 +++++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 projects/github.com/argp-standalone/argp-standalone/package.yml create mode 100644 projects/github.com/argp-standalone/argp-standalone/test.c create mode 100644 projects/github.com/zchunk/zchunk/package.yml diff --git a/projects/github.com/argp-standalone/argp-standalone/package.yml b/projects/github.com/argp-standalone/argp-standalone/package.yml new file mode 100644 index 0000000000..49638e7778 --- /dev/null +++ b/projects/github.com/argp-standalone/argp-standalone/package.yml @@ -0,0 +1,29 @@ +distributable: + url: https://github.com/argp-standalone/argp-standalone/archive/refs/tags/{{version}}.tar.gz + strip-components: 1 + +versions: + github: argp-standalone/argp-standalone/tags + +# Standalone GNU argp argument parser, for systems whose libc does not provide +# argp.h (macOS, FreeBSD, musl). On glibc Linux it is not needed but the build +# is harmless. + +build: + dependencies: + mesonbuild.com: "*" + ninja-build.org: "*" + freedesktop.org/pkg-config: "*" + script: + - meson setup build $ARGS + - meson compile -C build --jobs {{ hw.concurrency }} + - meson install -C build + env: + ARGS: + - --prefix={{prefix}} + - --buildtype=release + - --default-library=static + +test: + - cc test.c -I{{prefix}}/include -L{{prefix}}/lib -largp -o test + - ./test --version | grep -F 1.0 diff --git a/projects/github.com/argp-standalone/argp-standalone/test.c b/projects/github.com/argp-standalone/argp-standalone/test.c new file mode 100644 index 0000000000..f27e8b847e --- /dev/null +++ b/projects/github.com/argp-standalone/argp-standalone/test.c @@ -0,0 +1,10 @@ +#include +#include + +const char *argp_program_version = "argp-standalone-test 1.0"; + +int main(int argc, char **argv) +{ + error_t err = argp_parse(0, argc, argv, 0, 0, 0); + return err ? 1 : 0; +} diff --git a/projects/github.com/zchunk/zchunk/package.yml b/projects/github.com/zchunk/zchunk/package.yml new file mode 100644 index 0000000000..441c521fed --- /dev/null +++ b/projects/github.com/zchunk/zchunk/package.yml @@ -0,0 +1,48 @@ +distributable: + url: https://github.com/zchunk/zchunk/archive/refs/tags/{{version}}.tar.gz + strip-components: 1 + +versions: + github: zchunk/zchunk/tags + +# Reference C implementation of the zchunk container format used by Fedora's +# DNF/librepo for delta-downloaded repository metadata. + +dependencies: + openssl.org: ^1.1 + facebook.com/zstd: ^1 + curl.se: ^8 + +build: + dependencies: + mesonbuild.com: "*" + ninja-build.org: "*" + freedesktop.org/pkg-config: "*" + darwin: + github.com/argp-standalone/argp-standalone: "*" + script: + - meson setup build $ARGS + - meson compile -C build --jobs {{ hw.concurrency }} + - meson install -C build + env: + ARGS: + - --prefix={{prefix}} + - --buildtype=release + - -Ddocs=false + - -Dtests=false + +provides: + - bin/zck + - bin/unzck + - bin/zck_delta_size + - bin/zck_gen_zdict + - bin/zck_read_header + - bin/zckdl + +test: + - echo "hello zchunk roundtrip" > greeting.txt + - zck greeting.txt + - test -f greeting.txt.zck + - rm greeting.txt + - unzck greeting.txt.zck + - test "$(cat greeting.txt)" = "hello zchunk roundtrip" From 21a2b61679ea18170c47579a252cf18f7aed7775 Mon Sep 17 00:00:00 2001 From: tannevaled Date: Sat, 30 May 2026 19:41:16 +0200 Subject: [PATCH 2/2] fix(zchunk): use meson wrap subproject for argp on darwin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Darwin CI was failing because zchunk's build-time dep github.com/argp-standalone/argp-standalone is brand new in this PR and not yet published to dist.pkgx.dev — the resolver 404s when hydrating darwin deps. Linux passes because the dep is darwin-scoped and glibc supplies argp.h directly. Drop the explicit pantry dep and lean on zchunk's own subprojects/argp-standalone.wrap. The upstream wrap is wrap-git (needs git + network at meson-setup); rewrite it to wrap-file so meson fetches a sha256-verified tarball and builds argp-standalone as a subproject — fully from source, no vendoring, no prebuilts. Linux glibc never touches this path (zchunk's cc.links argp probe succeeds, the dep is never requested), so --force-fallback-for is a no-op on linux. --- projects/github.com/zchunk/zchunk/package.yml | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/projects/github.com/zchunk/zchunk/package.yml b/projects/github.com/zchunk/zchunk/package.yml index 441c521fed..38e4a73a6d 100644 --- a/projects/github.com/zchunk/zchunk/package.yml +++ b/projects/github.com/zchunk/zchunk/package.yml @@ -18,9 +18,26 @@ build: mesonbuild.com: "*" ninja-build.org: "*" freedesktop.org/pkg-config: "*" - darwin: - github.com/argp-standalone/argp-standalone: "*" script: + # macOS' libc has no , so zchunk's meson build falls back to + # the `argp-standalone` subproject shipped in upstream's tarball. The + # upstream wrap file is `wrap-git`, which needs git+network at build + # time; rewrite it as `wrap-file` so meson can fetch a verified + # tarball via curl (already available in our build env) and build the + # sources from source as a meson subproject. Linux glibc provides + # argp.h directly and never touches the subproject. + - run: | + cat > subprojects/argp-standalone.wrap <<'WRAP' + [wrap-file] + directory = argp-standalone-1.5.0 + source_url = https://github.com/argp-standalone/argp-standalone/archive/refs/tags/1.5.0.tar.gz + source_filename = argp-standalone-1.5.0.tar.gz + source_hash = c29eae929dfebd575c38174f2c8c315766092cec99a8f987569d0cad3c6d64f6 + + [provide] + dependency_names = argp-standalone + WRAP + if: darwin - meson setup build $ARGS - meson compile -C build --jobs {{ hw.concurrency }} - meson install -C build @@ -30,6 +47,8 @@ build: - --buildtype=release - -Ddocs=false - -Dtests=false + - --wrap-mode=default + - --force-fallback-for=argp-standalone provides: - bin/zck