pro tip: use scriptlets instead of custom plugins

Olivier Tilloy olivier.tilloy at canonical.com
Mon Feb 20 14:22:11 UTC 2017


On Fri, Feb 17, 2017 at 12:11 AM, Leo Arias <leo.arias at canonical.com> wrote:
> Hello!
>
> This week I've been cleaning a few of my old snaps, using some of the
> new features in more recent versions of snapcraft. At first I wasn't
> convinced about scriptlets, but now I think they are great. Take a
> look at this diff:
>
> 5 additions and 144 deletions
>
> https://github.com/elopio/ipfs-snap/commit/06f32696c1b461b1068e803e71e22bad50fe52eb
>
> Here is more info:
> https://insights.ubuntu.com/2017/02/02/run-scripts-during-snapcraft-builds-with-scriptlets/

Very useful, thanks for highlighting it Leo!
I've been able to replace the custom plugin for the 0AD snap with
scriptlets, and that simplifies the packaging quite a bit.

One thing that bit me is that I was expecting the 'install' scriptlet
to replace the `make install` step when using the make plugin, but it
doesn't. It runs `make`, `make install`, and then the install
scriptlet. Note that the documentation is reasonably clear about it,
but it looks a bit counterintuitive to me.

One thing I haven't been able to figure out: is the
parallel_build_count property exposed to scriptlets as a variable?
That would be useful for custom build scripts that call make.

Cheers,

 Olivier




More information about the Snapcraft mailing list