| ... | ... | @@ -60,8 +60,6 @@ omit_missing_hash_error: bool, |
| 60 | 60 | /// which specifies inclusion rules. This is intended to be true for the first |
| 61 | 61 | /// fetch task and false for the recursive dependencies. |
| 62 | 62 | allow_missing_paths_field: bool, |
| 63 | | allow_missing_fingerprint: bool, |
| 64 | | allow_name_string: bool, |
| 65 | 63 | /// If true and URL points to a Git repository, will use the latest commit. |
| 66 | 64 | use_latest_commit: bool, |
| 67 | 65 | |
| ... | ... | @@ -675,8 +673,6 @@ fn loadManifest(f: *Fetch, pkg_root: Cache.Path) RunError!void { |
| 675 | 673 | |
| 676 | 674 | f.manifest = try Manifest.parse(arena, ast.*, rng.interface(), .{ |
| 677 | 675 | .allow_missing_paths_field = f.allow_missing_paths_field, |
| 678 | | .allow_missing_fingerprint = f.allow_missing_fingerprint, |
| 679 | | .allow_name_string = f.allow_name_string, |
| 680 | 676 | }); |
| 681 | 677 | const manifest = &f.manifest.?; |
| 682 | 678 | |
| ... | ... | @@ -794,8 +790,6 @@ fn queueJobsForDeps(f: *Fetch) RunError!void { |
| 794 | 790 | .job_queue = f.job_queue, |
| 795 | 791 | .omit_missing_hash_error = false, |
| 796 | 792 | .allow_missing_paths_field = true, |
| 797 | | .allow_missing_fingerprint = true, |
| 798 | | .allow_name_string = true, |
| 799 | 793 | .use_latest_commit = false, |
| 800 | 794 | |
| 801 | 795 | .package_root = undefined, |
| ... | ... | @@ -2049,130 +2043,6 @@ const UnpackResult = struct { |
| 2049 | 2043 | } |
| 2050 | 2044 | }; |
| 2051 | 2045 | |
| 2052 | | test "tarball with duplicate paths" { |
| 2053 | | // This tarball has duplicate path 'dir1/file1' to simulate case sensitve |
| 2054 | | // file system on any file sytstem. |
| 2055 | | // |
| 2056 | | // duplicate_paths/ |
| 2057 | | // duplicate_paths/dir1/ |
| 2058 | | // duplicate_paths/dir1/file1 |
| 2059 | | // duplicate_paths/dir1/file1 |
| 2060 | | // duplicate_paths/build.zig.zon |
| 2061 | | // duplicate_paths/src/ |
| 2062 | | // duplicate_paths/src/main.zig |
| 2063 | | // duplicate_paths/src/root.zig |
| 2064 | | // duplicate_paths/build.zig |
| 2065 | | // |
| 2066 | | |
| 2067 | | const gpa = std.testing.allocator; |
| 2068 | | const io = std.testing.io; |
| 2069 | | var tmp = std.testing.tmpDir(.{}); |
| 2070 | | defer tmp.cleanup(); |
| 2071 | | |
| 2072 | | const tarball_name = "duplicate_paths.tar.gz"; |
| 2073 | | try saveEmbedFile(io, tarball_name, tmp.dir); |
| 2074 | | const tarball_path = try std.fmt.allocPrint(gpa, ".zig-cache/tmp/{s}/{s}", .{ tmp.sub_path, tarball_name }); |
| 2075 | | defer gpa.free(tarball_path); |
| 2076 | | |
| 2077 | | // Run tarball fetch, expect to fail |
| 2078 | | var fb: TestFetchBuilder = undefined; |
| 2079 | | var fetch = try fb.build(gpa, io, tmp.dir, tarball_path); |
| 2080 | | defer fb.deinit(); |
| 2081 | | try std.testing.expectError(error.FetchFailed, fetch.run()); |
| 2082 | | |
| 2083 | | try fb.expectFetchErrors(1, |
| 2084 | | \\error: unable to unpack tarball |
| 2085 | | \\ note: unable to create file 'dir1/file1': PathAlreadyExists |
| 2086 | | \\ |
| 2087 | | ); |
| 2088 | | } |
| 2089 | | |
| 2090 | | test "tarball with excluded duplicate paths" { |
| 2091 | | // Same as previous tarball but has build.zig.zon wich excludes 'dir1'. |
| 2092 | | // |
| 2093 | | // .paths = .{ |
| 2094 | | // "build.zig", |
| 2095 | | // "build.zig.zon", |
| 2096 | | // "src", |
| 2097 | | // } |
| 2098 | | // |
| 2099 | | |
| 2100 | | const gpa = std.testing.allocator; |
| 2101 | | const io = std.testing.io; |
| 2102 | | var tmp = std.testing.tmpDir(.{}); |
| 2103 | | defer tmp.cleanup(); |
| 2104 | | |
| 2105 | | const tarball_name = "duplicate_paths_excluded.tar.gz"; |
| 2106 | | try saveEmbedFile(io, tarball_name, tmp.dir); |
| 2107 | | const tarball_path = try std.fmt.allocPrint(gpa, ".zig-cache/tmp/{s}/{s}", .{ tmp.sub_path, tarball_name }); |
| 2108 | | defer gpa.free(tarball_path); |
| 2109 | | |
| 2110 | | // Run tarball fetch, should succeed |
| 2111 | | var fb: TestFetchBuilder = undefined; |
| 2112 | | var fetch = try fb.build(gpa, io, tmp.dir, tarball_path); |
| 2113 | | defer fb.deinit(); |
| 2114 | | try fetch.run(); |
| 2115 | | |
| 2116 | | const hex_digest = Package.multiHashHexDigest(fetch.computed_hash.digest); |
| 2117 | | try std.testing.expectEqualStrings( |
| 2118 | | "12200bafe035cbb453dd717741b66e9f9d1e6c674069d06121dafa1b2e62eb6b22da", |
| 2119 | | &hex_digest, |
| 2120 | | ); |
| 2121 | | |
| 2122 | | const expected_files: []const []const u8 = &.{ |
| 2123 | | "build.zig", |
| 2124 | | "build.zig.zon", |
| 2125 | | "src/main.zig", |
| 2126 | | "src/root.zig", |
| 2127 | | }; |
| 2128 | | try fb.expectPackageFiles(expected_files); |
| 2129 | | } |
| 2130 | | |
| 2131 | | test "tarball without root folder" { |
| 2132 | | // Tarball with root folder. Manifest excludes dir1 and dir2. |
| 2133 | | // |
| 2134 | | // build.zig |
| 2135 | | // build.zig.zon |
| 2136 | | // dir1/ |
| 2137 | | // dir1/file2 |
| 2138 | | // dir1/file1 |
| 2139 | | // dir2/ |
| 2140 | | // dir2/file2 |
| 2141 | | // src/ |
| 2142 | | // src/main.zig |
| 2143 | | // |
| 2144 | | |
| 2145 | | const gpa = std.testing.allocator; |
| 2146 | | const io = std.testing.io; |
| 2147 | | |
| 2148 | | var tmp = std.testing.tmpDir(.{}); |
| 2149 | | defer tmp.cleanup(); |
| 2150 | | |
| 2151 | | const tarball_name = "no_root.tar.gz"; |
| 2152 | | try saveEmbedFile(io, tarball_name, tmp.dir); |
| 2153 | | const tarball_path = try std.fmt.allocPrint(gpa, ".zig-cache/tmp/{s}/{s}", .{ tmp.sub_path, tarball_name }); |
| 2154 | | defer gpa.free(tarball_path); |
| 2155 | | |
| 2156 | | // Run tarball fetch, should succeed |
| 2157 | | var fb: TestFetchBuilder = undefined; |
| 2158 | | var fetch = try fb.build(gpa, io, tmp.dir, tarball_path); |
| 2159 | | defer fb.deinit(); |
| 2160 | | try fetch.run(); |
| 2161 | | |
| 2162 | | const hex_digest = Package.multiHashHexDigest(fetch.computed_hash.digest); |
| 2163 | | try std.testing.expectEqualStrings( |
| 2164 | | "12209f939bfdcb8b501a61bb4a43124dfa1b2848adc60eec1e4624c560357562b793", |
| 2165 | | &hex_digest, |
| 2166 | | ); |
| 2167 | | |
| 2168 | | const expected_files: []const []const u8 = &.{ |
| 2169 | | "build.zig", |
| 2170 | | "build.zig.zon", |
| 2171 | | "src/main.zig", |
| 2172 | | }; |
| 2173 | | try fb.expectPackageFiles(expected_files); |
| 2174 | | } |
| 2175 | | |
| 2176 | 2046 | test "set executable bit based on file content" { |
| 2177 | 2047 | if (!Io.File.Permissions.has_executable_bit) return error.SkipZigTest; |
| 2178 | 2048 | const gpa = std.testing.allocator; |
| ... | ... | @@ -2288,8 +2158,6 @@ const TestFetchBuilder = struct { |
| 2288 | 2158 | .job_queue = &self.job_queue, |
| 2289 | 2159 | .omit_missing_hash_error = true, |
| 2290 | 2160 | .allow_missing_paths_field = false, |
| 2291 | | .allow_missing_fingerprint = true, // so we can keep using the old testdata .tar.gz |
| 2292 | | .allow_name_string = true, // so we can keep using the old testdata .tar.gz |
| 2293 | 2161 | .use_latest_commit = true, |
| 2294 | 2162 | |
| 2295 | 2163 | .package_root = undefined, |