canonical / cpc-sbom

CPC maintained tool for generating SBOM for cloud images
GNU General Public License v3.0
7 stars 0 forks source link

Add support for listing snap packages #3

Closed philroche closed 1 year ago

philroche commented 1 year ago

This needs to include snaps that are installed and also snaps that are being pre-seeded.

philroche commented 1 year ago

https://github.com/CanonicalLtd/ubuntu-package-manifest and https://github.com/CanonicalLtd/ubuntu-package-manifest/blob/main/snap/local/list-snaps.py has example of how this can be done without having to invoke snap

This uses /var/lib/snapd/state.json

Example snipped for a snap

"ubuntu-cloud-image-changelog": {
                "type": "app",
                "sequence": [
                    {
                        "name": "ubuntu-cloud-image-changelog",
                        "snap-id": "ZjVj3J4mvXy9NC17ygen6pQAYtGDfEhY",
                        "revision": "58",
                        "channel": "latest/stable",
                        "title": "ubuntu-cloud-image-changelog",
                        "summary": "Helpful utility to generate package changelog between two cloud images",
                        "description": "Helpful utility to generate package changelog between two cloud images\nusing their package manifests.\n\nUsage:\nubuntu-cloud-image-changelog --from-manifest manifest1.manifest --to-manifest manifest2.manifest\n\nSource available @ https://github.com/CanonicalLtd/ubuntu-cloud-image-changelog"
                    },
                    {
                        "name": "ubuntu-cloud-image-changelog",
                        "snap-id": "ZjVj3J4mvXy9NC17ygen6pQAYtGDfEhY",
                        "revision": "59",
                        "channel": "latest/stable",
                        "title": "ubuntu-cloud-image-changelog",
                        "summary": "Helpful utility to generate package changelog between two cloud images",
                        "description": "Helpful utility to generate package changelog between two cloud images\nusing their package manifests.\n\nUsage:\nubuntu-cloud-image-changelog --from-manifest manifest1.manifest --to-manifest manifest2.manifest\n\nSource available @ https://github.com/CanonicalLtd/ubuntu-cloud-image-changelog"
                    }
                ],
                "active": true,
                "current": "59",
                "channel": "latest/stable",
                "last-refresh-time": "2023-02-08T11:20:10.423254335Z"
            }