I’m trying to build my first Snap for PHP composer, as it’s one of those pieces of software which is released too regularly for the normal Ubuntu packaging cycle to keep up, and so a Snap seems like a way of getting around this problem (I guess the other way would be a PPA?).
I’m using a clean Ubuntu 16.04 LTS VM (using Vagrant) for development.
Composer doesn’t have tagged releases on Git, the only way to reference a specific version is by using its commit hash. So far my snapcraft.yaml has the following:
name: composer version: '1.7.2' summary: PHP dependency management system description: | Composer is a dependency management system for PHP libraries. grade: devel confinement: devmode apps: composer: command: composer parts: composer-src: plugin: dump source: https://github.com/composer/getcomposer.org.git source-type: git source-commit: 7cf90ec1d9540d586f6ac80babbc342033adf6b6
If I run snapcraft I get the following output:
Pulling composer-src Cloning into '/vagrant/composer/parts/composer-src/src'... remote: Counting objects: 1915, done. remote: Compressing objects: 100% (24/24), done. remote: Total 1915 (delta 9), reused 21 (delta 4), pack-reused 1887 Receiving objects: 100% (1915/1915), 14.64 MiB | 4.14 MiB/s, done. Resolving deltas: 100% (989/989), done. Checking connectivity... done. Note: checking out '7cf90ec1d9540d586f6ac80babbc342033adf6b6'. You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by performing another checkout. If you want to create a new branch to retain commits you create, you may do so (now or later) by using -b with the checkout command again. Example: git checkout -b <new-branch-name> HEAD is now at 7cf90ec... Add 1.7.2 build Building composer-src Staging composer-src Priming composer-src Failed to generate snap metadata: The specified command 'composer' defined in the app 'composer' does not exist or is not executable
I’m not sure how to accomplish the next steps though. If I was installing composer manually I would run:
This creates a composer.phar file in the current directory, which I would then copy to somewhere in $PATH.
What is the best way to accomplish this in Snap? Or is Snap completely the wrong tool for this task and I should be looking at a PPA instead?