From a1a014196d1ed4cb70050b4a36f05453eb52d72c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Ferenc=20Nagy-Egri?= Date: Mon, 28 Oct 2024 15:33:49 +0100 Subject: [PATCH 1/2] scripts: Handle remote URL change in update_deps.py Without going through an intricate dance with git to change the remote URL of a repository, it's simplest to just nuke the cloned folder, as we have to do a clean clone anyway. --- scripts/update_deps.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/update_deps.py b/scripts/update_deps.py index d010f9b21..24d125a9f 100755 --- a/scripts/update_deps.py +++ b/scripts/update_deps.py @@ -415,8 +415,15 @@ def Checkout(self): if VERBOSE: print('Checking out {n} in {d}'.format(n=self.name, d=self.repo_dir)) - if self._args.do_clean_repo: + if os.path.exists(os.path.join(self.repo_dir, '.git')): + url_changed = command_output(['git', 'config', '--get', 'remote.origin.url'], self.repo_dir).strip() != self.url + else: + url_changed = False + + if self._args.do_clean_repo or url_changed: if os.path.isdir(self.repo_dir): + if VERBOSE: + print('Clearing directory {d}'.format(d=self.repo_dir)) shutil.rmtree(self.repo_dir, onerror = on_rm_error) if not os.path.exists(os.path.join(self.repo_dir, '.git')): self.Clone() From 723880bb8866580649c4578c614b3595dea62e4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Ferenc=20Nagy-Egri?= Date: Mon, 28 Oct 2024 15:34:12 +0100 Subject: [PATCH 2/2] scripts: Fix user self-hosting dependency in update_deps.py The documentation states that users can override where to take a dependency from via variables like VULKAN_HEADERS_INSTALL_DIR, however the helper.cmake written by the scripts/CMakeLists.txt FORCE updates the cache variable to the location inside known_good.json, practically overwriting the user-provided path given on the CLI using -D, also going into the cache. --- scripts/update_deps.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/update_deps.py b/scripts/update_deps.py index 24d125a9f..47810a00c 100755 --- a/scripts/update_deps.py +++ b/scripts/update_deps.py @@ -622,7 +622,7 @@ def CreateHelper(args, repos, filename): if repo.api is not None and repo.api != args.api: continue if install_names and repo.name in install_names and repo.on_build_platform: - helper_file.write('set({var} "{dir}" CACHE STRING "" FORCE)\n' + helper_file.write('set({var} "{dir}" CACHE STRING "")\n' .format( var=install_names[repo.name], dir=escape(repo.install_dir)))