Merge pull request #9721 from ThomasWaldmann/binary-build-scripts

Binary build scripts
This commit is contained in:
TW 2026-06-04 20:57:47 +02:00 committed by GitHub
commit 68bf6a1c64
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 27 additions and 7 deletions

View file

@ -299,8 +299,7 @@ jobs:
if: ${{ matrix.binary && startsWith(github.ref, 'refs/tags/') }}
run: |
pip install -r requirements.d/pyinstaller.txt
mkdir -p dist/binary
pyinstaller --clean --distpath=dist/binary scripts/borg.exe.spec
./scripts/build-borg-using-pyinstaller.sh
- name: Smoke-test the built binary (${{ matrix.binary }})
if: ${{ matrix.binary && startsWith(github.ref, 'refs/tags/') }}
@ -471,8 +470,7 @@ jobs:
if [[ "${{ matrix.do_binaries }}" == "true" && "${{ startsWith(github.ref, 'refs/tags/') }}" == "true" ]]; then
python -m pip install -r requirements.d/pyinstaller.txt
mkdir -p dist/binary
pyinstaller --clean --distpath=dist/binary scripts/borg.exe.spec
./scripts/build-borg-using-pyinstaller.sh
pushd dist/binary
echo "single-file binary"
chmod +x borg.exe
@ -665,8 +663,7 @@ jobs:
# build borg.exe
. env/bin/activate
pip install -e ".[cockpit,s3,sftp,rclone]"
mkdir -p dist/binary
pyinstaller -y --clean --distpath=dist/binary scripts/borg.exe.spec
./scripts/build-borg-using-pyinstaller.sh
# build sdist and wheel in dist/...
python -m build

View file

@ -3,7 +3,7 @@
set -euo pipefail
OUTPUT_DIR="build"
OUTPUT_DIR="dist/binary"
OUTPUT_FILENAME="borg-nuitka.exe" # .exe does NOT mean windows here
SRC_DIR="src/borg"
@ -13,6 +13,7 @@ echo "Building single-file binary of borgbackup..."
# We use --assume-yes-for-downloads to avoid interactive prompts in automated runs.
# We set PYTHONPATH=src to ensure the local version of borg is used.
# We include cffi to avoid runtime ModuleNotFoundError in argon2-cffi.
mkdir -p $OUTPUT_DIR
PYTHONPATH=src python -m nuitka \
--mode=onefile \
--assume-yes-for-downloads \

View file

@ -0,0 +1,22 @@
#!/bin/bash
# Generate a single-file binary of borgbackup using PyInstaller.
set -euo pipefail
OUTPUT_DIR="dist/binary"
SPEC_FILE="scripts/borg.exe.spec"
echo "Building single-file binary of borgbackup using PyInstaller..."
# Run PyInstaller compilation
# We use -y/--noconfirm to overwrite the output directory without asking.
# We use --clean to clean PyInstaller cache and temporary files before building.
mkdir -p $OUTPUT_DIR
pyinstaller \
-y \
--clean \
--distpath="$OUTPUT_DIR" \
"$SPEC_FILE"
echo "Single-file binary generated at:"
echo "$OUTPUT_DIR/borg.exe"