git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 06/11] meson: wire up generation of distribution archive

From
Patrick Steinhardt <ps@pks.im>
Date
Jan 22, 2025, 12:05 UTC
Message-ID
<Z5De75u-TpwmUpZ7@pks.im>
In-Reply-To
<87plkgibr0.fsf@iotcl.com>
On Tue, Jan 21, 2025 at 01:37:23PM +0100, Toon Claes wrote:
Show 32 quoted lines
> Patrick Steinhardt <ps@pks.im> writes:
> 
> > Meson knows to generate distribution archives via `meson dist`. In
> > addition to generating the archive itself, this target also knows to
> > compile and execute tests from that archive, which helps to ensure that
> > the result is an adequate drop-in replacement for the versioned project.
> >
> > While this already works as-is, one omission is that we don't propagate
> > the commit that this is built from into the resulting archive. This can
> > be fixed though by adding a distribution script that propagates the
> > version into the "version" file, which GIT-VERSION-GEN knows to read if
> > present.
> >
> > Use GIT-VERSION-GEN to populate that file. As the script is executed in
> > the build directory, not in the directory where we generate the archive,
> > we have adapt it to honor the "MESON_DIST_ROOT" environment variable.
> 
> I failed to understand why you couldn't pass the absolute path of the
> output file to GIT-VERSION-GEN. So I looked at the previous version of
> this patch, and it seems you explain better over there.
> 
> I was testing things locally and tried this line for the last argument
> to the script:
> 
>   run_command(shell, '-c', 'echo $MESON_DIST_ROOT', capture: true, check: true).stdout().strip() / 'version',
> 
> And I think I understand it better now. Meson does not execute this when
> you run `meson dist`, but when it (re)generates it's build files. At
> that stage $MESON_DIST_ROOT is not set.
> 
> It's unfortunate we have to learn GIT-VERSION-GEN about the
> $MESON_DIST_ROOT environment variable, but I don't see any other way.
Hm. Thinking about it a bit more there is an alternative:
    meson.add_dist_script(
      shell,
      '-c',
      '"$1" "$2" "$3" --format="@GIT_VERSION@" "$MESON_DIST_ROOT/version"',
      'GIT-VERSION-GEN',
      shell,
      meson.current_source_dir() / 'GIT-VERSION-GEN',
      meson.current_source_dir(),
    )

I think this is a much better solution as it doesn't require us to teach the script about `MESON_DIST_ROOT`.

Patrick
Previous: Toon ClaesNext: Patrick Steinhardt
Message 11 of 18 in “meson: a couple of additions”
  1. 00/11 meson: a couple of additionsPatrick Steinhardt, Jan 14, 2025
  2. 01/11 GIT-VERSION-GEN: simplify computing the dirty markerPatrick Steinhardt, Jan 14, 2025
  3. 02/11 GIT-VERSION-GEN: allow running without input and output filesPatrick Steinhardt, Jan 14, 2025
  4. Toon ClaesJan 21, 2025
  5. 03/11 meson: populate project version via GIT-VERSION-GENPatrick Steinhardt, Jan 14, 2025
  6. Toon ClaesJan 21, 2025
  7. 04/11 meson: fix dependencies for generated headersPatrick Steinhardt, Jan 14, 2025
  8. 05/11 meson: wire up development environmentsPatrick Steinhardt, Jan 14, 2025
  9. 06/11 meson: wire up generation of distribution archivePatrick Steinhardt, Jan 14, 2025
  10. Toon ClaesJan 21, 2025
  11. Patrick SteinhardtJan 22, 2025
  12. 07/11 meson: wire up fuzzersPatrick Steinhardt, Jan 14, 2025
  13. 08/11 meson: make the CSPRNG backend configurablePatrick Steinhardt, Jan 14, 2025
  14. 09/11 meson: fix compilation with Visual StudioPatrick Steinhardt, Jan 14, 2025
  15. 10/11 ci: raise error when Meson generates warningsPatrick Steinhardt, Jan 14, 2025
  16. Toon ClaesJan 21, 2025
  17. 11/11 ci: wire up Visual Studio build with MesonPatrick Steinhardt, Jan 14, 2025
  18. Junio C HamanoJan 14, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.