diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2019-01-23 19:57:59 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2019-01-23 19:57:59 +0530 |
commit | 13b54db26d3cddbc8e8519d6bb5a89a6d3b11fbc (patch) | |
tree | c9007d6459211a4c3143a5eb7711ee58ee9c1756 /mesonbuild | |
parent | 47732816f477c595f8130bbca8042b40ac27a1dc (diff) | |
download | meson-13b54db26d3cddbc8e8519d6bb5a89a6d3b11fbc.zip meson-13b54db26d3cddbc8e8519d6bb5a89a6d3b11fbc.tar.gz meson-13b54db26d3cddbc8e8519d6bb5a89a6d3b11fbc.tar.bz2 |
coredata: Only reject a load if major version differs
Our builddir ABI is stable across minor (stable) releases, so there is
no need to force a wipe. We already release pretty often, no need to
force people to wipe twice as often.
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/coredata.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py index 50e6b34..792a69b 100644 --- a/mesonbuild/coredata.py +++ b/mesonbuild/coredata.py @@ -588,6 +588,9 @@ def update_cmd_line_file(build_dir, options): with open(filename, 'w') as f: config.write(f) +def major_versions_differ(v1, v2): + return v1.split('.')[0:2] != v2.split('.')[0:2] + def load(build_dir): filename = os.path.join(build_dir, 'meson-private', 'coredata.dat') load_fail_msg = 'Coredata file {!r} is corrupted. Try with a fresh build tree.'.format(filename) @@ -603,7 +606,7 @@ def load(build_dir): "version of meson.".format(filename)) if not isinstance(obj, CoreData): raise MesonException(load_fail_msg) - if obj.version != version: + if major_versions_differ(obj.version, version): raise MesonException('Build directory has been generated with Meson version %s, ' 'which is incompatible with current version %s.\n' % (obj.version, version)) @@ -613,7 +616,7 @@ def save(obj, build_dir): filename = os.path.join(build_dir, 'meson-private', 'coredata.dat') prev_filename = filename + '.prev' tempfilename = filename + '~' - if obj.version != version: + if major_versions_differ(obj.version, version): raise MesonException('Fatal version mismatch corruption.') if os.path.exists(filename): import shutil |