Getting snapcraft.yaml version from a script
Curious how everyone makes sure the version string in the snapcraft.yaml up to date. And if there is an easy way to essentially drive it via 'git tags' and 'git describe'. If anyone has an recipe I would be very happy to use it across my repos. I've tried the following prepare script: sed -i 's/^version: .*/version: '`git describe --tags`'/' snapcraft.yaml But that won't work because snapcraft has read it before checking out the part to build. And I don't like having a separate build script if not necessary (especially since the launchpad builders wont use it). I have been playing around with npm recently, and the way their versions work are good -- but they are only dealing with public releases with a set semver (usually), but at least they have a script to update it with 'npm/yarn version'. What I would really like is to not directly specify the version but let snapcraft get it for me by executing a script. If there is nothing already existent out there... here is a proposal for allowing it and letting it be backward compatible: By default get it from the top-level 'version' value in snapcraft.yaml If that is not present one (and only one) of the parts must have a 'source-version'[1] key,value pair, where the value is a script to be executed -- just like the prepare step. [1] could also be named source-version-script This would get us the following: allow to specify string version using the old keyword. Make a new-keyword that allows us to set the version based on a script. The two different examples would look like... ``` name: some-package version: 1.2.0 ``` XOR ``` name: some-package parts: some-package: source: . source-version: git describe --tags ``` A further extension could be to have the source plugins (such as git/bzr/hg) have default source-version commands and if there is a part with the same name as the snap, use that by default, but that is just sugar and implicit data (which could be argued for either way). Thoughts, or other ways people are doing this now would be greatly appreciated. By the way, not sure if this is already thought out or if this is even the right place for a post like this. Thanks, Greg -- Snapcraft mailing list Snapcraft@lists.snapcraft.io Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/snapcraft
Re: Non-http git submodules with launchpad builders
Of course! https://bugs.launchpad.net/launchpad-buildd/+bug/1663920 Thanks! On Feb 11, 2017 12:42 PM, "Colin Watson" <cjwat...@ubuntu.com> wrote: > On Sat, Feb 11, 2017 at 12:05:37PM -0600, Gregory Lutostanski wrote: > > Is there any way I can let the git source from snapcraft not pull > > recusively? Or might we be able to have launchpad builders have a git > proxy > > (perhaps via GIT_PROXY_COMMAND, like in > > https://stackoverflow.com/questions/783811/getting-git- > to-work-with-a-proxy-server/21136254#21136254 > > ) > > I think it would be best to arrange for Launchpad builders to have a git > proxy; you aren't the first to run into this. Could you file a bug > against the launchpad-buildd project on Launchpad to remind us? > > Thanks, > > -- > Colin Watson [cjwat...@ubuntu.com] > > -- > Snapcraft mailing list > Snapcraft@lists.snapcraft.io > Modify settings or unsubscribe at: https://lists.ubuntu.com/ > mailman/listinfo/snapcraft > -- Snapcraft mailing list Snapcraft@lists.snapcraft.io Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/snapcraft
Non-http git submodules with launchpad builders
So I've got a snapcraft.yaml that builds fine locally, but it has submodules from a remote git:// repo (rather than https://), this means the HTTP and HTTPS proxies don't help -- which leads to errors on launchpad builders. I tried to change the submodule url in the prepare step, but snapcraft already does a git clone --recursive, so this is a step too late. (git:// anongit.freedesktop.org/xcb/util-common-m4.git, to https://anongit.freedesktop.org/git/xcb/util-common-m4.git) Is there any way I can let the git source from snapcraft not pull recusively? Or might we be able to have launchpad builders have a git proxy (perhaps via GIT_PROXY_COMMAND, like in https://stackoverflow.com/questions/783811/getting-git-to-work-with-a-proxy-server/21136254#21136254 ) Otherwise I will have to have a mirror of the upstream repo, with just submodules changed, which seems a bit hacky. Snapcraft.yaml is here: https://github.com/lutostag/easy2fa/blob/master/snap/snapcraft.yaml Has anyone else hit this issue? Thanks, Greg -- Snapcraft mailing list Snapcraft@lists.snapcraft.io Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/snapcraft