From 7d36f2ba3ab603044556b9548bea9893520747e1 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Tue, 16 Aug 2022 15:56:53 +0000 Subject: [PATCH] build: follow-up source-only tarballs --- MANIFEST.in | 3 +-- contrib/build-linux/sdist/README.md | 18 ++++++++++++++--- contrib/build-linux/sdist/make_sdist.sh | 27 ++++++++++++++----------- contrib/release.sh | 2 +- 4 files changed, 32 insertions(+), 18 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index 5b208a575..2a74487c0 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -8,8 +8,7 @@ recursive-include packages cacert.pem include contrib/requirements/requirements*.txt include contrib/deterministic-build/requirements*.txt -include contrib/make_libsecp256k1.sh -include contrib/build_tools_util.sh +include contrib/*.sh graft electrum prune electrum/tests diff --git a/contrib/build-linux/sdist/README.md b/contrib/build-linux/sdist/README.md index 96f8bb82b..abad65adf 100644 --- a/contrib/build-linux/sdist/README.md +++ b/contrib/build-linux/sdist/README.md @@ -1,5 +1,4 @@ -Source tarballs -=============== +# Source tarballs ✓ _This file should be reproducible, meaning you should be able to generate distributables that match the official releases._ @@ -7,18 +6,31 @@ Source tarballs This assumes an Ubuntu (x86_64) host, but it should not be too hard to adapt to another similar system. +We distribute two tarballs, a "normal" one (the default, recommended for users), +and a strictly source-only one (for Linux distro packagers). +The normal tarball, in addition to including everything from +the source-only one, also includes: +- compiled (`.mo`) locale files (in addition to source `.po` locale files) +- compiled (`_pb2.py`) protobuf files (in addition to source `.proto` files) +- the `packages/` folder containing source-only pure-python runtime dependencies + + +## Build steps + 1. Install Docker See `contrib/docker_notes.md`. -2. Build source tarball +2. Build tarball + (set envvar `OMIT_UNCLEAN_FILES=1` to build the "source-only" tarball) ``` $ ./build.sh ``` If you want reproducibility, try instead e.g.: ``` $ ELECBUILD_COMMIT=HEAD ELECBUILD_NOCACHE=1 ./build.sh + $ ELECBUILD_COMMIT=HEAD ELECBUILD_NOCACHE=1 OMIT_UNCLEAN_FILES=1 ./build.sh ``` 3. The generated distributables are in `./dist`. diff --git a/contrib/build-linux/sdist/make_sdist.sh b/contrib/build-linux/sdist/make_sdist.sh index f6381e07e..03b872910 100755 --- a/contrib/build-linux/sdist/make_sdist.sh +++ b/contrib/build-linux/sdist/make_sdist.sh @@ -19,6 +19,7 @@ break_legacy_easy_install # (make_packages will later install a pinned version of pip in a venv) python3 -m pip install --upgrade pip +rm -rf "$PROJECT_ROOT/packages/" if ([ "$OMIT_UNCLEAN_FILES" != 1 ]); then "$CONTRIB"/make_packages || fail "make_packages failed" fi @@ -37,7 +38,8 @@ git submodule update --init ) if ([ "$OMIT_UNCLEAN_FILES" = 1 ]); then - rm "$PROJECT_ROOT/electrum/paymentrequest_pb2.py" + # FIXME side-effecting repo... though in practice, this script probably runs in fresh_clone + rm -f "$PROJECT_ROOT/electrum/paymentrequest_pb2.py" fi ( @@ -52,17 +54,18 @@ fi fi TZ=UTC faketime -f '2000-11-11 11:11:11' python3 setup.py --quiet sdist --format=gztar --dist-dir="$PY_DISTDIR" if ([ "$OMIT_UNCLEAN_FILES" = 1 ]); then - for fn in "$DISTDIR/_sourceonly/"*; do - # Since ELECTRUM_VERSION is not available to us in this script, we have to use a regex. - # Expression 1: Electrum-X.Y.Z.tar.gz -> Electrum-sourceonly-X.Y.Z.tar.gz - # Capture group \1 = Electrum - # Capture group \2 = X.Y.Z.tar.gz - # Expression 2: dist/_sourceonly/X.tar.gz -> dist/X.tar.gz - mv "$fn" $(sed \ - -e 's/\(.*\)-\([^-]*\)/\1-sourceonly-\2/' \ - -e 's/\/_sourceonly//' \ - <<< "$fn") - done + python3 <