From 1e8e1eb95498da9a41fbb4f052d068a847045f2e Mon Sep 17 00:00:00 2001 From: Navdeep Singh Sidhu Date: Fri, 10 Aug 2018 02:12:55 -0500 Subject: [PATCH 01/14] 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 --- snap/snapcraft.yaml | 130 ++++++++++++++++++++++++++++++++++++ snap/wrappers/sqlitebrowser | 9 +++ 2 files changed, 139 insertions(+) create mode 100755 snap/snapcraft.yaml create mode 100755 snap/wrappers/sqlitebrowser diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml new file mode 100755 index 00000000..af592fc1 --- /dev/null +++ b/snap/snapcraft.yaml @@ -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 diff --git a/snap/wrappers/sqlitebrowser b/snap/wrappers/sqlitebrowser new file mode 100755 index 00000000..ea7ce9d9 --- /dev/null +++ b/snap/wrappers/sqlitebrowser @@ -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 "$@" From c2097561a59e3f833ec2c092bc47336b1cd08a8a Mon Sep 17 00:00:00 2001 From: Navdeep Singh Sidhu Date: Fri, 10 Aug 2018 16:05:58 -0500 Subject: [PATCH 02/14] Did the "wording adjustment" :), reduced the snap size by removing files from prime stage. * Fixed typo in snap summary, thanks @justinclift for pointing out * Reduced the size of snap package by removing big files from the package * Added revno to the version script * Added long description of snap package from deb package * Borrowed some code from vlc snap script to fix fall back UI (need further research to fix issue) Signed-off-by: Navdeep Singh Sidhu --- snap/snapcraft.yaml | 72 +++++---- snap/wrappers/sqlitebrowser | 306 +++++++++++++++++++++++++++++++++++- 2 files changed, 342 insertions(+), 36 deletions(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index af592fc1..3011c9bc 100755 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,10 +1,22 @@ 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`" + # version: 3.10.1 # the version of the snap + version: master + version-script: printf "`cat currentrelease | head -n 1 `-`git rev-list master --count`-` 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 + summary: DB browser for SQLite # 79 char long summary + description: | + SQLite Database Browser is a visual tool used to create, design and edit database files compatible with SQLite. Its interface is based on QT, and is meant to be used for users and developers that want to create databases, edit and search data using a familiar spreadsheet-like interface, without the need to learn complicated SQL commands. Controls and wizards are available for users to: + * Create and compact database files + * Create, define, modify and delete tables + * Create, define and delete indexes + * Browse, edit, add and delete records + * Search records + * Import and export records as text + * Import and export tables from/to CSV files + * Import and export databases from/to SQL dump files + * Issue SQL queries and inspect the results + * Examine a log of all SQL commands issued by the application + SQLite Database Browser is not a visual shell for the sqlite command line tool. It does not require familiarity with SQL commands. # a longer description for the snap confinement: strict # use "strict" to enforce system access only via declared interfaces grade: devel @@ -19,14 +31,14 @@ TMPDIR: $XDG_RUNTIME_DIR plugs: # - browser-support - - desktop - # - gsettings + # - desktop + - gsettings - home # - network # - opengl - - unity7 + # - unity7 # - wayland - - x11 + # - x11 - removable-media # - ssh-keys @@ -51,7 +63,7 @@ plugin: dump source: snap/ sqlitebrowser: - # source-type: git + # source-type: git plugin: cmake configflags: ["-DUSE_QT5=True", "-Dsqlcipher=1", "-Wno-dev"] source: . @@ -66,9 +78,9 @@ source-subdir: qt stage-packages: - libxkbcommon0 - - ttf-ubuntu-font-family - - dmz-cursor-theme - - light-themes + # - ttf-ubuntu-font-family + # - dmz-cursor-theme + # - light-themes # - adwaita-icon-theme # - gnome-themes-standard - shared-mime-info @@ -79,6 +91,10 @@ - appmenu-qt5 # - locales-all # - xdg-user-dirs + prime: + - -usr/lib/*-linux-gnu*/dri/* + - -usr/lib/*-linux-gnu*/libLLVM* + - -usr/lib/*-linux-gnu*/libcudata.so.* dump: plugin: dump @@ -87,14 +103,14 @@ - sqlitebrowser stage-packages: # - qtbase5-dev - # - libqt5gui5 + - libqt5gui5 # - libqt4gui4 # - libxkbcommon0 # - libxkbfile1 - # - gtk2-engines + - gtk2-engines - libc6 # - gtk2-engines-oxygen - # - gtk3-engines-breeze + - gtk3-engines-breeze - libgcc1 # - libqcustomplot1.3 # - libqt5network5 @@ -106,25 +122,13 @@ - 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/* + - usr/lib/*-linux-gnu*/libsqlcipher.so.0* + - usr/lib/*-linux-gnu*/libdb* + - usr/lib/*-linux-gnu*/libz.so* + - usr/lib/*-linux-gnu*/libatk* + - usr/lib/*-linux-gnu*/libgail* + prime: - $wanted diff --git a/snap/wrappers/sqlitebrowser b/snap/wrappers/sqlitebrowser index ea7ce9d9..c1d558c1 100755 --- a/snap/wrappers/sqlitebrowser +++ b/snap/wrappers/sqlitebrowser @@ -2,8 +2,310 @@ 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" + +needs_update=true + +. $SNAP_USER_DATA/.last_revision 2>/dev/null || true +if [ "$SNAP_DESKTOP_LAST_REVISION" = "$SNAP_REVISION" ]; then + needs_update=false +fi + +# If the user has modified their user-dirs settings, force an update +if [[ -f $HOME/.config/user-dirs.dirs.md5sum && -f $HOME/.config/user-dirs.locale.md5sum ]]; then + if [[ "$(md5sum < $REALHOME/.config/user-dirs.dirs)" != "$(cat $HOME/.config/user-dirs.dirs.md5sum)" || + "$(md5sum < $REALHOME/.config/user-dirs.locale)" != "$(cat $HOME/.config/user-dirs.locale.md5sum)" ]]; then + needs_update=true + fi +fi + +# Set $REALHOME to the users real home directory +REALHOME=`getent passwd $UID | cut -d ':' -f 6` + +if [ "$SNAP_ARCH" == "amd64" ]; then + ARCH="x86_64-linux-gnu" +elif [ "$SNAP_ARCH" == "armhf" ]; then + ARCH="arm-linux-gnueabihf" +elif [ "$SNAP_ARCH" == "arm64" ]; then + ARCH="aarch64-linux-gnu" +else + ARCH="$SNAP_ARCH-linux-gnu" +fi + + + + +############################################### +# Launcher common exports for any desktop app # +############################################### + +function prepend_dir() { + local var="$1" + local dir="$2" + if [ -d "$dir" ]; then + eval "export $var=\"\$dir\${$var:+:\$$var}\"" + fi +} + +function append_dir() { + local var="$1" + local dir="$2" + if [ -d "$dir" ]; then + eval "export $var=\"\${$var:+\$$var:}\$dir\"" + fi +} + +function can_open_file() { + return `head -c0 "$1" &> /dev/null`; +} + + +RUNTIME=$SNAP + +# XKB config +export XKB_CONFIG_ROOT=$RUNTIME/usr/share/X11/xkb + +# Give XOpenIM a chance to locate locale data. +# This is required for text input to work in SDL2 games. +export XLOCALEDIR=$RUNTIME/usr/share/X11/locale + + +# Set XCursors path +export XCURSOR_PATH=$RUNTIME/usr/share/icons + +# XDG Config +prepend_dir XDG_CONFIG_DIRS $SNAP/etc/xdg + +# Define snaps' own data dir +prepend_dir XDG_DATA_DIRS $SNAP/usr/share +prepend_dir XDG_DATA_DIRS $SNAP_USER_DATA + +# prepend_dir XDG_DATA_DIRS $SNAP/usr/share/gimp/2.0 + +# Set XDG_DATA_HOME to local path +export XDG_DATA_HOME=$SNAP_USER_DATA/.local/share +mkdir -p $XDG_DATA_HOME + +# Workaround for GLib < 2.53.2 not searching for schemas in $XDG_DATA_HOME: +# https://bugzilla.gnome.org/show_bug.cgi?id=741335 +prepend_dir XDG_DATA_DIRS $XDG_DATA_HOME + + +# Set cache folder to local path +export XDG_CACHE_HOME=$SNAP_USER_COMMON/.cache +if [[ -d $SNAP_USER_DATA/.cache && ! -e $XDG_CACHE_HOME ]]; then + # the .cache directory used to be stored under $SNAP_USER_DATA, migrate it + mv $SNAP_USER_DATA/.cache $SNAP_USER_COMMON/ +fi +mkdir -p $XDG_CACHE_HOME + +# Set config folder to local path +export XDG_CONFIG_HOME=$SNAP_USER_DATA/.config +mkdir -p $XDG_CONFIG_HOME + +# Create $XDG_RUNTIME_DIR if not exists (to be removed when LP: #1656340 is fixed) +[ -n "$XDG_RUNTIME_DIR" ] && mkdir -p $XDG_RUNTIME_DIR -m 700 + +# Ensure the app finds locale definitions (requires locales-all to be installed) +append_dir LOCPATH $RUNTIME/usr/lib/locale + +# If any, keep track of where XDG dirs were so we can potentially migrate the content later +test -f ${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs && . ${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs +for d in DOCUMENTS DESKTOP DOWNLOAD MUSIC PICTURES VIDEOS PUBLICSHARE TEMPLATES; do + eval $(echo "OLD_XDG_${d}_DIR")=`eval "$(echo "echo \\$XDG_${d}_DIR")"` +done + +# Setup user-dirs.* or run xdg-user-dirs-update if needed +needs_xdg_update=false +needs_xdg_links=false +if can_open_file "$REALHOME/.config/user-dirs.dirs" && can_open_file "$REALHOME/.config/user-dirs.locale"; then + sed /^#/!s#\$HOME#${REALHOME}#g $REALHOME/.config/user-dirs.dirs > $HOME/.config/user-dirs.dirs + cp -a $REALHOME/.config/user-dirs.locale $HOME/.config/ + for f in user-dirs.dirs user-dirs.locale; do + md5sum < $REALHOME/.config/$f > $HOME/.config/$f.md5sum + done +else + needs_xdg_update=true + needs_xdg_links=true +fi + +# Check if we can actually read the contents of each xdg dir +test -f ${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs && . ${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs +XDG_SPECIAL_DIRS=($XDG_DOCUMENTS_DIR $XDG_DESKTOP_DIR $XDG_DOWNLOAD_DIR $XDG_MUSIC_DIR $XDG_PICTURES_DIR $XDG_VIDEOS_DIR $XDG_PUBLIC_DIR $XDG_TEMPLATES_DIR) +for d in ${XDG_SPECIAL_DIRS[@]}; do + if ! can_open_file $d; then + needs_xdg_update=true + fi +done + +# If needs XDG update and xdg-user-dirs-update exists in $PATH, run it +if [ $needs_xdg_update = true ] && [ `which xdg-user-dirs-update` ]; then + xdg-user-dirs-update +fi + +# Create links for user-dirs.dirs +if [ $needs_xdg_links = true ]; then + test -f ${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs && . ${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs + XDG_SPECIAL_DIRS=($XDG_DOCUMENTS_DIR $XDG_DESKTOP_DIR $XDG_DOWNLOAD_DIR $XDG_MUSIC_DIR $XDG_PICTURES_DIR $XDG_VIDEOS_DIR $XDG_PUBLIC_DIR $XDG_TEMPLATES_DIR) + for d in ${XDG_SPECIAL_DIRS[@]}; do + b=$(realpath "$d" --relative-to="$REALHOME") + if [ -e $REALHOME/$b ] && [ ! -e $HOME/$b ]; then + ln -s $REALHOME/$b $HOME/$b + fi + done +else + # If we aren't creating new links, check if we have content saved in old locations and move it + for d in DOCUMENTS DESKTOP DOWNLOAD MUSIC PICTURES VIDEOS PUBLICSHARE TEMPLATES; do + old=`eval "$(echo "echo \\$OLD_XDG_${d}_DIR")"` + new=`eval "$(echo "echo \\$XDG_${d}_DIR")"` + if [ -L "$old" ] && [ -d "$new" ] && [ `readlink "$old"` != "$new" ]; then + mv "$old"/* "$new"/ 2>/dev/null + elif [ -d "$old" ] && [ -d "$new" ] && [ "$old" != "$new" ]; then + mv "$old"/* "$new"/ 2>/dev/null + fi + done +fi + +# If detect wayland server socket, then set environment so applications prefer +# wayland, and setup compat symlink (until we use user mounts. Remember, +# XDG_RUNTIME_DIR is /run/user//snap.$SNAP so look in the parent directory +# for the socket. For details: +# https://forum.snapcraft.io/t/wayland-dconf-and-xdg-runtime-dir/186/10 +# Applications that don't support wayland natively may define DISABLE_WAYLAND +# (to any non-empty value) to skip that logic entirely. +if [[ -n "$XDG_RUNTIME_DIR" && -z "$DISABLE_WAYLAND" ]]; then + wdisplay="wayland-0" + if [ -n "$WAYLAND_DISPLAY" ]; then + wdisplay="$WAYLAND_DISPLAY" + fi + wayland_sockpath="$XDG_RUNTIME_DIR/../$wdisplay" + wayland_snappath="$XDG_RUNTIME_DIR/$wdisplay" + if [ -S "$wayland_sockpath" ]; then + # if running under wayland, use it + #export WAYLAND_DEBUG=1 + export GDK_BACKEND="wayland" + export CLUTTER_BACKEND="wayland" + export QT_QPA_PLATFORM="wayland-egl" + # create the compat symlink for now + if [ ! -e "$wayland_snappath" ]; then + ln -s "$wayland_sockpath" "$wayland_snappath" + fi + fi +fi + +# Keep an array of data dirs, for looping through them +IFS=':' read -r -a data_dirs_array <<< "$XDG_DATA_DIRS" + +# Font Config and themes +export FONTCONFIG_PATH=$RUNTIME/etc/fonts/conf.d +export FONTCONFIG_FILE=$XDG_CONFIG_HOME/fontconfig/fonts.conf + + +function make_user_fontconfig { + echo "" + if [ -d $REALHOME/.local/share/fonts ]; then + echo " $REALHOME/.local/share/fonts" + fi + if [ -d $REALHOME/.fonts ]; then + echo " $REALHOME/.fonts" + fi + for d in "${data_dirs_array[@]}"; do + if [ -d "$d/fonts" ]; then + echo " $d/fonts" + fi + done + # We need to include this default cachedir first so that caching + # works: without it, fontconfig will try to write to the real user home + # cachedir and be blocked by AppArmor. + echo ' fontconfig' + if [ -d $REALHOME/.cache/fontconfig ]; then + echo " $REALHOME/.cache/fontconfig" + fi + echo "" +} + +if [ $needs_update = true ]; then + rm -rf $XDG_DATA_HOME/{fontconfig,fonts,fonts-*,themes,.themes} + mkdir -p $XDG_CONFIG_HOME/fontconfig + make_user_fontconfig > $FONTCONFIG_FILE + + # the themes symlink are needed for GTK 3.18 when the prefix isn't changed + # GTK 3.20 looks into XDG_DATA_DIR which has connected themes. + ln -sf $RUNTIME/usr/share/themes $XDG_DATA_HOME + ln -sfn $RUNTIME/usr/share/themes $SNAP_USER_DATA/.themes +fi + +# Build mime.cache +# needed for gtk and qt icon +if [ $needs_update = true ]; then + rm -rf $XDG_DATA_HOME/mime + if [ ! -f $RUNTIME/usr/share/mime/mime.cache ]; then + if [ `which update-mime-database` ]; then + cp --preserve=timestamps -dR $RUNTIME/usr/share/mime $XDG_DATA_HOME + update-mime-database $XDG_DATA_HOME/mime + fi + fi +fi + + +# Enable gsettings user changes +# symlink the dconf file if home plug is connected for read +DCONF_DEST_USER_DIR=$SNAP_USER_DATA/.config/dconf +if [ ! -f $DCONF_DEST_USER_DIR/user ]; then + if [ -f $REALHOME/.config/dconf/user ]; then + mkdir -p $DCONF_DEST_USER_DIR + ln -s $REALHOME/.config/dconf/user $DCONF_DEST_USER_DIR + fi +fi + + +# Gdk-pixbuf loaders +export GDK_PIXBUF_MODULE_FILE=$XDG_CACHE_HOME/gdk-pixbuf-loaders.cache +export GDK_PIXBUF_MODULEDIR=$RUNTIME/usr/lib/$ARCH/gdk-pixbuf-2.0/2.10.0/loaders +if [ $needs_update = true ]; then + rm -f $GDK_PIXBUF_MODULE_FILE + if [ -f $RUNTIME/usr/bin/gdk-pixbuf-query-loaders ]; then + $RUNTIME/usr/bin/gdk-pixbuf-query-loaders > $GDK_PIXBUF_MODULE_FILE + fi +fi + + + +# GTK theme and behavior modifier +# Those can impact the theme engine used by Qt as well +gtk_configs=(.config/gtk-3.0/settings.ini .config/gtk-3.0/bookmarks .config/gtk-2.0/gtkfilechooser.ini) +for f in ${gtk_configs[@]}; do + dest="$SNAP_USER_DATA/$f" + if [ ! -L "$dest" ] + then + mkdir -p `dirname $dest` + ln -s $REALHOME/$f $dest + fi +done + + +############################## +# GTK launcher specific part # +############################## + +export GTK_PATH=$RUNTIME/usr/lib/$ARCH/gtk-3.0:$RUNTIME/usr/lib/$ARCH/gtk-2.0 + +# # ibus and fcitx integration +# GTK_IM_MODULE_DIR=$XDG_CACHE_HOME/immodules +# export GTK_IM_MODULE_FILE=$GTK_IM_MODULE_DIR/immodules.cache +# if [ $needs_update = true ]; then +# rm -rf $GTK_IM_MODULE_DIR +# mkdir -p $GTK_IM_MODULE_DIR +# ln -s $RUNTIME/usr/lib/gtk-2.0/2.10.0/immodules/*.so $GTK_IM_MODULE_DIR +# $RUNTIME/usr/bin/gtk-query-immodules-2.0 > $GTK_IM_MODULE_FILE +# $RUNTIME/usr/bin/gtk-query-immodules-3.0 >> $GTK_IM_MODULE_FILE +# fi + +export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/$ARCH:$SNAP/usr/lib/$ARCH:$SNAP/usr/lib/$ARCH/mesa:$SNAP/usr/lib/$ARCH/mesa-egl" +export LD_LIBRARY_PATH="$SNAP/usr/lib/$ARCH:$SNAP/usr/lib/$ARCH/mesa:$LD_LIBRARY_PATH" export LD_LIBRARY_PATH=$SNAP_LIBRARY_PATH:$LD_LIBRARY_PATH + + + cd /snap/sqlitebrowser/current/bin +# echo $LD_LIBRARY_PATH ./sqlitebrowser "$@" From eb10edd4a1e13bababdb58ca404050b82063e30e Mon Sep 17 00:00:00 2001 From: Navdeep Singh Sidhu Date: Fri, 10 Aug 2018 17:21:16 -0500 Subject: [PATCH 03/14] Added echo message to request users to report issues with snap package Signed-off-by: Navdeep Singh Sidhu --- snap/wrappers/sqlitebrowser | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/snap/wrappers/sqlitebrowser b/snap/wrappers/sqlitebrowser index c1d558c1..7ebe128a 100755 --- a/snap/wrappers/sqlitebrowser +++ b/snap/wrappers/sqlitebrowser @@ -3,6 +3,8 @@ export PATH=$SNAP/bin:$SNAP/usr/bin:/snap/bin:$PATH export PATH="$SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH" +echo 'Please create an issue on https://github.com/sqlitebrowser/sqlitebrowser, if you encounter any problems with SNAP package of sqlitebrowser. Thanks !! @deepsidhu1313.' + needs_update=true . $SNAP_USER_DATA/.last_revision 2>/dev/null || true @@ -11,7 +13,7 @@ if [ "$SNAP_DESKTOP_LAST_REVISION" = "$SNAP_REVISION" ]; then fi # If the user has modified their user-dirs settings, force an update -if [[ -f $HOME/.config/user-dirs.dirs.md5sum && -f $HOME/.config/user-dirs.locale.md5sum ]]; then +if [[ -f $REALHOME/.config/user-dirs.dirs.md5sum && -f $REALHOME/.config/user-dirs.locale.md5sum ]]; then if [[ "$(md5sum < $REALHOME/.config/user-dirs.dirs)" != "$(cat $HOME/.config/user-dirs.dirs.md5sum)" || "$(md5sum < $REALHOME/.config/user-dirs.locale)" != "$(cat $HOME/.config/user-dirs.locale.md5sum)" ]]; then needs_update=true @@ -307,5 +309,4 @@ export LD_LIBRARY_PATH=$SNAP_LIBRARY_PATH:$LD_LIBRARY_PATH cd /snap/sqlitebrowser/current/bin -# echo $LD_LIBRARY_PATH ./sqlitebrowser "$@" From bbafb950e7f2f22a651cd11ae326573e02842457 Mon Sep 17 00:00:00 2001 From: Navdeep Singh Sidhu Date: Fri, 10 Aug 2018 17:51:25 -0500 Subject: [PATCH 04/14] Back to zero with reducing size as snap created by launchpad couldn't find display :0 Signed-off-by: Navdeep Singh Sidhu --- snap/snapcraft.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 3011c9bc..e18c1dd9 100755 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -31,14 +31,14 @@ TMPDIR: $XDG_RUNTIME_DIR plugs: # - browser-support - # - desktop + - desktop - gsettings - home # - network # - opengl - # - unity7 - # - wayland - # - x11 + - unity7 + - wayland + - x11 - removable-media # - ssh-keys @@ -91,10 +91,10 @@ - appmenu-qt5 # - locales-all # - xdg-user-dirs - prime: - - -usr/lib/*-linux-gnu*/dri/* - - -usr/lib/*-linux-gnu*/libLLVM* - - -usr/lib/*-linux-gnu*/libcudata.so.* + # prime: + # - -usr/lib/*-linux-gnu*/dri/* + # - -usr/lib/*-linux-gnu*/libLLVM* + # - -usr/lib/*-linux-gnu*/libcudata.so.* dump: plugin: dump From 2bdde8e9a9a0bfca091d297946995f86a6b3a327 Mon Sep 17 00:00:00 2001 From: Navdeep Singh Sidhu Date: Fri, 10 Aug 2018 18:02:37 -0500 Subject: [PATCH 05/14] Fixed Typo Signed-off-by: Navdeep Singh Sidhu --- snap/snapcraft.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index e18c1dd9..df62dc23 100755 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -3,7 +3,7 @@ version: master version-script: printf "`cat currentrelease | head -n 1 `-`git rev-list master --count`-` git -C . rev-parse --short HEAD`" - summary: DB browser for SQLite # 79 char long summary + summary: DB Browser for SQLite # 79 char long summary description: | SQLite Database Browser is a visual tool used to create, design and edit database files compatible with SQLite. Its interface is based on QT, and is meant to be used for users and developers that want to create databases, edit and search data using a familiar spreadsheet-like interface, without the need to learn complicated SQL commands. Controls and wizards are available for users to: * Create and compact database files From a54fd6e5c02aac4c2dafd3c3740fb29da92763ff Mon Sep 17 00:00:00 2001 From: Navdeep Singh Sidhu Date: Fri, 10 Aug 2018 18:03:55 -0500 Subject: [PATCH 06/14] * Fixed Typo Signed-off-by: Navdeep Singh Sidhu --- snap/snapcraft.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index df62dc23..44aa44e7 100755 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -5,7 +5,7 @@ summary: DB Browser for SQLite # 79 char long summary description: | - SQLite Database Browser is a visual tool used to create, design and edit database files compatible with SQLite. Its interface is based on QT, and is meant to be used for users and developers that want to create databases, edit and search data using a familiar spreadsheet-like interface, without the need to learn complicated SQL commands. Controls and wizards are available for users to: + SQLite Database Browser is a visual tool used to create, design and edit database files compatible with SQLite. Its interface is based on Qt, and is meant to be used for users and developers that want to create databases, edit and search data using a familiar spreadsheet-like interface, without the need to learn complicated SQL commands. Controls and wizards are available for users to: * Create and compact database files * Create, define, modify and delete tables * Create, define and delete indexes From cacd7e309074d40d243ca94674acb58b6839214a Mon Sep 17 00:00:00 2001 From: Navdeep Singh Sidhu Date: Sun, 12 Aug 2018 07:00:41 -0500 Subject: [PATCH 07/14] Fixed error related to libgail and libatk modules * Priming the gtk modules to fix ``` Gtk-Message: Failed to load module "gail" Gtk-Message: Failed to load module "atk-bridge" ``` Signed-off-by: Navdeep Singh Sidhu --- snap/snapcraft.yaml | 29 ++++++++++----------- snap/wrappers/sqlitebrowser | 52 +++++++++++++++++++++++++++---------- 2 files changed, 52 insertions(+), 29 deletions(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 44aa44e7..4b8188a3 100755 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -16,7 +16,7 @@ * Import and export databases from/to SQL dump files * Issue SQL queries and inspect the results * Examine a log of all SQL commands issued by the application - SQLite Database Browser is not a visual shell for the sqlite command line tool. It does not require familiarity with SQL commands. # a longer description for the snap + SQLite Database Browser is not a visual shell for the sqlite command line tool. It does not require familiarity with SQL commands. confinement: strict # use "strict" to enforce system access only via declared interfaces grade: devel @@ -81,20 +81,13 @@ # - 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 - # prime: - # - -usr/lib/*-linux-gnu*/dri/* - # - -usr/lib/*-linux-gnu*/libLLVM* - # - -usr/lib/*-linux-gnu*/libcudata.so.* + - appmenu-qt5 + - locales-all + - xdg-user-dirs dump: plugin: dump @@ -103,14 +96,14 @@ - sqlitebrowser stage-packages: # - qtbase5-dev - - libqt5gui5 + # - libqt5gui5 # - libqt4gui4 # - libxkbcommon0 # - libxkbfile1 - - gtk2-engines + # - gtk2-engines - libc6 # - gtk2-engines-oxygen - - gtk3-engines-breeze + # - gtk3-engines-breeze - libgcc1 # - libqcustomplot1.3 # - libqt5network5 @@ -120,6 +113,9 @@ - libsqlcipher-dev - libatk-adaptor - libgail-common + - libgail-3-0 + - libgail-3-dev + - libgail-dev filesets: wanted: - bin/* @@ -129,6 +125,9 @@ - usr/lib/*-linux-gnu*/libz.so* - usr/lib/*-linux-gnu*/libatk* - usr/lib/*-linux-gnu*/libgail* - + - usr/lib/*-linux-gnu*/gtk-2.0/modules/* + - etc/X11/Xsession.d/90atk-adaptor + - usr/lib/gnome-settings-daemon-3.0/gtk-modules/at-spi2-atk.desktop + - usr/lib/unity-settings-daemon-1.0/gtk-modules/at-spi2-atk.desktop prime: - $wanted diff --git a/snap/wrappers/sqlitebrowser b/snap/wrappers/sqlitebrowser index 7ebe128a..6a93eeaf 100755 --- a/snap/wrappers/sqlitebrowser +++ b/snap/wrappers/sqlitebrowser @@ -1,5 +1,7 @@ #!/bin/bash +SNAP=`echo $SNAP | sed -e "s|/var/lib/snapd||g"` + export PATH=$SNAP/bin:$SNAP/usr/bin:/snap/bin:$PATH export PATH="$SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH" @@ -74,6 +76,24 @@ export XLOCALEDIR=$RUNTIME/usr/share/X11/locale # Set XCursors path export XCURSOR_PATH=$RUNTIME/usr/share/icons +# Mesa Libs for OpenGL support +append_dir LD_LIBRARY_PATH $RUNTIME/usr/lib/$ARCH/mesa +append_dir LD_LIBRARY_PATH $RUNTIME/usr/lib/$ARCH/mesa-egl + +# Tell libGL where to find the drivers +export LIBGL_DRIVERS_PATH=$RUNTIME/usr/lib/$ARCH/dri +append_dir LD_LIBRARY_PATH $LIBGL_DRIVERS_PATH + +# Workaround in snapd for proprietary nVidia drivers mounts the drivers in +# /var/lib/snapd/lib/gl that needs to be in LD_LIBRARY_PATH +# Without that OpenGL using apps do not work with the nVidia drivers. +# Ref.: https://bugs.launchpad.net/snappy/+bug/1588192 +append_dir LD_LIBRARY_PATH /var/lib/snapd/lib/gl + +# Unity7 export (workaround for https://launchpad.net/bugs/1638405) +append_dir LD_LIBRARY_PATH $RUNTIME/usr/lib/$ARCH/libunity + + # XDG Config prepend_dir XDG_CONFIG_DIRS $SNAP/etc/xdg @@ -284,6 +304,13 @@ for f in ${gtk_configs[@]}; do fi done +# create symbolic link to ibus socket path for ibus to look up its socket files +# (see comments #3 and #6 on https://launchpad.net/bugs/1580463) +IBUS_CONFIG_PATH=$XDG_CONFIG_HOME/ibus +mkdir -p $IBUS_CONFIG_PATH +[ -d $IBUS_CONFIG_PATH/bus ] && rm -rf $IBUS_CONFIG_PATH/bus +ln -sfn $REALHOME/.config/ibus/bus $IBUS_CONFIG_PATH + ############################## # GTK launcher specific part # @@ -291,22 +318,19 @@ done export GTK_PATH=$RUNTIME/usr/lib/$ARCH/gtk-3.0:$RUNTIME/usr/lib/$ARCH/gtk-2.0 -# # ibus and fcitx integration -# GTK_IM_MODULE_DIR=$XDG_CACHE_HOME/immodules -# export GTK_IM_MODULE_FILE=$GTK_IM_MODULE_DIR/immodules.cache -# if [ $needs_update = true ]; then -# rm -rf $GTK_IM_MODULE_DIR -# mkdir -p $GTK_IM_MODULE_DIR -# ln -s $RUNTIME/usr/lib/gtk-2.0/2.10.0/immodules/*.so $GTK_IM_MODULE_DIR -# $RUNTIME/usr/bin/gtk-query-immodules-2.0 > $GTK_IM_MODULE_FILE -# $RUNTIME/usr/bin/gtk-query-immodules-3.0 >> $GTK_IM_MODULE_FILE -# fi +# ibus and fcitx integration +GTK_IM_MODULE_DIR=$XDG_CACHE_HOME/immodules +export GTK_IM_MODULE_FILE=$GTK_IM_MODULE_DIR/immodules.cache +if [ $needs_update = true ]; then + rm -rf $GTK_IM_MODULE_DIR + mkdir -p $GTK_IM_MODULE_DIR + ln -s $RUNTIME/usr/lib/$ARCH/gtk-2.0/2.10.0/immodules/*.so $GTK_IM_MODULE_DIR + $RUNTIME/usr/lib/$ARCH/libgtk2.0-0/gtk-query-immodules-2.0 > $GTK_IM_MODULE_FILE + # $RUNTIME/usr/lib/$ARCH/libgtk3.0-0/gtk-query-immodules-3.0 >> $GTK_IM_MODULE_FILE +fi export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/$ARCH:$SNAP/usr/lib/$ARCH:$SNAP/usr/lib/$ARCH/mesa:$SNAP/usr/lib/$ARCH/mesa-egl" export LD_LIBRARY_PATH="$SNAP/usr/lib/$ARCH:$SNAP/usr/lib/$ARCH/mesa:$LD_LIBRARY_PATH" export LD_LIBRARY_PATH=$SNAP_LIBRARY_PATH:$LD_LIBRARY_PATH - - -cd /snap/sqlitebrowser/current/bin -./sqlitebrowser "$@" +exec "desktop-launch" "$SNAP/bin/sqlitebrowser" "$@" From 1988b98f133d2622f6033e2be7b5013da94a3e4d Mon Sep 17 00:00:00 2001 From: Navdeep Singh Sidhu Date: Sat, 20 Oct 2018 14:24:19 -0500 Subject: [PATCH 08/14] Updated Build guide, travis config and snap config * Added build instructions for OpenSuse * Updated package list for Ubuntu build * Added initial code for x86 and x64 build of AppImage to travis file * More experiments with snap config to fix old UI. Signed-off-by: Navdeep Singh Sidhu --- .travis.yml | 4 ++++ BUILDING.md | 18 +++++++++++++++++- snap/snapcraft.yaml | 19 ++++++++++++++----- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7eb257aa..30cd5609 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,10 @@ branches: only: - master +env: + - ARCH=x86_64 DOCKER_IMAGE=amd64/ubuntu:trusty + - ARCH=i686 DOCKER_IMAGE=i386/ubuntu:trusty + matrix: fast_finish: true include: diff --git a/BUILDING.md b/BUILDING.md index 4a6b3b23..3e6b15b7 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -55,7 +55,7 @@ The same process works for building the code in any platform supported by Qt ```bash $ sudo apt install build-essential git-core cmake libsqlite3-dev qt5-default qttools5-dev-tools \ - libsqlcipher-dev + libsqlcipher-dev qtbase5-dev libantlr-dev libqt5scintilla2-dev libqcustomplot-dev qttools5-dev $ git clone https://github.com/sqlitebrowser/sqlitebrowser $ cd sqlitebrowser $ mkdir build @@ -88,6 +88,22 @@ $ sudo make install This should complete without errors, and `sqlitebrowser` should now be launch-able from the command line. +### OpenSUSE + +```bash + + +$ zypper in -y build git-core, libQt5Core5, libQt5Core5-32bit, libqt5-qtbase, libqt5-qtbase-devel, libqt5-qttools, libqt5-qttools-devel, build, gcc-c++, gcc, sqlite3-devel, libsqlite3-0, cmake, antlr-devel, sqlcipher-devel +$ git clone https://github.com/sqlitebrowser/sqlitebrowser +$ cd sqlitebrowser +$ mkdir build +$ cd build +$ cmake -Dsqlcipher=1 -Wno-dev -DFORCE_INTERNAL_QSCINTILLA=ON .. +$ make +$ sudo make install +``` + + ### MacOS X The application can be compiled to a single executable binary file, similar to diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 4b8188a3..030ce9c4 100755 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -4,7 +4,7 @@ version-script: printf "`cat currentrelease | head -n 1 `-`git rev-list master --count`-` git -C . rev-parse --short HEAD`" summary: DB Browser for SQLite # 79 char long summary - description: | + description: | SQLite Database Browser is a visual tool used to create, design and edit database files compatible with SQLite. Its interface is based on Qt, and is meant to be used for users and developers that want to create databases, edit and search data using a familiar spreadsheet-like interface, without the need to learn complicated SQL commands. Controls and wizards are available for users to: * Create and compact database files * Create, define, modify and delete tables @@ -71,6 +71,7 @@ build-packages: - qtbase5-dev - dpkg-dev + - libgtk-3-dev make-parameters: - FLAVOR=qt5 plugin: make @@ -78,17 +79,25 @@ source-subdir: qt stage-packages: - libxkbcommon0 - # - ttf-ubuntu-font-family - # - dmz-cursor-theme - # - light-themes + - ttf-ubuntu-font-family + - dmz-cursor-theme + - light-themes + - adwaita-icon-theme + - gnome-themes-standard - shared-mime-info + - libgtk-3-0 - libqt5gui5 - libgdk-pixbuf2.0-0 - libqt5svg5 - appmenu-qt5 + - libglib2.0-bin + - libgtk-3-bin + - unity-gtk3-module + - libappindicator3-1 - locales-all - xdg-user-dirs - + - ibus-gtk3 + - libibus-1.0-5 dump: plugin: dump after: From 323b416462e4280054137e0bef4568b437ad1e37 Mon Sep 17 00:00:00 2001 From: Navdeep Singh Sidhu Date: Sat, 17 Nov 2018 22:30:19 -0600 Subject: [PATCH 09/14] * Removing wrappers (to test fix https://bugs.launchpad.net/snapcraft/+bug/1791871) * Added qt5-gtk-platformtheme in comments, this can be uncommented if snap is build on base 18 to support gtk theme for QT app. Signed-off-by: Navdeep Singh Sidhu --- snap/snapcraft.yaml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 030ce9c4..2958bf9d 100755 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -25,7 +25,7 @@ apps: sqlitebrowser: - command: desktop-launch $SNAP/wrappers/sqlitebrowser + command: desktop-launch $SNAP/bin/sqlitebrowser desktop: share/applications/sqlitebrowser.desktop environment: TMPDIR: $XDG_RUNTIME_DIR @@ -59,9 +59,9 @@ - libqt5scintilla2-dev - git parts: - wrappers: - plugin: dump - source: snap/ + # wrappers: + # plugin: dump + # source: snap/ sqlitebrowser: # source-type: git plugin: cmake @@ -79,6 +79,7 @@ source-subdir: qt stage-packages: - libxkbcommon0 + # - qt5-gtk-platformtheme - ttf-ubuntu-font-family - dmz-cursor-theme - light-themes @@ -125,10 +126,12 @@ - libgail-3-0 - libgail-3-dev - libgail-dev + # - qt5-gtk-platformtheme filesets: wanted: - bin/* - share/* + - usr/lib/*.* - usr/lib/*-linux-gnu*/libsqlcipher.so.0* - usr/lib/*-linux-gnu*/libdb* - usr/lib/*-linux-gnu*/libz.so* From fb9e80820ddb2b48bdbdf071641e89209e6d74e8 Mon Sep 17 00:00:00 2001 From: Navdeep Singh Sidhu Date: Sun, 18 Nov 2018 00:06:40 -0600 Subject: [PATCH 10/14] Updated Readme * Added instructions for Snap package installation. Signed-off-by: Navdeep Singh Sidhu --- README.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0ff09121..cf90be4f 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ Download Windows releases here: * https://github.com/sqlitebrowser/sqlitebrowser/releases -**Note** - If for some reason the standard Windows release does not work +**Note** - If for some reason the standard Windows release does not work (e.g. gives an error), try a nightly build. Nightly builds often fix bugs reported after the last release. :D @@ -169,6 +169,19 @@ or this command: # pkg install sqlitebrowser +### Snap packages + +[![Get it from the Snap Store](https://snapcraft.io/static/images/badges/en/snap-store-black.svg)](https://snapcraft.io/sqlitebrowser) + +#### Snap Nightlies + + snap install sqlitebrowser --devmode + +#### Snap Stable + + snap install sqlitebrowser + + ### Compiling Instructions for compiling on Windows, OSX, Linux, and FreeBSD are From cc6cf60e9cd7d14f5eb616cbf869b770f8c6823a Mon Sep 17 00:00:00 2001 From: Navdeep Singh Sidhu Date: Sun, 18 Nov 2018 00:08:26 -0600 Subject: [PATCH 11/14] Fixed snap heading in readme Signed-off-by: Navdeep Singh Sidhu --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cf90be4f..fd844238 100644 --- a/README.md +++ b/README.md @@ -169,7 +169,7 @@ or this command: # pkg install sqlitebrowser -### Snap packages +## Snap packages [![Get it from the Snap Store](https://snapcraft.io/static/images/badges/en/snap-store-black.svg)](https://snapcraft.io/sqlitebrowser) From c31d299fedc6efe80379c90533d669cd187387ef Mon Sep 17 00:00:00 2001 From: Navdeep Singh Sidhu Date: Sun, 18 Nov 2018 00:10:40 -0600 Subject: [PATCH 12/14] * Readme.md - Fixed heading of compiling section. Signed-off-by: Navdeep Singh Sidhu --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fd844238..ad982ba1 100644 --- a/README.md +++ b/README.md @@ -182,7 +182,7 @@ or this command: snap install sqlitebrowser -### Compiling +## Compiling Instructions for compiling on Windows, OSX, Linux, and FreeBSD are in [BUILDING](BUILDING.md). From b6f7b1eec35b0f75d8139b4e5bb05b3436cf1a19 Mon Sep 17 00:00:00 2001 From: Navdeep Singh Sidhu Date: Sun, 18 Nov 2018 00:52:42 -0600 Subject: [PATCH 13/14] Snap package - Removed wrapper file * As mentioned in one of previous commits, dump wrapper was causing problem with launchpad CI/CD for snap packages. Content of this wrapper file resemble snapcraft-desktop-helpers for gtk application. Signed-off-by: Navdeep Singh Sidhu --- snap/wrappers/sqlitebrowser | 336 ------------------------------------ 1 file changed, 336 deletions(-) delete mode 100755 snap/wrappers/sqlitebrowser diff --git a/snap/wrappers/sqlitebrowser b/snap/wrappers/sqlitebrowser deleted file mode 100755 index 6a93eeaf..00000000 --- a/snap/wrappers/sqlitebrowser +++ /dev/null @@ -1,336 +0,0 @@ -#!/bin/bash - -SNAP=`echo $SNAP | sed -e "s|/var/lib/snapd||g"` - -export PATH=$SNAP/bin:$SNAP/usr/bin:/snap/bin:$PATH -export PATH="$SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH" - -echo 'Please create an issue on https://github.com/sqlitebrowser/sqlitebrowser, if you encounter any problems with SNAP package of sqlitebrowser. Thanks !! @deepsidhu1313.' - -needs_update=true - -. $SNAP_USER_DATA/.last_revision 2>/dev/null || true -if [ "$SNAP_DESKTOP_LAST_REVISION" = "$SNAP_REVISION" ]; then - needs_update=false -fi - -# If the user has modified their user-dirs settings, force an update -if [[ -f $REALHOME/.config/user-dirs.dirs.md5sum && -f $REALHOME/.config/user-dirs.locale.md5sum ]]; then - if [[ "$(md5sum < $REALHOME/.config/user-dirs.dirs)" != "$(cat $HOME/.config/user-dirs.dirs.md5sum)" || - "$(md5sum < $REALHOME/.config/user-dirs.locale)" != "$(cat $HOME/.config/user-dirs.locale.md5sum)" ]]; then - needs_update=true - fi -fi - -# Set $REALHOME to the users real home directory -REALHOME=`getent passwd $UID | cut -d ':' -f 6` - -if [ "$SNAP_ARCH" == "amd64" ]; then - ARCH="x86_64-linux-gnu" -elif [ "$SNAP_ARCH" == "armhf" ]; then - ARCH="arm-linux-gnueabihf" -elif [ "$SNAP_ARCH" == "arm64" ]; then - ARCH="aarch64-linux-gnu" -else - ARCH="$SNAP_ARCH-linux-gnu" -fi - - - - -############################################### -# Launcher common exports for any desktop app # -############################################### - -function prepend_dir() { - local var="$1" - local dir="$2" - if [ -d "$dir" ]; then - eval "export $var=\"\$dir\${$var:+:\$$var}\"" - fi -} - -function append_dir() { - local var="$1" - local dir="$2" - if [ -d "$dir" ]; then - eval "export $var=\"\${$var:+\$$var:}\$dir\"" - fi -} - -function can_open_file() { - return `head -c0 "$1" &> /dev/null`; -} - - -RUNTIME=$SNAP - -# XKB config -export XKB_CONFIG_ROOT=$RUNTIME/usr/share/X11/xkb - -# Give XOpenIM a chance to locate locale data. -# This is required for text input to work in SDL2 games. -export XLOCALEDIR=$RUNTIME/usr/share/X11/locale - - -# Set XCursors path -export XCURSOR_PATH=$RUNTIME/usr/share/icons - -# Mesa Libs for OpenGL support -append_dir LD_LIBRARY_PATH $RUNTIME/usr/lib/$ARCH/mesa -append_dir LD_LIBRARY_PATH $RUNTIME/usr/lib/$ARCH/mesa-egl - -# Tell libGL where to find the drivers -export LIBGL_DRIVERS_PATH=$RUNTIME/usr/lib/$ARCH/dri -append_dir LD_LIBRARY_PATH $LIBGL_DRIVERS_PATH - -# Workaround in snapd for proprietary nVidia drivers mounts the drivers in -# /var/lib/snapd/lib/gl that needs to be in LD_LIBRARY_PATH -# Without that OpenGL using apps do not work with the nVidia drivers. -# Ref.: https://bugs.launchpad.net/snappy/+bug/1588192 -append_dir LD_LIBRARY_PATH /var/lib/snapd/lib/gl - -# Unity7 export (workaround for https://launchpad.net/bugs/1638405) -append_dir LD_LIBRARY_PATH $RUNTIME/usr/lib/$ARCH/libunity - - -# XDG Config -prepend_dir XDG_CONFIG_DIRS $SNAP/etc/xdg - -# Define snaps' own data dir -prepend_dir XDG_DATA_DIRS $SNAP/usr/share -prepend_dir XDG_DATA_DIRS $SNAP_USER_DATA - -# prepend_dir XDG_DATA_DIRS $SNAP/usr/share/gimp/2.0 - -# Set XDG_DATA_HOME to local path -export XDG_DATA_HOME=$SNAP_USER_DATA/.local/share -mkdir -p $XDG_DATA_HOME - -# Workaround for GLib < 2.53.2 not searching for schemas in $XDG_DATA_HOME: -# https://bugzilla.gnome.org/show_bug.cgi?id=741335 -prepend_dir XDG_DATA_DIRS $XDG_DATA_HOME - - -# Set cache folder to local path -export XDG_CACHE_HOME=$SNAP_USER_COMMON/.cache -if [[ -d $SNAP_USER_DATA/.cache && ! -e $XDG_CACHE_HOME ]]; then - # the .cache directory used to be stored under $SNAP_USER_DATA, migrate it - mv $SNAP_USER_DATA/.cache $SNAP_USER_COMMON/ -fi -mkdir -p $XDG_CACHE_HOME - -# Set config folder to local path -export XDG_CONFIG_HOME=$SNAP_USER_DATA/.config -mkdir -p $XDG_CONFIG_HOME - -# Create $XDG_RUNTIME_DIR if not exists (to be removed when LP: #1656340 is fixed) -[ -n "$XDG_RUNTIME_DIR" ] && mkdir -p $XDG_RUNTIME_DIR -m 700 - -# Ensure the app finds locale definitions (requires locales-all to be installed) -append_dir LOCPATH $RUNTIME/usr/lib/locale - -# If any, keep track of where XDG dirs were so we can potentially migrate the content later -test -f ${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs && . ${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs -for d in DOCUMENTS DESKTOP DOWNLOAD MUSIC PICTURES VIDEOS PUBLICSHARE TEMPLATES; do - eval $(echo "OLD_XDG_${d}_DIR")=`eval "$(echo "echo \\$XDG_${d}_DIR")"` -done - -# Setup user-dirs.* or run xdg-user-dirs-update if needed -needs_xdg_update=false -needs_xdg_links=false -if can_open_file "$REALHOME/.config/user-dirs.dirs" && can_open_file "$REALHOME/.config/user-dirs.locale"; then - sed /^#/!s#\$HOME#${REALHOME}#g $REALHOME/.config/user-dirs.dirs > $HOME/.config/user-dirs.dirs - cp -a $REALHOME/.config/user-dirs.locale $HOME/.config/ - for f in user-dirs.dirs user-dirs.locale; do - md5sum < $REALHOME/.config/$f > $HOME/.config/$f.md5sum - done -else - needs_xdg_update=true - needs_xdg_links=true -fi - -# Check if we can actually read the contents of each xdg dir -test -f ${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs && . ${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs -XDG_SPECIAL_DIRS=($XDG_DOCUMENTS_DIR $XDG_DESKTOP_DIR $XDG_DOWNLOAD_DIR $XDG_MUSIC_DIR $XDG_PICTURES_DIR $XDG_VIDEOS_DIR $XDG_PUBLIC_DIR $XDG_TEMPLATES_DIR) -for d in ${XDG_SPECIAL_DIRS[@]}; do - if ! can_open_file $d; then - needs_xdg_update=true - fi -done - -# If needs XDG update and xdg-user-dirs-update exists in $PATH, run it -if [ $needs_xdg_update = true ] && [ `which xdg-user-dirs-update` ]; then - xdg-user-dirs-update -fi - -# Create links for user-dirs.dirs -if [ $needs_xdg_links = true ]; then - test -f ${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs && . ${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs - XDG_SPECIAL_DIRS=($XDG_DOCUMENTS_DIR $XDG_DESKTOP_DIR $XDG_DOWNLOAD_DIR $XDG_MUSIC_DIR $XDG_PICTURES_DIR $XDG_VIDEOS_DIR $XDG_PUBLIC_DIR $XDG_TEMPLATES_DIR) - for d in ${XDG_SPECIAL_DIRS[@]}; do - b=$(realpath "$d" --relative-to="$REALHOME") - if [ -e $REALHOME/$b ] && [ ! -e $HOME/$b ]; then - ln -s $REALHOME/$b $HOME/$b - fi - done -else - # If we aren't creating new links, check if we have content saved in old locations and move it - for d in DOCUMENTS DESKTOP DOWNLOAD MUSIC PICTURES VIDEOS PUBLICSHARE TEMPLATES; do - old=`eval "$(echo "echo \\$OLD_XDG_${d}_DIR")"` - new=`eval "$(echo "echo \\$XDG_${d}_DIR")"` - if [ -L "$old" ] && [ -d "$new" ] && [ `readlink "$old"` != "$new" ]; then - mv "$old"/* "$new"/ 2>/dev/null - elif [ -d "$old" ] && [ -d "$new" ] && [ "$old" != "$new" ]; then - mv "$old"/* "$new"/ 2>/dev/null - fi - done -fi - -# If detect wayland server socket, then set environment so applications prefer -# wayland, and setup compat symlink (until we use user mounts. Remember, -# XDG_RUNTIME_DIR is /run/user//snap.$SNAP so look in the parent directory -# for the socket. For details: -# https://forum.snapcraft.io/t/wayland-dconf-and-xdg-runtime-dir/186/10 -# Applications that don't support wayland natively may define DISABLE_WAYLAND -# (to any non-empty value) to skip that logic entirely. -if [[ -n "$XDG_RUNTIME_DIR" && -z "$DISABLE_WAYLAND" ]]; then - wdisplay="wayland-0" - if [ -n "$WAYLAND_DISPLAY" ]; then - wdisplay="$WAYLAND_DISPLAY" - fi - wayland_sockpath="$XDG_RUNTIME_DIR/../$wdisplay" - wayland_snappath="$XDG_RUNTIME_DIR/$wdisplay" - if [ -S "$wayland_sockpath" ]; then - # if running under wayland, use it - #export WAYLAND_DEBUG=1 - export GDK_BACKEND="wayland" - export CLUTTER_BACKEND="wayland" - export QT_QPA_PLATFORM="wayland-egl" - # create the compat symlink for now - if [ ! -e "$wayland_snappath" ]; then - ln -s "$wayland_sockpath" "$wayland_snappath" - fi - fi -fi - -# Keep an array of data dirs, for looping through them -IFS=':' read -r -a data_dirs_array <<< "$XDG_DATA_DIRS" - -# Font Config and themes -export FONTCONFIG_PATH=$RUNTIME/etc/fonts/conf.d -export FONTCONFIG_FILE=$XDG_CONFIG_HOME/fontconfig/fonts.conf - - -function make_user_fontconfig { - echo "" - if [ -d $REALHOME/.local/share/fonts ]; then - echo " $REALHOME/.local/share/fonts" - fi - if [ -d $REALHOME/.fonts ]; then - echo " $REALHOME/.fonts" - fi - for d in "${data_dirs_array[@]}"; do - if [ -d "$d/fonts" ]; then - echo " $d/fonts" - fi - done - # We need to include this default cachedir first so that caching - # works: without it, fontconfig will try to write to the real user home - # cachedir and be blocked by AppArmor. - echo ' fontconfig' - if [ -d $REALHOME/.cache/fontconfig ]; then - echo " $REALHOME/.cache/fontconfig" - fi - echo "" -} - -if [ $needs_update = true ]; then - rm -rf $XDG_DATA_HOME/{fontconfig,fonts,fonts-*,themes,.themes} - mkdir -p $XDG_CONFIG_HOME/fontconfig - make_user_fontconfig > $FONTCONFIG_FILE - - # the themes symlink are needed for GTK 3.18 when the prefix isn't changed - # GTK 3.20 looks into XDG_DATA_DIR which has connected themes. - ln -sf $RUNTIME/usr/share/themes $XDG_DATA_HOME - ln -sfn $RUNTIME/usr/share/themes $SNAP_USER_DATA/.themes -fi - -# Build mime.cache -# needed for gtk and qt icon -if [ $needs_update = true ]; then - rm -rf $XDG_DATA_HOME/mime - if [ ! -f $RUNTIME/usr/share/mime/mime.cache ]; then - if [ `which update-mime-database` ]; then - cp --preserve=timestamps -dR $RUNTIME/usr/share/mime $XDG_DATA_HOME - update-mime-database $XDG_DATA_HOME/mime - fi - fi -fi - - -# Enable gsettings user changes -# symlink the dconf file if home plug is connected for read -DCONF_DEST_USER_DIR=$SNAP_USER_DATA/.config/dconf -if [ ! -f $DCONF_DEST_USER_DIR/user ]; then - if [ -f $REALHOME/.config/dconf/user ]; then - mkdir -p $DCONF_DEST_USER_DIR - ln -s $REALHOME/.config/dconf/user $DCONF_DEST_USER_DIR - fi -fi - - -# Gdk-pixbuf loaders -export GDK_PIXBUF_MODULE_FILE=$XDG_CACHE_HOME/gdk-pixbuf-loaders.cache -export GDK_PIXBUF_MODULEDIR=$RUNTIME/usr/lib/$ARCH/gdk-pixbuf-2.0/2.10.0/loaders -if [ $needs_update = true ]; then - rm -f $GDK_PIXBUF_MODULE_FILE - if [ -f $RUNTIME/usr/bin/gdk-pixbuf-query-loaders ]; then - $RUNTIME/usr/bin/gdk-pixbuf-query-loaders > $GDK_PIXBUF_MODULE_FILE - fi -fi - - - -# GTK theme and behavior modifier -# Those can impact the theme engine used by Qt as well -gtk_configs=(.config/gtk-3.0/settings.ini .config/gtk-3.0/bookmarks .config/gtk-2.0/gtkfilechooser.ini) -for f in ${gtk_configs[@]}; do - dest="$SNAP_USER_DATA/$f" - if [ ! -L "$dest" ] - then - mkdir -p `dirname $dest` - ln -s $REALHOME/$f $dest - fi -done - -# create symbolic link to ibus socket path for ibus to look up its socket files -# (see comments #3 and #6 on https://launchpad.net/bugs/1580463) -IBUS_CONFIG_PATH=$XDG_CONFIG_HOME/ibus -mkdir -p $IBUS_CONFIG_PATH -[ -d $IBUS_CONFIG_PATH/bus ] && rm -rf $IBUS_CONFIG_PATH/bus -ln -sfn $REALHOME/.config/ibus/bus $IBUS_CONFIG_PATH - - -############################## -# GTK launcher specific part # -############################## - -export GTK_PATH=$RUNTIME/usr/lib/$ARCH/gtk-3.0:$RUNTIME/usr/lib/$ARCH/gtk-2.0 - -# ibus and fcitx integration -GTK_IM_MODULE_DIR=$XDG_CACHE_HOME/immodules -export GTK_IM_MODULE_FILE=$GTK_IM_MODULE_DIR/immodules.cache -if [ $needs_update = true ]; then - rm -rf $GTK_IM_MODULE_DIR - mkdir -p $GTK_IM_MODULE_DIR - ln -s $RUNTIME/usr/lib/$ARCH/gtk-2.0/2.10.0/immodules/*.so $GTK_IM_MODULE_DIR - $RUNTIME/usr/lib/$ARCH/libgtk2.0-0/gtk-query-immodules-2.0 > $GTK_IM_MODULE_FILE - # $RUNTIME/usr/lib/$ARCH/libgtk3.0-0/gtk-query-immodules-3.0 >> $GTK_IM_MODULE_FILE -fi - -export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/$ARCH:$SNAP/usr/lib/$ARCH:$SNAP/usr/lib/$ARCH/mesa:$SNAP/usr/lib/$ARCH/mesa-egl" -export LD_LIBRARY_PATH="$SNAP/usr/lib/$ARCH:$SNAP/usr/lib/$ARCH/mesa:$LD_LIBRARY_PATH" -export LD_LIBRARY_PATH=$SNAP_LIBRARY_PATH:$LD_LIBRARY_PATH - -exec "desktop-launch" "$SNAP/bin/sqlitebrowser" "$@" From ce36277c962f1c71ab0db4fb1d37fdde3dc01bc5 Mon Sep 17 00:00:00 2001 From: Navdeep Singh Sidhu Date: Sun, 18 Nov 2018 01:32:18 -0600 Subject: [PATCH 14/14] * Commented code required to build AppImage (CI/CD) packages for the moment as it was causing trouble with Travis config. Signed-off-by: Navdeep Singh Sidhu --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 30cd5609..b6e71220 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,9 +6,9 @@ branches: only: - master -env: - - ARCH=x86_64 DOCKER_IMAGE=amd64/ubuntu:trusty - - ARCH=i686 DOCKER_IMAGE=i386/ubuntu:trusty +# env: +# - ARCH=x86_64 DOCKER_IMAGE=amd64/ubuntu:trusty +# - ARCH=i686 DOCKER_IMAGE=i386/ubuntu:trusty matrix: fast_finish: true