Message ID | 20221024093455.39969-1-anthony.perard@citrix.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [XEN,for-4.17] tools/golang: Remove existing *.gen.go before re-creating them | expand |
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)
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@citrix.com> --- 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(+)