authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-06-05 00:36:11 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-06-05 00:36:11 -07:00
log3a37a1d1bdb22b1e8c2a4c5685ef30c5f25f8dad
tree010b93d353fc43b91c36626d312b3d3a7c2a62bb
parentc1ec64ee6762ee140b46f9dcbf442aba742d4c7f

util/dep_type- assert that fetch and pull commands succeed


1 files changed, 8 insertions(+), 8 deletions(-)

src/util/dep_type.zig+8-8
...@@ -34,20 +34,20 @@ pub const DepType = enum {...@@ -34,20 +34,20 @@ pub const DepType = enum {
34 switch (self) {34 switch (self) {
35 .system_lib => {},35 .system_lib => {},
36 .git => {36 .git => {
37 _ = try u.run_cmd(null, &.{ "git", "clone", "--recurse-submodules", rpath, dpath });37 u.assert((try u.run_cmd(null, &.{ "git", "clone", "--recurse-submodules", rpath, dpath })) == 0, "git clone {s} failed", .{rpath});
38 },38 },
39 .hg => {39 .hg => {
40 _ = try u.run_cmd(null, &.{ "hg", "clone", rpath, dpath });40 u.assert((try u.run_cmd(null, &.{ "hg", "clone", rpath, dpath })) == 0, "hg clone {s} failed", .{rpath});
41 },41 },
42 .http => {42 .http => {
43 try std.fs.cwd().makePath(dpath);43 try std.fs.cwd().makePath(dpath);
44 _ = try u.run_cmd(dpath, &.{ "wget", rpath });44 u.assert((try u.run_cmd(dpath, &.{ "wget", rpath })) == 0, "wget {s} failed", .{rpath});
45 const f = rpath[std.mem.lastIndexOf(u8, rpath, "/").? + 1 ..];45 const f = rpath[std.mem.lastIndexOf(u8, rpath, "/").? + 1 ..];
46 if (std.mem.endsWith(u8, f, ".zip")) {46 if (std.mem.endsWith(u8, f, ".zip")) {
47 _ = try u.run_cmd(dpath, &.{ "unzip", f, "-d", "." });47 u.assert((try u.run_cmd(dpath, &.{ "unzip", f, "-d", "." })) == 0, "unzip {s} failed", .{f});
48 }48 }
49 if (std.mem.endsWith(u8, f, ".tar") or std.mem.endsWith(u8, f, ".tar.gz") or std.mem.endsWith(u8, f, ".tar.xz") or std.mem.endsWith(u8, f, ".tar.zst")) {49 if (std.mem.endsWith(u8, f, ".tar") or std.mem.endsWith(u8, f, ".tar.gz") or std.mem.endsWith(u8, f, ".tar.xz") or std.mem.endsWith(u8, f, ".tar.zst")) {
50 _ = try u.run_cmd(dpath, &.{ "tar", "-xf", f, "-C", "." });50 u.assert((try u.run_cmd(dpath, &.{ "tar", "-xf", f, "-C", "." })) == 0, "un-tar {s} failed", .{f});
51 }51 }
52 },52 },
53 }53 }
...@@ -57,11 +57,11 @@ pub const DepType = enum {...@@ -57,11 +57,11 @@ pub const DepType = enum {
57 switch (self) {57 switch (self) {
58 .system_lib => {},58 .system_lib => {},
59 .git => {59 .git => {
60 _ = try u.run_cmd(dpath, &.{ "git", "fetch" });60 u.assert((try u.run_cmd(dpath, &.{ "git", "fetch" })) == 0, "git fetch failed", .{});
61 _ = try u.run_cmd(dpath, &.{ "git", "pull" });61 u.assert((try u.run_cmd(dpath, &.{ "git", "pull" })) == 0, "git pull failed", .{});
62 },62 },
63 .hg => {63 .hg => {
64 _ = try u.run_cmd(dpath, &.{ "hg", "pull" });64 u.assert((try u.run_cmd(dpath, &.{ "hg", "pull" })) == 0, "hg pull failed", .{});
65 },65 },
66 .http => {66 .http => {
67 //67 //