post-process-oabi: Flush tempfile before using it

The NamedTemporaryFile is buffered by default, so there might be data
left in the buffer when shutil.copyfileobj() completes. This would then
result in TarFile.extractall() failing due to trying to read from an
incomplete archive.
This commit is contained in:
Ole André Vadla Ravnås committed 2024-05-02 21:11:55 +02:00
1 parent aa3ea2ba93
commit 2470ad11f3
1 file changed
+1
+1
View File
@@ -35,6 +35,7 @@ def main():
with urllib.request.urlopen(arm64e_sdk_url) as response, \
tempfile.NamedTemporaryFile(suffix=".tar.xz") as archive:
shutil.copyfileobj(response, archive)
archive.flush()
arm64e_artifact_path = Path(archive.name)
with tempfile.TemporaryDirectory() as patched_artifact_dir: