gtg icon indicating copy to clipboard operation
gtg copied to clipboard

Tarballs generated by Ninja / Meson dist include a ".github" directory

Open nekohayo opened this issue 2 years ago • 1 comments

Something worth investigating and documenting (if it's not a matter of committing some config file or something): the release checklist markdown files in the docs mentions that we typically use .ninja -C .local_build/ dist to build release tarballs, but by doing so, Meson also bundles a ".github" directory in it (and the meson.build files are also bundled, is it supposed to do that?)...

@leio suggested to use meson dist instead of the ninja command, but reportedly that would still include that folder, and we're not sure meson dist and ninja dist are actually different. "these days it's mostly all meson commands, that wrap ninja pretty much, but could do some extra things (or actually work on non-ninja cases, like with visual studio projects)"

In theory, it is possible that "if you want to avoid it, we need to set up a .gitattributes (to get git archive to exclude it) and use git archive instead"

Me, I have no clue about any of this stuff, so this ticket here is a small task for anyone who may know the answers to inspect the output of such generated tarballs and either change the config or update the contributors documentation to indicate the best procedure, if needed.

nekohayo avatar Mar 02 '22 19:03 nekohayo

Hi, Meson developer here!

The ninja dist and meson dist targets are supposed to behave more or less the same, because the alternative would be terribly confusing. There is one slight difference in that ninja dist will first make sure that build.ninja itself is up to date, which may mean running reconfigure.

The same basic idea applies to test or install as well. ninja test will first build all targets, then run meson test --no-rebuild --print-errorlogs (no-rebuild is because ninja prerequisites already did all building, print-errorlogs is just a good default). ninja targets are convenience targets that are supposed to "do the right thing", but running the command directly gives you more control.

The exception is meson compile, a convenience target that goes the other way around and detects whether you are using Visual Studio, Apple XCode, or ninja, and then runs the correct one to perform a build. That one is a bit odd.

Either way the dist backend will by default act like --formats=xztar, do a full distcheck (i.e. run the testsuite on the created dist) and, particularly of interest here, it will perform the action of transferring source files into the dist tarball using git-archive.

So it will respect .gitattributes, regardless of how you run it.

Note: this is a bugfix I contributed in https://github.com/mesonbuild/meson/commit/604088b5411460208357ac17f6fc565a591564cf and present since Meson 0.60.0, before that you will need to use meson.add_dist_script() and add a script that will run during the dist creation process and run rm -rf .github/.

eli-schwartz avatar Mar 02 '22 20:03 eli-schwartz