Browse Source

build-wine: allow local testing

Before, it was only possible to test commits that are
on Github (pull request or merged). Now, changes can be
tested locally too.

This introduces the risk that a release could be built
containing uncommitted changes which by definition breaks
deterministic builds. Fortunately, this will always be
detected because the version string is created using
`git describe --tags --dirty`.

Also, retire $TARGET variable because it decouples the
build scripts from the commit revision to be built. This
is a problem for deterministic  builds.
3.2.x
Filip Gospodinov 7 years ago
parent
commit
73fee2fefa
  1. 4
      .travis.yml
  2. 26
      contrib/build-wine/build-electrum-git.sh
  3. 6
      contrib/build-wine/build.sh
  4. 8
      contrib/build-wine/docker/README.md
  5. 4
      contrib/build-wine/electrum.nsi
  6. 5
      contrib/build-wine/prepare-wine.sh

4
.travis.yml

@ -33,7 +33,7 @@ jobs:
install:
- sudo docker build --no-cache -t electrum-wine-builder-img ./contrib/build-wine/docker/
script:
- sudo docker run --name electrum-wine-builder-cont -v $PWD:/opt/electrum --rm --workdir /opt/electrum/contrib/build-wine electrum-wine-builder-img ./build.sh $TRAVIS_COMMIT
- 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
after_success: true
- os: osx
language: c
@ -53,4 +53,4 @@ jobs:
script:
- ./contrib/deterministic-build/check_submodules.sh
after_success: true
if: tag IS present
if: tag IS present

26
contrib/build-wine/build-electrum-git.sh

@ -19,23 +19,7 @@ set -e
mkdir -p tmp
cd tmp
if [ -d ./electrum ]; then
rm ./electrum -rf
fi
git clone https://github.com/spesmilo/electrum -b master
pushd electrum
if [ ! -z "$1" ]; then
# a commit/tag/branch was specified
if ! git cat-file -e "$1" 2> /dev/null
then # can't find target
# try pull requests
git config --local --add remote.origin.fetch '+refs/pull/*/merge:refs/remotes/origin/pr/*'
git fetch --all
fi
git checkout $1
fi
pushd $WINEPREFIX/drive_c/electrum
# Load electrum-icons and electrum-locale for this release
git submodule init
@ -59,11 +43,9 @@ popd
find -exec touch -d '2000-11-11T11:11:11+00:00' {} +
popd
rm -rf $WINEPREFIX/drive_c/electrum
cp -r electrum $WINEPREFIX/drive_c/electrum
cp electrum/LICENCE .
cp -r ./electrum/contrib/deterministic-build/electrum-locale/locale $WINEPREFIX/drive_c/electrum/lib/
cp ./electrum/contrib/deterministic-build/electrum-icons/icons_rc.py $WINEPREFIX/drive_c/electrum/gui/qt/
cp $WINEPREFIX/drive_c/electrum/LICENCE .
cp -r $WINEPREFIX/drive_c/electrum/contrib/deterministic-build/electrum-locale/locale $WINEPREFIX/drive_c/electrum/lib/
cp $WINEPREFIX/drive_c/electrum/contrib/deterministic-build/electrum-icons/icons_rc.py $WINEPREFIX/drive_c/electrum/gui/qt/
# Install frozen dependencies
$PYTHON -m pip install -r ../../deterministic-build/requirements.txt

6
contrib/build-wine/build.sh

@ -2,10 +2,6 @@
# Lucky number
export PYTHONHASHSEED=22
if [ ! -z "$1" ]; then
to_build="$1"
fi
here=$(dirname "$0")
test -n "$here" -a -d "$here" || exit
@ -28,5 +24,5 @@ find -exec touch -d '2000-11-11T11:11:11+00:00' {} +
popd
ls -l /opt/wine64/drive_c/python*
$here/build-electrum-git.sh $to_build && \
$here/build-electrum-git.sh && \
echo "Done."

8
contrib/build-wine/docker/README.md

@ -25,14 +25,14 @@ folder.
3. Build Windows binaries
```
$ TARGET=master
$ git checkout $REV
$ sudo docker run \
--name electrum-wine-builder-cont \
-v .:/opt/electrum \
-v $PWD:/opt/wine64/drive_c/electrum \
--rm \
--workdir /opt/electrum/contrib/build-wine \
--workdir /opt/wine64/drive_c/electrum/contrib/build-wine \
electrum-wine-builder-img \
./build.sh $TARGET
./build.sh
```
4. The generated binaries are in `./contrib/build-wine/dist`.

4
contrib/build-wine/electrum.nsi

@ -72,7 +72,7 @@
!define MUI_ABORTWARNING
!define MUI_ABORTWARNING_TEXT "Are you sure you wish to abort the installation of ${PRODUCT_NAME}?"
!define MUI_ICON "tmp\electrum\icons\electrum.ico"
!define MUI_ICON "c:\electrum\icons\electrum.ico"
;--------------------------------
;Pages
@ -111,7 +111,7 @@ Section
;Files to pack into the installer
File /r "dist\electrum\*.*"
File "..\..\icons\electrum.ico"
File "c:\electrum\icons\electrum.ico"
;Store installation folder
WriteRegStr HKCU "Software\${PRODUCT_NAME}" "" $INSTDIR

5
contrib/build-wine/prepare-wine.sh

@ -79,11 +79,6 @@ retry() {
here=$(dirname $(readlink -e $0))
set -e
# Clean up Wine environment
echo "Cleaning $WINEPREFIX"
rm -rf $WINEPREFIX
echo "done"
wine 'wineboot'
cd /tmp/electrum-build

Loading…
Cancel
Save