Skip to content

Commit

Permalink
\#11: Initial AppImage packaging system
Browse files Browse the repository at this point in the history
  • Loading branch information
kbumsik committed Jun 24, 2018
1 parent aba7c94 commit a40ea8e
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 19 deletions.
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ script:
- echo No test scripts implemented yet. Travis is used only for deploy yet.

before_deploy:
- package/update_version.sh $TRAVIS_TAG
- package/build_all.sh $TRAVIS_TAG

deploy:
- provider: releases
api_key:
secure: zFbsCIKcsvWU/Yc+9k294Qj8QY48VlkV8DSScP5gz6dQegeUSaSHI/YafherkFQ0B03bIY8yc7roMtDo7HAkEnPptjFhdUiOFI11+xDVb3s7Y8Ek2nV3znQzdtR4CR/94l3in6R3DH+eNA6+6Je/NIWLdVcvRX07RBSfBVdPmnsAyAD9KNTsl8Q4c20HgtLNxfWv2s5eCyD+heCTLYrErEZKZ5vYeeANmWomHvT2ED/4QerpBP8wkh59QXD1S79CF7oyq6X173ZJUQVxdBP+OSXt/mDBAoqf+TV6okawRZn48JluvCWAJ7BceX7t9emd1rVI/s8t3wCP+eMcmNn5g/6UJaCPnTJ5YplTuUWRc63UFSkE0AY8WYcRlrz+/OiXYgQ8LMXfN23aWgarHCbS2vHR3Afu9gpLCoKucr36hKhs3zfjJzVLFFW16mnbaTFcBzfDDRpkvOANB1aZwGVRFpTIWIMjkn0+lxWTC/moIJvQlfRPsC4dN5cDAilRQlguHzayebtGE8X0PuIe9A8bkET3V/y+KPnQiSJ7J+5PNoDSdqRAE4IKvVOLEyHtlqBVkvIHKnugUnWPIZ21gm5RemMEj9/YGa8Efwz7PIKtJJ3kFMGDYKVlIKyB+rg/TFWNdo6jjevnWM6y4SfVI3kFyjA+mp31o6nshrQy0zVQpd8=
file:
- "package/debian/build/virtscreen_$TRAVIS_TAG-1_all.deb"
- package/debian/build/virtscreen_$TRAVIS_TAG-1_all.deb
- package/appimage/VirtScreen-x86_64.AppImage
skip_cleanup: true
on:
tags: true
Expand Down
17 changes: 13 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@
FROM ubuntu:bionic
LABEL author="Bumsik Kim <[email protected]>"

WORKDIR /app
CMD ["/bin/bash"]

RUN apt-get update && \
apt-get install -y python3-all python3-pip python3-wheel fakeroot debmake debhelper fakeroot wget tar && \
apt-get install -y python3-all python3-pip python3-wheel fakeroot debmake debhelper fakeroot wget tar curl && \
apt-get autoremove -y && \
ln /usr/bin/python3 /usr/bin/python && \
ln /usr/bin/pip3 /usr/bin/pip && \
Expand All @@ -18,3 +15,15 @@ RUN apt-get update && \
RUN wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \
bash ~/miniconda.sh -b -p ~/miniconda && \
rm ~/miniconda.sh

# AppImageKit
WORKDIR /opt
RUN wget https://github.com/AppImage/AppImageKit/releases/download/10/appimagetool-x86_64.AppImage && \
chmod a+x appimagetool-x86_64.AppImage && \
./appimagetool-x86_64.AppImage --appimage-extract && \
mv squashfs-root appimagetool && \
rm appimagetool-x86_64.AppImage
ENV PATH=/opt/appimagetool/usr/bin:$PATH

WORKDIR /app
CMD ["/bin/bash"]
33 changes: 21 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
# for python packaging reference.

DOCKER_NAME=kbumsik/virtscreen
DOCKER_RUN=docker run -v $(shell pwd)/package/debian:/app $(DOCKER_NAME)
DOCKER_RUN_TTY=docker run --interactive --tty -v $(shell pwd)/package/debian:/app $(DOCKER_NAME)
DOCKER_RUN=docker run --interactive --tty -v $(shell pwd):/app $(DOCKER_NAME)
DOCKER_RUN_TTY=docker run --interactive --tty -v $(shell pwd):/app $(DOCKER_NAME)
DOCKER_RUN_DEB=docker run -v $(shell pwd)/package/debian:/app $(DOCKER_NAME)

.PHONY:

Expand Down Expand Up @@ -41,29 +42,37 @@ docker-push:
docker login
docker push $(DOCKER_NAME)

# For AppImage packaging, https://github.com/AppImage/AppImageKit/wiki/Creating-AppImages
appimage-build:
$(DOCKER_RUN) package/appimage/build.sh
$(DOCKER_RUN) chown -R $(shell id -u):$(shell id -u) package/appimage

appimage-clean:
$(DOCKER_RUN) rm -rf package/appimage/virtscreen.AppDir package/appimage/VirtScreen-x86_64.AppImage

# For Debian packaging, https://www.debian.org/doc/manuals/debmake-doc/ch08.en.html#setup-py
deb-make:
$(DOCKER_RUN) /app/debmake.sh
$(DOCKER_RUN_DEB) /app/debmake.sh

deb-build: deb-make
$(DOCKER_RUN) /app/copy_debian.sh
$(DOCKER_RUN) /app/debuild.sh
$(DOCKER_RUN_DEB) /app/copy_debian.sh
$(DOCKER_RUN_DEB) /app/debuild.sh

deb-contents:
$(DOCKER_RUN) /app/contents.sh
$(DOCKER_RUN_DEB) /app/contents.sh

deb-env-make:
$(DOCKER_RUN) /app/debmake.sh virtualenv
$(DOCKER_RUN_DEB) /app/debmake.sh virtualenv

deb-env-build: deb-env-make
$(DOCKER_RUN) /app/copy_debian.sh virtualenv
$(DOCKER_RUN) /app/debuild.sh virtualenv
$(DOCKER_RUN_DEB) /app/copy_debian.sh virtualenv
$(DOCKER_RUN_DEB) /app/debuild.sh virtualenv

deb-chown:
$(DOCKER_RUN) chown -R $(shell id -u):$(shell id -u) /app/build
$(DOCKER_RUN_DEB) chown -R $(shell id -u):$(shell id -u) /app/build

deb-clean:
$(DOCKER_RUN) rm -rf /app/build
$(DOCKER_RUN_DEB) rm -rf /app/build

# For AUR: https://wiki.archlinux.org/index.php/Python_package_guidelines
# and: https://wiki.archlinux.org/index.php/Creating_packages
Expand Down Expand Up @@ -95,4 +104,4 @@ arch-clean:
cd package/archlinux
rm -rf pkg src *.tar*

clean: arch-clean deb-clean python-clean
clean: appimage-clean arch-clean deb-clean python-clean
15 changes: 15 additions & 0 deletions package/appimage/AppRun
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh
# This script is only for isolated miniconda environment
# Used in AppImage package
SCRIPTDIR=$(dirname $0)
ENV=$SCRIPTDIR/usr/share/virtscreen/env

echo $SCRIPTDIR
export PYTHONPATH=$ENV/lib/python3.6
export LD_LIBRARY_PATH=$ENV/lib
export QT_PLUGIN_PATH=$ENV/lib/python3.6/site-packages/PyQt5/Qt/plugins
export QML2_IMPORT_PATH=$ENV/lib/python3.6/site-packages/PyQt5/Qt/qml
# export QT_QPA_FONTDIR=/usr/share/fonts
# export QT_XKB_CONFIG_ROOT=/usr/share/X11/xkb

$ENV/bin/python3 $ENV/bin/virtscreen
32 changes: 32 additions & 0 deletions package/appimage/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

# Directory
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
ROOT=$DIR/../..

cd $ROOT/package/appimage
mkdir virtscreen.AppDir
cd virtscreen.AppDir
# Create virtualenv
install -d usr/share/virtscreen
source $HOME/miniconda/bin/activate && \
conda create -y --copy --prefix usr/share/virtscreen/env python=3.6
# Install VirtScreen using pip
source $HOME/miniconda/bin/activate && \
source activate usr/share/virtscreen/env && \
pip install $ROOT
# Delete unnecessary installed files done by setup.py
rm -rf usr/share/virtscreen/env/lib/python3.6/site-packages/usr
# Copy desktop entry, icon, and AppRun
install -m 644 -D $ROOT/virtscreen.desktop \
usr/share/applications/virtscreen.desktop
install -m 644 -D $ROOT/virtscreen.desktop \
.
install -m 644 -D $ROOT/data/virtscreen.png \
usr/share/pixmaps/virtscreen.png
install -m 644 -D $ROOT/data/virtscreen.png \
.
install -m 755 -D $ROOT/package/appimage/AppRun \
.
cd ..
appimagetool virtscreen.AppDir
7 changes: 6 additions & 1 deletion package/update_version.sh → package/build_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ build_pypi () {
make -C $ROOT python-wheel
}

build_appimage () {
make -C $ROOT appimage-build
}

build_arch () {
wget -q https://github.com/kbumsik/VirtScreen/archive/$VERSION.tar.gz
SHA256=$(sha256sum $VERSION.tar.gz | cut -d' ' -f1)
Expand All @@ -49,5 +53,6 @@ build_debian () {

override_version
# build_pypi
build_arch
build_appimage
# build_arch
build_debian

0 comments on commit a40ea8e

Please sign in to comment.