Added CD (Continuous Deployment) snap packaging support

* Added required files to create a snap package. Launchpad account will automate the build whenever code is committed to git repo

# What is a snap?

A snap :
* is a squashFS filesystem containing your app code and a snap.yaml file containing specific metadata. It has a read-only file-system and, once installed, a writable area.
* is self-contained. It bundles most of the libraries and run-times it needs and can be updated and reverted without affecting the rest of the system.
* is confined from the OS and other apps through security mechanisms, but can exchange content and functions with other snaps according to fine-grained policies controlled by the user and the OS defaults.

//TODO
* Try reducing the size of final snap packages by removing unnecessary packages from priming stage

Signed-off-by: Navdeep Singh Sidhu <deepsidhu1313@users.noreply.github.com>
This commit is contained in:
Navdeep Singh Sidhu
2018-08-10 02:12:55 -05:00
parent d3d9d10ecd
commit 1e8e1eb954
2 changed files with 139 additions and 0 deletions

130
snap/snapcraft.yaml Executable file
View File

@@ -0,0 +1,130 @@
name: sqlitebrowser # the name of the snap
# version: 3.10.1 # the version of the snap
version: master
version-script: printf "`cat currentrelease | head -n 1 `-` git -C . rev-parse --short HEAD`"
summary: DB browser for Sqlite # 79 char long summary
description: GUI editor for SQLite databases # a longer description for the snap
confinement: strict # use "strict" to enforce system access only via declared interfaces
grade: devel
icon: images/sqlitebrowser.svg
type: app
apps:
sqlitebrowser:
command: desktop-launch $SNAP/wrappers/sqlitebrowser
desktop: share/applications/sqlitebrowser.desktop
environment:
TMPDIR: $XDG_RUNTIME_DIR
plugs:
# - browser-support
- desktop
# - gsettings
- home
# - network
# - opengl
- unity7
# - wayland
- x11
- removable-media
# - ssh-keys
build-packages:
- build-essential
- g++
- qtbase5-dev
- qttools5-dev
- qttools5-dev-tools
- libsqlite3-dev
- cmake
- libantlr-dev
- libsqlcipher-dev
- libqcustomplot-dev
# - libx11-xcb1
# - libx11-xcb-dev
# - libxcb-xkb-dev
- libqt5scintilla2-dev
- git
parts:
wrappers:
plugin: dump
source: snap/
sqlitebrowser:
# source-type: git
plugin: cmake
configflags: ["-DUSE_QT5=True", "-Dsqlcipher=1", "-Wno-dev"]
source: .
desktop-qt5:
build-packages:
- qtbase5-dev
- dpkg-dev
make-parameters:
- FLAVOR=qt5
plugin: make
source: https://github.com/ubuntu/snapcraft-desktop-helpers.git
source-subdir: qt
stage-packages:
- libxkbcommon0
- ttf-ubuntu-font-family
- dmz-cursor-theme
- light-themes
# - adwaita-icon-theme
# - gnome-themes-standard
- shared-mime-info
- libqt5gui5
- libgdk-pixbuf2.0-0
- libqt5svg5
- try:
- appmenu-qt5
# - locales-all
# - xdg-user-dirs
dump:
plugin: dump
after:
- desktop-qt5
- sqlitebrowser
stage-packages:
# - qtbase5-dev
# - libqt5gui5
# - libqt4gui4
# - libxkbcommon0
# - libxkbfile1
# - gtk2-engines
- libc6
# - gtk2-engines-oxygen
# - gtk3-engines-breeze
- libgcc1
# - libqcustomplot1.3
# - libqt5network5
# - libqt5scintilla2-12v5
- libsqlite3-0
- libstdc++6
- libsqlcipher-dev
- libatk-adaptor
- libgail-common
filesets:
wanted:
# - etc/*
# - lib/*
- bin/*
#- share/icons/hicolor/256x256/apps/*
- share/*
# - usr/lib/*-linux-gnu/libsqlcipher.so.0
# - usr/lib/*-linux-gnu/libdb*
# - usr/lib/*-linux-gnu/libz.so*
# - usr/share/*
# - usr/share/doc
# - usr/share/man
# - usr/share/lintian
# - usr/bin/sqlitebrowser
# - usr/share/applications/sqlitebrowser.desktop
# - usr/lib/*
# - usr/lib/*-linux-gnu/*
# - usr/lib/*
# - lib/*-linux-gnu/*
# - usr/lib/x86_64-linux-gnu/mesa/*
# - usr/lib/*-linux-gnu/qt5/plugins/*
prime:
- $wanted

9
snap/wrappers/sqlitebrowser Executable file
View File

@@ -0,0 +1,9 @@
#!/bin/bash
export PATH=$SNAP/bin:$SNAP/usr/bin:/snap/bin:$PATH
export PATH="$SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/*-linux-gnu:$SNAP/usr/lib/*-linux-gnu:$SNAP/usr/lib/*-linux-gnu/mesa:$SNAP/usr/lib/*-linux-gnu/mesa-egl"
export LD_LIBRARY_PATH="$SNAP/usr/lib/*-linux-gnu:$SNAP/usr/lib/*-linux-gnu/mesa:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH=$SNAP_LIBRARY_PATH:$LD_LIBRARY_PATH
cd /snap/sqlitebrowser/current/bin
./sqlitebrowser "$@"