More snapcraft troubleshooting (#1622)

Finally got the snap to successfully run
This commit is contained in:
Micah Lee 2022-10-07 15:44:12 -07:00 committed by GitHub
parent 2144bc89fe
commit 6c6c6bc62d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 68 additions and 27 deletions

View file

@ -305,24 +305,6 @@ jobs:
name: mac-build
path: ~/onionshare-macos.tar.gz
# build-snap:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - name: Install dependencies
# run: |
# sudo lxd init --auto
# sudo snap install snapcraft --classic
# - name: Build snap
# run: sudo snapcraft --use-lxd
# - uses: actions/upload-artifact@v3
# with:
# name: snapcraft-build
# path: onionshare_*.snap
build-flatpak:
runs-on: ubuntu-latest
steps:
@ -356,3 +338,21 @@ jobs:
with:
name: flatpak-build
path: ~/OnionShare.flatpak
build-snap:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo lxd init --auto
sudo snap install snapcraft --classic
- name: Build snap
run: sudo snapcraft --use-lxd
- uses: actions/upload-artifact@v3
with:
name: snapcraft-build
path: onionshare_*.snap

View file

@ -9,7 +9,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.9'
python-version: "3.9"
- name: Install dependencies
run: |
sudo apt-get update
@ -34,7 +34,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.9'
python-version: "3.9"
- name: Install dependencies
run: |
sudo apt-get update

View file

@ -19,7 +19,7 @@ architectures:
apps:
onionshare:
common-id: org.onionshare.OnionShare
command: bin/onionshare
command: bin/onionshare-launcher
extensions: [gnome-3-38]
plugs:
- desktop
@ -32,7 +32,7 @@ apps:
cli:
common-id: org.onionshare.OnionShareCli
command: bin/onionshare-cli
command: bin/onionshare-cli-launcher
plugs:
- home
- network
@ -42,12 +42,45 @@ apps:
LANG: C.UTF-8
parts:
# Launcher scripts, in order to set PYTHONPATH
launcher:
plugin: nil
override-build: |
mkdir -p $SNAPCRAFT_PART_INSTALL/bin
cat > $SNAPCRAFT_PART_INSTALL/bin/launcher-setup << EOF
#!/bin/sh
export PATH=\$SNAP/bin:\$SNAP/usr/bin:\$SNAP/usr/local/bin:\$PATH
export PYTHONPATH=\$SNAP/lib/python3.8/site-packages:\$SNAP/usr/lib/python3/dist-packages
export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\$SNAP/usr/local/lib
ORIG_IFS=\$IFS
IFS=":"
LIB_BASE=\$(for D in \$LD_LIBRARY_PATH; do echo \$D; done | grep \$SNAP/usr/lib/)
IFS=\$ORIGIN_IFS
export QT_PLUGIN_PATH=\$LIB_BASE/qt5/plugins
EOF
cat > $SNAPCRAFT_PART_INSTALL/bin/onionshare-launcher << EOF
#!/bin/sh
. \$SNAP/bin/launcher-setup
onionshare \$@
EOF
cat > $SNAPCRAFT_PART_INSTALL/bin/onionshare-cli-launcher << EOF
#!/bin/sh
. \$SNAP/bin/launcher-setup
onionshare-cli \$@
EOF
chmod 755 $SNAPCRAFT_PART_INSTALL/bin/launcher-setup
chmod 755 $SNAPCRAFT_PART_INSTALL/bin/onionshare-launcher
chmod 755 $SNAPCRAFT_PART_INSTALL/bin/onionshare-cli-launcher
onionshare:
source: ./desktop
plugin: python
python-packages:
- qrcode
- pyside2 == 5.15.2.1
build-environment:
- PATH: /usr/bin:$PATH
- PYTHONPATH: ""
stage-packages:
- libasound2
- libatk1.0-0
@ -109,19 +142,28 @@ parts:
- libxslt1.1
- libxtst6
- qtwayland5
- python3-pyside2.qtcore
- python3-pyside2.qtgui
- python3-pyside2.qtwidgets
override-build: |
python3 -m pip install qrcode --prefix $SNAPCRAFT_PART_INSTALL
python3 setup.py install --prefix $SNAPCRAFT_PART_INSTALL
after: [onionshare-cli]
onionshare-cli:
source: ./cli
plugin: python
build-environment:
- PATH: /usr/bin:$PATH
- PYTHONPATH: ""
build-packages:
- build-essential
- libssl-dev
- libffi-dev
- python3-dev
- python3-pip
- rustc
- cargo
override-build: |
python3 -m pip install poetry
python3 -m pip install setuptools
@ -136,8 +178,7 @@ parts:
source-type: tar
plugin: autotools
autotools-configure-parameters:
- "--with-libevent-dir=/build/onionshare/parts/libevent/install/usr/local"
# - "--with-libevent-dir=/root/parts/libevent/install/usr/local"
- "--with-libevent-dir=$SNAPCRAFT_PROJECT_DIR/../parts/libevent/install/usr/local"
build-packages:
- libssl-dev
- zlib1g-dev