Skip to content

Commit be7c8db

Browse files
committed
making linux AppImages available locally instead of downloaded at build time
The last build failed because our python3 AppImage 404d on download. For buskill-app (the first repo that cloned *this* repo as a cross-platform GUI python app), I ended up making all dependencies download locally--well, just the ones outside apt that can't be downloaded securely. * BusKill/buskill-app#2 For now this commit just copies some of that logic upstream to this repo so that the linux builds won't fail due to 404 in the future..
1 parent ec275a1 commit be7c8db

File tree

6 files changed

+91
-6
lines changed

6 files changed

+91
-6
lines changed

build/deps/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
This dir holds all the files needed to build this app on all platforms. We store these files in the repo instead of downloading them at build-time because the tools used to download them do not provide secure authentication and integrity checks.
2+
3+
And also to prevent 404s from breaking our builds
4+
5+
* https://github.com/maltfield/cross-platform-python-gui/runs/974530021?check_suite_focus=true
6+
7+
There's a `SHA256SUMS` file in this directory that contains the sha256 hashes of the files in this directory.
8+
9+
You should also be able to use the `download.sh` script in this directory to re-download the assets.

build/deps/SHA256SUM

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
d918b4df547b388ef253f3c9e7f6529ca81a885395c31f619d9aaf7030499a13 appimagetool-x86_64.AppImage
2+
aafa857bdd6e01211e1dc11c00b2c207481606d869ae3ba73432db24a35add9f python3.7.8-cp37-cp37m-manylinux2014_x86_64.AppImage
1.88 MB
Binary file not shown.

build/deps/download.sh

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#!/bin/bash
2+
set -x
3+
################################################################################
4+
# File: build/deps/download.sh
5+
# Purpose: Use this script to download the files in this dir. Useful if, for
6+
# example, you don't trust their integrity and/or want to verify them.
7+
#
8+
# * https://github.com/BusKill/buskill-app/issues/2
9+
#
10+
# Note: This script was built to be run in Debian or TAILS
11+
# Authors: Michael Altfield <[email protected]>
12+
# Created: 2020-08-19
13+
# Updated: 2020-08-19
14+
# Version: 0.1
15+
################################################################################
16+
17+
sudo apt-get -y install python3-pip python3-setuptools
18+
19+
CURL="/usr/bin/curl"
20+
WGET="/usr/bin/wget --retry-on-host-error --retry-connrefused"
21+
PYTHON="/usr/bin/python3"
22+
23+
# in tails, we must torify
24+
if [[ "`whoami`" == "amnesia" ]]; then
25+
CURL="/usr/bin/torify ${CURL}"
26+
WGET="/usr/bin/torify ${WGET}"
27+
PYTHON="/usr/bin/torify ${PYTHON}"
28+
fi
29+
30+
tmpDir=`mktemp -d`
31+
pushd "${tmpDir}"
32+
33+
# first get some info about our internet connection
34+
${CURL} -s https://ifconfig.co/country | head -n1
35+
${CURL} -s https://check.torproject.org | grep Congratulations | head -n1
36+
37+
# and today's date
38+
date -u +"%Y-%m-%d"
39+
40+
# first download and upgrade pip (required to get some wheels)
41+
${PYTHON} -m pip download --no-cache-dir pip==20.1.1
42+
${PYTHON} -m pip install --upgrade pip==20.1.1
43+
44+
# pip (all platforms)
45+
#${PYTHON} -m pip download --no-cache-dir kivy==1.11.1 libusb1==1.8 pyinstaller==3.6 altgraph==0.17 macholib==1.14 future==0.18.2 pefile==2019.4.18 pywin32-ctypes==0.2.0 setuptools==49.1.0 wheel==0.34.2 virtualenv==20.0.26
46+
47+
# pip (platform-specific binaries/wheels)
48+
${WGET} `${CURL} -s https://pypi.org/simple/kivy/ | grep -oE 'https://.*Kivy-1.11.1-cp37-cp37m-win_amd64.whl#'`
49+
${WGET} `${CURL} -s https://pypi.org/simple/kivy/ | grep -oE 'https://.*Kivy-1.11.1-cp37-cp37m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl#'`
50+
${WGET} `${CURL} -s https://pypi.org/simple/pypiwin32/ | grep -oE 'https://.*pypiwin32-223-py3-none-any.whl#'`
51+
${WGET} `${CURL} -s https://pypi.org/simple/pywin32/ | grep -oE 'https://.*pywin32-228-cp37-cp37m-win_amd64.whl#'`
52+
${WGET} `${CURL} -s https://pypi.org/simple/kivy-deps-sdl2/ | grep -oE 'https://.*kivy_deps.sdl2-0.2.0-cp37-cp37m-win_amd64.whl#'`
53+
${WGET} `${CURL} -s https://pypi.org/simple/kivy-deps-glew/ | grep -oE 'https://.*kivy_deps.glew-0.2.0-cp37-cp37m-win_amd64.whl#'`
54+
${WGET} `${CURL} -s https://pypi.org/simple/kivy-deps-angle/ | grep -oE 'https://.*kivy_deps.angle-0.2.0-cp37-cp37m-win_amd64.whl#'`
55+
56+
# misc linux
57+
${WGET} https://github.com/niess/python-appimage/releases/download/python3.7/python3.7.8-cp37-cp37m-manylinux2014_x86_64.AppImage
58+
${WGET} https://github.com/AppImage/AppImageKit/releases/download/12/appimagetool-x86_64.AppImage
59+
${WGET} --output-document=squashfs4.4.tar.gz https://sourceforge.net/projects/squashfs/files/squashfs/squashfs4.4/squashfs4.4.tar.gz/download
60+
61+
# misc windows
62+
${WGET} https://www.python.org/ftp/python/3.7.8/python-3.7.8-amd64.exe
63+
64+
# misc macos
65+
${WGET} https://github.com/libusb/libusb/releases/download/v1.0.23/libusb-1.0.23.tar.bz2
66+
${WGET} https://homebrew.bintray.com/bottles/wget-1.20.3_2.catalina.bottle.tar.gz
67+
${WGET} https://homebrew.bintray.com/bottles/python-3.7.8.catalina.bottle.tar.gz
68+
${WGET} https://homebrew.bintray.com/bottles/sdl2-2.0.12_1.catalina.bottle.tar.gz
69+
${WGET} https://homebrew.bintray.com/bottles/sdl2_image-2.0.5.catalina.bottle.tar.gz
70+
${WGET} https://homebrew.bintray.com/bottles/sdl2_ttf-2.0.15.catalina.bottle.tar.gz
71+
${WGET} https://homebrew.bintray.com/bottles/sdl2_mixer-2.0.4.catalina.bottle.tar.gz
72+
${WGET} https://homebrew.bintray.com/bottles/libmodplug-0.8.9.0.catalina.bottle.1.tar.gz
73+
74+
# get checksums
75+
sha256sum *
16.8 MB
Binary file not shown.

build/linux/buildAppImage.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,11 @@ source /tmp/kivy_venv/bin/activate; python -m pip install -r requirements.txt
4646
# PREPARE APPDIR #
4747
##################
4848

49-
# download the latest python-appimage release, which is an AppImage containing
50-
# the core python3.7 runtime. We use this as a base for building our own python
49+
# We use this python-appimage release as a base for building our own python
5150
# AppImage. We only have to add our code and depends to it.
52-
wget -O /tmp/python3.7.AppImage https://github.com/niess/python-appimage/releases/download/python3.7/python3.7.7-cp37-cp37m-manylinux2014_x86_64.AppImage
53-
chmod +x /tmp/python3.7.AppImage
54-
/tmp/python3.7.AppImage --appimage-extract
51+
cp build/deps/python3.7.8-cp37-cp37m-manylinux2014_x86_64.AppImage /tmp/python.AppImage
52+
chmod +x /tmp/python.AppImage
53+
/tmp/python.AppImage --appimage-extract
5554
mv squashfs-root /tmp/kivy_appdir
5655

5756
# copy depends that were installed with kivy into our kivy AppDir
@@ -111,7 +110,7 @@ chmod +x /tmp/kivy_appdir/AppRun
111110
##################
112111

113112
# create the AppImage from kivy AppDir
114-
wget -O /tmp/appimagetool.AppImage https://github.com/AppImage/AppImageKit/releases/download/12/appimagetool-x86_64.AppImage
113+
cp build/deps/appimagetool-x86_64.AppImage /tmp/appimagetool.AppImage
115114
chmod +x /tmp/appimagetool.AppImage
116115

117116
# create the dist dir for our result to be uploaded as an artifact

0 commit comments

Comments
 (0)