Prohibit the use of override_file and subproject options in machine files.

overrides
Jussi Pakkanen 4 years ago
parent 42abae2e07
commit 4748fee06a
  1. 3
      cross/ubuntu-armhf.txt
  2. 17
      mesonbuild/environment.py
  3. 1
      mesonbuild/msetup.py

@ -14,6 +14,9 @@ ld = '/usr/bin/arm-linux/gnueabihf-ld'
c_args = ['-DMESON_TEST_ISSUE_1665=1']
cpp_args = '-DMESON_TEST_ISSUE_1665=1'
[zlib:built-in options]
c_std = 'c99'
[properties]
root = '/usr/arm-linux-gnueabihf'

@ -783,6 +783,21 @@ class Environment:
self.wrap_resolver = None
self.overrides = OptionOverrides()
self.init_overrides()
self.check_dual_overrides()
def has_per_subproject_options(self):
for o in self.options:
if o.subproject:
return True
return False
def check_dual_overrides(self):
if self.has_per_subproject_options() and self.coredata.options[mesonlib.OptionKey('override_file')].value:
raise MesonException('''Tried to define a per-subproject option in a machine file when override_file was defined.
This is not supported. All per-subproject options should be transitioned to
use the override file. Machine file overrides are deprecatd and will be
removed in a future Meson release.''')
def _load_machine_file_options(self, config: 'ConfigParser', properties: Properties, machine: MachineChoice) -> None:
"""Read the contents of a Machine file and put it in the options store."""
@ -814,6 +829,8 @@ class Environment:
subproject, section = section.split(':')
else:
subproject = ''
if subproject != '':
mlog.deprecation('Per-subproject option values in machine files are deprecated, transition to using an override_file instead.')
if section == 'built-in options':
for k, v in values.items():
key = OptionKey.from_string(k)

@ -224,6 +224,7 @@ class MesonApp:
except Exception as e:
mintro.write_meson_info_file(b, [e])
raise
env.check_dual_overrides()
# Print all default option values that don't match the current value
for def_opt_name, def_opt_value, cur_opt_value in intr.get_non_matching_default_options():
mlog.log('Option', mlog.bold(def_opt_name), 'is:',

Loading…
Cancel
Save