Skip to content

Conversation

@JanKoudijs
Copy link
Contributor

@JanKoudijs JanKoudijs commented Oct 6, 2025

The Flatpak manifest linter matches dependencies against vcpkg.json and if there is a match checks if versions are equal. If there is no match it checks if there is a listed exclusion. If there is no version match or no listed exclusion then linting fails.

Merging this PR means that vcpkg.json updates have a failing CI if the Flatpak manifest isn't updated accordingly, there has to be awareness of the Flatpak existence.

@gmta
Copy link
Collaborator

gmta commented Oct 6, 2025

You should probably swap the commits in terms of their ordering, so the linter doesn't fail for the commit you introduce it in.

@JanKoudijs
Copy link
Contributor Author

I have setup the commit hooks in my local repo, including the CI linting. The first commit doesn't give issues because it does not update the Flatpak manifest or vcpkg.json, so the check is not performed.

Am I overlooking a scenario?

@gmta
Copy link
Collaborator

gmta commented Oct 6, 2025

I have setup the commit hooks in my local repo, including the CI linting. The first commit doesn't give issues because it does not update the Flatpak manifest or vcpkg.json, so the check is not performed.

Am I overlooking a scenario?

Yes! If you look at the other tools invoked by lint-ci.sh, you'll see that their behavior is to check the paths provided to them as arguments, or they use git ls-files to enumerate all files they potentially need to check. In other words: if lint-ci.sh is run without arguments, you need to check everything there is to check in the repository.

@JanKoudijs
Copy link
Contributor Author

You should probably swap the commits in terms of their ordering, so the linter doesn't fail for the commit you introduce it in.

I have swapped the commits and added the functionality to perform the test if no arguments are provided.

with open(VCPKG) as input:
for package in json.load(input)["overrides"]:
# Add name/version pair, strip any '#' postfix from the version
vcpkg[package["name"]] = str(package["version"]).split("#")[0]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We read all the vcpkg versions, but we don't report packages that are only mentioned in vcpkg but not the flatpak. This is a common mistake (we add a new dependency but forgot to add it to flatpak, e.g. see cpptrace). Can this script spot those as well?

Copy link
Contributor Author

@JanKoudijs JanKoudijs Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current script is indeed limited to finding mismatches in dependencies that are found in both vcpkg and the flatpak. What complicates a full version check is that Flatpak uses runtimes. The org.kde.Platform runtime we use includes commonly used libraries to reduce the size of the application Flatpak itself. Such runtime libraries are not explicitly listed in the flatpak.

I saw that today the flatpak label has been added, to trigger Flatpak builds in CI. Applying this label to PRs will also add in detecting partial version updates early.

Besides the flatpak label there is also a dependencies label, this might also be a good candidate to trigger Flatpak builds in CI.

Would these 3 together give an acceptable detection?

Btw. can this PR get the flatpak label?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't report packages that are only mentioned in vcpkg but not the flatpak.

The other way around also happens. Not all vcpkg dependencies have a pinned version in [overrides], preventing comparison against the flatpak. The newly added cpptrace is an example of this. I don't know if it would be good practice to pin more dependency versions in vcpkg.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The flatpak label is just for the actual build. Regular CI linting runs the script you're introducing here, that's not related to that.

cpptrace should definitely have a pinned version in vcpkg.json.

Maybe start off assuming everything must have identical versions, and keep a list of exceptions in your script?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The flatpak label is just for the actual build. Regular CI linting runs the script you're introducing here, that's not related to that.

I'm not sure I understand, does this mean that this was done after the merge and not as part of the PR checks?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We read all the vcpkg versions, but we don't report packages that are only mentioned in vcpkg but not the flatpak.

The updated script checks for dependencies that are unique for vcpkg or the flatpak if they have a listed exclusion, if not then linting fails.

Reasons for exclusion are:

  • Flatpak build dependencies
  • Flatpak dependencies of dependencies, these are not versioned in vcpkg
  • Flatpak runtime libraries
  • vcpkg dependencies specific for the non-Linux platforms

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cpptrace should definitely have a pinned version in vcpkg.json.

done

@JanKoudijs JanKoudijs force-pushed the meta-check-flatpak branch 2 times, most recently from abe8284 to 05da258 Compare October 11, 2025 17:41
The Flatpak manifest linter matches dependencies against vcpkg.json
and if there is a match checks if versions are equal.
If there is no match it checks if there is a listed exclusion.
If there is no version match or no listed exclusion then linting fails.
@JanKoudijs JanKoudijs requested a review from gmta October 14, 2025 14:57
FLATPAK_MANIFEST = "Meta/CMake/flatpak/org.ladybird.Ladybird.json"
SELF = "Ladybird"

# List of build tools that are not provided by the Flatpak SDK and therefor in the manifest
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Repeated typo: "therefor" -> "therefore"

"libxml2",
"libyuv",
"vulkan-memory-allocator",
"zstd",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from vulkan-memory-allocator, seems like we pull all of these in as part of a vcpkg build. Shouldn't we pin these versions in vcpkg.json as well, even though they're transitive dependencies? 🤔

Copy link
Contributor Author

@JanKoudijs JanKoudijs Oct 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I now query the version from the vcpkg baseline if it is not found in vcpkg overrides. As the vcpkg repo isn't necessarily available at the time of linting, it is (shallow) cloned if needed. Is this an acceptable approach for a linter?

I took this approach over manual pinning of transitive dependencies as I think that will be error prone. When e.g. only a top level dependency gets updated you can end up with incompatible versions.

This added functionality revealed 3 packages in the flatpak that were older compared to the vcpkg baseline, these are now aligned.

"qtbase",
"qtmultimedia",
"sqlite3",
"zlib",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean that we're linking against whatever the kde runtime gives us for these libraries in terms of their versions? These are all pretty critical, wouldn't it be safer to build against the exact same versions as those in vcpkg.json?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically this can be done, but anticipating a future Flathub submission, I'm not sure about this. In Flathub submission PRs you see the reviewers often report that some library is in the runtime and should be used from that. They seem pretty strict in their policies.

If there is no version specified in vcpkg overrides then the vcpkg
baseline is queried for the version. The baseline is what ensures
dependency compatibility.
@JanKoudijs JanKoudijs requested a review from gmta November 2, 2025 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants