Pass local dump source into cleanbuild

Hi,

Pardon my ignorance with both LXD/C and snapcraft cleanbuild, this is my first attempt at building a snap, but is there a way to make a local tgz file available to snapcraft cleanbuild?

I’m trying to build a snap that requires a rather large tgz that is technically not available for easy remote download (closed source IDE, need to login to their site to get download). The application needs a bunch of libraries installed to enable 32bit compiling etc that I’d really rather not install on my machine, hence cleanbuild.

I had a test build working without all the required libraries with the following snapcraft.yml:

name: xojo
version: '2017r3'
summary: Cross platform rapid application development IDE
description: |
  Cross platform rapid application development IDE and language.
  Build desktop, console and web applications for Mac, Windows and Linux.
  Build mobile applications for iOS.

grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots

parts:
  xojo:
    plugin: dump
    source: ../xojo$SNAPCRAFT_PROJECT_VERSION.tgz

apps:
  xojo:
    command: Xojo

This worked fine, pulled in …/xojo2017r3.tgz and after install the app ran but was a mess due to the missing libs.

To get libs without any local changes, changed snapcraft.yml to:

name: xojo
version: '2017r3'
summary: Cross platform rapid application development IDE
description: |
  Cross platform rapid application development IDE and language.
  Build desktop, console and web applications for Mac, Windows and Linux.
  Build mobile applications for iOS.

grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots

parts:
  add-architecture:
    plugin: nil
    prepare: |
      dpkg --add-architecture i386
      apt update

  xojo:
    after: [add-architecture]
    plugin: dump
    source: ../xojo$SNAPCRAFT_PROJECT_VERSION.tgz
    stage-packages:
      - on amd64:
        - libc6:i386
        - libncurses5:i386
        - libstdc++6:i386
        - libglib2.0-0:i386
        - libsoup2.4-1:i386
        - libgtk-3-0:i386
        - libwebkitgtk-3.0-0:i386

apps:
  xojo:
    command: Xojo

This had all kinds of issues when using plain old snapcraft (after clean) that scared me no end (local file related stuff), so I definitely want to use snapcraft cleanbuild instead, but it errors out with “…/xoho2017r3.tgz” not found.

What’s weird is that when run with --debug I found an install.sh script I’ve also got in my local project (right next to the tgz) in the container in various places, but not the tgz.

Is it possible to use local source files in snapcraft cleanbuild?

Doh! I answered my own question when mentioning seeing the install.sh script inside the container!

It seems the local project dir is copied into the container, I just needed to move the tgz file into the project dir and change ../ to ./ in the source and it found it.

Sorry for the noise.

1 Like