Skip to content

Commit

Permalink
[snap] Add 'snap/snapcraft.yaml'
Browse files Browse the repository at this point in the history
This commit introduces support the bundling/delivering universal-ctags through
the 'snap' mechanism/store - for more details see https://snapcraft.io.

"A snap is a bundle of your app and its dependencies that works without
modification across Linux.  Snaps are discoverable and installable from
the Snap store, an app store with an audience of millions." [1]

In case the support/snapcraft.yaml file is accepted it can be published
in the Snap Store [2] which is required for people to easily install it.

Assistance for publishing in the snap store is available if required.

Test Procedure
==============

Build/Snap
----------

$ sudo apt install -y lxd lxd-clients
$ lxc launch ubuntu:16.04 snapcrafting  # create 'snapcrafting' container
$ lxc exec snapcrafting -- su - ubuntu  # execute user shell in container

$ sudo snap install snapcraft --classic # install snapcraft tool/commands
$ sudo apt-get update # update for installing build dependencies packages

$ git clone https://github.com/universal-ctags/ctags.git
$ cd ctags

$ # get this snapcraft.yaml file
$ snapcraft
...
Building universal-ctags
./configure --prefix=
...
make -j4
...
Snapping 'universal-ctags' \
Snapped universal-ctags_0.1.1_amd64.snap

Install/Contents
----------------

$ sudo snap install universal-ctags_0.1.1_amd64.snap --dangerous --classic

$ which universal-ctags.ctags
/snap/bin/universal-ctags.ctags

$ find /snap/universal-ctags/
/snap/universal-ctags/
/snap/universal-ctags/current
/snap/universal-ctags/x1
/snap/universal-ctags/x1/bin
/snap/universal-ctags/x1/bin/ctags
/snap/universal-ctags/x1/bin/readtags
/snap/universal-ctags/x1/command-ctags.wrapper
/snap/universal-ctags/x1/command-universal-ctags.wrapper
/snap/universal-ctags/x1/meta
/snap/universal-ctags/x1/meta/gui
/snap/universal-ctags/x1/meta/snap.yaml
/snap/universal-ctags/x1/snap
/snap/universal-ctags/x1/snap/.snapcraft.yaml.swp
/snap/universal-ctags/x1/usr
/snap/universal-ctags/x1/usr/lib
/snap/universal-ctags/x1/usr/lib/x86_64-linux-gnu
/snap/universal-ctags/x1/usr/lib/x86_64-linux-gnu/libicudata.so.55
/snap/universal-ctags/x1/usr/lib/x86_64-linux-gnu/libicuuc.so.55
/snap/universal-ctags/x1/usr/lib/x86_64-linux-gnu/libxml2.so.2

Testing
-------

~/ctags$ universal-ctags.ctags -R

~/ctags$ vim -t main

The 'universal-ctags' can be aliased to 'ctags'[4].

References:
[1] "Creating a snap" in https://docs.snapcraft.io/creating-a-snap/6799
[2] "Share with your friends" in https://docs.snapcraft.io/c-c-applications/7817
[3] "Demystifying Snap Confinement" in https://snapcraft.io/blog/demystifying-snap-confinement
[4] "Commands and aliases" in https://docs.snapcraft.io/commands-and-aliases/3950

Signed-off-by: Gavin Guo <gavin.guo@canonical.com>
  • Loading branch information
Gavin Guo committed Dec 10, 2018
1 parent c7d224b commit 7e471f7
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: universal-ctags # you probably want to 'snapcraft register <name>'
version: '0.1.1' # just for humans, typically '1.2+git' or '1.3.2'
summary: Symbol tags for tracing code # 79 char long summary
description: |
The goal of the project is preparing and maintaining common/unified working
space where people interested in making ctags better can work together.
grade: stable # must be 'stable' to release into candidate/stable channels
confinement: strict # use 'strict' once you have the right plugs and slots

apps:
ctags:
command: ctags
plugs:
- home

parts:
universal-ctags:
source-type: git
source: https://github.com/universal-ctags/ctags.git
# See 'snapcraft plugins'
plugin: autotools

0 comments on commit 7e471f7

Please sign in to comment.