Skip to content

Conversation

@konrad-schwarz
Copy link
Contributor

@konrad-schwarz konrad-schwarz commented Aug 25, 2025

Meson can model a substantial amount of information useful for an RPM .spec file or for other distribution packaging schemes.
The meson introspect command exports this information as JSON that can be transformed, e.g., into a .spec file.

This pull request adds some information to sso-mib's meson.build to facilitate this.

The commits have the following purpose:

  1. Added project's license information to meson.build fills in the project's license and license_files slots.

  2. Added a meson install_tag to sso_mib_tool marks the executable sso-mib-tool with a separate install_tag.
    In Meson, install tags can be used to install only a subset of the targets with the --tags option.
    .spec file generation can use install tags to derive sub-packaging information.

3) Have git-archive set the project version from the latest v%d.%d.%d ta… uses git-archive's substitution feature to automatically update the project's version from the latest release tag. Note that this requires git-archive to actually produce an archive; the meson.build file in the repo remains unchanged. To avoid problems, a fallback version of 0.0.1 is used in this case.

Unfortunately, limitations of meson and git-archive force a convoluted code structure:

- The very first statement in meson.build must be project(). This makes it impossible to move the version fallback code ahead of the project() statement. Also, Meson's string manipulation is limited, e.g., regular expressions are not supported, which makes it impossible to remove dirty suffixes from the version string. On the other hand, this enforces proper release tagging.

- git-archive expands only a single instance of the describe keyword (which works similarly to git-describe). This is to avoid denial-of-service attacks -- although why they couldn't calculate this once and cache the result is beyond me.

This third commit is not necessary for RPM generation and could be dropped.

link_with : [libsso_mib],
dependencies: [glibdep, giodep, jsondep, uuiddep]
dependencies: [glibdep, giodep, jsondep, uuiddep],
install_tag : 'tool'
Copy link
Member

Choose a reason for hiding this comment

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

What is the reason to add it?

Copy link
Contributor Author

@konrad-schwarz konrad-schwarz Aug 25, 2025

Choose a reason for hiding this comment

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

See above, but: Meson has the concept of install tags to enable a subset of installation targets to be installed. By default, it provides a "devel" tag comprising files typically found in a -devel sub-package and a "runtime" tag comprising everything else.

The Debian packaging puts sso-mib-tool into a separate, optional sub-package; this change does the same for Meson (i.e., meson install --tags runtime would not install sso-mib-tool) and provides this information to downstream consumers, i.e. other packaging systems.

meson.build Outdated
'sso-mib',
'c',
version : '0.6.0',
version : '$Format:%H$'.contains ('Format:%')?
Copy link
Member

Choose a reason for hiding this comment

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

Hi, let's split that off into an independent MR. We need to check if that is compatible with the debian tooling, which builds the package from a source tarball (without git).

Copy link
Member

@fmoessbauer fmoessbauer left a comment

Choose a reason for hiding this comment

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

Please see my inline comments. And please add the signed-off line. For details, see the CONTRIBUTING.md guide.

@konrad-schwarz konrad-schwarz force-pushed the RPMs branch 2 times, most recently from 0bdffb7 to 285dc83 Compare August 26, 2025 09:58
@konrad-schwarz
Copy link
Contributor Author

git-archive related commit has been removed and can be merged separately.

@fmoessbauer
Copy link
Member

@konrad-schwarz : please check the CI results, e.g.

../meson.build:3:0: ERROR: project got unknown keyword arguments "license_files"

@konrad-schwarz
Copy link
Contributor Author

@konrad-schwarz : please check the CI results, e.g.

../meson.build:3:0: ERROR: project got unknown keyword arguments "license_files"

Debian Bookworm Meson's version is too old:

image image

I will probably run into the same problem on RHEL 8. My suggestion: create a patch in the Bookworm release that removes the offending line in meson.build. The information is required only to create the packaging specification and has no additional semantics.

Meson does not seem to have a preprocessing stage or a way of including/excluding code depending on its own version, so a patch would be the the only technical option.

The alternative would be to reject this commit outright -- but this strategy precludes benefiting from improvements to Meson or other subsystems/libraries for the sake of maximum backwards compatibility.

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