Currently, the src dir may be removed when the test version has changed.
Just to check to make and copy the src if it has been removed.

Signed-off-by: Mike Qiu <[email protected]>
---
 client/shared/base_utils.py |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/client/shared/base_utils.py b/client/shared/base_utils.py
index 363a6a2..8a6524d 100644
--- a/client/shared/base_utils.py
+++ b/client/shared/base_utils.py
@@ -767,9 +767,17 @@ def update_version(srcdir, preserve_srcdir, new_version, 
install,
     if install_needed:
         if not preserve_srcdir and os.path.exists(srcdir):
             shutil.rmtree(srcdir)
+        if not os.path.isdir(srcdir):
+            source_code_dir = os.path.join(os.path.dirname(
+                          os.path.dirname(os.path.dirname(srcdir))),
+                          'tests', os.path.basename(os.path.dirname(srcdir)),
+                          'src')
+            if os.path.isdir(source_code_dir):
+                shutil.copytree(source_code_dir, srcdir)
+            else:
+                os.makedirs(srcdir)
         install(*args, **dargs)
-        if os.path.exists(srcdir):
-            pickle.dump(new_version, open(versionfile, 'w'))
+        pickle.dump(new_version, open(versionfile, 'w'))
 
 
 def get_stderr_level(stderr_is_expected):
-- 
1.7.7.6

_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel

Reply via email to