Skip to content
This repository has been archived by the owner on Jun 14, 2018. It is now read-only.

snapcraft.yaml: add support for building a snap package #77

Merged
merged 12 commits into from Mar 6, 2017
5 changes: 5 additions & 0 deletions linux/.gitignore
@@ -0,0 +1,5 @@
stage
snap
prime
parts
*.snap
72 changes: 72 additions & 0 deletions linux/snap/snapcraft.yaml
@@ -0,0 +1,72 @@
name: nextcloud-client
version: 2.2.4+git
icon: ../nextcloudtheme/theme/colored/Nextcloud-icon.svg
summary: Nextcloud Desktop Client
description: |
The Nextcloud Desktop Client is a tool to synchronize files from Nextcloud
Server with your computer.

grade: stable
confinement: strict

parts:
client:
plugin: cmake
source: ../
source-subdir: client
build-packages:
- g++
- libqt5webkit5-dev
- libsqlite3-dev
- libssl-dev
- pkg-config
- qt5keychain-dev
- qttools5-dev-tools
configflags:
- -DCMAKE_BUILD_TYPE=Release
- -DOEM_THEME_DIR=$SNAPCRAFT_PART_INSTALL/../src/nextcloudtheme

# XXX: This is an hack to have a kind of bind-mount with absolute prefix.
- -DCMAKE_INSTALL_PREFIX=/snap/$SNAPCRAFT_PROJECT_NAME/current/usr
- -DCMAKE_INSTALL_LIBDIR=/snap/$SNAPCRAFT_PROJECT_NAME/current/usr/lib
- -DSYSCONF_INSTALL_DIR=/snap/$SNAPCRAFT_PROJECT_NAME/current/etc
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose behind this? The commit mentions remembering config, but I don't have that issue with nextcloud-client-kyrofa. Am I misunderstanding?

Copy link
Contributor Author

@3v1n0 3v1n0 Feb 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this, the client won't be able to access to $SNAP/etc/Nextcloud/sync-exclude.lst (which causes syncing not to work here; I deleted the log stating it, but if you want, I can paste it), the same with any other possibly hardcoded path. We need to be sure that the client will be able to access to such files.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @kyrofa

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tried simply -DSYSCONF_INSTALL_DIR=config (or etc if you prefer, though that meaning breaks down in a snap)? That works for me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried that, but then my snap was trying to access located in $PATH_WHERE_I_WAS_BUILDING_THIS_SNAP/part/client/build/config not sure why...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also translations are there... For example:

for i in $(grep /snap/nextcloud-client prime/ -rl); do echo - $i:; strings $i | grep /snap/nextcloud-client; done gives me:

- prime/usr/bin/nextcloud:
/snap/nextcloud-client/current/usr//snap/nextcloud-client/current/usr/lib/nextcloud
/snap/nextcloud-client/current/usr/share/nextcloud/i18n/
- prime/usr/bin/nextcloudcmd:
/snap/nextcloud-client/current/usr//snap/nextcloud-client/current/usr/lib/nextcloud
- prime/usr/lib/libnextcloudsync.so.2.3.0:
/snap/nextcloud-client/current/usr//snap/nextcloud-client/current/usr/lib/nextcloud
/snap/nextcloud-client/current/etc/%1
/snap/nextcloud-client/current/etc/%1/%1.conf

Let me see what happens using your way...

Copy link
Contributor Author

@3v1n0 3v1n0 Mar 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried that too, but it's not fine, the same command (with different pattern) gives me:

/media/marco/M.2-SSD/client_theming/linux/parts/client/build/client/config/%1
/media/marco/M.2-SSD/client_theming/linux/parts/client/build/client/config/%1/%1.conf

where /media/marco/M.2-SSD/client_theming is the local repo path.

Copy link
Contributor Author

@3v1n0 3v1n0 Mar 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried that too, but it's not fine, the same command (with different pattern) gives me:

/media/marco/M.2-SSD/client_theming/linux/parts/client/build/client/config/%1
/media/marco/M.2-SSD/client_theming/linux/parts/client/build/client/config/%1/%1.conf

where /media/marco/M.2-SSD/client_theming is the local repo path.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You say you get a log denying access. Do you still get that message? Do you get that message with nextcloud-client-kyrofa?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mh, no... I can't either test what's the log saying though since the run-clientis missing a $*.
I'll try to build it locally

organize:
snap/nextcloud-client/current: .

after:
- desktop-qt5

xdg-open:
source: https://github.com/ubuntu-core/snapd-xdg-open.git
source-depth: 1
plugin: dump
organize:
data/xdg-open: bin/xdg-open
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain this part, please? Obviously snapd-xdg-open needs to run as an external "trusted helper" if you will (i.e. outside of confinement). You're just copying a piece of it so as to not use the one xdg-utils, it seems, but I was under the impression that nothing "special" was needed within a snap to use snapd-xdg-open as long as it was installed on the system. Is that not the case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This kind of xdg-open right now is needed in order to be able to call that trusted service.
At least, without it there's no way for me to open links (while file:// protocol is not supported unfortunately) when confined.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, thank you 😃 .

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just saw this, by the way. Can you use the one in /usr/local/bin of the core snap?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No scratch that, it's not available until 2.23. Carry on.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eh, in fact that's why I didn't do it :-)

prime:
- bin

apps:
nextcloud-client:
aliases:
- nextcloud
command: |
env LD_LIBRARY_PATH=$SNAP/usr/lib/nextcloud:$LD_LIBRARY_PATH
desktop-launch nextcloud
desktop: usr/share/applications/nextcloud.desktop
plugs:
- unity7
- home
- network
- network-bind
- network-manager
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is network-manager required?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See this bug, Qt network status checker needs it, and so this client if it wants to know the connection status.

This is not an auto-connected interface, though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, okay. It still works if the interface is not connected, though? What features do we lose by not having it automatically connected?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Things will work properly anyway... I'm not sure if this client is actually using this feature, but consider that as an "optimization". When Qt knows if there's a connection or not, it won't try to transfer data.

Users will be free to manually connect to this interface if they want an optimized client though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good deal.


cmd:
aliases:
- nextcloudcmd
command: |
env LD_LIBRARY_PATH=$SNAP/usr/lib/nextcloud:$LD_LIBRARY_PATH
desktop-launch nextcloudcmd
plugs:
- unity7
- home
- network