Skip to content

vcs_tag custom command is run in source dir, but file objects provided are relative to build dir #14474

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mar-v-in opened this issue Apr 12, 2025 · 0 comments

Comments

@mar-v-in
Copy link

Describe the bug
When using vcs_tag with a custom command, the command is executed with current working dir set to the source directory. I guess that is intentional as it makes things easier when dealing with commands like git. However, when arguments provided in the command are file objects (which is needed if they should end up as a dependency), these file objects are passed as a path to the command, that is relative to the build directory (not the current working directory), thus the path is not found.

To Reproduce
meson.build:

project('test')
prog_python = import('python').find_installation()
vcs_tag(command: [prog_python, files('test.py')], input: 'test.in', output: 'test.out')

test.in:

VCS TAG: @VCS_TAG@

test.py

print("Test")
$ meson setup build
$ meson compile -C build
/usr/bin/python3: can't open file '<source root>/../test.py': [Errno 2] No such file or directory

Expected behavior
The file parameter should be provided relative to CWD at execution time, that is relative to the source directory, not the build directory. At the same time the dependency in the build.ninja file must remain relative to the build directory for ninja to correctly represent it.

system parameters
Meson 1.7.0 on Debian sid.

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

No branches or pull requests

1 participant