From 3df1c3bbf7583b48c999060c24557f665cd87236 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Thu, 17 Jun 2021 19:03:23 +0200 Subject: [PATCH] build: rename some scripts also, merge sdist/build.sh and sdist/make_tgz into sdist/make_sdist.sh --- .travis.yml | 6 +- contrib/build-linux/appimage/README.md | 2 +- .../appimage/{build.sh => make_appimage.sh} | 0 contrib/build-linux/sdist/README.md | 2 +- contrib/build-linux/sdist/build.sh | 32 ---------- contrib/build-linux/sdist/make_sdist.sh | 60 +++++++++++++++++++ contrib/build-linux/sdist/make_tgz | 43 ------------- contrib/build-wine/README.md | 24 ++++---- contrib/build-wine/{build.sh => make_win.sh} | 4 +- contrib/release.sh | 16 ++--- 10 files changed, 87 insertions(+), 102 deletions(-) rename contrib/build-linux/appimage/{build.sh => make_appimage.sh} (100%) delete mode 100755 contrib/build-linux/sdist/build.sh create mode 100755 contrib/build-linux/sdist/make_sdist.sh delete mode 100755 contrib/build-linux/sdist/make_tgz rename contrib/build-wine/{build.sh => make_win.sh} (93%) diff --git a/.travis.yml b/.travis.yml index dc2016f8b..42bcdc8ab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -61,7 +61,7 @@ jobs: install: - sudo docker build --no-cache -t electrum-wine-builder-img ./contrib/build-wine/ script: - - sudo docker run --name electrum-wine-builder-cont -v $PWD:/opt/wine64/drive_c/electrum --rm --workdir /opt/wine64/drive_c/electrum/contrib/build-wine electrum-wine-builder-img ./build.sh + - sudo docker run --name electrum-wine-builder-cont -v $PWD:/opt/wine64/drive_c/electrum --rm --workdir /opt/wine64/drive_c/electrum/contrib/build-wine electrum-wine-builder-img ./make_win.sh after_success: true - if: (branch = master) OR (tag IS present) name: "Android build" @@ -103,7 +103,7 @@ jobs: install: - sudo docker build --no-cache -t electrum-appimage-builder-img ./contrib/build-linux/appimage/ script: - - sudo docker run --name electrum-appimage-builder-cont -v $PWD:/opt/electrum --rm --workdir /opt/electrum/contrib/build-linux/appimage electrum-appimage-builder-img ./build.sh + - sudo docker run --name electrum-appimage-builder-cont -v $PWD:/opt/electrum --rm --workdir /opt/electrum/contrib/build-linux/appimage electrum-appimage-builder-img ./make_appimage.sh after_success: true - if: (branch = master) OR (tag IS present) name: "tarball build" @@ -123,7 +123,7 @@ jobs: - sudo docker build --no-cache -t electrum-sdist-builder-img ./contrib/build-linux/sdist/ script: - echo "Building sdist at $PWD" - - sudo docker run --name electrum-sdist-builder-cont -v $PWD:/opt/electrum --rm --workdir /opt/electrum/contrib/build-linux/sdist electrum-sdist-builder-img ./build.sh + - sudo docker run --name electrum-sdist-builder-cont -v $PWD:/opt/electrum --rm --workdir /opt/electrum/contrib/build-linux/sdist electrum-sdist-builder-img ./make_sdist.sh after_success: true - stage: release check install: diff --git a/contrib/build-linux/appimage/README.md b/contrib/build-linux/appimage/README.md index 0b50ec7e3..b4712c000 100644 --- a/contrib/build-linux/appimage/README.md +++ b/contrib/build-linux/appimage/README.md @@ -37,7 +37,7 @@ see [issue #5159](https://github.com/spesmilo/electrum/issues/5159). --rm \ --workdir /opt/electrum/contrib/build-linux/appimage \ electrum-appimage-builder-img \ - ./build.sh + ./make_appimage.sh ``` 4. The generated binary is in `./dist`. diff --git a/contrib/build-linux/appimage/build.sh b/contrib/build-linux/appimage/make_appimage.sh similarity index 100% rename from contrib/build-linux/appimage/build.sh rename to contrib/build-linux/appimage/make_appimage.sh diff --git a/contrib/build-linux/sdist/README.md b/contrib/build-linux/sdist/README.md index 9381dc87d..d0b09f8c2 100644 --- a/contrib/build-linux/sdist/README.md +++ b/contrib/build-linux/sdist/README.md @@ -45,6 +45,6 @@ folder. --rm \ --workdir /opt/electrum/contrib/build-linux/sdist \ electrum-sdist-builder-img \ - ./build.sh + ./make_sdist.sh ``` 4. The generated distributables are in `./dist`. diff --git a/contrib/build-linux/sdist/build.sh b/contrib/build-linux/sdist/build.sh deleted file mode 100755 index 16d2bcd28..000000000 --- a/contrib/build-linux/sdist/build.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - -set -e - -PROJECT_ROOT="$(dirname "$(readlink -e "$0")")/../../.." -CONTRIB="$PROJECT_ROOT/contrib" -CONTRIB_SDIST="$CONTRIB/build-linux/sdist" -DISTDIR="$PROJECT_ROOT/dist" - -. "$CONTRIB"/build_tools_util.sh - -# note that at least py3.7 is needed, to have https://bugs.python.org/issue30693 -python3 --version || fail "python interpreter not found" - -break_legacy_easy_install - -# upgrade to modern pip so that it knows the flags we need. -# we will then install a pinned version of pip as part of requirements-build-sdist -python3 -m pip install --upgrade pip - -info "Installing pinned requirements." -python3 -m pip install --no-dependencies --no-warn-script-location -r "$CONTRIB"/deterministic-build/requirements-build-sdist.txt - - -"$CONTRIB"/make_packages || fail "make_packages failed" - -"$CONTRIB_SDIST"/make_tgz || fail "make_tgz failed" - - -info "done." -ls -la "$DISTDIR" -sha256sum "$DISTDIR"/* diff --git a/contrib/build-linux/sdist/make_sdist.sh b/contrib/build-linux/sdist/make_sdist.sh new file mode 100755 index 000000000..7aae3f423 --- /dev/null +++ b/contrib/build-linux/sdist/make_sdist.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +set -e + +PROJECT_ROOT="$(dirname "$(readlink -e "$0")")/../../.." +CONTRIB="$PROJECT_ROOT/contrib" +CONTRIB_SDIST="$CONTRIB/build-linux/sdist" +DISTDIR="$PROJECT_ROOT/dist" +LOCALE="$PROJECT_ROOT/electrum/locale/" + +. "$CONTRIB"/build_tools_util.sh + +# note that at least py3.7 is needed, to have https://bugs.python.org/issue30693 +python3 --version || fail "python interpreter not found" + +break_legacy_easy_install + +# upgrade to modern pip so that it knows the flags we need. +# we will then install a pinned version of pip as part of requirements-build-sdist +python3 -m pip install --upgrade pip + +info "Installing pinned requirements." +python3 -m pip install --no-dependencies --no-warn-script-location -r "$CONTRIB"/deterministic-build/requirements-build-sdist.txt + + +"$CONTRIB"/make_packages || fail "make_packages failed" + +git submodule update --init + +( + cd "$CONTRIB/deterministic-build/electrum-locale/" + if ! which msgfmt > /dev/null 2>&1; then + echo "Please install gettext" + exit 1 + fi + # We include both source (.po) and compiled (.mo) locale files in the source dist. + # Maybe we should exclude the compiled locale files? see https://askubuntu.com/a/144139 + # (also see MANIFEST.in) + rm -rf "$LOCALE" + for i in ./locale/*; do + dir="$PROJECT_ROOT/electrum/$i/LC_MESSAGES" + mkdir -p "$dir" + msgfmt --output-file="$dir/electrum.mo" "$i/electrum.po" || true + cp $i/electrum.po "$PROJECT_ROOT/electrum/$i/electrum.po" + done +) + +( + cd "$PROJECT_ROOT" + + find -exec touch -h -d '2000-11-11T11:11:11+00:00' {} + + + # note: .zip sdists would not be reproducible due to https://bugs.python.org/issue40963 + TZ=UTC faketime -f '2000-11-11 11:11:11' python3 setup.py --quiet sdist --format=gztar +) + + +info "done." +ls -la "$DISTDIR" +sha256sum "$DISTDIR"/* diff --git a/contrib/build-linux/sdist/make_tgz b/contrib/build-linux/sdist/make_tgz deleted file mode 100755 index b61bbbbbc..000000000 --- a/contrib/build-linux/sdist/make_tgz +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -set -e - -CONTRIB_SDIST="$(dirname "$(readlink -e "$0")")" -CONTRIB="$CONTRIB_SDIST"/../.. -ROOT_FOLDER="$CONTRIB"/.. -PACKAGES="$ROOT_FOLDER"/packages/ -LOCALE="$ROOT_FOLDER"/electrum/locale/ - -if [ ! -d "$PACKAGES" ]; then - echo "Run make_packages first!" - exit 1 -fi - -git submodule update --init - -( - cd "$CONTRIB/deterministic-build/electrum-locale/" - if ! which msgfmt > /dev/null 2>&1; then - echo "Please install gettext" - exit 1 - fi - # We include both source (.po) and compiled (.mo) locale files in the source dist. - # Maybe we should exclude the compiled locale files? see https://askubuntu.com/a/144139 - # (also see MANIFEST.in) - rm -rf "$LOCALE" - for i in ./locale/*; do - dir="$ROOT_FOLDER/electrum/$i/LC_MESSAGES" - mkdir -p "$dir" - msgfmt --output-file="$dir/electrum.mo" "$i/electrum.po" || true - cp $i/electrum.po "$ROOT_FOLDER/electrum/$i/electrum.po" - done -) - -( - cd "$ROOT_FOLDER" - - find -exec touch -h -d '2000-11-11T11:11:11+00:00' {} + - - # note: .zip sdists would not be reproducible due to https://bugs.python.org/issue40963 - TZ=UTC faketime -f '2000-11-11 11:11:11' python3 setup.py --quiet sdist --format=gztar -) diff --git a/contrib/build-wine/README.md b/contrib/build-wine/README.md index b244850d6..e213a98c8 100644 --- a/contrib/build-wine/README.md +++ b/contrib/build-wine/README.md @@ -51,7 +51,7 @@ folder. --rm \ --workdir /opt/wine64/drive_c/electrum/contrib/build-wine \ electrum-wine-builder-img \ - ./build.sh + ./make_win.sh ``` 4. The generated binaries are in `./contrib/build-wine/dist`. @@ -70,18 +70,18 @@ The release signing procedure involves a signer (the holder of the certificate/key) and one or multiple trusted verifiers: -| Signer | Verifier | -|-----------------------------------------------------------|-----------------------------------| -| Build .exe files using `build.sh` | | -| Sign .exe with `./sign.sh` | | -| Upload signed files to download server | | -| | Build .exe files using `build.sh` | -| | Compare files using `unsign.sh` | -| | Sign .exe file using `gpg -b` | +| Signer | Verifier | +|-----------------------------------------------------------|--------------------------------------| +| Build .exe files using `make_win.sh` | | +| Sign .exe with `./sign.sh` | | +| Upload signed files to download server | | +| | Build .exe files using `make_win.sh` | +| | Compare files using `unsign.sh` | +| | Sign .exe file using `gpg -b` | -| Signer and verifiers: | -|-----------------------------------------------------------------------------------------------| -| Upload signatures to 'electrum-signatures' repo, as `$version/$filename.$builder.asc` | +| Signer and verifiers: | +|--------------------------------------------------------------------------------------------------| +| Upload signatures to 'electrum-signatures' repo, as `$version/$filename.$builder.asc` | diff --git a/contrib/build-wine/build.sh b/contrib/build-wine/make_win.sh similarity index 93% rename from contrib/build-wine/build.sh rename to contrib/build-wine/make_win.sh index fee22bed9..5ee803e6a 100755 --- a/contrib/build-wine/build.sh +++ b/contrib/build-wine/make_win.sh @@ -53,7 +53,7 @@ else "$CONTRIB"/make_zbar.sh || fail "Could not build zbar" fi -$here/prepare-wine.sh || fail "prepare-wine failed" +"$here/prepare-wine.sh" || fail "prepare-wine failed" info "Resetting modification time in C:\Python..." # (Because of some bugs in pyinstaller) @@ -62,6 +62,6 @@ find -exec touch -d '2000-11-11T11:11:11+00:00' {} + popd ls -l /opt/wine64/drive_c/python* -$here/build-electrum-git.sh || fail "build-electrum-git failed" +"$here/build-electrum-git.sh" || fail "build-electrum-git failed" info "Done." diff --git a/contrib/release.sh b/contrib/release.sh index 23156f572..64791a544 100755 --- a/contrib/release.sh +++ b/contrib/release.sh @@ -49,7 +49,7 @@ else --rm \ --workdir /opt/electrum/contrib/build-linux/sdist \ electrum-sdist-builder-img \ - ./build.sh + ./make_sdist.sh popd cp /opt/electrum/contrib/build-linux/sdist/fresh_clone/electrum/dist/$target dist/ fi @@ -66,12 +66,12 @@ if test -f dist/$target; then else sudo docker build -t electrum-appimage-builder-img contrib/build-linux/appimage sudo docker run -it \ - --name electrum-appimage-builder-cont \ - -v $PWD:/opt/electrum \ - --rm \ - --workdir /opt/electrum/contrib/build-linux/appimage \ - electrum-appimage-builder-img \ - ./build.sh + --name electrum-appimage-builder-cont \ + -v $PWD:/opt/electrum \ + --rm \ + --workdir /opt/electrum/contrib/build-linux/appimage \ + electrum-appimage-builder-img \ + ./make_appimage.sh fi @@ -93,7 +93,7 @@ else --rm \ --workdir /opt/wine64/drive_c/electrum/contrib/build-wine \ electrum-wine-builder-img \ - ./build.sh + ./make_win.sh # do this in the fresh clone directory! cd contrib/build-wine/ ./sign.sh