| ... | @@ -1385,7 +1385,7 @@ fn configure(graph: *Graph, options: ConfigureOptions) !ScannedConfig { | ... | @@ -1385,7 +1385,7 @@ fn configure(graph: *Graph, options: ConfigureOptions) !ScannedConfig { |
| 1385 | printPkgTree(.{ | 1385 | printPkgTree(.{ |
| 1386 | .writer = initStdoutWriter(io), | 1386 | .writer = initStdoutWriter(io), |
| 1387 | .mode = try .detect(io, .stdout(), NO_COLOR, CLICOLOR_FORCE), | 1387 | .mode = try .detect(io, .stdout(), NO_COLOR, CLICOLOR_FORCE), |
| 1388 | }, arena, &job_queue, &fetch) catch |err| switch (err) { | 1388 | }, arena, graph.global_cache_root, &job_queue, &fetch, &fork_set) catch |err| switch (err) { |
| 1389 | error.WriteFailed => return stdout_writer_allocation.err.?, | 1389 | error.WriteFailed => return stdout_writer_allocation.err.?, |
| 1390 | else => |e| return e, | 1390 | else => |e| return e, |
| 1391 | }; | 1391 | }; |
| ... | @@ -1469,7 +1469,7 @@ fn configure(graph: *Graph, options: ConfigureOptions) !ScannedConfig { | ... | @@ -1469,7 +1469,7 @@ fn configure(graph: *Graph, options: ConfigureOptions) !ScannedConfig { |
| 1469 | const man = &f.manifest; | 1469 | const man = &f.manifest; |
| 1470 | const dep_names = man.dependencies.keys(); | 1470 | const dep_names = man.dependencies.keys(); |
| 1471 | try mod.deps.ensureUnusedCapacity(arena, @intCast(dep_names.len)); | 1471 | try mod.deps.ensureUnusedCapacity(arena, @intCast(dep_names.len)); |
| 1472 | for (dep_names, man.dependencies.values()) |name, dep| { | 1472 | for (dep_names, man.dependencies.values()) |name, *dep| { |
| 1473 | const dep_digest = Package.Fetch.depDigest( | 1473 | const dep_digest = Package.Fetch.depDigest( |
| 1474 | f.package_root, | 1474 | f.package_root, |
| 1475 | graph.global_cache_root, | 1475 | graph.global_cache_root, |
| ... | @@ -1804,8 +1804,10 @@ fn validateFingerprints( | ... | @@ -1804,8 +1804,10 @@ fn validateFingerprints( |
| 1804 | fn printPkgTree( | 1804 | fn printPkgTree( |
| 1805 | terminal: Io.Terminal, | 1805 | terminal: Io.Terminal, |
| 1806 | arena: Allocator, | 1806 | arena: Allocator, |
| | 1807 | global_cache_root: Cache.Directory, |
| 1807 | job_queue: *const Fetch.JobQueue, | 1808 | job_queue: *const Fetch.JobQueue, |
| 1808 | root_fetch: *const Fetch, | 1809 | root_fetch: *const Fetch, |
| | 1810 | fork_set: *const Package.Fetch.JobQueue.ForkSet, |
| 1809 | ) !void { | 1811 | ) !void { |
| 1810 | if (!root_fetch.have_manifest) return; | 1812 | if (!root_fetch.have_manifest) return; |
| 1811 | const names = root_fetch.manifest.dependencies.keys(); | 1813 | const names = root_fetch.manifest.dependencies.keys(); |
| ... | @@ -1814,37 +1816,49 @@ fn printPkgTree( | ... | @@ -1814,37 +1816,49 @@ fn printPkgTree( |
| 1814 | .parent = null, | 1816 | .parent = null, |
| 1815 | .last = i == names.len - 1, | 1817 | .last = i == names.len - 1, |
| 1816 | }; | 1818 | }; |
| 1817 | try printPkgTreeChild(terminal, arena, job_queue, &print_node, name, dep.hash); | 1819 | switch (dep.location) { |
| | 1820 | .url => { |
| | 1821 | const child_hash = if (dep.hash) |h| Package.Hash.fromSlice(h) else null; |
| | 1822 | try printPkgTreeChild(terminal, arena, global_cache_root, job_queue, &print_node, name, child_hash, fork_set); |
| | 1823 | }, |
| | 1824 | .path => { |
| | 1825 | const child_hash = Package.Fetch.depDigest(root_fetch.package_root, global_cache_root, dep); |
| | 1826 | try printPkgTreeChild(terminal, arena, global_cache_root, job_queue, &print_node, name, child_hash, fork_set); |
| | 1827 | }, |
| | 1828 | } |
| 1818 | } | 1829 | } |
| 1819 | } | 1830 | } |
| 1820 | | 1831 | |
| 1821 | fn printPkgTreeChild( | 1832 | fn printPkgTreeChild( |
| 1822 | terminal: Io.Terminal, | 1833 | terminal: Io.Terminal, |
| 1823 | arena: Allocator, | 1834 | arena: Allocator, |
| | 1835 | global_cache_root: Cache.Directory, |
| 1824 | job_queue: *const Fetch.JobQueue, | 1836 | job_queue: *const Fetch.JobQueue, |
| 1825 | parent_print_node: *const PrintNode, | 1837 | parent_print_node: *const PrintNode, |
| 1826 | dep_name: []const u8, | 1838 | dep_name: []const u8, |
| 1827 | opt_hash: ?[]const u8, | 1839 | opt_pkg_hash: ?Package.Hash, |
| | 1840 | fork_set: *const Package.Fetch.JobQueue.ForkSet, |
| 1828 | ) !void { | 1841 | ) !void { |
| 1829 | const w = terminal.writer; | 1842 | const w = terminal.writer; |
| 1830 | try parent_print_node.printPrefixedChild(w, terminal.mode); | 1843 | try parent_print_node.printPrefixedChild(w, terminal.mode); |
| 1831 | try w.writeAll(dep_name); | 1844 | try w.writeAll(dep_name); |
| 1832 | | 1845 | |
| 1833 | const hash = opt_hash orelse { | 1846 | const pkg_hash = opt_pkg_hash orelse { |
| 1834 | try terminal.setColor(.red); | 1847 | try terminal.setColor(.red); |
| 1835 | try w.writeAll(" (missing hash)\n"); | 1848 | try w.writeAll(" (missing hash)\n"); |
| 1836 | try terminal.setColor(.reset); | 1849 | try terminal.setColor(.reset); |
| 1837 | return; | 1850 | return; |
| 1838 | }; | 1851 | }; |
| 1839 | try terminal.setColor(.dim); | 1852 | try terminal.setColor(.dim); |
| 1840 | try w.print(" {s}", .{hash}); | 1853 | try w.print(" {s}", .{pkg_hash.toSlice()}); |
| 1841 | try terminal.setColor(.reset); | 1854 | try terminal.setColor(.reset); |
| 1842 | const child_fetch = job_queue.table.get(.fromSlice(hash)) orelse { | 1855 | const child_fetch = job_queue.table.get(pkg_hash) orelse { |
| 1843 | try terminal.setColor(.red); | 1856 | try terminal.setColor(.red); |
| 1844 | try w.writeAll(" (fetch failed)\n"); | 1857 | try w.writeAll(" (fetch failed)\n"); |
| 1845 | try terminal.setColor(.reset); | 1858 | try terminal.setColor(.reset); |
| 1846 | return; | 1859 | return; |
| 1847 | }; | 1860 | }; |
| | 1861 | |
| 1848 | switch (child_fetch.lazy_status) { | 1862 | switch (child_fetch.lazy_status) { |
| 1849 | .eager, .available => {}, | 1863 | .eager, .available => {}, |
| 1850 | .unavailable => { | 1864 | .unavailable => { |
| ... | @@ -1854,8 +1868,19 @@ fn printPkgTreeChild( | ... | @@ -1854,8 +1868,19 @@ fn printPkgTreeChild( |
| 1854 | return; | 1868 | return; |
| 1855 | }, | 1869 | }, |
| 1856 | } | 1870 | } |
| | 1871 | if (!child_fetch.have_manifest) { |
| | 1872 | try w.writeByte('\n'); |
| | 1873 | return; |
| | 1874 | } |
| | 1875 | |
| | 1876 | const project_id: Package.ProjectId = .init(child_fetch.manifest.name, child_fetch.manifest.id); |
| | 1877 | if (fork_set.getKeyPtrAdapted(project_id, @as(Fetch.JobQueue.Fork.Adapter, .{}))) |fork| { |
| | 1878 | try terminal.setColor(.yellow); |
| | 1879 | try w.print(" (fork: {f})", .{fork.path}); |
| | 1880 | try terminal.setColor(.reset); |
| | 1881 | } |
| | 1882 | |
| 1857 | try w.writeByte('\n'); | 1883 | try w.writeByte('\n'); |
| 1858 | if (!child_fetch.have_manifest) return; | | |
| 1859 | | 1884 | |
| 1860 | const names = child_fetch.manifest.dependencies.keys(); | 1885 | const names = child_fetch.manifest.dependencies.keys(); |
| 1861 | for (names, child_fetch.manifest.dependencies.values(), 0..) |name, *dep, i| { | 1886 | for (names, child_fetch.manifest.dependencies.values(), 0..) |name, *dep, i| { |
| ... | @@ -1863,7 +1888,16 @@ fn printPkgTreeChild( | ... | @@ -1863,7 +1888,16 @@ fn printPkgTreeChild( |
| 1863 | .parent = parent_print_node, | 1888 | .parent = parent_print_node, |
| 1864 | .last = i == names.len - 1, | 1889 | .last = i == names.len - 1, |
| 1865 | }; | 1890 | }; |
| 1866 | try printPkgTreeChild(terminal, arena, job_queue, &print_node, name, dep.hash); | 1891 | switch (dep.location) { |
| | 1892 | .url => { |
| | 1893 | const child_hash = if (dep.hash) |h| Package.Hash.fromSlice(h) else null; |
| | 1894 | try printPkgTreeChild(terminal, arena, global_cache_root, job_queue, &print_node, name, child_hash, fork_set); |
| | 1895 | }, |
| | 1896 | .path => { |
| | 1897 | const child_hash = Package.Fetch.depDigest(child_fetch.package_root, global_cache_root, dep); |
| | 1898 | try printPkgTreeChild(terminal, arena, global_cache_root, job_queue, &print_node, name, child_hash, fork_set); |
| | 1899 | }, |
| | 1900 | } |
| 1867 | } | 1901 | } |
| 1868 | } | 1902 | } |
| 1869 | | 1903 | |