Skip to content

meson dist --include-subprojects fails on an unpromoted subproject #12489

Description

@bgilbert

Describe the bug
When running meson dist on a project with a subproject (glib) which itself has a subproject (gvdb), meson dist --include-subprojects fails with a FileNotFoundError on the promoted sub-subproject directory. Building the project first doesn't help.

glib tarballs include both gvdb.wrap and a gvdb directory, in case that makes a difference. Meson automatically promotes gvdb.wrap but not gvdb.

To Reproduce

#!/bin/bash

set -ex

cd $(mktemp -d)

python3 -m venv env
env/bin/pip install meson
meson=$(pwd)/env/bin/meson

mkdir src
cd src
cat > meson.build <<EOF
project('test')
subproject('glib')
EOF
mkdir subprojects
$meson wrap install glib

git init
git add meson.build subprojects/glib.wrap
git commit -m initial

$meson setup build
cd build
$meson dist --include-subprojects --no-tests

This produces:

[...]
+ /tmp/tmp.o6S4xT3ZeL/env/bin/meson dist --include-subprojects --no-tests
Traceback (most recent call last):
  File "/tmp/tmp.o6S4xT3ZeL/env/lib64/python3.11/site-packages/mesonbuild/mesonmain.py", line 194, in run
    return options.run_func(options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/tmp.o6S4xT3ZeL/env/lib64/python3.11/site-packages/mesonbuild/mdist.py", line 371, in run
    names = project.create_dist(archives)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/tmp.o6S4xT3ZeL/env/lib64/python3.11/site-packages/mesonbuild/mdist.py", line 209, in create_dist
    if is_git(sub_src_root):
       ^^^^^^^^^^^^^^^^^^^^
  File "/tmp/tmp.o6S4xT3ZeL/env/lib64/python3.11/site-packages/mesonbuild/mdist.py", line 88, in is_git
    return quiet_git(['ls-files', '--error-unmatch', 'meson.build'], src_root)[0]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/tmp.o6S4xT3ZeL/env/lib64/python3.11/site-packages/mesonbuild/utils/universal.py", line 210, in quiet_git
    p, o, e = git(cmd, workingdir, check)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/tmp.o6S4xT3ZeL/env/lib64/python3.11/site-packages/mesonbuild/utils/universal.py", line 199, in git
    p, o, e = Popen_safe(cmd, cwd=workingdir, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/tmp.o6S4xT3ZeL/env/lib64/python3.11/site-packages/mesonbuild/utils/universal.py", line 1485, in Popen_safe
    p = subprocess.Popen(args, universal_newlines=True, encoding=encoding, close_fds=False,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib64/python3.11/subprocess.py", line 1950, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmp.o6S4xT3ZeL/src/subprojects/gvdb'

ERROR: Unhandled python OSError. This is probably not a Meson bug, but an issue with your build environment.

Expected behavior
Meson produces a dist tarball.

system parameters

  • Is this a cross build or just a plain native build (for the same computer)?
    native
  • what operating system (e.g. MacOS Catalina, Windows 10, CentOS 8.0, Ubuntu 18.04, etc.)
    Fedora 38
  • what Python version are you using e.g. 3.8.0
    3.11.6
  • what meson --version
    1.2.3
  • what ninja --version if it's a Ninja build
    1.11.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    distIssues related to `meson dist`.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions