From 131643847bb0eb1748a4a9c8c38be76c2c28469c Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 3 Jun 2024 16:03:49 +0200 Subject: sys/syz-sysgen: remove all files in the case set of arches has changed If arched are renamed, old files will stay around and break builds. Remove all existing generated files for writing new ones. --- sys/syz-sysgen/sysgen.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'sys') diff --git a/sys/syz-sysgen/sysgen.go b/sys/syz-sysgen/sysgen.go index b1ed731bb..f170ad410 100644 --- a/sys/syz-sysgen/sysgen.go +++ b/sys/syz-sysgen/sysgen.go @@ -91,6 +91,18 @@ func main() { } osutil.MkdirAll(filepath.Join(*outDir, "sys", OS, "gen")) + // Cleanup old files in the case set of architectures has chnaged. + allFiles, err := filepath.Glob(filepath.Join(*outDir, "sys", OS, "gen", "*.go")) + if err != nil { + tool.Failf("failed to glob: %v", err) + } + for _, file := range allFiles { + if strings.HasSuffix(file, "empty.go") { + continue + } + os.Remove(file) + } + var archs []string for arch := range targets.List[OS] { archs = append(archs, arch) -- cgit mrf-deployment