From 0d8380ec5adf5457af3be0c0b9142520ec343c8b Mon Sep 17 00:00:00 2001 From: Davide Grilli Date: Mon, 8 Dec 2025 23:21:01 +0100 Subject: [PATCH] Fix(build): Enhance reproducibility of AppImage builds with version handling --- contrib/build-linux/appimage/make_appimage.sh | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/contrib/build-linux/appimage/make_appimage.sh b/contrib/build-linux/appimage/make_appimage.sh index 2d37786e5..586c7d129 100755 --- a/contrib/build-linux/appimage/make_appimage.sh +++ b/contrib/build-linux/appimage/make_appimage.sh @@ -25,9 +25,6 @@ PYTHON_VERSION=3.12.11 PY_VER_MAJOR="3.12" # as it appears in fs paths PKG2APPIMAGE_COMMIT="a9c85b7e61a3a883f4a35c41c5decb5af88b6b5d" -VERSION=$(git describe --tags --dirty --always) -APPIMAGE="$DISTDIR/pallectrum-$VERSION-x86_64.AppImage" - rm -rf "$BUILDDIR" mkdir -p "$APPDIR" "$CACHEDIR" "$PIP_CACHE_DIR" "$DISTDIR" "$DLL_TARGET_DIR" @@ -115,6 +112,22 @@ info "installing pip." break_legacy_easy_install +info "determining version for AppImage filename." +# For reproducible builds or clean repo: use clean version from version.py +# For development builds with uncommitted changes: add git hash and -dirty suffix +VERSION=$("$python" "$CONTRIB"/print_electrum_version.py) +if [ -n "$ELECBUILD_COMMIT" ] || git diff-index --quiet HEAD -- ; then + # Reproducible build or clean repo: clean version only + APPIMAGE="$DISTDIR/pallectrum-v$VERSION-x86_64.AppImage" +else + # Development build with uncommitted changes: add git info + GIT_HASH=$(git rev-parse --short=9 HEAD) + VERSION_WITH_HASH="v$VERSION-$(git rev-list --count HEAD)-g$GIT_HASH-dirty" + APPIMAGE="$DISTDIR/pallectrum-$VERSION_WITH_HASH-x86_64.AppImage" +fi +info "AppImage will be: $APPIMAGE" + + info "preparing electrum-locale." ( "$CONTRIB/locale/build_cleanlocale.sh"