[PATCH rtems-lwip v1 1/5] lwip-to-rtems.py: Add support for reverse changes

Kinsey Moore kinsey.moore at oarcorp.com
Thu Aug 25 19:43:28 UTC 2022


This adds the necessary support for moving changes back and forth to the
upstream repository.
---
 lwip-to-rtems.py | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/lwip-to-rtems.py b/lwip-to-rtems.py
index acd6922..1be2628 100755
--- a/lwip-to-rtems.py
+++ b/lwip-to-rtems.py
@@ -86,8 +86,8 @@ print("Direction:                   %s" % (("reverse", "forward")[isForward]))
 
 
 def copyFiles(isforward):
+    files = json.load(open('file-import.json', 'r'))
     if (isforward):
-        files = json.load(open('file-import.json', 'r'))
         src_dir = os.path.abspath(LWIP_UPSTREAM_DIR)
         print("Files Imported:")
         for f in files['files-to-import']:
@@ -95,10 +95,14 @@ def copyFiles(isforward):
             dst_file = os.path.join(dst_dir, f.split('/')[-1])
             if not os.path.exists(dst_dir):
                 os.makedirs(dst_dir)
-            if not os.path.exists(dst_file):
-                Path(dst_file).touch()
-                print(dst_file)
-                copyfile(str(os.path.join(src_dir, f)),
-                         str(dst_file))
+            Path(dst_file).touch()
+            print(dst_file)
+            copyfile(str(os.path.join(src_dir, f)),
+                     str(dst_file))
+    else:
+        for f in files['files-to-import']:
+            src_file = os.path.join(os.path.abspath(LWIP_DIR), f)
+            dst_file = os.path.join(os.path.abspath(LWIP_UPSTREAM_DIR), f)
+            copyfile(str(src_file), str(dst_file))
 
 copyFiles(isForward)
-- 
2.30.2



More information about the devel mailing list