Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[snap] Add 'snap/snapcraft.yaml' #1941

Merged
merged 1 commit into from
Dec 10, 2018

Conversation

bboymimi
Copy link
Member

@bboymimi bboymimi commented Dec 3, 2018

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.

Signed-off-by: Gavin Guo gavin.guo@canonical.com

@coveralls
Copy link

coveralls commented Dec 3, 2018

Coverage Status

Coverage remained the same at 84.889% when pulling 7e471f7 on bboymimi:snap_support into c7d224b on universal-ctags:master.

@masatake
Copy link
Member

masatake commented Dec 3, 2018

Thank you, but I don't understand what is this.
Could you write how to utilize the yaml file and benefits to snap/README.rst or somewhere?

@bboymimi bboymimi force-pushed the snap_support branch 2 times, most recently from 579a04c to b8587e7 Compare December 7, 2018 09:26
@bboymimi
Copy link
Member Author

bboymimi commented Dec 7, 2018

Hi Masatake,

The snap/ folder is only for the snap related files. I've updated the commit message and make the snap explanation more clearly. Could you help to review the commit and see if there are any problems? Thank you!

@masatake
Copy link
Member

masatake commented Dec 8, 2018

Thank you for updating.
I have a question about snap. Is it possible to distribute man pages?
I introduced some incompatiblities to u-ctags. I have written them in our man pages.
I would like users to know the incompatibilities.

@bboymimi
Copy link
Member Author

Hi Masatake,

https://forum.snapcraft.io/t/support-for-man-pages/2299
According to the above discussion, the 'man' feature still is not available. We can add the man page once it's supported.

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>
@masatake
Copy link
Member

I see. Thank you.

@masatake masatake merged commit 7dd0253 into universal-ctags:master Dec 10, 2018
@masatake
Copy link
Member

I found one critical bad thing.
universal-ctags.ctags, this is really bad name. Universal-ctags considers the extension .ctags is for defining a command line based parser. (I called it optlib in our manuals.)
You will see man .ctags file in https://github.com/universal-ctags/ctags/tree/master/optlib

Is there anyway not to use universal-ctags.ctags?

@masatake
Copy link
Member

... Though I merged, I would like to revert this.
You can distribute the snapfile at another repository like https://github.com/universal-ctags/ctags-docker instead. How do you think being a member of universal-ctags organization to maintain the snapfile?

I'm very sorry to be late to propose this. I'm being busy so I could not take much time for this project now.

@masatake
Copy link
Member

Your excellent commit log can be convert to README.md of the new repository.

@bboymimi
Copy link
Member Author

Hi Masatake,

It's ok, we can separate the snap package version to another repo.
Please let me know how to be a member of the ctags organization. And
how to create a separate repo under your main repo 'universal-ctags.'

Besides, we need to settle down the name of the executable file. How
about to change the name to 'universal-ctags'? In my perspective, if
we set up the name to 'ctags' only, it will be a conflict between
different implementations of ctags, like 'exuberant ctags' if the user
installs multiple 'ctags' implementation at the same time.

As described in my commit message, we can then set up the alias when
there are multiple 'ctags' implementations exist in the system by:

$ sudo snap alias universal-ctags ctags
Added:

  • universal-ctags as ctags

$ ls /snap/bin/ctags -al
lrwxrwxrwx 1 root root 15 Dec 11 02:50 /snap/bin/ctags -> universal-ctags

I also updated the branch for the naming rule. Please have a look and
let me know if there is anything need to be changed. Thanks!

@masatake
Copy link
Member

I sent an invitation to you. You can make a repository for the snap file at universal-ctags organization after accepting the invitation. You may add a link to your new repository to README.md of universal-ctags/ctags repository. Feel free to make a pull request for updating README.md.

The name "universal-ctags" or "u-ctags" is o.k. What I strongly object is using .ctags as an file name extension.

I will try the snap file on Fedora when I get time.
Thank you.

@masatake
Copy link
Member

I'm very confused when I see your new repo.
I assumed you can maintain only snapfile like universal-ctags/ctags-docker just maintains Dockerfile.
Howeveer, your new repository includes all ctags source code. Do you need all the files?

As far as reading snapcraft.yaml, the file has a field for the git repository for the target source code.

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

So I guessed the snap tool chain has ability to fetch source code from external repository.

@bboymimi
Copy link
Member Author

Thank you for the comment, I'm also now testing the procedure on my own GitHub branch and will figure out soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants