aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/coredata.py4
-rw-r--r--mesonbuild/mconf.py1
-rw-r--r--test cases/unit/109 configure same noop/meson.build1
-rw-r--r--test cases/unit/109 configure same noop/meson_options.txt5
-rw-r--r--unittests/allplatformstests.py10
5 files changed, 18 insertions, 3 deletions
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py
index 0094796..17133f5 100644
--- a/mesonbuild/coredata.py
+++ b/mesonbuild/coredata.py
@@ -23,7 +23,7 @@ from .mesonlib import (
MesonException, EnvironmentException, MachineChoice, PerMachine,
PerMachineDefaultable, default_libdir, default_libexecdir,
default_prefix, split_args, OptionKey, OptionType, stringlistify,
- pickle_load
+ pickle_load, replace_if_different
)
from .wrap import WrapMode
import ast
@@ -1066,7 +1066,7 @@ def save(obj: CoreData, build_dir: str) -> str:
pickle.dump(obj, f)
f.flush()
os.fsync(f.fileno())
- os.replace(tempfilename, filename)
+ replace_if_different(filename, tempfilename)
return filename
diff --git a/mesonbuild/mconf.py b/mesonbuild/mconf.py
index aa49949..227da6d 100644
--- a/mesonbuild/mconf.py
+++ b/mesonbuild/mconf.py
@@ -93,7 +93,6 @@ class Conf:
# Do nothing when using introspection
if self.default_values_only:
return
- # Only called if something has changed so overwrite unconditionally.
coredata.save(self.coredata, self.build_dir)
# We don't write the build file because any changes to it
# are erased when Meson is executed the next time, i.e. when
diff --git a/test cases/unit/109 configure same noop/meson.build b/test cases/unit/109 configure same noop/meson.build
new file mode 100644
index 0000000..d3f1326
--- /dev/null
+++ b/test cases/unit/109 configure same noop/meson.build
@@ -0,0 +1 @@
+project('configure same noop test')
diff --git a/test cases/unit/109 configure same noop/meson_options.txt b/test cases/unit/109 configure same noop/meson_options.txt
new file mode 100644
index 0000000..c406af2
--- /dev/null
+++ b/test cases/unit/109 configure same noop/meson_options.txt
@@ -0,0 +1,5 @@
+option(
+ 'opt',
+ type : 'string',
+ value: '',
+)
diff --git a/unittests/allplatformstests.py b/unittests/allplatformstests.py
index 5179ce1..0ac47e7 100644
--- a/unittests/allplatformstests.py
+++ b/unittests/allplatformstests.py
@@ -4290,3 +4290,13 @@ class AllPlatformTests(BasePlatformTests):
self.init(testdir)
self.build()
+
+ def test_configure_same_noop(self):
+ testdir = os.path.join(self.unit_test_dir, '109 configure same noop')
+ self.init(testdir, extra_args=['-Dopt=val'])
+
+ filename = os.path.join(self.privatedir, 'coredata.dat')
+ oldmtime = os.path.getmtime(filename)
+ self.setconf(["-Dopt=val"])
+ newmtime = os.path.getmtime(filename)
+ self.assertEqual(oldmtime, newmtime)