From f28935f8fe9b44ccc07cd2d68263242ee4c4d4a2 Mon Sep 17 00:00:00 2001 From: Lee Miller Date: Sun, 5 May 2024 19:24:04 +0300 Subject: [PATCH 1/2] Avoid recursion when trying to build bitmsghash lib in environments where prebuilt one is unusable and make doesn't work. --- src/proofofwork.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/proofofwork.py b/src/proofofwork.py index 49e86f59..5e157db9 100644 --- a/src/proofofwork.py +++ b/src/proofofwork.py @@ -5,11 +5,11 @@ Proof of work calculation import ctypes import os +import subprocess # nosec B404 import sys import tempfile import time from struct import pack, unpack -from subprocess import call # nosec B404 import highlevelcrypto import openclpow @@ -278,18 +278,26 @@ def buildCPoW(): try: if "bsd" in sys.platform: # BSD make - call(["make", "-C", os.path.join(paths.codePath(), "bitmsghash"), - '-f', 'Makefile.bsd']) # nosec B607, B603 + subprocess.check_call([ # nosec B607, B603 + "make", "-C", os.path.join(paths.codePath(), "bitmsghash"), + '-f', 'Makefile.bsd']) else: # GNU make - call([ # nosec B607, B603 + subprocess.check_call([ # nosec B607, B603 "make", "-C", os.path.join(paths.codePath(), "bitmsghash")]) - if os.path.exists(os.path.join(paths.codePath(), "bitmsghash", "bitmsghash.so")): + if os.path.exists( + os.path.join(paths.codePath(), "bitmsghash", "bitmsghash.so") + ): init() notifyBuild(True) else: notifyBuild(True) + except (OSError, subprocess.CalledProcessError): + notifyBuild(True) except: # noqa:E722 + logger.warning( + 'Unexpected exception rised when tried to build bitmsghash lib', + exc_info=True) notifyBuild(True) -- 2.45.1 From 8fa9da4cb4d76adabd9dbb4f889b314bb1085488 Mon Sep 17 00:00:00 2001 From: Lee Miller Date: Mon, 6 May 2024 20:23:24 +0300 Subject: [PATCH 2/2] Fix cross-compilation in the appimage build script and simplify local building --- .buildbot/appimage/build.sh | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/.buildbot/appimage/build.sh b/.buildbot/appimage/build.sh index c592c1e8..c8dc4f56 100755 --- a/.buildbot/appimage/build.sh +++ b/.buildbot/appimage/build.sh @@ -14,36 +14,45 @@ function set_sourceline { fi } +function build_appimage { + set_sourceline + ./${BUILDER} --recipe ${RECIPE} || exit 1 + rm -rf build +} + [ -f ${BUILDER} ] || wget -qO ${BUILDER} \ https://github.com/AppImageCrafters/appimage-builder/releases/download/v1.1.0/appimage-builder-1.1.0-x86_64.AppImage \ && chmod +x ${BUILDER} +chmod 1777 /tmp export ARCH=amd64 export APPIMAGE_ARCH=x86_64 export RUNTIME=${APPIMAGE_ARCH} -set_sourceline -./${BUILDER} --recipe ${RECIPE} || exit 1 +build_appimage export ARCH=armhf export APPIMAGE_ARCH=${ARCH} export RUNTIME=gnueabihf export CC=arm-linux-gnueabihf-gcc export CXX=${CC} -set_sourceline -./${BUILDER} --recipe ${RECIPE} || exit 1 +build_appimage export ARCH=arm64 export APPIMAGE_ARCH=aarch64 export RUNTIME=${APPIMAGE_ARCH} export CC=aarch64-linux-gnu-gcc export CXX=${CC} -set_sourceline -./${BUILDER} --recipe ${RECIPE} +build_appimage -mkdir -p ../out -sha256sum PyBitmessage*.AppImage > ../out/SHA256SUMS +EXISTING_OWNER=$(stat -c %u ../out) || mkdir -p ../out + +sha256sum PyBitmessage*.AppImage >> ../out/SHA256SUMS cp PyBitmessage*.AppImage ../out + +if [ ${EXISTING_OWNER} ]; then + chown ${EXISTING_OWNER} ../out/PyBitmessage*.AppImage ../out/SHA256SUMS +fi -- 2.45.1