From 2512c25c0bb3649c4cc8be20ac30d59630241ae4 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Fri, 28 Jan 2022 14:59:33 +0530 Subject: ninja backend: Fix usage of same constants file for native and cross For example: ``` meson builddir \ --native-file vs2019-paths.txt \ --native-file vs2019-win-x64.txt \ --cross-file vs2019-paths.txt \ --cross-file vs2019-win-arm64.txt ``` This was causing the error: > ERROR: Multiple producers for Ninja target "/path/to/vs2019-paths.txt". Please rename your targets. Fix it by using a set() when generating the list of regen files, and add a test for it too. --- mesonbuild/backend/backends.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'mesonbuild') diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index e43c8c7..eb4d03f 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -1191,14 +1191,14 @@ class Backend: def get_regen_filelist(self) -> T.List[str]: '''List of all files whose alteration means that the build definition needs to be regenerated.''' - deps = [str(Path(self.build_to_src) / df) - for df in self.interpreter.get_build_def_files()] + deps = OrderedSet([str(Path(self.build_to_src) / df) + for df in self.interpreter.get_build_def_files()]) if self.environment.is_cross_build(): - deps.extend(self.environment.coredata.cross_files) - deps.extend(self.environment.coredata.config_files) - deps.append('meson-private/coredata.dat') + deps.update(self.environment.coredata.cross_files) + deps.update(self.environment.coredata.config_files) + deps.add('meson-private/coredata.dat') self.check_clock_skew(deps) - return deps + return list(deps) def generate_regen_info(self) -> None: deps = self.get_regen_filelist() @@ -1210,7 +1210,7 @@ class Backend: with open(filename, 'wb') as f: pickle.dump(regeninfo, f) - def check_clock_skew(self, file_list: T.List[str]) -> None: + def check_clock_skew(self, file_list: T.Iterable[str]) -> None: # If a file that leads to reconfiguration has a time # stamp in the future, it will trigger an eternal reconfigure # loop. -- cgit v1.1