How can get a whole snapcraft.yaml of a .snap file

Hi, boys:

I wonder to know to get the snapcraft.yaml of a snap file.

For instance, I can find a snap named nginxrtmp-minsikl (https://snapcraft.io/nginxrtmp-minsikl), but I cannot get the snapcraft.yaml, and cannot create the snapcraft.yaml according the snap and snap.yaml.
Besides, I cannot find the contacter or owner of the snap file.

In my work, I should make my own snapcraft.yaml and build the snap file myself, so I would like to get the snapcraft.yaml of the snap and learn from the snapcraft.yaml.

Any response will be appreciated.

Many thanks ahead.

Hi @jiaxiaolei, If you have a application.snap file then you can unpack it into squashfs-root/ and inspect it:

$ sudo unsquashfs application.snap
$ cat squashfs-root/snap/snapcraft.yaml

Hi, hellsorth, thank you very much,.

I know the command unsquashfs and unsquashfs can get the whole file of a snap file.

But, I find most application.snap can just get snap.yaml in squashfs-root/meta/snap.yaml, rather than snapcraft.yaml. There is no parts in snap.yaml, and because of lack of parts, we can not use snapcraft to build a application.snap with snap.yaml.

In fact, after we use snap install application.snap, we can get the snap.yaml in /snap/<application>/current/meta/snap.yaml

a example of snap.yaml:

name: pythonserver
version: 2.0
summary: a simple python server
description: This is the webserver API in python demo
architectures:
- amd64
confinement: strict
grade: stable
apps:
  mywebserver:
    command: command-mywebserver.wrapper
    plugs:
    - network-bind
    - network

a example of snapcraft.yaml

      name: pythonserver
      version: 2.0
      summary: a simple python server
      description: This is the webserver API in python demo
      confinement: strict
      grade: stable
      icon: icon.png
      apps:
        mywebserver:
          command: bin/server
          plugs:
          - network-bind
          - network
      parts:
        server:
          plugin: python
          source: .
        source:
          plugin: dump
          source: .
          organize:
            server.py: bin/server

Another problem is that I can not get the nginxrtmp-minsikl.snap. :frowning:

In the general case, you won’t be able to reproduce a build solely from the information in the binary .snap file.

You’ve found the meta/snap.yaml file, which provides information to snapd about the snap. @hellsworth was referring to a separate snap/snapcraft.yaml file, which is closer to what you are after: in some cases it will be sufficient, but it might also refer to local resources within the original Snapcraft project that won’t appear in the binary.

By default, Snapcraft will not include a snap/snapcraft.yaml file in the resulting snap: you need to set SNAPCRAFT_BUILD_INFO=1 in the environment to achieve this. With that said, builds produced through build.snapcraft.io or Launchpad have this set automatically.