mirror of
https://github.com/pyenv/pyenv.git
synced 2026-10-02 23:41:06 +09:00
pyenv-binary: use xz compression for archives (#3543)
This commit is contained in:
parent
5d43b9a39d
commit
676b71e7b5
2
.github/workflows/publish_binary.yml
vendored
2
.github/workflows/publish_binary.yml
vendored
@ -52,7 +52,7 @@ jobs:
|
|||||||
- name: Update downloads
|
- name: Update downloads
|
||||||
run: |
|
run: |
|
||||||
mkdir -p site/pythons/binaries
|
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/
|
site/pythons/binaries/
|
||||||
cd site/pythons
|
cd site/pythons
|
||||||
./update.sh
|
./update.sh
|
||||||
|
|||||||
@ -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
|
is not portable across, say, glibc and musl, or to an older glibc; the platform
|
||||||
and dependency metadata exist to catch that.
|
and dependency metadata exist to catch that.
|
||||||
|
|
||||||
|
Installing a binary package requires `tar` with xz support (typically provided
|
||||||
|
by the `xz` package).
|
||||||
|
|
||||||
## Commands
|
## Commands
|
||||||
|
|
||||||
### `pyenv binary package [-v|--verbose] <version>[:<entry>] --archive-base-url <url>`
|
### `pyenv binary package [-v|--verbose] <version>[:<entry>] --archive-base-url <url>`
|
||||||
@ -29,7 +32,7 @@ Pass `-v` to show build progress from `pyenv install`.
|
|||||||
```sh
|
```sh
|
||||||
pyenv binary package 3.12.7 \
|
pyenv binary package 3.12.7 \
|
||||||
--archive-base-url https://example.com/binaries
|
--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.
|
# its .meta file and a `3.12.7-debian-12-x86_64' definition.
|
||||||
|
|
||||||
pyenv binary package 3.12.7:company-python \
|
pyenv binary package 3.12.7:company-python \
|
||||||
@ -54,7 +57,7 @@ pyenv binary package-name 3.12.7
|
|||||||
|
|
||||||
### `pyenv binary save <version> [<output-dir>] [--name <name>]`
|
### `pyenv binary save <version> [<output-dir>] [--name <name>]`
|
||||||
|
|
||||||
Packs an installed version into `<version>-<platform>.tar.gz` (relative paths)
|
Packs an installed version into `<version>-<platform>.tar.xz` (relative paths)
|
||||||
and writes `<version>-<platform>.meta` describing the build platform (OS, arch,
|
and writes `<version>-<platform>.meta` describing the build platform (OS, arch,
|
||||||
distro and libc version) and the system libraries the build links against. Use
|
distro and libc version) and the system libraries the build links against. Use
|
||||||
`--name` to set a different base name for both files.
|
`--name` to set a different base name for both files.
|
||||||
@ -78,7 +81,7 @@ needs are present.
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
pyenv binary generate-installer ./dist/3.12.7-linux-x86_64.meta \
|
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"
|
-o "$(pyenv root)/plugins/python-build/share/python-build/3.12.7-linux-x86_64"
|
||||||
|
|
||||||
pyenv install 3.12.7-linux-x86_64
|
pyenv install 3.12.7-linux-x86_64
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
# Installs <version> from source under a separate entry name, saves it as a
|
# Installs <version> from source under a separate entry name, saves it as a
|
||||||
# binary package, then emits a python-build definition for that package.
|
# binary package, then emits a python-build definition for that package.
|
||||||
# The archive, metadata and definition are written to the current directory
|
# The archive, metadata and definition are written to the current directory
|
||||||
# as <entry>.tar.gz, <entry>.meta and <entry>.
|
# as <entry>.tar.xz, <entry>.meta and <entry>.
|
||||||
#
|
#
|
||||||
# <version> A version `pyenv install' knows how to build.
|
# <version> A version `pyenv install' knows how to build.
|
||||||
# <entry> The optional name to build under and install the
|
# <entry> The optional name to build under and install the
|
||||||
@ -16,7 +16,7 @@
|
|||||||
# -v,--verbose Show build progress from `pyenv install'.
|
# -v,--verbose Show build progress from `pyenv install'.
|
||||||
# --archive-base-url <url>
|
# --archive-base-url <url>
|
||||||
# Where the archive will be hosted; the definition
|
# Where the archive will be hosted; the definition
|
||||||
# downloads it from <url>/<entry>.tar.gz.
|
# downloads it from <url>/<entry>.tar.xz.
|
||||||
#
|
#
|
||||||
set -e
|
set -e
|
||||||
[ -n "$PYENV_DEBUG" ] && set -x
|
[ -n "$PYENV_DEBUG" ] && set -x
|
||||||
@ -80,4 +80,4 @@ pyenv-install ${verbose:+--verbose} "$spec"
|
|||||||
pyenv-binary-save "$entry" "$PWD" --name "$entry"
|
pyenv-binary-save "$entry" "$PWD" --name "$entry"
|
||||||
|
|
||||||
pyenv-binary-generate-installer "${entry}.meta" \
|
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"
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
#
|
#
|
||||||
# Usage: pyenv binary save <version> [<output-dir>] [--name <name>]
|
# Usage: pyenv binary save <version> [<output-dir>] [--name <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
|
# writes a metadata file listing the build platform and the system libraries
|
||||||
# it links against, so an installer can check compatibility before unpacking.
|
# it links against, so an installer can check compatibility before unpacking.
|
||||||
#
|
#
|
||||||
@ -134,10 +134,10 @@ system_deps() {
|
|||||||
|
|
||||||
mkdir -p "$output_dir"
|
mkdir -p "$output_dir"
|
||||||
package_name="${package_name:-${version}-${platform}}"
|
package_name="${package_name:-${version}-${platform}}"
|
||||||
archive="${package_name}.tar.gz"
|
archive="${package_name}.tar.xz"
|
||||||
metadata="${package_name}.meta"
|
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"
|
echo "# pyenv-binary metadata"
|
||||||
|
|||||||
@ -66,10 +66,10 @@ pyenv-install --list --bare
|
|||||||
run pyenv-binary-package 3.12.7 --archive-base-url http://example.com/binaries
|
run pyenv-binary-package 3.12.7 --archive-base-url http://example.com/binaries
|
||||||
assert_success
|
assert_success
|
||||||
assert [ -d "${PYENV_ROOT}/versions/3.12.7-debian-12-x86_64" ]
|
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" ]
|
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"
|
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" {
|
@test "rejects an entry name containing a slash" {
|
||||||
@ -102,10 +102,10 @@ generate-installer"
|
|||||||
--archive-base-url http://example.com/binaries
|
--archive-base-url http://example.com/binaries
|
||||||
assert_success
|
assert_success
|
||||||
assert [ -d "${PYENV_ROOT}/versions/3.12.7-test" ]
|
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" ]
|
assert [ -f "${BATS_TEST_TMPDIR}/3.12.7-test.meta" ]
|
||||||
run grep '^ARCHIVE_URL=' "${BATS_TEST_TMPDIR}/3.12.7-test"
|
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" {
|
@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 \
|
run pyenv-binary-package 3.12.7:3.12.7-test \
|
||||||
--archive-base-url http://example.com/binaries/
|
--archive-base-url http://example.com/binaries/
|
||||||
assert_success
|
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"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,13 +33,13 @@ platform() {
|
|||||||
@test "packages an installed version" {
|
@test "packages an installed version" {
|
||||||
create_version "3.12.7"
|
create_version "3.12.7"
|
||||||
local out="${BATS_TEST_TMPDIR}/dist"
|
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"
|
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 "$archive" ]
|
||||||
assert [ -f "${out}/3.12.7-$(platform).meta" ]
|
assert [ -f "${out}/3.12.7-$(platform).meta" ]
|
||||||
run tar -tzf "$archive"
|
run tar -tJf "$archive"
|
||||||
assert_success
|
assert_success
|
||||||
assert_line 0 "3.12.7/"
|
assert_line 0 "3.12.7/"
|
||||||
}
|
}
|
||||||
@ -49,10 +49,10 @@ platform() {
|
|||||||
local out="${BATS_TEST_TMPDIR}/dist"
|
local out="${BATS_TEST_TMPDIR}/dist"
|
||||||
|
|
||||||
run pyenv-binary-save "3.12.7" "$out" --name "custom"
|
run pyenv-binary-save "3.12.7" "$out" --name "custom"
|
||||||
assert_success "Saved custom.tar.gz and custom.meta to $out"
|
assert_success "Saved custom.tar.xz and custom.meta to $out"
|
||||||
assert [ -f "${out}/custom.tar.gz" ]
|
assert [ -f "${out}/custom.tar.xz" ]
|
||||||
run grep '^archive=' "${out}/custom.meta"
|
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" {
|
@test "fails when --name has no value" {
|
||||||
@ -76,7 +76,7 @@ platform() {
|
|||||||
assert_success
|
assert_success
|
||||||
assert_line "version=3.12.7"
|
assert_line "version=3.12.7"
|
||||||
assert_line "platform=$(platform)"
|
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" {
|
@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"
|
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_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" {
|
@test "records only direct libraries resolved outside the prefix" {
|
||||||
|
|||||||
@ -12,7 +12,7 @@ FROM bash:$BASH
|
|||||||
apk add sed coreutils findutils \
|
apk add sed coreutils findutils \
|
||||||
;fi
|
;fi
|
||||||
# Bats
|
# Bats
|
||||||
RUN apk add --update parallel ncurses git binutils \
|
RUN apk add --update parallel ncurses git binutils xz \
|
||||||
&& mkdir -p ~/.parallel \
|
&& mkdir -p ~/.parallel \
|
||||||
&& touch ~/.parallel/will-cite
|
&& touch ~/.parallel/will-cite
|
||||||
COPY --from=bats /root/bats-core /root/bats-core
|
COPY --from=bats /root/bats-core /root/bats-core
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user