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

373 Views Asked by At

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?

2

There are 2 best solutions below

0
On

Solved.

AFTER build-finish but BEFORE build-export:

mkdir -p "$BDIR/files/share/app-info/xmls"
cat "$BDIR/files/share/metainfo/"* | sed 1d | gzip > "$BDIR/files/share/app-info/xmls/$FID.xml.gz"
$BDIR -- build-dir, $FID -- flatpak application id, "sed 1d" -- removing "<?xml ... ?>" line
1
On

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.