Setting release version in snapcraft build

Stuart Bishop stuart.bishop at canonical.com
Fri Sep 2 08:01:46 UTC 2016


On 2 September 2016 at 00:46, Leo Arias <leo.arias at canonical.com> wrote:

> This is a pain point for me too. Most upstreams store the version number
> in only one place, because editing more than one for every tagged
> release is too boring.
>

This is what https://bugs.launchpad.net/snapcraft/+bug/1594794 is about.

The plugin can extract a version number in many cases (and plugins could be
added that just do this - eg. pull the version from debian/changelog or git
tags | grep release | naturalsort | tail -1 or run staging/usr/bin/foo
--version or whatever). So a particular part might know its version, and we
could declare which part's version is used for the snap. No need to specify
anything on the command line, and it would work with Launchpad without
extra work.

When we add the snapcraft.yaml, I suspect that the version field will be
> forgotten often, and it will not be in sync.
>

Especially when juggling multiple release branches, which differ only by
the version number.


> However, there are a few issues with this. First, launchpad would need a
> new text field to fill the version. And then what would you write in
> that field? I see problems if you write a static string and if you write
> a command to be appended to the snapcraft run.
>
> Also, it's not always straight-forward to get the version from the code.
> Some projects store it in multiple statements, like major=2; minor=1;
> patch=3; Transforming that into "v2.1.3" results in a script that's not
> so nice.
>
> Now, I can see it working at least for the snaps I'm building using
> travis and docker. I can get the sha1 when building from master, or the
> name of tag when there is one, and use that as the version. I would love
> that.
>
> We could make that snapcraft --snap-version=$(git rev-parse HEAD) just
> overwrites the version field, useful immediately for people not using
> launchpad.
>
> pura vida
>
>
>

-- 
Stuart Bishop <stuart.bishop at canonical.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/snapcraft/attachments/20160902/242f6b1e/attachment.html>


More information about the Snapcraft mailing list