Mesa (master): tracie: Switch to using shutil.move for cross filesystem moves

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 2 11:11:46 UTC 2020


Module: Mesa
Branch: master
Commit: d0f836e5aef29c5887cb5f3d3cba2b1d7d5d78fd
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d0f836e5aef29c5887cb5f3d3cba2b1d7d5d78fd

Author: Rohan Garg <rohan.garg at collabora.com>
Date:   Mon Mar 30 19:12:00 2020 +0200

tracie: Switch to using shutil.move for cross filesystem moves

When running tracie in a docker container, renaming files from
inside the container to a bind-mounted folder on the host causes
a invalid cross-device link due to os.rename limitations.

Switching to shutil allows us to overcome this.

Signed-off-by: Rohan Garg <rohan.garg at collabora.com>
Reviewed-by: Eric Anholt <eric at anholt.net>
Reviewed-by: Alexandros Frantzis <alexandros.frantzis at collabora.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4377>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4377>

---

 .gitlab-ci/tracie/tracie.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci/tracie/tracie.py b/.gitlab-ci/tracie/tracie.py
index 388a73423bf..efedcbc4880 100644
--- a/.gitlab-ci/tracie/tracie.py
+++ b/.gitlab-ci/tracie/tracie.py
@@ -8,6 +8,7 @@ import sys
 import tempfile
 import time
 import yaml
+import shutil
 
 from pathlib import Path
 from PIL import Image
@@ -128,9 +129,9 @@ def check_trace(repo_url, repo_commit, device_name, trace, expectation):
     trace_dir = os.path.split(trace['path'])[0]
     results_path = os.path.join(RESULTS_PATH, trace_dir, "test", device_name)
     os.makedirs(results_path, exist_ok=True)
-    os.rename(log_file, os.path.join(results_path, os.path.split(log_file)[1]))
+    shutil.move(log_file, os.path.join(results_path, os.path.split(log_file)[1]))
     if not ok or os.environ.get('TRACIE_STORE_IMAGES', '0') == '1':
-            os.rename(image_file, os.path.join(results_path, os.path.split(image_file)[1]))
+            shutil.move(image_file, os.path.join(results_path, os.path.split(image_file)[1]))
 
     return ok
 



More information about the mesa-commit mailing list