use atomic_output for write_depfile

Suspect android_build_server would run lint.py asynchronously,
and it would rewrite depfile (*.d) when siso doesn't recognize.
It makes *.d not clean, and need to check all build steps for nop build.

To mitigate this, use atomic_output, so not update mtime of depfile
when depfile content is the same as before.

Bug: 428258115
Change-Id: I737e54872774b1e7fe163c021700054036cfc1fe
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6692592
Auto-Submit: Fumitoshi Ukai <[email protected]>
Reviewed-by: Andrew Grieve <[email protected]>
Commit-Queue: Fumitoshi Ukai <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1480864}
diff --git a/build/action_helpers.py b/build/action_helpers.py
index 48d8ae5..7399716 100644
--- a/build/action_helpers.py
+++ b/build/action_helpers.py
@@ -103,7 +103,8 @@
 
   path = pathlib.Path(depfile_path)
   path.parent.mkdir(parents=True, exist_ok=True)
-  path.write_text(''.join(sb))
+  with atomic_output(str(path), mode='w', encoding='utf-8') as w:
+    w.write(''.join(sb))
 
 
 def parse_gn_list(value):