warn if common-id wasn't parsed

Bug #1814902 reported by Harald Sitter
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
Fix Released
Medium
Claudio Matsuoka

Bug Description

Currently you can apparently put anything in the common-id entry of an app. It'd be grand if snapcraft would get angry about common-ids it doesn't think are right.

For example to avoid typos:

```
apps:
    kbruch:
        command: kbruch
        common-id: org.ked.kbruch.desktop
parts:
    kbruch:
        plugin: cmake
        source: parse-info: [usr/share/metainfo/org.kde.kbruch.appdata.xml]
```

Also for appstream specifically the id is encoded in the xml. If it gets changed there but one forgets to also update the snapcraft.yaml, things would silently break and it'd not at all be obvious why on the snapcraft side of things.

tags: added: 19.04 19.04-blue
Changed in snapcraft:
assignee: nobody → Claudio Matsuoka (cmatsuoka)
status: New → In Progress
Revision history for this message
Claudio Matsuoka (cmatsuoka) wrote :

Is the encoding of common-id in the xml file name a KDE-specific policy? The Appstream specification requires the filename to be unique, but apparently doesn't set specific rules for naming the file.

Revision history for this message
Harald Sitter (apachelogger) wrote :

For the purpose of asserting this you can **only** rely on the id specified inside the file not the name of the file. The filename itself may be anything unique. It just happens to be the same as the id a lot of times as the id itself is also unique. That being said not even for KDE software the file is entirely reflective of the appstream id. In example I posted the id has a .desktop suffix, the file name does not (and as far as appstream is concerned the .desktop means something, albeit nothing special, it's part of the id same as org, kde, and kbruch)

Revision history for this message
Claudio Matsuoka (cmatsuoka) wrote :

Proposed fix: https://github.com/snapcore/snapcraft/pull/2542

Using this patch, the following warning is generated in the example case:

```
Common ID 'org.ked.kbruch.desktop' specified in app 'kbruch' is not used in any appstream metafile.
```

Changed in snapcraft:
status: In Progress → Fix Committed
milestone: none → 3.5
importance: Undecided → Medium
Changed in snapcraft:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.