[cocci] Flatpak package for Coccinelle

Jan Tojnar
2024-06-23T12:49:03Z

Hello Julia and everyone!

To make Coccinelle more easily available to a wider range of people, I
have decided to package it using Flatpak [1], a distribution-
independent package manager backed by Freedesktop.org and preferred by
many developers of Linux desktop environments like GNOME, KDE or
Pantheon. This will be useful for situations where Flatpak is more
available or familiar than OCaml toolchain, such as for most GNOME
developers.

Eventually, the goal is to have it available in the Flathub repository
but there are several (numbered) questions to resolve before that can
happen.

First, each app requires an ID [2] in reverse-DNS format. I think
`fr.inria.Coccinelle` would be nicest. But I have also seen
`fr.lip6.Coccinelle` floating around but that might be older domain
name. And following the guidelines literally (you should have control
over the domain), it would probably have to be
`fr.inria.gitlab.coccinelle.Coccinelle` or
`fr.inria.gitlabpages.coccinelle.Coccinelle` but that feels over the
top.

(1) Is `fr.inria.Coccinelle` acceptable?

Second, uploading a package to Flathub requires an AppStream [3]
manifest, which contains items such as textual description of the
project, categories, authors, links and information about releases. I
took the description from the Coccinelle website but I am not sure what
the copyright status is:

> Coccinelle is a program matching and transformation engine which
provides the language SmPL (Semantic Patch Language) for specifying
desired matches and transformations in C code. Coccinelle was initially
targeted towards performing collateral evolutions in Linux. Such
evolutions comprise the changes that are needed in client code in
response to evolutions in library APIs, and may include modifications
such as renaming a function, adding a function argument whose value is
somehow context-dependent, and reorganizing a data structure. Beyond
collateral evolutions, Coccinelle is successfully used (by us and
others) for finding and fixing bugs in systems code.

Flathub and distro tooling combine metadata of software projects in
their repositories into indexes and other derivative databases so they
require the AppStream metadata to be distributed under one of several
licenses [4] vetted for mutual compatibility (e.g. Creative Commons,
Public Domain, or GNU Free Documentation License).

(2) Could you clarify who the copyright holder of the above
description is, and if it can be shared under one for the licenses
listed in [4]?

Third, it is preferred [5] to ship the AppStream metadata upstream so
that other distributions can use it. Shipping the metainfo in the
Coccinelle repository would require updating the file with a new
version and date before each release but that can be integrated into
the existing maintenance version script. No problem if you do not want
that, we can maintain it locally in a Flathub repository.

(3) Do you wish to include the AppStream metadata in the
repository?

Fourth, the Flatpak manifest can be also included in the Git repository
to allow building Coccinelle from the repo in a Flatpak environment.
This would improve access to the development versions of Coccinelle
but, since people who need those are probably more likely to be able to
obtain OCaml toolchain themselves, it might not be worth the
maintenance burden. I can help but I understand if this is not
something you want to bother with.

(4) Do you wish to include Flatpak manifest in the repository?

On that note, having the Flatpak manifest in the repo would also allow
us to have GitHub/GitLab CI (Continuous Integration) environment
automatically build latest version of Coccinelle and allow users to
download it without having to build it, just like Flathub will enable
that for stable versions of Coccinelle.

(5) Are you interested in such integration?

Lastly, one of the goals of Flatpak is to have upstream developers
publish their software using Flatpak themselves, essentially creating a
singular distribution platform for Linux systems. It is recommended [6]
that I ask you if you want to submit Coccinelle to Flathub yourself.
But I understand that you are busy and I can maintain the package if
you will not.

(6) Do you want to maintain Coccinelle package on Flathub yourself?

I have opened a draft PR on GitHub so that external reviewers can give
input on the patches before submitting them here (if desired):

https://github.com/coccinelle/coccinelle/pull/370

I have also created a PR to add Coccinelle to Flathub:

https://github.com/flathub/flathub/pull/5354

Cheers,

Jan

[1]: https://en.wikipedia.org/wiki/Flatpak
[2]:
https://docs.flathub.org/docs/for-app-authors/requirements#application-id
[3]: https://en.wikipedia.org/wiki/AppStream
[4]:
https://www.freedesktop.org/software/appstream/docs/chap-Metadata.html#tag-metadata_license
[5]:
https://docs.flathub.org/docs/for-app-authors/requirements#acceptable-but-should-be-submitted-upstream
[6]: