From f25e3846543ea34c8b87cf7d85d14c66aef882d4 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Tue, 28 Mar 2023 22:34:07 +0000 Subject: [PATCH] build: fail if not inside git clone related: https://github.com/spesmilo/electrum/issues/8284 --- contrib/android/make_apk.sh | 2 ++ contrib/build-linux/appimage/make_appimage.sh | 6 ++++-- contrib/build-linux/sdist/make_sdist.sh | 2 ++ contrib/build-wine/make_win.sh | 2 ++ contrib/osx/make_osx.sh | 2 ++ 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/contrib/android/make_apk.sh b/contrib/android/make_apk.sh index d9b1bd9ef..5f0d383fb 100755 --- a/contrib/android/make_apk.sh +++ b/contrib/android/make_apk.sh @@ -10,6 +10,8 @@ LOCALE="$PROJECT_ROOT"/electrum/locale/ . "$CONTRIB"/build_tools_util.sh +git -C "$PROJECT_ROOT" rev-parse 2>/dev/null || fail "Building outside a git clone is not supported." + # arguments have been checked in build.sh export ELEC_APK_GUI=$1 diff --git a/contrib/build-linux/appimage/make_appimage.sh b/contrib/build-linux/appimage/make_appimage.sh index 6d3dca24d..5db025f8b 100755 --- a/contrib/build-linux/appimage/make_appimage.sh +++ b/contrib/build-linux/appimage/make_appimage.sh @@ -12,6 +12,10 @@ CACHEDIR="$CONTRIB_APPIMAGE/.cache/appimage" 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 @@ -22,8 +26,6 @@ PKG2APPIMAGE_COMMIT="a9c85b7e61a3a883f4a35c41c5decb5af88b6b5d" VERSION=$(git describe --tags --dirty --always) APPIMAGE="$DISTDIR/electrum-$VERSION-x86_64.AppImage" -. "$CONTRIB"/build_tools_util.sh - rm -rf "$BUILDDIR" mkdir -p "$APPDIR" "$CACHEDIR" "$PIP_CACHE_DIR" "$DISTDIR" "$DLL_TARGET_DIR" diff --git a/contrib/build-linux/sdist/make_sdist.sh b/contrib/build-linux/sdist/make_sdist.sh index 20d4f5d50..73b658810 100755 --- a/contrib/build-linux/sdist/make_sdist.sh +++ b/contrib/build-linux/sdist/make_sdist.sh @@ -10,6 +10,8 @@ LOCALE="$PROJECT_ROOT/electrum/locale" . "$CONTRIB"/build_tools_util.sh +git -C "$PROJECT_ROOT" rev-parse 2>/dev/null || fail "Building outside a git clone is not supported." + # note that at least py3.7 is needed, to have https://bugs.python.org/issue30693 python3 --version || fail "python interpreter not found" diff --git a/contrib/build-wine/make_win.sh b/contrib/build-wine/make_win.sh index 51ddaae54..5d9423c34 100755 --- a/contrib/build-wine/make_win.sh +++ b/contrib/build-wine/make_win.sh @@ -35,6 +35,8 @@ export WINE_PYTHON="wine $WINE_PYHOME/python.exe -OO -B" . "$CONTRIB"/build_tools_util.sh +git -C "$PROJECT_ROOT" rev-parse 2>/dev/null || fail "Building outside a git clone is not supported." + info "Clearing $here/build and $here/dist..." rm "$here"/build/* -rf rm "$here"/dist/* -rf diff --git a/contrib/osx/make_osx.sh b/contrib/osx/make_osx.sh index af205c663..615e6dbe7 100755 --- a/contrib/osx/make_osx.sh +++ b/contrib/osx/make_osx.sh @@ -25,6 +25,8 @@ mkdir -p "$CACHEDIR" "$DLL_TARGET_DIR" cd "$PROJECT_ROOT" +git -C "$PROJECT_ROOT" rev-parse 2>/dev/null || fail "Building outside a git clone is not supported." + which brew > /dev/null 2>&1 || fail "Please install brew from https://brew.sh/ to continue" which xcodebuild > /dev/null 2>&1 || fail "Please install xcode command line tools to continue"