Files
pallectrum/contrib/build-linux/appimage/make_appimage.sh

281 lines
12 KiB
Bash
Raw Normal View History

#!/bin/bash
set -e
PROJECT_ROOT="$(dirname "$(readlink -e "$0")")/../../.."
CONTRIB="$PROJECT_ROOT/contrib"
CONTRIB_APPIMAGE="$CONTRIB/build-linux/appimage"
DISTDIR="$PROJECT_ROOT/dist"
BUILDDIR="$CONTRIB_APPIMAGE/build/appimage"
APPDIR="$BUILDDIR/electrum.AppDir"
CACHEDIR="$CONTRIB_APPIMAGE/.cache/appimage"
TYPE2_RUNTIME_REPO_DIR="$CACHEDIR/type2-runtime"
export DLL_TARGET_DIR="$CACHEDIR/dlls"
PIP_CACHE_DIR="$CONTRIB_APPIMAGE/.cache/pip_cache"
. "$CONTRIB"/build_tools_util.sh
git -C "$PROJECT_ROOT" rev-parse 2>/dev/null || fail "Building outside a git clone is not supported."
export GCC_STRIP_BINARIES="1"
# pinned versions
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/electrum-$VERSION-x86_64.AppImage"
rm -rf "$BUILDDIR"
mkdir -p "$APPDIR" "$CACHEDIR" "$PIP_CACHE_DIR" "$DISTDIR" "$DLL_TARGET_DIR"
# potential leftover from setuptools that might make pip put garbage in binary
rm -rf "$PROJECT_ROOT/build"
info "downloading some dependencies."
download_if_not_exist "$CACHEDIR/functions.sh" "https://raw.githubusercontent.com/AppImage/pkg2appimage/$PKG2APPIMAGE_COMMIT/functions.sh"
verify_hash "$CACHEDIR/functions.sh" "8f67711a28635b07ce539a9b083b8c12d5488c00003d6d726c7b134e553220ed"
download_if_not_exist "$CACHEDIR/appimagetool" "https://github.com/AppImage/appimagetool/releases/download/1.9.0/appimagetool-x86_64.AppImage"
verify_hash "$CACHEDIR/appimagetool" "46fdd785094c7f6e545b61afcfb0f3d98d8eab243f644b4b17698c01d06083d1"
# note: desktop-file-utils in the docker image is needed to run desktop-file-validate for appimagetool <= 1.9.0, so it can be removed once
# appimagetool tags a new release (see https://github.com/AppImage/appimagetool/pull/47)
download_if_not_exist "$CACHEDIR/Python-$PYTHON_VERSION.tar.xz" "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz"
verify_hash "$CACHEDIR/Python-$PYTHON_VERSION.tar.xz" "c30bb24b7f1e9a19b11b55a546434f74e739bb4c271a3e3a80ff4380d49f7adb"
info "building python."
tar xf "$CACHEDIR/Python-$PYTHON_VERSION.tar.xz" -C "$CACHEDIR"
(
if [ -f "$CACHEDIR/Python-$PYTHON_VERSION/python" ]; then
info "python already built, skipping"
exit 0
fi
cd "$CACHEDIR/Python-$PYTHON_VERSION"
LC_ALL=C export BUILD_DATE=$(date -u -d "@$SOURCE_DATE_EPOCH" "+%b %d %Y")
LC_ALL=C export BUILD_TIME=$(date -u -d "@$SOURCE_DATE_EPOCH" "+%H:%M:%S")
# Patches taken from Ubuntu http://archive.ubuntu.com/ubuntu/pool/main/p/python3.11/python3.11_3.11.6-3.debian.tar.xz
patch -p1 < "$CONTRIB_APPIMAGE/patches/python-3.11-reproducible-buildinfo.diff"
./configure \
--cache-file="$CACHEDIR/python.config.cache" \
--prefix="$APPDIR/usr" \
--enable-ipv6 \
--enable-shared \
-q
make "-j$CPU_COUNT" -s || fail "Could not build Python"
)
info "installing python."
(
cd "$CACHEDIR/Python-$PYTHON_VERSION"
make -s install > /dev/null || fail "Could not install Python"
# When building in docker on macOS, python builds with .exe extension because the
# case insensitive file system of macOS leaks into docker. This causes the build
# to result in a different output on macOS compared to Linux. We simply patch
# sysconfigdata to remove the extension.
# Some more info: https://bugs.python.org/issue27631
sed -i -e 's/\.exe//g' "${APPDIR}/usr/lib/python${PY_VER_MAJOR}"/_sysconfigdata*
)
if ls "$DLL_TARGET_DIR"/libsecp256k1.so.* 1> /dev/null 2>&1; then
info "libsecp256k1 already built, skipping"
else
"$CONTRIB"/make_libsecp256k1.sh || fail "Could not build libsecp"
fi
cp -f "$DLL_TARGET_DIR"/libsecp256k1.so.* "$APPDIR/usr/lib/" || fail "Could not copy libsecp to its destination"
if [ -f "$DLL_TARGET_DIR/libzbar.so.0" ]; then
info "libzbar already built, skipping"
else
# note: could instead just use the libzbar0 pkg from debian/apt, but that is too old and missing fixes for CVE-2023-40889
"$CONTRIB"/make_zbar.sh || fail "Could not build zbar"
fi
cp -f "$DLL_TARGET_DIR/libzbar.so.0" "$APPDIR/usr/lib/" || fail "Could not copy libzbar to its destination"
appdir_python() {
env \
PYTHONNOUSERSITE=1 \
LD_LIBRARY_PATH="$APPDIR/usr/lib:$APPDIR/usr/lib/x86_64-linux-gnu${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH}" \
"$APPDIR/usr/bin/python${PY_VER_MAJOR}" "$@"
}
python='appdir_python'
info "installing pip."
"$python" -m ensurepip
break_legacy_easy_install
info "preparing electrum-locale."
(
"$CONTRIB/locale/build_cleanlocale.sh"
# we want the binary to have only compiled (.mo) locale files; not source (.po) files
2025-04-10 17:37:54 +00:00
rm -r "$PROJECT_ROOT/electrum/locale/locale"/*/electrum.po
)
info "Installing build dependencies."
# note: re pip installing from PyPI,
# we prefer compiling C extensions ourselves, instead of using binary wheels,
# hence "--no-binary :all:" flags. However, we specifically allow
# - PyQt6, as it's harder to build from source
# - cryptography, as it's harder to build from source
# - the whole of "requirements-build-base.txt", which includes pip and friends, as it also includes "wheel",
# and I am not quite sure how to break the circular dependence there (I guess we could introduce
# "requirements-build-base-base.txt" with just wheel in it...)
"$python" -m pip install --no-build-isolation --no-dependencies --no-warn-script-location \
--cache-dir "$PIP_CACHE_DIR" -r "$CONTRIB/deterministic-build/requirements-build-base.txt"
"$python" -m pip install --no-build-isolation --no-dependencies --no-binary :all: --no-warn-script-location \
2021-03-07 22:12:26 +01:00
--cache-dir "$PIP_CACHE_DIR" -r "$CONTRIB/deterministic-build/requirements-build-appimage.txt"
# opt out of compiling C extensions
export YARL_NO_EXTENSIONS=1
2025-05-30 17:43:51 +00:00
export FROZENLIST_NO_EXTENSIONS=1
export ELECTRUM_ECC_DONT_COMPILE=1
info "installing electrum and its dependencies."
"$python" -m pip install --no-build-isolation --no-dependencies --no-binary :all: --no-warn-script-location \
2021-03-07 22:12:26 +01:00
--cache-dir "$PIP_CACHE_DIR" -r "$CONTRIB/deterministic-build/requirements.txt"
"$python" -m pip install --no-build-isolation --no-dependencies --no-binary :all: --only-binary PyQt6,PyQt6-Qt6,cryptography --no-warn-script-location \
2021-03-07 22:12:26 +01:00
--cache-dir "$PIP_CACHE_DIR" -r "$CONTRIB/deterministic-build/requirements-binaries.txt"
"$python" -m pip install --no-build-isolation --no-dependencies --no-binary :all: --no-warn-script-location \
2021-03-07 22:12:26 +01:00
--cache-dir "$PIP_CACHE_DIR" -r "$CONTRIB/deterministic-build/requirements-hw.txt"
"$python" -m pip install --no-build-isolation --no-dependencies --no-warn-script-location \
2021-03-07 22:12:26 +01:00
--cache-dir "$PIP_CACHE_DIR" "$PROJECT_ROOT"
# was only needed during build time, not runtime
"$python" -m pip uninstall -y Cython
info "desktop integration."
cp "$PROJECT_ROOT/electrum.desktop" "$APPDIR/electrum.desktop"
cp "$PROJECT_ROOT/electrum/gui/icons/electrum.png" "$APPDIR/electrum.png"
# add launcher
cp "$CONTRIB_APPIMAGE/apprun.sh" "$APPDIR/AppRun"
info "finalizing AppDir."
(
export PKG2AICOMMIT="$PKG2APPIMAGE_COMMIT"
. "$CACHEDIR/functions.sh"
cd "$APPDIR"
# copy system dependencies
copy_deps; copy_deps; copy_deps
move_lib
# apply global appimage blacklist to exclude stuff
# move usr/include out of the way to preserve usr/include/python${PY_VER_MAJOR}.
mv usr/include usr/include.tmp
delete_blacklisted
mv usr/include.tmp usr/include
)
info "Copying additional libraries"
(
# On some systems it can cause problems to use the system libusb (on AppImage excludelist)
cp -f /usr/lib/x86_64-linux-gnu/libusb-1.0.so "$APPDIR/usr/lib/libusb-1.0.so" || fail "Could not copy libusb"
# some distros lack libxkbcommon-x11
cp -f /usr/lib/x86_64-linux-gnu/libxkbcommon-x11.so.0 "$APPDIR"/usr/lib/x86_64-linux-gnu || fail "Could not copy libxkbcommon-x11"
AppImage build: Include libxcb into the image Ubuntu 20.04 needs `libxcb-xinerama.so.0` and Debian 10 needs `libxcb-util.so.1` for the Qt `xcb` plugin. ----- ported from https://github.com/Electron-Cash/Electron-Cash/commit/380f04a8054fe9fd9169721089c5da360f9d0807 see https://github.com/Electron-Cash/Electron-Cash/issues/2196 ----- In particular, see this comment: >> I confirmed that both Ubuntu 20.04 and Debian 10.8 clean install have an issue with the 4.2.4 AppImage. > > Any idea what broke it? I assume it used to work. Yes, it did work in 4.2.3 which used PyQt5 5.13.2. I just had a look at the xcb plugin and it definitely has less dependencies: ``` ago@ubuntu2004vm:~/src/Electron-Cash/dist$ ldd squashfs-root/usr/lib/python3.6/site-packages/PyQt5/Qt/plugins/platforms/libqxcb.so|grep xcb libX11-xcb.so.1 => /lib/x86_64-linux-gnu/libX11-xcb.so.1 (0x00007f0ec9d07000) libxcb.so.1 => /lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f0ec9cdd000) libxcb-xkb.so.1 => /lib/x86_64-linux-gnu/libxcb-xkb.so.1 (0x00007f0ec6ead000) ``` compared to PyQt5 5.15.2 in 4.2.4: ``` ago@ubuntu2004vm:~/src/Electron-Cash/dist$ ldd squashfs-root/usr/lib/python3.8/site-packages/PyQt5/Qt/plugins/platforms/libqxcb.so|grep xcb libX11-xcb.so.1 => /lib/x86_64-linux-gnu/libX11-xcb.so.1 (0x00007fcb5715f000) libxcb-icccm.so.4 => /lib/x86_64-linux-gnu/libxcb-icccm.so.4 (0x00007fcb57158000) libxcb-image.so.0 => /lib/x86_64-linux-gnu/libxcb-image.so.0 (0x00007fcb56f51000) libxcb-shm.so.0 => /lib/x86_64-linux-gnu/libxcb-shm.so.0 (0x00007fcb56f4c000) libxcb-util.so.1 => /lib/x86_64-linux-gnu/libxcb-util.so.1 (0x00007fcb56d46000) libxcb-keysyms.so.1 => /lib/x86_64-linux-gnu/libxcb-keysyms.so.1 (0x00007fcb56d41000) libxcb-randr.so.0 => /lib/x86_64-linux-gnu/libxcb-randr.so.0 (0x00007fcb56d2e000) libxcb-render-util.so.0 => /lib/x86_64-linux-gnu/libxcb-render-util.so.0 (0x00007fcb56d27000) libxcb-render.so.0 => /lib/x86_64-linux-gnu/libxcb-render.so.0 (0x00007fcb56d16000) libxcb-shape.so.0 => /lib/x86_64-linux-gnu/libxcb-shape.so.0 (0x00007fcb56d11000) libxcb-sync.so.1 => /lib/x86_64-linux-gnu/libxcb-sync.so.1 (0x00007fcb56d07000) libxcb-xfixes.so.0 => /lib/x86_64-linux-gnu/libxcb-xfixes.so.0 (0x00007fcb56cfd000) libxcb-xinerama.so.0 => /lib/x86_64-linux-gnu/libxcb-xinerama.so.0 (0x00007fcb56cf8000) libxcb-xkb.so.1 => /lib/x86_64-linux-gnu/libxcb-xkb.so.1 (0x00007fcb56cda000) libxcb.so.1 => /lib/x86_64-linux-gnu/libxcb.so.1 (0x00007fcb56cae000) ```
2021-03-27 20:18:32 +01:00
# some distros lack some libxcb libraries (see https://github.com/Electron-Cash/Electron-Cash/issues/2196)
cp -f /usr/lib/x86_64-linux-gnu/libxcb-* "$APPDIR"/usr/lib/x86_64-linux-gnu || fail "Could not copy libxcb"
)
info "stripping binaries from debug symbols."
# "-R .note.gnu.build-id" also strips the build id
# "-R .comment" also strips the GCC version information
strip_binaries()
{
chmod u+w -R "$APPDIR"
{
printf '%s\0' "$APPDIR/usr/bin/python${PY_VER_MAJOR}"
find "$APPDIR" -type f -regex '.*\.so\(\.[0-9.]+\)?$' -print0
} | xargs -0 --no-run-if-empty --verbose strip -R .note.gnu.build-id -R .comment
}
strip_binaries
remove_emptydirs()
{
find "$APPDIR" -type d -empty -print0 | xargs -0 --no-run-if-empty rmdir -vp --ignore-fail-on-non-empty
}
remove_emptydirs
info "removing some unneeded stuff to decrease binary size."
rm -rf "$APPDIR"/usr/{share,include}
PYDIR="$APPDIR/usr/lib/python${PY_VER_MAJOR}"
rm -rf "$PYDIR"/{test,ensurepip,lib2to3,idlelib,turtledemo}
rm -rf "$PYDIR"/{ctypes,sqlite3,tkinter,unittest}/test
rm -rf "$PYDIR"/distutils/{command,tests}
build appimage: make binary somewhat smaller by excluding stuff 4.1.5->4.2.1, the appimage grew 54M->66M. This change shrinks it back to 58M. ``` $ ls -lah total 224M drwxrwxr-x 5 user user 4.0K Mar 27 18:18 . drwxrwxr-x 16 user user 4.0K Mar 23 16:02 .. -rwxrw-r-- 1 user user 48M Dec 18 2020 electrum-4.0.9-x86_64.AppImage -rwxrw-r-- 1 user user 54M Jan 19 14:25 electrum-4.1.5-x86_64.AppImage -rwxr-xr-x 1 user user 58M Mar 27 18:12 electrum-4.2.1-dirty-x86_64.AppImage -rwxrw-r-- 1 user user 66M Mar 27 15:00 electrum-4.2.1-x86_64.AppImage ``` I've used the great `ncdu` tool to investigate file sizes. ``` $ du squashfs-root-415/usr/lib/python3.7/ --max-depth=1 | sort -nr | head -n8 154608 squashfs-root-415/usr/lib/python3.7/ 138864 squashfs-root-415/usr/lib/python3.7/site-packages 4720 squashfs-root-415/usr/lib/python3.7/lib-dynload 1744 squashfs-root-415/usr/lib/python3.7/encodings 664 squashfs-root-415/usr/lib/python3.7/pydoc_data 460 squashfs-root-415/usr/lib/python3.7/distutils 460 squashfs-root-415/usr/lib/python3.7/asyncio 436 squashfs-root-415/usr/lib/python3.7/email $ du squashfs-root-421/usr/lib/python3.9/ --max-depth=1 | sort -nr | head -n8 194088 squashfs-root-421/usr/lib/python3.9/ 143512 squashfs-root-421/usr/lib/python3.9/site-packages 33824 squashfs-root-421/usr/lib/python3.9/config-3.9-x86_64-linux-gnu 5244 squashfs-root-421/usr/lib/python3.9/lib-dynload 1720 squashfs-root-421/usr/lib/python3.9/encodings 696 squashfs-root-421/usr/lib/python3.9/pydoc_data 520 squashfs-root-421/usr/lib/python3.9/asyncio 464 squashfs-root-421/usr/lib/python3.9/distutils ``` We should delete `usr/lib/python3.9/config-3.9-x86_64-linux-gnu/` (which is 33M unpacked) With py3.7 (electrum 4.1.5), this folder was named `config-3.7m-x86_64-linux-gnu`, presumably because the default config to compile py3.7 was `--with-pymalloc`, but maybe it is not for py3.9... ? not sure. (see https://peps.python.org/pep-3149/ )
2022-03-27 19:27:55 +02:00
rm -rf "$PYDIR"/config-3.*-x86_64-linux-gnu
rm -rf "$PYDIR"/site-packages/{opt,pip,setuptools,wheel}
rm -rf "$PYDIR"/site-packages/Cryptodome/SelfTest
rm -rf "$PYDIR"/site-packages/{psutil,qrcode,websocket}/tests
# rm lots of unused parts of Qt/PyQt. (assuming PyQt 6 layout)
for component in connectivity declarative help location multimedia quickcontrols2 serialport webengine websockets xmlpatterns ; do
rm -rf "$PYDIR"/site-packages/PyQt6/Qt6/translations/qt${component}_*
rm -rf "$PYDIR"/site-packages/PyQt6/Qt6/resources/qt${component}_*
done
rm -rf "$PYDIR"/site-packages/PyQt6/Qt6/{qml,libexec}
rm -rf "$PYDIR"/site-packages/PyQt6/{pyrcc*.so,pylupdate*.so,uic}
rm -rf "$PYDIR"/site-packages/PyQt6/Qt6/plugins/{bearer,gamepads,geometryloaders,geoservices,playlistformats,position,renderplugins,sceneparsers,sensors,sqldrivers,texttospeech,webview}
for component in Bluetooth Concurrent Designer Help Location NetworkAuth Nfc Positioning PositioningQuick Qml Quick Sensors SerialPort Sql Test Web Xml Labs ShaderTools SpatialAudio ; do
rm -rf "$PYDIR"/site-packages/PyQt6/Qt6/lib/libQt6${component}*
rm -rf "$PYDIR"/site-packages/PyQt6/Qt${component}*
rm -rf "$PYDIR"/site-packages/PyQt6/bindings/Qt${component}*
done
for component in Qml Quick ; do
rm -rf "$PYDIR"/site-packages/PyQt6/Qt6/lib/libQt6*${component}.so*
done
rm -rf "$PYDIR"/site-packages/PyQt6/Qt.so
# these are deleted as they were not deterministic; and are not needed anyway
find "$APPDIR" -path '*/__pycache__*' -delete
# although note that *.dist-info might be needed by certain packages...
build: appimage: fix trezor plugin for new trezorlib - similar to prev commit that fixes it for the pyinstaller builds - note that .dist-info/RECORD files are still not reproducible for many packages :(((( ``` $ cd dist/ $ ./electrum-*-x86_64.AppImage1 --appimage-extract $ mv squashfs-root/ squashfs-root1/ $ ./electrum-*-x86_64.AppImage2 --appimage-extract $ mv squashfs-root/ squashfs-root2/ $ $(cd squashfs-root1; find -type f -exec sha256sum '{}' \; > ./../sha256sum1) $ $(cd squashfs-root2; find -type f -exec sha256sum '{}' \; > ./../sha256sum2) $ diff sha256sum1 sha256sum2 > d $ cat d 507c507 < 269a133bd0d3c85265219c14154323ed934ac36ef9b389da609e43788de2bbcd ./usr/lib/python3.12/site-packages/cffi-1.17.1.dist-info/RECORD --- > d2c08987f207eed8e90476c576eeff67c0809d1bfd35234e583a2dc6895c5ff1 ./usr/lib/python3.12/site-packages/cffi-1.17.1.dist-info/RECORD 518c518 < d08bd76099191932f3cd289c19427ccab51d9c00a6c2e5126c57f83a84ec2246 ./usr/lib/python3.12/site-packages/aiohttp-3.12.4.dist-info/RECORD --- > 281c5c7e2b28e56134fa8690a2a446e3ebc515f8cb3705cd5d06e83c53812fab ./usr/lib/python3.12/site-packages/aiohttp-3.12.4.dist-info/RECORD 630c630 < 33665bc46c14e2c0f409ef2627170b093f6d7741e9516928928acbeeb717f155 ./usr/lib/python3.12/site-packages/propcache-0.3.1.dist-info/RECORD --- > 4fddb29289418edb3ec392a09b8efa826333a60cf508055cac809375e497174e ./usr/lib/python3.12/site-packages/propcache-0.3.1.dist-info/RECORD 1497c1497 < f80c1b47d15a7262ab2b81bcfc1f69816961b9f6b0fd3775ee5b5eb40d4b7a5b ./usr/lib/python3.12/site-packages/pyqt6_sip-13.10.2.dist-info/RECORD --- > 1b8fb8ea4d50d401cd4f6689531ab4922cb064b9caaec1aae6bd885c3a387eca ./usr/lib/python3.12/site-packages/pyqt6_sip-13.10.2.dist-info/RECORD 3108c3108 < ca06bbe1dba05cd647e89411dd301fad15f42d0ff53ac2c509391cf0303c15c4 ./usr/lib/python3.12/site-packages/multidict-6.4.4.dist-info/RECORD --- > 400741699b95d3c6bde3c64c7a4bb04b26cbdaee437a17b398d202794a1bd4cd ./usr/lib/python3.12/site-packages/multidict-6.4.4.dist-info/RECORD 3233c3233 < f67e8f271725676df296fab7fab72099f3b853905f9ff677b5de261a52412411 ./usr/lib/python3.12/site-packages/hidapi-0.14.0.post4.dist-info/RECORD --- > f4d43d5e4c3c2aa3e69fa40c7307b23b82ce4c5e4d5fb041a75b11ddc2ed7423 ./usr/lib/python3.12/site-packages/hidapi-0.14.0.post4.dist-info/RECORD 3271c3271 < aaa92bb84d0f56e82832903f1109dd4362c09ea4af0fefe3d0c95509bc0920ed ./usr/lib/python3.12/site-packages/cbor2-5.6.5.dist-info/RECORD --- > 8a21af0fadf22898266581df9987c97ee737a670bef9d71d5f53427619466b88 ./usr/lib/python3.12/site-packages/cbor2-5.6.5.dist-info/RECORD ``` ----- Example RECORD files: ``` $ diff squashfs-root1/./usr/lib/python3.12/site-packages/aiohttp-3.12.4.dist-info/RECORD squashfs-root2/./usr/lib/python3.12/site-packages/aiohttp-3.12.4.dist-info/RECORD 64c64 < aiohttp/_http_parser.cpython-312-x86_64-linux-gnu.so,sha256=SjcWt8faDDTOxBHetnDdlQU31sPj0Suc8pwY1_UnKkE,2868384 --- > aiohttp/_http_parser.cpython-312-x86_64-linux-gnu.so,sha256=xdf5Uy_NnFLmSmqNmeY7wytgwFdY7pHxZLOFFfl2Aq8,2868384 66c66 < aiohttp/_http_writer.cpython-312-x86_64-linux-gnu.so,sha256=g6PDJVuICGYq8rywuI6XFWLP6tw1KLWLpwSvJODWo18,510280 --- > aiohttp/_http_writer.cpython-312-x86_64-linux-gnu.so,sha256=U_Y0F0oYClrGRIKO_agXtAohjJ_jqfG375vESBZ56CY,510280 80c80 < aiohttp/_websocket/mask.cpython-312-x86_64-linux-gnu.so,sha256=u0PluBaJntMBktyD1AYv267FvbUO6gpj-Nt7erLj3Qg,257384 --- > aiohttp/_websocket/mask.cpython-312-x86_64-linux-gnu.so,sha256=tEnvrEzSPEtaFI8V_Ey08zy4SBmDhnm-QnxTxgDSYM4,257384 85c85 < aiohttp/_websocket/reader_c.cpython-312-x86_64-linux-gnu.so,sha256=wfcclW8jYOTVeLDRPO87dPvOBrtXiqxBsnEbP0yyGpI,1816496 --- > aiohttp/_websocket/reader_c.cpython-312-x86_64-linux-gnu.so,sha256=jfey8U3MSIp04r0bG_a1TFkIKSzMQ-FLSAWD3nY4wgg,1816496 ``` ``` $ diff squashfs-root1/./usr/lib/python3.12/site-packages/hidapi-0.14.0.post4.dist-info/RECORD squashfs-root2/./usr/lib/python3.12/site-packages/hidapi-0.14.0.post4.dist-info/RECORD 1c1 < hid.cpython-312-x86_64-linux-gnu.so,sha256=JefmLwo-XKZZmno3PBdmHnREed0Yw7IaPYCI2k1UmbM,1152024 --- > hid.cpython-312-x86_64-linux-gnu.so,sha256=38htTAcIC4nnTPIIjD0jkdtdwtGyWlBIhQwQ-g0K0iI,1152024 12c12 < hidraw.cpython-312-x86_64-linux-gnu.so,sha256=dJ4kVI0jXUj_Ba2cMcAL7Wjy8fkO21VPbhAmR-5n30Y,1156768 --- > hidraw.cpython-312-x86_64-linux-gnu.so,sha256=7908Jgbg7A-3JRtfKabPr_WJkMIjYgd5pX78_Yajo54,1156768 ``` ----- error at runtime: ``` 22.51 | E | plugins.trezor.trezor | error importing trezor plugin deps Traceback (most recent call last): File "/tmp/.mount_electrteDkNu/usr/lib/python3.12/importlib/metadata/__init__.py", line 397, in from_name return next(cls.discover(name=name)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ StopIteration During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/tmp/.mount_electrteDkNu/usr/lib/python3.12/site-packages/electrum/plugins/trezor/trezor.py", line 29, in <module> from .clientbase import TrezorClientBase, RecoveryDeviceInputMethod File "/tmp/.mount_electrteDkNu/usr/lib/python3.12/site-packages/electrum/plugins/trezor/clientbase.py", line 18, in <module> import trezorlib.device File "/tmp/.mount_electrteDkNu/usr/lib/python3.12/site-packages/trezorlib/device.py", line 27, in <module> from slip10 import SLIP10 File "/tmp/.mount_electrteDkNu/usr/lib/python3.12/site-packages/slip10/__init__.py", line 6, in <module> __version__ = importlib.metadata.version(__package__ or __name__) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/.mount_electrteDkNu/usr/lib/python3.12/importlib/metadata/__init__.py", line 889, in version return distribution(distribution_name).version ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/.mount_electrteDkNu/usr/lib/python3.12/importlib/metadata/__init__.py", line 862, in distribution return Distribution.from_name(distribution_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/.mount_electrteDkNu/usr/lib/python3.12/importlib/metadata/__init__.py", line 399, in from_name raise PackageNotFoundError(name) importlib.metadata.PackageNotFoundError: No package metadata was found for slip10 ```
2025-06-05 18:12:54 +00:00
# e.g. slip10 uses importlib that needs it
for f in "$PYDIR"/site-packages/slip10-*.dist-info; do mv "$f" "$(echo "$f" | sed s/\.dist-info/\.dist-info2/)"; done
rm -rf "$PYDIR"/site-packages/*.dist-info/
rm -rf "$PYDIR"/site-packages/*.egg-info/
build: appimage: fix trezor plugin for new trezorlib - similar to prev commit that fixes it for the pyinstaller builds - note that .dist-info/RECORD files are still not reproducible for many packages :(((( ``` $ cd dist/ $ ./electrum-*-x86_64.AppImage1 --appimage-extract $ mv squashfs-root/ squashfs-root1/ $ ./electrum-*-x86_64.AppImage2 --appimage-extract $ mv squashfs-root/ squashfs-root2/ $ $(cd squashfs-root1; find -type f -exec sha256sum '{}' \; > ./../sha256sum1) $ $(cd squashfs-root2; find -type f -exec sha256sum '{}' \; > ./../sha256sum2) $ diff sha256sum1 sha256sum2 > d $ cat d 507c507 < 269a133bd0d3c85265219c14154323ed934ac36ef9b389da609e43788de2bbcd ./usr/lib/python3.12/site-packages/cffi-1.17.1.dist-info/RECORD --- > d2c08987f207eed8e90476c576eeff67c0809d1bfd35234e583a2dc6895c5ff1 ./usr/lib/python3.12/site-packages/cffi-1.17.1.dist-info/RECORD 518c518 < d08bd76099191932f3cd289c19427ccab51d9c00a6c2e5126c57f83a84ec2246 ./usr/lib/python3.12/site-packages/aiohttp-3.12.4.dist-info/RECORD --- > 281c5c7e2b28e56134fa8690a2a446e3ebc515f8cb3705cd5d06e83c53812fab ./usr/lib/python3.12/site-packages/aiohttp-3.12.4.dist-info/RECORD 630c630 < 33665bc46c14e2c0f409ef2627170b093f6d7741e9516928928acbeeb717f155 ./usr/lib/python3.12/site-packages/propcache-0.3.1.dist-info/RECORD --- > 4fddb29289418edb3ec392a09b8efa826333a60cf508055cac809375e497174e ./usr/lib/python3.12/site-packages/propcache-0.3.1.dist-info/RECORD 1497c1497 < f80c1b47d15a7262ab2b81bcfc1f69816961b9f6b0fd3775ee5b5eb40d4b7a5b ./usr/lib/python3.12/site-packages/pyqt6_sip-13.10.2.dist-info/RECORD --- > 1b8fb8ea4d50d401cd4f6689531ab4922cb064b9caaec1aae6bd885c3a387eca ./usr/lib/python3.12/site-packages/pyqt6_sip-13.10.2.dist-info/RECORD 3108c3108 < ca06bbe1dba05cd647e89411dd301fad15f42d0ff53ac2c509391cf0303c15c4 ./usr/lib/python3.12/site-packages/multidict-6.4.4.dist-info/RECORD --- > 400741699b95d3c6bde3c64c7a4bb04b26cbdaee437a17b398d202794a1bd4cd ./usr/lib/python3.12/site-packages/multidict-6.4.4.dist-info/RECORD 3233c3233 < f67e8f271725676df296fab7fab72099f3b853905f9ff677b5de261a52412411 ./usr/lib/python3.12/site-packages/hidapi-0.14.0.post4.dist-info/RECORD --- > f4d43d5e4c3c2aa3e69fa40c7307b23b82ce4c5e4d5fb041a75b11ddc2ed7423 ./usr/lib/python3.12/site-packages/hidapi-0.14.0.post4.dist-info/RECORD 3271c3271 < aaa92bb84d0f56e82832903f1109dd4362c09ea4af0fefe3d0c95509bc0920ed ./usr/lib/python3.12/site-packages/cbor2-5.6.5.dist-info/RECORD --- > 8a21af0fadf22898266581df9987c97ee737a670bef9d71d5f53427619466b88 ./usr/lib/python3.12/site-packages/cbor2-5.6.5.dist-info/RECORD ``` ----- Example RECORD files: ``` $ diff squashfs-root1/./usr/lib/python3.12/site-packages/aiohttp-3.12.4.dist-info/RECORD squashfs-root2/./usr/lib/python3.12/site-packages/aiohttp-3.12.4.dist-info/RECORD 64c64 < aiohttp/_http_parser.cpython-312-x86_64-linux-gnu.so,sha256=SjcWt8faDDTOxBHetnDdlQU31sPj0Suc8pwY1_UnKkE,2868384 --- > aiohttp/_http_parser.cpython-312-x86_64-linux-gnu.so,sha256=xdf5Uy_NnFLmSmqNmeY7wytgwFdY7pHxZLOFFfl2Aq8,2868384 66c66 < aiohttp/_http_writer.cpython-312-x86_64-linux-gnu.so,sha256=g6PDJVuICGYq8rywuI6XFWLP6tw1KLWLpwSvJODWo18,510280 --- > aiohttp/_http_writer.cpython-312-x86_64-linux-gnu.so,sha256=U_Y0F0oYClrGRIKO_agXtAohjJ_jqfG375vESBZ56CY,510280 80c80 < aiohttp/_websocket/mask.cpython-312-x86_64-linux-gnu.so,sha256=u0PluBaJntMBktyD1AYv267FvbUO6gpj-Nt7erLj3Qg,257384 --- > aiohttp/_websocket/mask.cpython-312-x86_64-linux-gnu.so,sha256=tEnvrEzSPEtaFI8V_Ey08zy4SBmDhnm-QnxTxgDSYM4,257384 85c85 < aiohttp/_websocket/reader_c.cpython-312-x86_64-linux-gnu.so,sha256=wfcclW8jYOTVeLDRPO87dPvOBrtXiqxBsnEbP0yyGpI,1816496 --- > aiohttp/_websocket/reader_c.cpython-312-x86_64-linux-gnu.so,sha256=jfey8U3MSIp04r0bG_a1TFkIKSzMQ-FLSAWD3nY4wgg,1816496 ``` ``` $ diff squashfs-root1/./usr/lib/python3.12/site-packages/hidapi-0.14.0.post4.dist-info/RECORD squashfs-root2/./usr/lib/python3.12/site-packages/hidapi-0.14.0.post4.dist-info/RECORD 1c1 < hid.cpython-312-x86_64-linux-gnu.so,sha256=JefmLwo-XKZZmno3PBdmHnREed0Yw7IaPYCI2k1UmbM,1152024 --- > hid.cpython-312-x86_64-linux-gnu.so,sha256=38htTAcIC4nnTPIIjD0jkdtdwtGyWlBIhQwQ-g0K0iI,1152024 12c12 < hidraw.cpython-312-x86_64-linux-gnu.so,sha256=dJ4kVI0jXUj_Ba2cMcAL7Wjy8fkO21VPbhAmR-5n30Y,1156768 --- > hidraw.cpython-312-x86_64-linux-gnu.so,sha256=7908Jgbg7A-3JRtfKabPr_WJkMIjYgd5pX78_Yajo54,1156768 ``` ----- error at runtime: ``` 22.51 | E | plugins.trezor.trezor | error importing trezor plugin deps Traceback (most recent call last): File "/tmp/.mount_electrteDkNu/usr/lib/python3.12/importlib/metadata/__init__.py", line 397, in from_name return next(cls.discover(name=name)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ StopIteration During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/tmp/.mount_electrteDkNu/usr/lib/python3.12/site-packages/electrum/plugins/trezor/trezor.py", line 29, in <module> from .clientbase import TrezorClientBase, RecoveryDeviceInputMethod File "/tmp/.mount_electrteDkNu/usr/lib/python3.12/site-packages/electrum/plugins/trezor/clientbase.py", line 18, in <module> import trezorlib.device File "/tmp/.mount_electrteDkNu/usr/lib/python3.12/site-packages/trezorlib/device.py", line 27, in <module> from slip10 import SLIP10 File "/tmp/.mount_electrteDkNu/usr/lib/python3.12/site-packages/slip10/__init__.py", line 6, in <module> __version__ = importlib.metadata.version(__package__ or __name__) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/.mount_electrteDkNu/usr/lib/python3.12/importlib/metadata/__init__.py", line 889, in version return distribution(distribution_name).version ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/.mount_electrteDkNu/usr/lib/python3.12/importlib/metadata/__init__.py", line 862, in distribution return Distribution.from_name(distribution_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/.mount_electrteDkNu/usr/lib/python3.12/importlib/metadata/__init__.py", line 399, in from_name raise PackageNotFoundError(name) importlib.metadata.PackageNotFoundError: No package metadata was found for slip10 ```
2025-06-05 18:12:54 +00:00
for f in "$PYDIR"/site-packages/slip10-*.dist-info2; do mv "$f" "$(echo "$f" | sed s/\.dist-info2/\.dist-info/)"; done
find -exec touch -h -d '2000-11-11T11:11:11+00:00' {} +
info "creating the AppImage."
(
cd "$BUILDDIR"
cp "$CACHEDIR/appimagetool" "$CACHEDIR/appimagetool_copy"
# zero out "appimage" magic bytes, as on some systems they confuse the linker
sed -i 's|AI\x02|\x00\x00\x00|' "$CACHEDIR/appimagetool_copy"
chmod +x "$CACHEDIR/appimagetool_copy"
"$CACHEDIR/appimagetool_copy" --appimage-extract
# We build a small wrapper for mksquashfs that removes the -mkfs-time option
# as it conflicts with SOURCE_DATE_EPOCH.
mv "$BUILDDIR/squashfs-root/usr/bin/mksquashfs" "$BUILDDIR/squashfs-root/usr/bin/mksquashfs_orig"
cat > "$BUILDDIR/squashfs-root/usr/bin/mksquashfs" << EOF
#!/bin/sh
args=\$(echo "\$@" | sed -e 's/-mkfs-time 0//')
"$BUILDDIR/squashfs-root/usr/bin/mksquashfs_orig" \$args
EOF
chmod +x "$BUILDDIR/squashfs-root/usr/bin/mksquashfs"
env VERSION="$VERSION" ARCH=x86_64 ./squashfs-root/AppRun --runtime-file "$TYPE2_RUNTIME_REPO_DIR/runtime-x86_64" --no-appstream --verbose "$APPDIR" "$APPIMAGE"
)
info "done."
ls -la "$DISTDIR"
sha256sum "$DISTDIR"/*