Skip to content

Commit

Permalink
fix regression in converting build_target kwargs to typed_kwargs
Browse files Browse the repository at this point in the history
We haven't actually verified that these kwargs are equal to what we had
before, and should probably revert the entire series. But I have
multiple reports in the wild of projects that no longer build because of
`install: [true, false, get_option('foobar')]` which was always
incorrect and always equal to just dropping values all over the floor
and treating it the same as "bool(value) == True".

Special case this particular typed kwarg and allow it with a sternly
worded warning that it was always wrong and should never ever ever be
done.

Fixes: https://bugs.gentoo.org/917118
Fixes: http://qa-logs.debian.net/2023/11/11/rhythmbox_3.4.7-1_unstable_meson-exp.log

Thanks to the Gentoo Tinderbox project, and Lucas Nussbaum of the Debian
project.
  • Loading branch information
eli-schwartz authored and jpakkane committed Nov 12, 2023
1 parent 97dc880 commit 76e6340
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions mesonbuild/interpreter/interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3318,6 +3318,13 @@ def build_target(self, node: mparser.BaseNode, args: T.Tuple[str, SourcesVarargs
# backwards compatibility anyway
sources = [s for s in sources
if not isinstance(s, (build.BuildTarget, build.ExtractedObjects))]

# due to lack of type checking, these are "allowed" for legacy reasons
if not isinstance(kwargs['install'], bool):
FeatureBroken.single_use('install kwarg with non-boolean value', '1.3.0', self.subproject,
'This was never intended to work, and is essentially the same as using `install: true` regardless of value.',
node)

sources = self.source_strings_to_files(sources)
objs = kwargs['objects']
kwargs['dependencies'] = extract_as_list(kwargs, 'dependencies')
Expand Down
3 changes: 2 additions & 1 deletion mesonbuild/interpreter/type_checking.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,8 @@ def _objects_validator(vals: T.List[ObjectTypes]) -> T.Optional[str]:
OVERRIDE_OPTIONS_KW,
KwargInfo('build_by_default', bool, default=True, since='0.38.0'),
KwargInfo('extra_files', ContainerTypeInfo(list, (str, File)), default=[], listify=True),
INSTALL_KW,
# Accursed. We allow this for backwards compat and warn in the interpreter.
KwargInfo('install', object, default=False),
INSTALL_MODE_KW,
KwargInfo('implicit_include_directories', bool, default=True, since='0.42.0'),
NATIVE_KW,
Expand Down

0 comments on commit 76e6340

Please sign in to comment.