I have been trying to build a snap, using snapcraft on Ubuntu 16.04 GNOME.
My source, is from a branch on a github repository. Hence, I thus far have managed
parts:
snappy-repo:
plugin: nil
source-type: git
source: https://github.com/retrocausal/repo
source-branch: locallts
build-packages: [git,libsecret-1-0,libsecret-common,libsecret-1-dev,fakeroot, libx11-dev, libxkbfile-dev,gcc-5,g++-5]
prepare: |
sh run.sh
within prepare , and in run.sh , I am installing all the npm packages my build would need.
This build process, would create a .deb archive, inside
parts |
|snappy-repo
|build
|debian
| repo.deb
How do I now, add another part to my snapcraft.yaml part structure,
that can have the source pointing to the output of snappy-repo?
For snaps that use npm you may want to use the nodejs plugin
You need have the contents you want to consume staged but not necessarily primed if they are only useful for the building of the dependent part, to be either staged or primed they need to end up in the part’s install directory, given there is no similar make install rule run here (plugin: nil) you will need to do a few extra manual steps, here is an illustrative example
parts:
snappy-repo:
source: https://github.com/retrocasual/repo
...
plugin: nil
build-packages: [...]
prepare: |
sh run.sh
install:
install debian/repo.deb $SNAPCRAFT_PART_INSTALL/repo.deb
prime:
- -repo.deb
repo-user:
prepare: |
dpkg-deb -x $SNAPCRAFT_STAGE/repo.deb
after: [snappy-repo]
So,
-
install under snappy-repo just makes sure that repo.deb ends up in the top level stage dir in the project
-
repo-user is configured to run after snappy-repo
- the
prepare entry in repo-user unpacks repo.deb from the stage director
- the
prime entry in snappy-repo makes sure the deb does not make it to the snap (in case that is your intention) as it avoids priming it.
3 Likes
This just works excellently! thanks @sergiusens!
Yeah I do not want the debian package to go into the snap.
I with the above , have managed to
- pull the latest changes from a git repository,
- build a debian package with node
- unpack the debain archive from part 1 in part2
just what I needed.
Now I gotta read about what to do with the dumped unpacked .deb package
1 Like