| 275 | return self.write(relative, data) |
| 276 | |
| 277 | def publish(self, meta): |
| 278 | # A partial JSON file is never a commit marker. The pending complete |
| 279 | # file remains evidence, and hard-link creation cannot overwrite a |
| 280 | # preexisting or symlink destination. |
| 281 | self.json("meta.pending.json", meta) |
| 282 | for name in ("profiles", "tests"): |
| 283 | data = _read(os.path.join(self.path, name + ".tsv"), self.args.max_map_bytes) |
| 284 | if hashlib.sha256(data).hexdigest() != meta[name + "_sha256"]: |
| 285 | _error("identity", "wire changed before publication") |
| 286 | self.check() |
| 287 | os.fsync(self.directory) |
| 288 | os.link("meta.pending.json", "meta.json", src_dir_fd=self.directory, |
| 289 | dst_dir_fd=self.directory, follow_symlinks=False) |
| 290 | |
| 291 | def inventory(self): |
| 292 | """Bound scans while children run; never follow raw tree symlinks.""" |