Install stage-packages .deb from local path ubuntu:focal


Below is a sample of the snapcraft.YAML file I use to build my app.

    plugin: python
    source: .
      - snap/local/requirements.txt
      - build-essential
      - git
      - libxslt1-dev
      - python3-setuptools
      - avahi-utils
      - bind9
      - chrony
      - python3-django
      - python3-django-piston3

I want to use a particular version for python3-django-piston3 which is part of stage-packages.

I have stored the file “python3-django-piston3_0.5.1-306-g.4d801e8~ubuntu20.04.1_all.deb” on local path. I want snapcraft to take stage-package python3-django-piston3 from my local path and build app.

Could you please provide the steps?

Welcome to the snapcraft community! :wink:

As far as I know, the stage-packages property only supports installing packages using the system package manager like apt.

You must manually extract the deb file using dpkg in an override script [1] or use a separate part with the dump plugin [2]. Take a look here [3] for ideas.

For more details, you can always take a look at the snapcraft.yaml reference [4].



[3] Install existing deb file as part of snap installation