snap: Port to core20

This commit is contained in:
Maximilian Federle
2021-11-20 11:51:21 +01:00
committed by Laurent Trinques
parent c70eb65259
commit 5055e93114
3 changed files with 82 additions and 33 deletions

View File

@@ -1,13 +1,15 @@
#!/bin/sh
# a KDE session forces the KDE Plasma platformtheme which is incompatible with QET
# unset the ENV vars in that case to prevent loading of the theme
if [ ! -z "$KDE_FULL_SESSION" ]; then
unset KDE_FULL_SESSION
fi
if echo "$XDG_CURRENT_DESKTOP" | grep -q KDE; then
unset XDG_CURRENT_DESKTOP
# check if _only_ the correct framework snap is connected
framework_name=$(grep "name:" $SNAP/kf5/meta/snap.yaml | cut -d" " -f2)
if [ "$framework_name" != "kde-frameworks-5-qt-5-15-3-core20" ]; then
downloads_dir=$(xdg-user-dir DOWNLOAD)
test ! -d "$downloads_dir" && mkdir -p "$downloads_dir"
instructions_file="snap.qelectrotech.update-instructions.html"
target="$downloads_dir/$instructions_file"
cp "$SNAP/update-instructions/$instructions_file" "$target"
xdg-open "$target"
exit 1
fi
# migrate .qet directory from SNAP_USER_DATA to SNAP_USER_COMMON
@@ -23,12 +25,4 @@ fi
mkdir -p "$HOME/.qet"
ln -snf "$SNAP/bin/DXFtoQET" "$HOME/.qet/DXFtoQET"
# start desktop portal. Open & save dialogs might fail if it is not running
dbus-send --print-reply \
--dest=org.freedesktop.DBus \
/org/freedesktop/DBus \
org.freedesktop.DBus.StartServiceByName \
string:org.freedesktop.portal.Desktop \
uint32:0
exec "${@}"

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
name: qelectrotech
title: QElectroTech
base: core18
base: core20
adopt-info: qelectrotech
license: GPL-2.0
summary: Electrical diagram editor
@@ -10,6 +10,7 @@ description: |
grade: stable
confinement: strict
compression: lzo
architectures:
- build-on: amd64
@@ -30,15 +31,14 @@ apps:
extensions: [kde-neon]
plugs: &plugs [opengl, unity7, home, removable-media, gsettings, network, cups-control]
environment: &env
__EGL_VENDOR_LIBRARY_DIRS: $SNAP/kf5/usr/share/glvnd/egl_vendor.d:$SNAP/usr/share/glvnd/egl_vendor.d
TCL_LIBRARY: $SNAP/usr/share/tcltk/tcl8.6
QT_QPA_PLATFORMTHEME: gtk3
QT_AUTO_SCREEN_SCALE_FACTOR: 1
HOME: $SNAP_USER_COMMON
PYTHONPATH: $SNAP:$SNAP/lib/python3.6/site-packages:$SNAP/usr/lib/python3.6:$SNAP/usr/lib/python3.6/lib-dynload
PYTHONPATH: $SNAP:$SNAP/lib/python3.8/site-packages:$SNAP/usr/lib/python3.8:$SNAP/usr/lib/python3.8/lib-dynload
qet-tb-generator:
command: bin/qelectrotech-launch $SNAP/bin/qet_tb_generator
command: bin/qet_tb_generator
command-chain:
- bin/qelectrotech-launch
extensions: [kde-neon]
plugs: *plugs
environment: *env
@@ -56,9 +56,14 @@ parts:
organize:
'*': bin/
update-instructions:
plugin: dump
source: build-aux/snap/local/update-instructions
organize:
'*': update-instructions/
qet-tb-generator:
plugin: python
python-version: python3
source: https://github.com/raulroda/qet_tb_generator-plugin.git
python-packages: [PySimpleGUI]
stage-packages:
@@ -69,14 +74,14 @@ parts:
kde-sdk-setup:
plugin: nil
build-snaps:
- kde-frameworks-5-core18-sdk
- kde-frameworks-5-qt-5-15-3-core20-sdk
build-packages:
- g++
- mesa-common-dev
- libglvnd-dev
- rsync
override-build: |
rsync -a --ignore-existing /snap/kde-frameworks-5-core18-sdk/current/ /
rsync -a --ignore-existing /snap/kde-frameworks-5-qt-5-15-3-core20-sdk/current/ /
dxf-to-qet:
after: [kde-sdk-setup]
@@ -92,14 +97,15 @@ parts:
after: [kde-sdk-setup]
plugin: nil
source: .
stage-packages: [ git, sqlite3 ]
stage-packages: [ git, sqlite3, xdg-user-dirs ]
build-packages:
- git
- libsqlite3-dev
override-pull: |
snapcraftctl pull
snap_version=$(git describe --dirty)
modified_displayed_version=$snap_version".snap"
displayed_version=$(grep "displayedVersion" sources/qet.h | tr -d "\";" | cut -d" " -f5)
snap_version="${displayed_version}~$(git rev-parse --short=8 HEAD)"
modified_displayed_version="${snap_version}.snap"
sed -i -E "s|const QString displayedVersion =.*|const QString displayedVersion =\"$modified_displayed_version\";|" sources/qet.h
snapcraftctl set-version "$snap_version"
override-build: |
@@ -115,11 +121,14 @@ parts:
cleanup:
after: [qelectrotech, dxf-to-qet, qet-tb-generator]
plugin: nil
build-snaps: [core18, kde-frameworks-5-core18]
build-snaps: [kde-frameworks-5-qt-5-15-3-core20]
override-prime: |
# Remove all files from snap that are already included in the base snap or in
# any connected content snaps
set -eux
for snap in "core18" "kde-frameworks-5-core18"; do # List all content-snaps and base snaps you're using here
cd "/snap/$snap/current" && find . -type f,l -exec rm -f "$SNAPCRAFT_PRIME/{}" \;
for snap in "kde-frameworks-5-qt-5-15-3-core20"; do # List all content-snaps you're using here
cd "/snap/$snap/current" && find . -type f,l -exec rm -f "$SNAPCRAFT_PRIME/{}" "$SNAPCRAFT_PRIME/usr/{}" \;
done
for cruft in bug lintian man; do
rm -rf $SNAPCRAFT_PRIME/usr/share/$cruft
done
find $SNAPCRAFT_PRIME/usr/share/doc/ -type f -not -name 'copyright' -delete
find $SNAPCRAFT_PRIME/usr/share -type d -empty -delete