dlang / dub

Package and build management system for D
MIT License
676 stars 227 forks source link

Support snap packaging dub projects and dub itself #999

Open WebDrake opened 8 years ago

WebDrake commented 8 years ago

Recently I've been playing with creating snap packages from D projects, specifically:

The draft work for all this can be found here (this initial PR will be finalized once dub v1.1.1 is released): https://github.com/WebDrake/dub.snap/pull/1/files

This issue is intended to summarize the work done so far, the work still to be done, and to coordinate on what the snapcraft plugin would need to support (and potentially, what dub could do to better support the plugin).

WebDrake commented 8 years ago

Of the work done so far, the essential components are as follows.

snapcraft dub plugin

The dub.py file defines a snapcraft plugin that permits the creation of snap packages from dub projects. These plugins essentially need to support build and install options. Since dub only supports the former, the install stage may require some extra work on the part of the person creating the snap package. In the long run, this plugin should be submitted upstream as part of snapcraft; in the short term, it can be copy-pasted into other snap package definitions.

The plugin currently gets a copy of dub by downloading the dub package available in the Ubuntu archives (in future a better option may be to download one of the prebuilt dub packages from https://code.dlang.org/download; more on this later). It does not download any particular D compiler; this is expected to be handled by the user of the plugin.

It currently supports a subset of the dub build command-line flags:

snap package for dub

The snapcraft.yaml file defines a snap package for dub itself, using the dub plugin to help build it (since the build.sh script would be difficult to use with snapcraft). In the long run, this could in principle be included in the upstream source tree to allow a snap package to be built directly from the dub source itself, but it currently works as an "external" snap fetching the dub source from GitHub and building from that.

A brief summary of its contents:

constraints on use

Due to snap-package confinement, there are currently a number of limitations on what can be done with the snap-packaged dub:

Beyond this, I have not extensively tested the results; at this stage I'm more interested in what people think of the general idea, particularly what you think of the dub.py plugin and what extra features it might need to support.

Anyone running Ubuntu 16.04 or later can have a go at building the snap package by following the instructions in the project readme: https://github.com/WebDrake/dub.snap/blob/master/README.md

WebDrake commented 7 years ago

... ping? Don't know how many people this is of interest to, but I was hoping at least for some comments or feedback.

Would be particularly interested in any thoughts on the possibility of creating a dub install command that could be used to support the dub plugin for snapcraft.

WebDrake commented 7 years ago

Just to follow up here: fairly recently snap packages gained a third confinement option, classic, which allows the package to see and use the resources of the host Linux system on which it is installed. This has greatly simplified packaging dub, which now no longer needs e.g. a D compiler to be bundled alongside it.

See https://github.com/WebDrake/dub.snap/pull/3 for details.