Search code examples
flatpakflatpak-builder

How do I set the version string of my flatpak application?


When I run flatpak list some applications have a version:

$ flatpak list
Name                                     Application ID                                  Version             Branch       Origin         Installation
Cambalache                               ar.xjuan.Cambalache                             0.10.3              stable       flathub        system
ungoogled-chromium                       com.github.Eloston.UngoogledChromium            112.0.5615.165      stable       flathub        system
Codecs                                   com.github.Eloston.UngoogledChromium.Codecs                         stable       flathub        system
Flatseal                                 com.github.tchx84.Flatseal                      1.8.1               stable       fedora         system
OBS Studio                               com.obsproject.Studio                           29.0.2              stable       flathub        system
My Example App                           org.example.App                                                     master       remote1-origin user

I want my application to have this column reflect its actual version too, but after searching for a way to set it for several days, I came up with nothing. It's not mentioned anywhere in the flatpak or flatpak-builder documentation...

Do I have to add it as a field in my .json app manifest? Or is it a flag to flatpak-builder or flatpak build-bundle?


Solution

  • Ok, I think I figured it out. What I needed is a metainfo.xml file (or an appdata.xml file). Flatpak reads this file (specifically, the <releases> tag) and sets the Version column to the version string of the latest release.

    The only problem that remains is that some applications install it as *.appdata.xml and others call it *.metainfo.xml.

    The flatpak documentation contradicts itself on this matter:
    https://docs.flatpak.org/en/latest/freedesktop-quick-reference.html#appdata-files
    https://docs.flatpak.org/en/latest/conventions.html#appdata-files

    But I guess this is a separate question.

    Update 2024-06-30: The freedesktop link above is dead, but here is a nice specification from them. In §2.1.2 there is a note on the .appdata.xml name:

    Component metadata ... can be installed with an .appdata.xml extension as well for historical reasons.

    So, basically, prefer .metainfo.xml nowadays.