Skip to content
This repository has been archived by the owner on Dec 29, 2020. It is now read-only.

Commit

Permalink
Snap packaging maintenance
Browse files Browse the repository at this point in the history
* Fix yaml lint issues @travis

* Add flameshot-launch: fixes theme and app indicator on core18

* Using upstream for desktop file and icon

* Update snap to new standards

- Closes #6
- Closes #7
- Desktop file pulled from Upstream.
- Icon pulled from Upstream.
- Enchanced themeing.
- Bump base to Core18.

* Update travis to support core18 base
  • Loading branch information
hurricanehrndz authored and holazt committed Sep 4, 2019
1 parent 329aa64 commit 07ee0b4
Show file tree
Hide file tree
Showing 12 changed files with 234 additions and 121 deletions.
135 changes: 91 additions & 44 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
---

language: bash
dist: xenial
sudo: required

Expand All @@ -6,62 +9,106 @@ branches:
- master

cache:
directories:
- $HOME/.cache
directories:
- $HOME/.cache

env:
global:
# Environment variables for packaging
- PRODUCT=flameshot
- VERSION=0.6.0
- RELEASE=1
- ARCH=x86_64
- SNAP_DOCKER_REPO="snapcore/snapcraft"
- FLATPAK_DOCKER_REPO="vitzy/flameshot:fedora-28"
global:
# Environment variables for packaging
- PRODUCT=flameshot
- VERSION=0.6.0
- RELEASE=1
- ARCH=x86_64
- FLATPAK_DOCKER_REPO="vitzy/flameshot:fedora-28"
- LC_ALL: C.UTF-8
- LANG: C.UTF-8
- SNAPCRAFT_ENABLE_SILENT_REPORT: y
- SNAPCRAFT_ENABLE_DEVELOPER_DEBUG: y


matrix:
include:
- os: linux
env: OS=ubuntu DIST=xenial EXTEN=appimage
language: cpp
- os: linux
env: OS=ubuntu DIST=xenial EXTEN=snap
services: docker
language: cpp
- os: linux
env: OS=fedora DIST=28 EXTEN=flatpak RUN_TIME=kde
services: docker
language: cpp
# - os: linux
# env: OS=fedora DIST=28 EXTEN=flatpak RUN_TIME=gnome
# services: docker
# language: cpp
# - os: linux
# env: OS=fedora DIST=28 EXTEN=flatpak RUN_TIME=freedesktop
# services: docker
# language: cpp

include:
- os: linux
env: OS=ubuntu DIST=xenial EXTEN=appimage
language: cpp
- os: linux
env: OS=ubuntu DIST=xenial EXTEN=snap
language: cpp
addons:
snaps:
- name: snapcraft
channel: stable
classic: true
- name: http
- name: transfer
- name: lxd
channel: stable
- os: linux
env: OS=fedora DIST=28 EXTEN=flatpak RUN_TIME=kde
services: docker
language: cpp
# - os: linux
# env: OS=fedora DIST=28 EXTEN=flatpak RUN_TIME=gnome
# services: docker
# language: cpp
# - os: linux
# env: OS=fedora DIST=28 EXTEN=flatpak RUN_TIME=freedesktop
# services: docker

before_install:
- export ROOT_PATH="$(pwd)"
- git clone https://github.com/lupoDharkael/flameshot
- export SRC_PATH="${ROOT_PATH}/flameshot"
- chmod +x ${ROOT_PATH}/scripts/*.sh
- chmod +x ${ROOT_PATH}/scripts/services/*.sh
- if [[ "${EXTEN}" == "appimage" ]]; then source ${ROOT_PATH}/scripts/appimage_before_install.sh; fi
- if [[ "${EXTEN}" == "snap" ]]; then source ${ROOT_PATH}/scripts/snap_before_install.sh; fi
- if [[ "${EXTEN}" == "flatpak" ]]; then source ${ROOT_PATH}/scripts/flatpak_before_install.sh; fi
- |
case "$EXTEN" in
"appimage")
source ${ROOT_PATH}/scripts/appimage_before_install.sh
;;
"snap")
source ${ROOT_PATH}/scripts/snap_before_install.sh
;;
"flatpak")
source ${ROOT_PATH}/scripts/flatpak_before_install.sh
;;
esac
install:
- if [[ "${EXTEN}" == "appimage" ]]; then source ${ROOT_PATH}/scripts/appimage_install.sh; fi
- if [[ "${EXTEN}" == "snap" ]]; then source ${ROOT_PATH}/scripts/snap_install.sh; fi
- if [[ "${EXTEN}" == "flatpak" ]]; then source ${ROOT_PATH}/scripts/flatpak_install.sh; fi
- |
case "${EXTEN}" in
"appimage")
source ${ROOT_PATH}/scripts/appimage_install.sh
;;
"snap")
source ${ROOT_PATH}/scripts/snap_install.sh
;;
"flatpak")
source ${ROOT_PATH}/scripts/flatpak_install.sh
;;
esac
script:
- if [[ "${EXTEN}" == "appimage" ]]; then source ${ROOT_PATH}/scripts/appimage_script.sh; fi
- if [[ "${EXTEN}" == "snap" ]]; then source ${ROOT_PATH}/scripts/snap_script.sh; fi
- if [[ "${EXTEN}" == "flatpak" ]]; then source ${ROOT_PATH}/scripts/flatpak_script.sh; fi
- |
case "${EXTEN}" in
"appimage")
source ${ROOT_PATH}/scripts/appimage_script.sh
;;
"snap")
source ${ROOT_PATH}/scripts/snap_script.sh
;;
"flatpak")
source ${ROOT_PATH}/scripts/flatpak_script.sh
;;
esac
- pwd && ls

after_success:
- if [[ "${EXTEN}" == "appimage" ]]; then source ${ROOT_PATH}/scripts/appimage_after_success.sh; fi
- if [[ "${EXTEN}" == "snap" ]]; then source ${ROOT_PATH}/scripts/snap_after_success.sh; fi
- |
case "${EXTEN}" in
"appimage")
source ${ROOT_PATH}/scripts/appimage_after_success.sh
;;
"snap")
source ${ROOT_PATH}/scripts/snap_after_success.sh
;;
esac
4 changes: 3 additions & 1 deletion scripts/appimage_before_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

set -e

git clone https://github.com/lupoDharkael/flameshot

# Get linuxdeployqt tool
travis_retry wget \
-c "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage" \
-O linuxdeployqt
chmod +x linuxdeployqt
chmod +x linuxdeployqt
2 changes: 2 additions & 0 deletions scripts/flatpak_before_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

set -e

git clone https://github.com/lupoDharkael/flameshot

cp -rf "${ROOT_PATH}"/flatpak "${SRC_PATH}"
# --privileged gives too many permissions to the container.
# FUSE functionality needs in fact only the following permissions:
Expand Down
14 changes: 11 additions & 3 deletions scripts/snap_after_success.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@

set -e

echo "File name: flameshot-app_${VERSION}_amd64.${EXTEN} ."
RESULT_SNAP=$(find ./ -name "*.snap")

SHA256=$(sha256sum "${RESULT_PATH}/flameshot-app_${VERSION}_amd64.${EXTEN}")
if [[ $TRAVIS_PULL_REQUEST != "false" ]]; then
TRANSFER_SNAP="${RESULT_SNAP%%.snap}-pr$TRAVIS_PULL_REQUEST.snap"
mv "$RESULT_SNAP" "$TRANSFER_SNAP"
RESULT_SNAP="$TRANSFER_SNAP"
fi

SHA256=$(sha256sum "$RESULT_SNAP")
echo "SHA256: ${SHA256} ."

travis_retry bash "${ROOT_PATH}/scripts/services/0x0.st.sh" "${RESULT_PATH}/flameshot-app_${VERSION}_amd64.${EXTEN}"
timeout 240 /snap/bin/transfer "$RESULT_SNAP"

travis_retry bash "${ROOT_PATH}/scripts/services/0x0.st.sh" "${RESULT_SNAP}"
3 changes: 1 addition & 2 deletions scripts/snap_before_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@

set -e

cp -rf "${ROOT_PATH}"/snap "${SRC_PATH}"
docker run --name snap-builder -v $SRC_PATH:$SRC_PATH -w $SRC_PATH -td $SNAP_DOCKER_REPO
echo "SNAP Install Step..."
7 changes: 4 additions & 3 deletions scripts/snap_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

set -e

docker exec -i snap-builder apt update
docker exec -i snap-builder sh -c "apt install -y snapcraft build-essential g++"
docker exec -i snap-builder sh -c "apt autoclean -y && apt clean -y"
sudo apt update
sudo /snap/bin/lxd.migrate -yes
sudo /snap/bin/lxd waitready
sudo /snap/bin/lxd init --auto
14 changes: 2 additions & 12 deletions scripts/snap_script.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
#!/bin/bash --

set -e
docker exec -i snap-builder snapcraft clean
docker exec -i snap-builder snapcraft

# docker exec -i snap-builder snapcraft enable-ci travis --refresh

# move snap package
RESULT_PATH="${SRC_PATH}"/results
mkdir "${RESULT_PATH}"

cd flameshot
docker exec -i snap-builder sh -c "mv flameshot*.snap flameshot-app_amd64.snap"
# docker cp still doesn't support wildcards
docker cp snap-builder:$SRC_PATH/flameshot-app_amd64.snap $RESULT_PATH/flameshot-app_${VERSION}_amd64.snap
mkdir -p "$TRAVIS_BUILD_DIR/snaps-cache"
sudo snapcraft --use-lxd
35 changes: 0 additions & 35 deletions snap/gui/flameshot.desktop

This file was deleted.

Binary file removed snap/gui/flameshot.png
Binary file not shown.
16 changes: 16 additions & 0 deletions snap/local/launchers/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# /snap/local/launchers

Here are the launchers, or wrapper programs to deal with some runtime-fixable
problems for the snapped applications, like setting proper environmental
variables in snap.

In convention launchers are named _something_-launch, for dealing certain
problem with _something_, and usually can be called in a stacked manner to
consolidate their modifications.

```yaml
apps:
_app_name_:
command: foo-launch bar-launch _app_command_
```
24 changes: 24 additions & 0 deletions snap/local/launchers/flameshot-launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash

# This is the maintainence launcher for the snap, make necessary runtime
# environment changes to make the snap work here. You may also insert security
# confinement/deprecation/obsoletion notice of the snap here.

set \
-o errexit \
-o errtrace \
-o nounset \
-o pipefail

# gtk-common-themes support
export QT_QPA_PLATFORMTHEME=gtk3
# Correct the TMPDIR path for Chromium Framework/Electron to
# ensure libappindicator has readable resources
export TMPDIR=$XDG_RUNTIME_DIR
# Coerce XDG_CURRENT_DESKTOP to Unity so that App Indicators
# are used and do not fall back to Notification Area applets
# or disappear completely.
export XDG_CURRENT_DESKTOP=Unity

# Finally run the next part of the command chain
exec "${@}"
Loading

0 comments on commit 07ee0b4

Please sign in to comment.