diff --git a/.github/workflows/publish_binary.yml b/.github/workflows/publish_binary.yml index 30f801ce..c3ce5fbb 100644 --- a/.github/workflows/publish_binary.yml +++ b/.github/workflows/publish_binary.yml @@ -52,7 +52,7 @@ jobs: - name: Update downloads run: | mkdir -p site/pythons/binaries - cp "dist/$entry.tar.gz" "dist/$entry.meta" "dist/$entry" \ + cp "dist/$entry.tar.xz" "dist/$entry.meta" "dist/$entry" \ site/pythons/binaries/ cd site/pythons ./update.sh diff --git a/plugins/pyenv-binary/README.md b/plugins/pyenv-binary/README.md index 817e9a6f..e88537f4 100644 --- a/plugins/pyenv-binary/README.md +++ b/plugins/pyenv-binary/README.md @@ -14,6 +14,9 @@ architecture and a compatible libc) and have the recorded system libraries. It is not portable across, say, glibc and musl, or to an older glibc; the platform and dependency metadata exist to catch that. +Installing a binary package requires `tar` with xz support (typically provided +by the `xz` package). + ## Commands ### `pyenv binary package [-v|--verbose] [:] --archive-base-url ` @@ -29,7 +32,7 @@ Pass `-v` to show build progress from `pyenv install`. ```sh pyenv binary package 3.12.7 \ --archive-base-url https://example.com/binaries -# On Debian 12 x86_64, writes 3.12.7-debian-12-x86_64.tar.gz, +# On Debian 12 x86_64, writes 3.12.7-debian-12-x86_64.tar.xz, # its .meta file and a `3.12.7-debian-12-x86_64' definition. pyenv binary package 3.12.7:company-python \ @@ -54,7 +57,7 @@ pyenv binary package-name 3.12.7 ### `pyenv binary save [] [--name ]` -Packs an installed version into `-.tar.gz` (relative paths) +Packs an installed version into `-.tar.xz` (relative paths) and writes `-.meta` describing the build platform (OS, arch, distro and libc version) and the system libraries the build links against. Use `--name` to set a different base name for both files. @@ -78,7 +81,7 @@ needs are present. ```sh pyenv binary generate-installer ./dist/3.12.7-linux-x86_64.meta \ - --archive-url https://example.com/3.12.7-linux-x86_64.tar.gz \ + --archive-url https://example.com/3.12.7-linux-x86_64.tar.xz \ -o "$(pyenv root)/plugins/python-build/share/python-build/3.12.7-linux-x86_64" pyenv install 3.12.7-linux-x86_64 diff --git a/plugins/pyenv-binary/libexec/pyenv-binary-package b/plugins/pyenv-binary/libexec/pyenv-binary-package index f86666e2..77479f2a 100755 --- a/plugins/pyenv-binary/libexec/pyenv-binary-package +++ b/plugins/pyenv-binary/libexec/pyenv-binary-package @@ -7,7 +7,7 @@ # Installs from source under a separate entry name, saves it as a # binary package, then emits a python-build definition for that package. # The archive, metadata and definition are written to the current directory -# as .tar.gz, .meta and . +# as .tar.xz, .meta and . # # A version `pyenv install' knows how to build. # The optional name to build under and install the @@ -16,7 +16,7 @@ # -v,--verbose Show build progress from `pyenv install'. # --archive-base-url # Where the archive will be hosted; the definition -# downloads it from /.tar.gz. +# downloads it from /.tar.xz. # set -e [ -n "$PYENV_DEBUG" ] && set -x @@ -80,4 +80,4 @@ pyenv-install ${verbose:+--verbose} "$spec" pyenv-binary-save "$entry" "$PWD" --name "$entry" pyenv-binary-generate-installer "${entry}.meta" \ - --archive-url "${archive_base_url%/}/${entry}.tar.gz" -o "$entry" + --archive-url "${archive_base_url%/}/${entry}.tar.xz" -o "$entry" diff --git a/plugins/pyenv-binary/libexec/pyenv-binary-save b/plugins/pyenv-binary/libexec/pyenv-binary-save index b940123a..444c02cc 100755 --- a/plugins/pyenv-binary/libexec/pyenv-binary-save +++ b/plugins/pyenv-binary/libexec/pyenv-binary-save @@ -4,7 +4,7 @@ # # Usage: pyenv binary save [] [--name ] # -# Packs an installed version into a relocatable .tar.gz (relative paths) and +# Packs an installed version into a relocatable .tar.xz (relative paths) and # writes a metadata file listing the build platform and the system libraries # it links against, so an installer can check compatibility before unpacking. # @@ -134,10 +134,10 @@ system_deps() { mkdir -p "$output_dir" package_name="${package_name:-${version}-${platform}}" -archive="${package_name}.tar.gz" +archive="${package_name}.tar.xz" metadata="${package_name}.meta" -tar -C "$(dirname "$prefix")" -czf "${output_dir}/${archive}" "$(basename "$prefix")" +tar -C "$(dirname "$prefix")" -cJf "${output_dir}/${archive}" "$(basename "$prefix")" { echo "# pyenv-binary metadata" diff --git a/plugins/pyenv-binary/test/package.bats b/plugins/pyenv-binary/test/package.bats index 4186a1c8..40e875a9 100644 --- a/plugins/pyenv-binary/test/package.bats +++ b/plugins/pyenv-binary/test/package.bats @@ -66,10 +66,10 @@ pyenv-install --list --bare run pyenv-binary-package 3.12.7 --archive-base-url http://example.com/binaries assert_success assert [ -d "${PYENV_ROOT}/versions/3.12.7-debian-12-x86_64" ] - assert [ -f "${BATS_TEST_TMPDIR}/3.12.7-debian-12-x86_64.tar.gz" ] + assert [ -f "${BATS_TEST_TMPDIR}/3.12.7-debian-12-x86_64.tar.xz" ] assert [ -f "${BATS_TEST_TMPDIR}/3.12.7-debian-12-x86_64.meta" ] run grep '^ARCHIVE_URL=' "${BATS_TEST_TMPDIR}/3.12.7-debian-12-x86_64" - assert_success "ARCHIVE_URL=http://example.com/binaries/3.12.7-debian-12-x86_64.tar.gz" + assert_success "ARCHIVE_URL=http://example.com/binaries/3.12.7-debian-12-x86_64.tar.xz" } @test "rejects an entry name containing a slash" { @@ -102,10 +102,10 @@ generate-installer" --archive-base-url http://example.com/binaries assert_success assert [ -d "${PYENV_ROOT}/versions/3.12.7-test" ] - assert [ -f "${BATS_TEST_TMPDIR}/3.12.7-test.tar.gz" ] + assert [ -f "${BATS_TEST_TMPDIR}/3.12.7-test.tar.xz" ] assert [ -f "${BATS_TEST_TMPDIR}/3.12.7-test.meta" ] run grep '^ARCHIVE_URL=' "${BATS_TEST_TMPDIR}/3.12.7-test" - assert_success "ARCHIVE_URL=http://example.com/binaries/3.12.7-test.tar.gz" + assert_success "ARCHIVE_URL=http://example.com/binaries/3.12.7-test.tar.xz" } @test "correctly joins archive base url with a trailing slash" { @@ -127,5 +127,5 @@ done run pyenv-binary-package 3.12.7:3.12.7-test \ --archive-base-url http://example.com/binaries/ assert_success - assert_line "pyenv-binary-generate-installer --archive-url http://example.com/binaries/3.12.7-test.tar.gz" + assert_line "pyenv-binary-generate-installer --archive-url http://example.com/binaries/3.12.7-test.tar.xz" } diff --git a/plugins/pyenv-binary/test/save.bats b/plugins/pyenv-binary/test/save.bats index 11afe55e..62e0fe83 100644 --- a/plugins/pyenv-binary/test/save.bats +++ b/plugins/pyenv-binary/test/save.bats @@ -33,13 +33,13 @@ platform() { @test "packages an installed version" { create_version "3.12.7" local out="${BATS_TEST_TMPDIR}/dist" - local archive="${out}/3.12.7-$(platform).tar.gz" + local archive="${out}/3.12.7-$(platform).tar.xz" run pyenv-binary-save "3.12.7" "$out" - assert_success "Saved 3.12.7-$(platform).tar.gz and 3.12.7-$(platform).meta to $out" + assert_success "Saved 3.12.7-$(platform).tar.xz and 3.12.7-$(platform).meta to $out" assert [ -f "$archive" ] assert [ -f "${out}/3.12.7-$(platform).meta" ] - run tar -tzf "$archive" + run tar -tJf "$archive" assert_success assert_line 0 "3.12.7/" } @@ -49,10 +49,10 @@ platform() { local out="${BATS_TEST_TMPDIR}/dist" run pyenv-binary-save "3.12.7" "$out" --name "custom" - assert_success "Saved custom.tar.gz and custom.meta to $out" - assert [ -f "${out}/custom.tar.gz" ] + assert_success "Saved custom.tar.xz and custom.meta to $out" + assert [ -f "${out}/custom.tar.xz" ] run grep '^archive=' "${out}/custom.meta" - assert_success "archive=custom.tar.gz" + assert_success "archive=custom.tar.xz" } @test "fails when --name has no value" { @@ -76,7 +76,7 @@ platform() { assert_success assert_line "version=3.12.7" assert_line "platform=$(platform)" - assert_line "archive=3.12.7-$(platform).tar.gz" + assert_line "archive=3.12.7-$(platform).tar.xz" } @test "records the original installation prefix" { @@ -94,7 +94,7 @@ platform() { PATH="$(path_without readelf)" run pyenv-binary-save "3.12.7" "${BATS_TEST_TMPDIR}/dist" assert_failure "pyenv-binary: need readelf to inspect shared libraries" - assert [ ! -e "${BATS_TEST_TMPDIR}/dist/3.12.7-$(platform).tar.gz" ] + assert [ ! -e "${BATS_TEST_TMPDIR}/dist/3.12.7-$(platform).tar.xz" ] } @test "records only direct libraries resolved outside the prefix" { diff --git a/test/Dockerfile b/test/Dockerfile index 58fd3f21..732e6438 100644 --- a/test/Dockerfile +++ b/test/Dockerfile @@ -12,7 +12,7 @@ FROM bash:$BASH apk add sed coreutils findutils \ ;fi # Bats - RUN apk add --update parallel ncurses git binutils \ + RUN apk add --update parallel ncurses git binutils xz \ && mkdir -p ~/.parallel \ && touch ~/.parallel/will-cite COPY --from=bats /root/bats-core /root/bats-core