Browse Source

build: follow-up source-only tarballs

patch-4
SomberNight 2 years ago
parent
commit
7d36f2ba3a
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 3
      MANIFEST.in
  2. 18
      contrib/build-linux/sdist/README.md
  3. 27
      contrib/build-linux/sdist/make_sdist.sh
  4. 2
      contrib/release.sh

3
MANIFEST.in

@ -8,8 +8,7 @@ recursive-include packages cacert.pem
include contrib/requirements/requirements*.txt include contrib/requirements/requirements*.txt
include contrib/deterministic-build/requirements*.txt include contrib/deterministic-build/requirements*.txt
include contrib/make_libsecp256k1.sh include contrib/*.sh
include contrib/build_tools_util.sh
graft electrum graft electrum
prune electrum/tests prune electrum/tests

18
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 ✓ _This file should be reproducible, meaning you should be able to generate
distributables that match the official releases._ 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 This assumes an Ubuntu (x86_64) host, but it should not be too hard to adapt to another
similar system. 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 1. Install Docker
See `contrib/docker_notes.md`. 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 $ ./build.sh
``` ```
If you want reproducibility, try instead e.g.: If you want reproducibility, try instead e.g.:
``` ```
$ ELECBUILD_COMMIT=HEAD ELECBUILD_NOCACHE=1 ./build.sh $ 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`. 3. The generated distributables are in `./dist`.

27
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) # (make_packages will later install a pinned version of pip in a venv)
python3 -m pip install --upgrade pip python3 -m pip install --upgrade pip
rm -rf "$PROJECT_ROOT/packages/"
if ([ "$OMIT_UNCLEAN_FILES" != 1 ]); then if ([ "$OMIT_UNCLEAN_FILES" != 1 ]); then
"$CONTRIB"/make_packages || fail "make_packages failed" "$CONTRIB"/make_packages || fail "make_packages failed"
fi fi
@ -37,7 +38,8 @@ git submodule update --init
) )
if ([ "$OMIT_UNCLEAN_FILES" = 1 ]); then 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 fi
( (
@ -52,17 +54,18 @@ fi
fi fi
TZ=UTC faketime -f '2000-11-11 11:11:11' python3 setup.py --quiet sdist --format=gztar --dist-dir="$PY_DISTDIR" 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 if ([ "$OMIT_UNCLEAN_FILES" = 1 ]); then
for fn in "$DISTDIR/_sourceonly/"*; do python3 <<EOF
# Since ELECTRUM_VERSION is not available to us in this script, we have to use a regex. import importlib.util
# Expression 1: Electrum-X.Y.Z.tar.gz -> Electrum-sourceonly-X.Y.Z.tar.gz import os
# Capture group \1 = Electrum
# Capture group \2 = X.Y.Z.tar.gz # load version.py; needlessly complicated alternative to "imp.load_source":
# Expression 2: dist/_sourceonly/X.tar.gz -> dist/X.tar.gz version_spec = importlib.util.spec_from_file_location('version', 'electrum/version.py')
mv "$fn" $(sed \ version_module = importlib.util.module_from_spec(version_spec)
-e 's/\(.*\)-\([^-]*\)/\1-sourceonly-\2/' \ version_spec.loader.exec_module(version_module)
-e 's/\/_sourceonly//' \
<<< "$fn") VER = version_module.ELECTRUM_VERSION
done os.rename(f"dist/_sourceonly/Electrum-{VER}.tar.gz", f"dist/Electrum-sourceonly-{VER}.tar.gz")
EOF
rmdir "$PY_DISTDIR" rmdir "$PY_DISTDIR"
fi fi
) )

2
contrib/release.sh

@ -204,7 +204,7 @@ if [ -z "$RELEASEMANAGER" ] ; then
test -f "$apk2" || fail "apk2 not found among sftp downloads" test -f "$apk2" || fail "apk2 not found among sftp downloads"
test -f "$dmg" || fail "dmg not found among sftp downloads" test -f "$dmg" || fail "dmg not found among sftp downloads"
test -f "$PROJECT_ROOT/dist/$tarball" || fail "tarball not found among built files" test -f "$PROJECT_ROOT/dist/$tarball" || fail "tarball not found among built files"
test -f "$PROJECT_ROOT/dist/$srctarball" || fail "tarball not found among built files" test -f "$PROJECT_ROOT/dist/$srctarball" || fail "srctarball not found among built files"
test -f "$PROJECT_ROOT/dist/$appimage" || fail "appimage not found among built files" test -f "$PROJECT_ROOT/dist/$appimage" || fail "appimage not found among built files"
test -f "$CONTRIB/build-wine/dist/$win1" || fail "win1 not found among built files" test -f "$CONTRIB/build-wine/dist/$win1" || fail "win1 not found among built files"
test -f "$CONTRIB/build-wine/dist/$win2" || fail "win2 not found among built files" test -f "$CONTRIB/build-wine/dist/$win2" || fail "win2 not found among built files"

Loading…
Cancel
Save