[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[XEN PATCH for-4.17] tools/golang: Remove existing *.gen.go before re-creating them


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Date: Mon, 24 Oct 2022 10:34:55 +0100
  • Authentication-results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>, Henry Wang <Henry.Wang@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, "George Dunlap" <george.dunlap@xxxxxxxxxx>, Nick Rosbrook <rosbrookn@xxxxxxxxx>, "Wei Liu" <wl@xxxxxxx>
  • Delivery-date: Mon, 24 Oct 2022 09:35:16 +0000
  • Ironport-data: A9a23:SmhODq9vT7KfpjWveVcWDrUDrX6TJUtcMsCJ2f8bNWPcYEJGY0x3z GIdXzuFM6nYZ2CgLY9zYN+y80MAvMfcydNiSgNtqy48E34SpcT7XtnIdU2Y0wF+jCHgZBk+s 5hBMImowOQcFCK0SsKFa+C5xZVE/fjUAOC6UIYoAwgpLSd8UiAtlBl/rOAwh49skLCRDhiE/ Nj/uKUzAnf8s9JPGj9Suv/rRC9H5qyo4mpA5AdmP5ingXeF/5UrJMNHTU2OByOQrrl8RoaSW +vFxbelyWLVlz9F5gSNy+uTnuUiG9Y+DCDW4pZkc/HKbitq/0Te5p0TJvsEAXq7vh3S9zxHJ HehgrTrIeshFvWkdO3wyHC0GQkmVUFN0OevzXRSLaV/ZqAJGpfh66wGMa04AWEX0ttTW0MUq fA4Eh4EdQKkmuX1367mV8A506zPLOGzVG8eknRpzDWfBvc6W5HTBa7N4Le03h9p2JoIR6yHI ZNEN3w/N3wsYDUWUrsTIJs4gOevgGi5azBCoUiZjaE2/3LS3Ep6172F3N/9KobbGpQKwRfwS mTu+VakUhQwL9ukmB2b1lKcv9DRpi35R9dHfFG/3qEz2wDCroAJMzUMUkCxu/6+iUiWVNdWK khS8S0rxYAt8GS7Q9+7WAe3yFaUsxhZV9dOHukS7ACW1rGS8wufHnIDTDNKdJohrsBebRwn0 EWY2ezgAzNHuaeQD3ma89+pQSiaYHZPazVYPGldEFVDs4KLTJwPYgznc/I5MvTpgv3PNzjr0 ReXq2shm+gOpJtev0mkxmzvjzWpr5nPawc64ATLQ26ohj9EiJ6Zi5+AsgaCs6sZRGqNZhzY5 SVfxZDChAwbJcvV/BFhVtnhC11ACxytFDTHyWBiEJA6n9hG0y7yJNsAiN2SyaoADyrlRdMLS BWC0e+yzMUJVJdPUUOQS9vrY/nGNYC6SbzYugn8N7KimKRZeg6d5z1JbkWNxW3rm0VEufhhZ 8nGLJ70Ui5EU/sPIN+KqwA1iOFD+8zD7TmLGcCTI+qPjdJym0J5uZ9aaQDTP4jVHYuPoRnP8 sY3Cid540w3bQEKWQGOqdR7BQlTdRATXMmmw/G7g8bee2KK7kl6UKSPqV7gEqQ495loehDgp SjlBBcGmACl3hUq62yiMxheVV8mZr4nxVpTAMDmFQzAN6QLCWp30JoiSg==
  • Ironport-hdrordr: A9a23:8TIsV698TzEUBn+UFZRuk+DUI+orL9Y04lQ7vn2YSXRuHPBw8P re+MjztCWE7gr5N0tBpTntAsW9qBDnhPtICOsqTNSftWDd0QPCRuxfBOPZslrd8kbFl9K1u5 0OT0EHMqyTMWRH
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

In cases where we don't have permission to write to the existing
*.gen.go, we should be able to remove them and recreate them.

Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
---

For 4.17:
    Without this, it is possible that the Gitlab CI got in a state
    where writing to the file would fail, but removing it and creating
    a new one should work.

    This issue have been observed only on `fedora-gcc*` jobs as fedora
    is our only container that have `golang` installed. And it runs
    the build as a `user` instead of `root.
---
 tools/golang/xenlight/gengotypes.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/golang/xenlight/gengotypes.py 
b/tools/golang/xenlight/gengotypes.py
index 9fec60602d..ed0122874f 100644
--- a/tools/golang/xenlight/gengotypes.py
+++ b/tools/golang/xenlight/gengotypes.py
@@ -45,6 +45,7 @@ def xenlight_golang_generate_types(path = None, types = None, 
comment = None):
     if path is None:
         path = 'types.gen.go'
 
+    os.unlink(path)
     with open(path, 'w') as f:
         if comment is not None:
             f.write(comment)
@@ -209,6 +210,7 @@ def xenlight_golang_generate_helpers(path = None, types = 
None, comment = None):
     if path is None:
         path = 'helpers.gen.go'
 
+    os.unlink(path)
     with open(path, 'w') as f:
         if comment is not None:
             f.write(comment)
-- 
Anthony PERARD




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.