5

While building Debian packages, pbuilder (and similar tools) help in building packages in an isolated environment, so that odd settings in my system don't cause problems in building:

pbuilder aims to be an easy-to-setup system for auto-building Debian packages inside a clean-room environment, so that it is possible to verify that a package can be built on most Debian installations. The clean-room environment is achieved through the use of a base chroot image, so that only minimal packages will be installed inside the chroot.

Is there an equivalent for snapcraft?


Context: I just had some locale problems interfere with building a snap for Cassandra. I'd been getting locale errors that I am too lazy to look into, and during the build process, javadoc failed because of Unicode characters in some files. Using C.UTF-8 as the locale fixed that:

export LC_ALL=C.UTF-8
snapcraft

However, my locale shouldn't affect building packages, snappy or Debian. Something like pbuilder would be useful here.

muru
  • 193,181
  • 53
  • 473
  • 722
  • There is a pre-built Cassandra snap package named *cassandra*. To install and configure the cassandra snap package follow the instructions in [this answer](https://askubuntu.com/questions/1003195/how-can-etc-apt-sources-list-d-object-be-removed/1003200#1003200). – karel Feb 07 '18 at 12:45

1 Answers1

7

You certainly can. snapcraft has a "cleanbuild" option which can either (default) build locally inside an lxd container, or remotely (via the --remote option).

So:-

Build in a local lxd (needs the lxd package to be installed, and networking setup for LXD):

snapcraft cleanbuild

Build in a remote lxd:

snapcraft cleanbuild --remote remotemachine

I followed this guide to setup remote building on my home server. Works well!

muru
  • 193,181
  • 53
  • 473
  • 722
popey
  • 22,629
  • 9
  • 71
  • 123
  • 1
    This doesn't seem to be quite on par with pbuilder - for one thing, it seems to do no caching at all for packages, so each run downloads every package it needs afresh (and worse, from archive.ubuntu.com). And I'm still fighting to make it work for with Java. :/ Those are different questions, though. – muru Mar 21 '17 at 08:28