aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/coredata.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2019-01-22 22:41:50 +0530
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2019-01-23 19:50:50 +0530
commitd02ec7111ef3447d7807827e8c9afa93e680ee18 (patch)
tree01d3fbd519383e857f0220cb6dbf594fd6850412 /mesonbuild/coredata.py
parent379b42c5b18cd94feded28791a5189ee253ba04e (diff)
downloadmeson-d02ec7111ef3447d7807827e8c9afa93e680ee18.zip
meson-d02ec7111ef3447d7807827e8c9afa93e680ee18.tar.gz
meson-d02ec7111ef3447d7807827e8c9afa93e680ee18.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/coredata.py')
-rw-r--r--mesonbuild/coredata.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py
index c7e3689..9850722 100644
--- a/mesonbuild/coredata.py
+++ b/mesonbuild/coredata.py
@@ -643,6 +643,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)
@@ -658,7 +661,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))
@@ -668,7 +671,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