From 7dedd67e8e9d59ddbced970ff0f010feb6fbfde7 Mon Sep 17 00:00:00 2001 From: onyks-os <129986281+onyks-os@users.noreply.github.com> Date: Thu, 3 Dec 2026 20:11:59 +0100 Subject: [PATCH] install.sh: upgrade a source install instead of failing on bin/ttp install_locked.sh installs the wheel with `installer`, which never overwrites, so re-running scripts/install.sh over an existing /opt/ttp failed with FileExistsError: /opt/ttp/venv/bin/ttp (seen upgrading 0.5.1 to 0.5.2). Uninstall the previous version from the venv first, and replace /opt/ttp/ttp instead of copying over it. CI now installs the runtime twice into one venv. Co-Authored-By: Claude Opus 5.5 Signed-off-by: onyks-os <129986281+onyks-os@users.noreply.github.com> --- .github/workflows/ci.yml | 2 ++ CHANGELOG.md | 10 ++++++++++ docs/web/release-notes/changelog.md | 10 ++++++++++ scripts/install.sh | 2 ++ scripts/install_locked.sh | 2 ++ 5 files changed, 26 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 182684f..da7463f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -78,6 +78,8 @@ jobs: run: | python -m venv "$RUNNER_TEMP/ttp-runtime" bash scripts/install_locked.sh "$RUNNER_TEMP/ttp-runtime/bin/python" runtime + # Again over the first: scripts/install.sh upgrades a source install this way. + bash scripts/install_locked.sh "$RUNNER_TEMP/ttp-runtime/bin/python" runtime "$RUNNER_TEMP/ttp-runtime/bin/ttp" --help >/dev/null "$RUNNER_TEMP/ttp-runtime/bin/ttp" start --help >/dev/null "$RUNNER_TEMP/ttp-runtime/bin/ttp" config --help >/dev/null diff --git a/CHANGELOG.md b/CHANGELOG.md index a0f7477..12ce55d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- `scripts/install.sh` could not upgrade a source install. It installs the + wheel with `installer`, which refuses to overwrite a file, so a second run + stopped at `/opt/ttp/venv/bin/ttp` with `FileExistsError`, possibly after + part of the new version was already written. The previous version is now + uninstalled from the venv first, and `/opt/ttp/ttp` is replaced rather than + copied over, so modules a release removed do not linger. CI installs the + runtime twice into one venv. + ### Tests - The `nse` extra requires `network-sandbox-engine>=2.9.0`. In 2.9.0 a diff --git a/docs/web/release-notes/changelog.md b/docs/web/release-notes/changelog.md index 92035d4..4a5065d 100644 --- a/docs/web/release-notes/changelog.md +++ b/docs/web/release-notes/changelog.md @@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- `scripts/install.sh` could not upgrade a source install. It installs the + wheel with `installer`, which refuses to overwrite a file, so a second run + stopped at `/opt/ttp/venv/bin/ttp` with `FileExistsError`, possibly after + part of the new version was already written. The previous version is now + uninstalled from the venv first, and `/opt/ttp/ttp` is replaced rather than + copied over, so modules a release removed do not linger. CI installs the + runtime twice into one venv. + ### Tests - The `nse` extra requires `network-sandbox-engine>=2.9.0`. In 2.9.0 a diff --git a/scripts/install.sh b/scripts/install.sh index dfdba51..1ca1e96 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -51,6 +51,8 @@ echo "[TTP] Starting system-wide installation..." # This follows Linux best practices for optional/third-party software. echo "[TTP] Deploying files to /opt/ttp..." mkdir -p /opt/ttp +# A copy, not a merge: modules a newer release removed must not linger. +rm -rf /opt/ttp/ttp cp -r ttp /opt/ttp/ cp -r assets /opt/ttp/ cp pyproject.toml /opt/ttp/ diff --git a/scripts/install_locked.sh b/scripts/install_locked.sh index 97cf5b8..0f1e925 100755 --- a/scripts/install_locked.sh +++ b/scripts/install_locked.sh @@ -13,6 +13,8 @@ if [ "$profile" != docs ]; then work=$(mktemp -d) trap 'rm -rf "$work"' EXIT "$python" -m build --no-isolation --wheel --outdir "$work" "$source_dir" + # installer never overwrites: without this, re-running install.sh to upgrade stops at bin/ttp. + "$python" -m pip uninstall --yes --quiet transparent-tor-proxy "$python" -m installer "$work"/*.whl fi "$python" -m pip check