authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-01-07 22:15:28-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-01-08 11:52:38-07:00
log089ebeb8736e9186c14d8228fa5594c518dcdb4b
treea6ff0c5cb4a5c664079e3810397665d471d3b456
parent6405d37d9f07565d40a8412badafebd44003ed01

update-mingw tool: add config.h to whitelist


1 files changed, 13 insertions(+), 5 deletions(-)

tools/update_mingw.zig+13-5
...@@ -45,13 +45,16 @@ pub fn main() !void {...@@ -45,13 +45,16 @@ pub fn main() !void {
45 while (try walker.next()) |entry| {45 while (try walker.next()) |entry| {
46 if (entry.kind != .file) continue;46 if (entry.kind != .file) continue;
4747
48 // Special exception to keep the copyright file.
49 if (std.mem.eql(u8, entry.path, "COPYING")) continue;
50
51 src_crt_dir.copyFile(entry.path, dest_crt_dir, entry.path, .{}) catch |err| switch (err) {48 src_crt_dir.copyFile(entry.path, dest_crt_dir, entry.path, .{}) catch |err| switch (err) {
52 error.FileNotFound => {49 error.FileNotFound => {
53 std.log.warn("deleting {s}", .{entry.path});50 const whitelisted = for (whitelist) |item| {
54 try dest_crt_dir.deleteFile(entry.path);51 if (std.mem.eql(u8, entry.path, item)) break true;
52 } else false;
53
54 if (!whitelisted) {
55 std.log.warn("deleting {s}", .{entry.path});
56 try dest_crt_dir.deleteFile(entry.path);
57 }
55 },58 },
56 else => {59 else => {
57 std.log.err("unable to copy {s}: {s}", .{ entry.path, @errorName(err) });60 std.log.err("unable to copy {s}: {s}", .{ entry.path, @errorName(err) });
...@@ -105,6 +108,11 @@ pub fn main() !void {...@@ -105,6 +108,11 @@ pub fn main() !void {
105 return std.process.cleanExit();108 return std.process.cleanExit();
106}109}
107110
111const whitelist = [_][]const u8{
112 "COPYING",
113 "include" ++ std.fs.path.sep_str ++ "config.h",
114};
115
108const ok_exts = [_][]const u8{116const ok_exts = [_][]const u8{
109 ".def",117 ".def",
110 ".def.in",118 ".def.in",