authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-08-25 00:25:48 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-08-25 00:25:48 -07:00
log7ef751ed074ac1b6b70f0e0f5aa56047cfb4895e
tree7a51e4243af908d3622e97de1dcf4e36b523fda9
parent6ff661c8e810cad315325aa7e4a682b35c164111

cmd/fetch- remove parent module from logging


3 files changed, 12 insertions(+), 12 deletions(-)

src/cmd/aquila/install.zig+1-1
...@@ -46,7 +46,7 @@ pub fn execute(args: [][]u8) !void {...@@ -46,7 +46,7 @@ pub fn execute(args: [][]u8) !void {
46 .update = false,46 .update = false,
47 };47 };
48 try fetchoptions.init();48 try fetchoptions.init();
49 const modpath = try common.get_modpath(cachepath, dep, "install", &fetchoptions);49 const modpath = try common.get_modpath(cachepath, dep, &fetchoptions);
50 const moddir = try std.fs.cwd().openDir(modpath, .{});50 const moddir = try std.fs.cwd().openDir(modpath, .{});
5151
52 // zigmod ci52 // zigmod ci
src/common.zig+10-10
...@@ -34,11 +34,11 @@ pub fn collect_deps_deep(cachepath: []const u8, mdir: std.fs.Dir, options: *Coll...@@ -34,11 +34,11 @@ pub fn collect_deps_deep(cachepath: []const u8, mdir: std.fs.Dir, options: *Coll
34 defer moduledeps.deinit();34 defer moduledeps.deinit();
35 if (m.root_files.len > 0) {35 if (m.root_files.len > 0) {
36 try std.fs.cwd().makePath(".zigmod/deps/files");36 try std.fs.cwd().makePath(".zigmod/deps/files");
37 try moduledeps.append(try add_files_package("root", m.root_files, m.name));37 try moduledeps.append(try add_files_package("root", m.root_files));
38 }38 }
39 try moduledeps.append(try collect_deps(cachepath, mdir, options));39 try moduledeps.append(try collect_deps(cachepath, mdir, options));
40 for (m.devdeps) |*d| {40 for (m.devdeps) |*d| {
41 if (try get_module_from_dep(d, cachepath, m.name, options)) |founddep| {41 if (try get_module_from_dep(d, cachepath, options)) |founddep| {
42 try moduledeps.append(founddep);42 try moduledeps.append(founddep);
43 }43 }
44 }44 }
...@@ -60,10 +60,10 @@ pub fn collect_deps(cachepath: []const u8, mdir: std.fs.Dir, options: *CollectOp...@@ -60,10 +60,10 @@ pub fn collect_deps(cachepath: []const u8, mdir: std.fs.Dir, options: *CollectOp
60 defer moduledeps.deinit();60 defer moduledeps.deinit();
61 if (m.files.len > 0) {61 if (m.files.len > 0) {
62 try std.fs.cwd().makePath(".zigmod/deps/files");62 try std.fs.cwd().makePath(".zigmod/deps/files");
63 try moduledeps.append(try add_files_package(m.id, m.files, m.name));63 try moduledeps.append(try add_files_package(m.id, m.files));
64 }64 }
65 for (m.deps) |*d| {65 for (m.deps) |*d| {
66 if (try get_module_from_dep(d, cachepath, m.name, options)) |founddep| {66 if (try get_module_from_dep(d, cachepath, options)) |founddep| {
67 try moduledeps.append(founddep);67 try moduledeps.append(founddep);
68 }68 }
69 }69 }
...@@ -92,7 +92,7 @@ pub fn collect_pkgs(mod: u.Module, list: *std.ArrayList(u.Module)) anyerror!void...@@ -92,7 +92,7 @@ pub fn collect_pkgs(mod: u.Module, list: *std.ArrayList(u.Module)) anyerror!void
92 }92 }
93}93}
9494
95pub fn get_modpath(cachepath: []const u8, d: u.Dep, parent_name: []const u8, options: *CollectOptions) ![]const u8 {95pub fn get_modpath(cachepath: []const u8, d: u.Dep, options: *CollectOptions) ![]const u8 {
96 const p = try std.fs.path.join(gpa, &.{ cachepath, try d.clean_path() });96 const p = try std.fs.path.join(gpa, &.{ cachepath, try d.clean_path() });
97 const pv = try std.fs.path.join(gpa, &.{ cachepath, try d.clean_path_v() });97 const pv = try std.fs.path.join(gpa, &.{ cachepath, try d.clean_path_v() });
9898
...@@ -101,7 +101,7 @@ pub fn get_modpath(cachepath: []const u8, d: u.Dep, parent_name: []const u8, opt...@@ -101,7 +101,7 @@ pub fn get_modpath(cachepath: []const u8, d: u.Dep, parent_name: []const u8, opt
101 if (!nocache and u.list_contains(options.already_fetched.items, pv)) return pv;101 if (!nocache and u.list_contains(options.already_fetched.items, pv)) return pv;
102102
103 if (options.log and d.type != .local) {103 if (options.log and d.type != .local) {
104 u.print("fetch: {s}: {s}: {s}", .{ parent_name, @tagName(d.type), d.path });104 u.print("fetch: {s}: {s}", .{ @tagName(d.type), d.path });
105 }105 }
106 defer {106 defer {
107 if (!bootstrap and options.log and d.type != .local) {107 if (!bootstrap and options.log and d.type != .local) {
...@@ -197,7 +197,7 @@ pub fn get_modpath(cachepath: []const u8, d: u.Dep, parent_name: []const u8, opt...@@ -197,7 +197,7 @@ pub fn get_modpath(cachepath: []const u8, d: u.Dep, parent_name: []const u8, opt
197 }197 }
198}198}
199199
200pub fn get_module_from_dep(d: *u.Dep, cachepath: []const u8, parent_name: []const u8, options: *CollectOptions) anyerror!?u.Module {200pub fn get_module_from_dep(d: *u.Dep, cachepath: []const u8, options: *CollectOptions) anyerror!?u.Module {
201 if (options.lock) |lock| {201 if (options.lock) |lock| {
202 for (lock) |item| {202 for (lock) |item| {
203 if (std.mem.eql(u8, item[0], try d.clean_path())) {203 if (std.mem.eql(u8, item[0], try d.clean_path())) {
...@@ -208,7 +208,7 @@ pub fn get_module_from_dep(d: *u.Dep, cachepath: []const u8, parent_name: []cons...@@ -208,7 +208,7 @@ pub fn get_module_from_dep(d: *u.Dep, cachepath: []const u8, parent_name: []cons
208 }208 }
209 }209 }
210 }210 }
211 const modpath = try get_modpath(cachepath, d.*, parent_name, options);211 const modpath = try get_modpath(cachepath, d.*, options);
212 const moddir = if (std.mem.eql(u8, modpath, "files") or modpath.len == 0) try std.fs.cwd().openDir(cachepath, .{}) else try std.fs.cwd().openDir(modpath, .{});212 const moddir = if (std.mem.eql(u8, modpath, "files") or modpath.len == 0) try std.fs.cwd().openDir(cachepath, .{}) else try std.fs.cwd().openDir(modpath, .{});
213213
214 const nocache = d.type == .local or d.type == .system_lib;214 const nocache = d.type == .local or d.type == .system_lib;
...@@ -276,7 +276,7 @@ pub fn get_module_from_dep(d: *u.Dep, cachepath: []const u8, parent_name: []cons...@@ -276,7 +276,7 @@ pub fn get_module_from_dep(d: *u.Dep, cachepath: []const u8, parent_name: []cons
276 }276 }
277}277}
278278
279pub fn add_files_package(pkg_name: []const u8, dirs: []const []const u8, parent_name: []const u8) !u.Module {279pub fn add_files_package(pkg_name: []const u8, dirs: []const []const u8) !u.Module {
280 const destination = ".zigmod/deps/files";280 const destination = ".zigmod/deps/files";
281 const fname = try std.mem.join(gpa, "", &.{ pkg_name, ".zig" });281 const fname = try std.mem.join(gpa, "", &.{ pkg_name, ".zig" });
282282
...@@ -335,7 +335,7 @@ pub fn add_files_package(pkg_name: []const u8, dirs: []const []const u8, parent_...@@ -335,7 +335,7 @@ pub fn add_files_package(pkg_name: []const u8, dirs: []const []const u8, parent_
335 .log = false,335 .log = false,
336 .update = false,336 .update = false,
337 };337 };
338 return (try get_module_from_dep(&d, destination, parent_name, &options)).?;338 return (try get_module_from_dep(&d, destination, &options)).?;
339}339}
340340
341pub fn parse_lockfile(dir: std.fs.Dir) ![]const [4][]const u8 {341pub fn parse_lockfile(dir: std.fs.Dir) ![]const [4][]const u8 {
src/util/module.zig+1-1
...@@ -28,7 +28,7 @@ pub const Module = struct {...@@ -28,7 +28,7 @@ pub const Module = struct {
28 var moddeps = std.ArrayList(Module).init(gpa);28 var moddeps = std.ArrayList(Module).init(gpa);
29 defer moddeps.deinit();29 defer moddeps.deinit();
30 for (dep.deps) |*d| {30 for (dep.deps) |*d| {
31 if (try common.get_module_from_dep(d, dir, dep.name, options)) |founddep| {31 if (try common.get_module_from_dep(d, dir, options)) |founddep| {
32 try moddeps.append(founddep);32 try moddeps.append(founddep);
33 }33 }
34 }34 }