authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-06-18 22:05:23 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-06-18 22:05:23 -07:00
logd5f3d9ad04713fe889980e05a2a725d5ad4c8b57
tree71ff8a72b340f01cb26a4fd6dcc0b82b785b4e7e
parentc04a957c4a5571a2e633e57db3e5c7160df04dc9

lots of fixes, update to zig master 0.11.0-dev.3620+c76ce25a6


18 files changed, 61 insertions(+), 72 deletions(-)

.github/workflows/nightly.yml+1-1
...@@ -26,7 +26,7 @@ jobs:...@@ -26,7 +26,7 @@ jobs:
26 - name: Setup Zig26 - name: Setup Zig
27 uses: goto-bus-stop/setup-zig@v127 uses: goto-bus-stop/setup-zig@v1
28 with:28 with:
29 version: "0.11.0-dev.2777+b95cdf0ae"29 version: "0.11.0-dev.3620+c76ce25a6"
3030
31 - run: zig version31 - run: zig version
32 - run: zig env32 - run: zig env
.github/workflows/push.yml+1-1
...@@ -19,7 +19,7 @@ jobs:...@@ -19,7 +19,7 @@ jobs:
19 - name: Setup Zig19 - name: Setup Zig
20 uses: goto-bus-stop/setup-zig@v120 uses: goto-bus-stop/setup-zig@v1
21 with:21 with:
22 version: "0.11.0-dev.2777+b95cdf0ae"22 version: "0.11.0-dev.3620+c76ce25a6"
2323
24 - run: zig version24 - run: zig version
25 - run: zig env25 - run: zig env
README.md+1-1
...@@ -17,7 +17,7 @@ A package manager for the Zig programming language....@@ -17,7 +17,7 @@ A package manager for the Zig programming language.
17- https://github.com/nektro/zigmod/releases17- https://github.com/nektro/zigmod/releases
1818
19## Built With19## Built With
20- Zig master (at least `0.11.0-dev.2777+b95cdf0ae`)20- Zig master (at least `0.11.0-dev.3620+c76ce25a6`)
21- See [`zig.mod`](./zig.mod) and [`zigmod.lock`](./zigmod.lock)21- See [`zig.mod`](./zig.mod) and [`zigmod.lock`](./zigmod.lock)
2222
23### Build from Source23### Build from Source
deps.zig+14-21
...@@ -57,18 +57,17 @@ pub fn fetch(exe: *std.build.LibExeObjStep) void {...@@ -57,18 +57,17 @@ pub fn fetch(exe: *std.build.LibExeObjStep) void {
57 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/MasterQ32/zig-uri", "d4299ad6043ad19f2ce0676687b0bff57273eae2").step);57 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/MasterQ32/zig-uri", "d4299ad6043ad19f2ce0676687b0bff57273eae2").step);
58 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/marlersoft/zigwin32", "b70e7f818d77a0c0f39b0bd9c549e16439ff5780").step);58 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/marlersoft/zigwin32", "b70e7f818d77a0c0f39b0bd9c549e16439ff5780").step);
59 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/arqv-ini", "ee395fd34e152d9067def609d86b7af5382b83b1").step);59 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/arqv-ini", "ee395fd34e152d9067def609d86b7af5382b83b1").step);
60 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/iguanaTLS", "9356ff1d2edf627b531a2829a679a7b6d908a6ca").step);60 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/iguanaTLS", "e70995575b397f33d798339d4f1656bcdf0ab82f").step);
61 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-ansi", "faf9585bfe5980c24748ee8a3e6a22faaa50b437").step);61 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-ansi", "faf9585bfe5980c24748ee8a3e6a22faaa50b437").step);
62 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-detect-license", "8f13721bd18c0e546841b6f2e11da839550d6287").step);62 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-detect-license", "8f13721bd18c0e546841b6f2e11da839550d6287").step);
63 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-extras", "a74468be60283e66e9b20388372394b54219d6b0").step);63 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-extras", "ff267312e8d714c9b9d8c44ad3291f6e509dc12f").step);
64 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-inquirer", "5cc2a5565d04fe2c0085f0d6818590e800d9dcf7").step);64 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-inquirer", "5cc2a5565d04fe2c0085f0d6818590e800d9dcf7").step);
65 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-json", "b0111b41d725682629b7f899b90500ddad3818bf").step);
66 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-leven", "550cabd5a18ace5e67761bc5b867c10e926f4314").step);65 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-leven", "550cabd5a18ace5e67761bc5b867c10e926f4314").step);
67 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-licenses", "c9b8cbf3565675a056ad4e9b57cb4f84020e7680").step);66 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-licenses", "c9b8cbf3565675a056ad4e9b57cb4f84020e7680").step);
68 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-licenses-text", "3c07c6e4eb0965dafd0b029c632f823631b3169c").step);67 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-licenses-text", "3c07c6e4eb0965dafd0b029c632f823631b3169c").step);
69 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-range", "4b2f12808aa09be4b27a163efc424dd4e0415992").step);68 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-range", "4b2f12808aa09be4b27a163efc424dd4e0415992").step);
70 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-time", "6094c777eb7b7fbadbf5102f3872d3ad0a2a630e").step);69 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-time", "ca9c0e6b644d74c1d549cc2c1ee22113aa021bd8").step);
71 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-yaml", "3f3641e90697546e7f8aeef365815c4ccab168b0").step);70 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-yaml", "e56b9fed6c0afd1c4d29bedc08c3899ffe1165e9").step);
72 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/truemedian/hzzp", "501386e13b2f7849128f3b271d23de6127b1d9d7").step);71 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/truemedian/hzzp", "501386e13b2f7849128f3b271d23de6127b1d9d7").step);
73 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/truemedian/zfetch", "829973144f680cd16be16923041fa810c1dee417").step);72 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/truemedian/zfetch", "829973144f680cd16be16923041fa810c1dee417").step);
74 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/ziglibs/known-folders", "d13ba6137084e55f873f6afb67447fe8906cc951").step);73 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/ziglibs/known-folders", "d13ba6137084e55f873f6afb67447fe8906cc951").step);
...@@ -158,7 +157,7 @@ pub const Package = struct {...@@ -158,7 +157,7 @@ pub const Package = struct {
158};157};
159158
160fn checkMinZig(current: std.SemanticVersion, exe: *std.build.LibExeObjStep) void {159fn checkMinZig(current: std.SemanticVersion, exe: *std.build.LibExeObjStep) void {
161 const min = std.SemanticVersion.parse("0.11.0-dev.2777+b95cdf0ae") catch return;160 const min = std.SemanticVersion.parse("0.11.0-dev.3620+c76ce25a6") catch return;
162 if (current.order(min).compare(.lt)) @panic(exe.step.owner.fmt("Your Zig version v{} does not meet the minimum build requirement of v{}", .{current, min}));161 if (current.order(min).compare(.lt)) @panic(exe.step.owner.fmt("Your Zig version v{} does not meet the minimum build requirement of v{}", .{current, min}));
163}162}
164163
...@@ -179,9 +178,9 @@ pub const package_data = struct {...@@ -179,9 +178,9 @@ pub const package_data = struct {
179 .entry = "/git/github.com/nektro/arqv-ini/ee395fd34e152d9067def609d86b7af5382b83b1/src/ini.zig",178 .entry = "/git/github.com/nektro/arqv-ini/ee395fd34e152d9067def609d86b7af5382b83b1/src/ini.zig",
180 };179 };
181 pub var _csbnipaad8n7 = Package{180 pub var _csbnipaad8n7 = Package{
182 .store = "/git/github.com/nektro/iguanaTLS/9356ff1d2edf627b531a2829a679a7b6d908a6ca",181 .store = "/git/github.com/nektro/iguanaTLS/e70995575b397f33d798339d4f1656bcdf0ab82f",
183 .name = "iguanaTLS",182 .name = "iguanaTLS",
184 .entry = "/git/github.com/nektro/iguanaTLS/9356ff1d2edf627b531a2829a679a7b6d908a6ca/src/main.zig",183 .entry = "/git/github.com/nektro/iguanaTLS/e70995575b397f33d798339d4f1656bcdf0ab82f/src/main.zig",
185 };184 };
186 pub var _s84v9o48ucb0 = Package{185 pub var _s84v9o48ucb0 = Package{
187 .store = "/git/github.com/nektro/zig-ansi/faf9585bfe5980c24748ee8a3e6a22faaa50b437",186 .store = "/git/github.com/nektro/zig-ansi/faf9585bfe5980c24748ee8a3e6a22faaa50b437",
...@@ -189,15 +188,9 @@ pub const package_data = struct {...@@ -189,15 +188,9 @@ pub const package_data = struct {
189 .entry = "/git/github.com/nektro/zig-ansi/faf9585bfe5980c24748ee8a3e6a22faaa50b437/src/lib.zig",188 .entry = "/git/github.com/nektro/zig-ansi/faf9585bfe5980c24748ee8a3e6a22faaa50b437/src/lib.zig",
190 };189 };
191 pub var _f7dubzb7cyqe = Package{190 pub var _f7dubzb7cyqe = Package{
192 .store = "/git/github.com/nektro/zig-extras/a74468be60283e66e9b20388372394b54219d6b0",191 .store = "/git/github.com/nektro/zig-extras/ff267312e8d714c9b9d8c44ad3291f6e509dc12f",
193 .name = "extras",192 .name = "extras",
194 .entry = "/git/github.com/nektro/zig-extras/a74468be60283e66e9b20388372394b54219d6b0/src/lib.zig",193 .entry = "/git/github.com/nektro/zig-extras/ff267312e8d714c9b9d8c44ad3291f6e509dc12f/src/lib.zig",
195 };
196 pub var _ocmr9rtohgcc = Package{
197 .store = "/git/github.com/nektro/zig-json/b0111b41d725682629b7f899b90500ddad3818bf",
198 .name = "json",
199 .entry = "/git/github.com/nektro/zig-json/b0111b41d725682629b7f899b90500ddad3818bf/src/lib.zig",
200 .deps = &[_]*Package{ &_f7dubzb7cyqe },
201 };194 };
202 pub var _0npcrzfdlrvk = Package{195 pub var _0npcrzfdlrvk = Package{
203 .store = "/git/github.com/nektro/zig-licenses/c9b8cbf3565675a056ad4e9b57cb4f84020e7680",196 .store = "/git/github.com/nektro/zig-licenses/c9b8cbf3565675a056ad4e9b57cb4f84020e7680",
...@@ -233,15 +226,15 @@ pub const package_data = struct {...@@ -233,15 +226,15 @@ pub const package_data = struct {
233 .deps = &[_]*Package{ &_pt88y5d80m25, &_96h80ezrvj7i },226 .deps = &[_]*Package{ &_pt88y5d80m25, &_96h80ezrvj7i },
234 };227 };
235 pub var _iecwp4b3bsfm = Package{228 pub var _iecwp4b3bsfm = Package{
236 .store = "/git/github.com/nektro/zig-time/6094c777eb7b7fbadbf5102f3872d3ad0a2a630e",229 .store = "/git/github.com/nektro/zig-time/ca9c0e6b644d74c1d549cc2c1ee22113aa021bd8",
237 .name = "time",230 .name = "time",
238 .entry = "/git/github.com/nektro/zig-time/6094c777eb7b7fbadbf5102f3872d3ad0a2a630e/time.zig",231 .entry = "/git/github.com/nektro/zig-time/ca9c0e6b644d74c1d549cc2c1ee22113aa021bd8/time.zig",
239 .deps = &[_]*Package{ &_f7dubzb7cyqe },232 .deps = &[_]*Package{ &_f7dubzb7cyqe },
240 };233 };
241 pub var _g982zq6e8wsv = Package{234 pub var _g982zq6e8wsv = Package{
242 .store = "/git/github.com/nektro/zig-yaml/3f3641e90697546e7f8aeef365815c4ccab168b0",235 .store = "/git/github.com/nektro/zig-yaml/e56b9fed6c0afd1c4d29bedc08c3899ffe1165e9",
243 .name = "yaml",236 .name = "yaml",
244 .entry = "/git/github.com/nektro/zig-yaml/3f3641e90697546e7f8aeef365815c4ccab168b0/yaml.zig",237 .entry = "/git/github.com/nektro/zig-yaml/e56b9fed6c0afd1c4d29bedc08c3899ffe1165e9/yaml.zig",
245 .deps = &[_]*Package{ &_f7dubzb7cyqe },238 .deps = &[_]*Package{ &_f7dubzb7cyqe },
246 };239 };
247 pub var _9k24gimke1an = Package{240 pub var _9k24gimke1an = Package{
...@@ -263,7 +256,7 @@ pub const package_data = struct {...@@ -263,7 +256,7 @@ pub const package_data = struct {
263 pub var _89ujp8gq842x = Package{256 pub var _89ujp8gq842x = Package{
264 .name = "zigmod",257 .name = "zigmod",
265 .entry = "/../..//src/lib.zig",258 .entry = "/../..//src/lib.zig",
266 .deps = &[_]*Package{ &_g982zq6e8wsv, &_s84v9o48ucb0, &_2ta738wrqbaq, &_0npcrzfdlrvk, &_ejw82j2ipa0e, &_ocmr9rtohgcc, &_2ovav391ivak, &_c1xirp1ota5p, &_u7sysdckdymi, &_iecwp4b3bsfm, &_f7dubzb7cyqe },259 .deps = &[_]*Package{ &_g982zq6e8wsv, &_s84v9o48ucb0, &_2ta738wrqbaq, &_0npcrzfdlrvk, &_ejw82j2ipa0e, &_2ovav391ivak, &_c1xirp1ota5p, &_u7sysdckdymi, &_iecwp4b3bsfm, &_f7dubzb7cyqe },
267 };260 };
268 pub var _root = Package{261 pub var _root = Package{
269 };262 };
docs/README.md+1-1
...@@ -10,7 +10,7 @@ The rest of this documentation will assume you already have Zig installed....@@ -10,7 +10,7 @@ The rest of this documentation will assume you already have Zig installed.
1010
11As Zig is still in development itself, if you plan to contribute to Zigmod you will need a master download of Zig. Those can be obtained from https://ziglang.org/download/#release-master.11As Zig is still in development itself, if you plan to contribute to Zigmod you will need a master download of Zig. Those can be obtained from https://ziglang.org/download/#release-master.
1212
13The earliest Zig release this Zigmod was verified to work with is `0.11.0-dev.2777+b95cdf0ae`.13The earliest Zig release this Zigmod was verified to work with is `0.11.0-dev.3620+c76ce25a6`.
1414
15## Download15## Download
16You may download a precompiled binary from https://github.com/nektro/zigmod/releases or build the project from source.16You may download a precompiled binary from https://github.com/nektro/zigmod/releases or build the project from source.
licenses.txt-1
...@@ -9,7 +9,6 @@ MIT:...@@ -9,7 +9,6 @@ MIT:
9- git https://github.com/nektro/zig-detect-license9- git https://github.com/nektro/zig-detect-license
10- git https://github.com/nektro/zig-extras10- git https://github.com/nektro/zig-extras
11- git https://github.com/nektro/zig-inquirer11- git https://github.com/nektro/zig-inquirer
12- git https://github.com/nektro/zig-json
13- git https://github.com/nektro/zig-leven12- git https://github.com/nektro/zig-leven
14- git https://github.com/nektro/zig-licenses13- git https://github.com/nektro/zig-licenses
15- git https://github.com/nektro/zig-licenses-text14- git https://github.com/nektro/zig-licenses-text
src/cmd/aq.zig+5-5
...@@ -2,7 +2,7 @@ const std = @import("std");...@@ -2,7 +2,7 @@ const std = @import("std");
2const string = []const u8;2const string = []const u8;
3const gpa = std.heap.c_allocator;3const gpa = std.heap.c_allocator;
4const zfetch = @import("zfetch");4const zfetch = @import("zfetch");
5const json = @import("json");5const extras = @import("extras");
66
7const u = @import("./../util/index.zig");7const u = @import("./../util/index.zig");
88
...@@ -43,7 +43,7 @@ pub fn execute(args: [][]u8) !void {...@@ -43,7 +43,7 @@ pub fn execute(args: [][]u8) !void {
43 u.fail("unknown command \"{s}\" for \"zigmod aq\"", .{args[0]});43 u.fail("unknown command \"{s}\" for \"zigmod aq\"", .{args[0]});
44}44}
4545
46pub fn server_fetch(url: string) !json.Value {46pub fn server_fetch(url: string) !std.json.ValueTree {
47 const req = try zfetch.Request.init(gpa, url, null);47 const req = try zfetch.Request.init(gpa, url, null);
48 defer req.deinit();48 defer req.deinit();
4949
...@@ -55,10 +55,10 @@ pub fn server_fetch(url: string) !json.Value {...@@ -55,10 +55,10 @@ pub fn server_fetch(url: string) !json.Value {
5555
56 const r = req.reader();56 const r = req.reader();
57 const body_content = try r.readAllAlloc(gpa, std.math.maxInt(usize));57 const body_content = try r.readAllAlloc(gpa, std.math.maxInt(usize));
58 const val = try json.parse(gpa, body_content);58 const val = try extras.parse_json(gpa, body_content);
5959
60 if (val.getT("message", .String)) |msg| {60 if (val.root.object.get("message")) |msg| {
61 std.log.err("server: {s}", .{msg});61 std.log.err("server: {s}", .{msg.string});
62 return error.AquilaBadResponse;62 return error.AquilaBadResponse;
63 }63 }
64 return val;64 return val;
src/cmd/aquila/add.zig+2-2
...@@ -19,8 +19,8 @@ pub fn do(dir: std.fs.Dir, pkg_id: string) !string {...@@ -19,8 +19,8 @@ pub fn do(dir: std.fs.Dir, pkg_id: string) !string {
19 const val = try aq.server_fetch(url);19 const val = try aq.server_fetch(url);
2020
21 const pkg_url = try std.fmt.allocPrint(gpa, "https://{s}/{s}", .{21 const pkg_url = try std.fmt.allocPrint(gpa, "https://{s}/{s}", .{
22 val.getT(.{ "repo", "domain" }, .String).?,22 val.root.object.get("repo").?.object.get("domain").?.string,
23 val.getT(.{ "package", "remote_name" }, .String).?,23 val.root.object.get("package").?.object.get("remote_name").?.string,
24 });24 });
2525
26 const m = try zigmod.ModFile.from_dir(gpa, dir);26 const m = try zigmod.ModFile.from_dir(gpa, dir);
src/cmd/fetch.zig+1-1
...@@ -165,7 +165,7 @@ fn create_lockfile(alloc: std.mem.Allocator, list: *std.ArrayList(zigmod.Module)...@@ -165,7 +165,7 @@ fn create_lockfile(alloc: std.mem.Allocator, list: *std.ArrayList(zigmod.Module)
165 const fl = try dir.createFile("zigmod.lock", .{});165 const fl = try dir.createFile("zigmod.lock", .{});
166 defer fl.close();166 defer fl.close();
167167
168 std.sort.sort(zigmod.Module, list.items, {}, zigmod.Module.lessThan);168 std.mem.sort(zigmod.Module, list.items, {}, zigmod.Module.lessThan);
169169
170 const wl = fl.writer();170 const wl = fl.writer();
171 try wl.writeAll("2\n");171 try wl.writeAll("2\n");
src/cmd/generate.zig+1-1
...@@ -26,7 +26,7 @@ pub fn execute(args: [][]u8) !void {...@@ -26,7 +26,7 @@ pub fn execute(args: [][]u8) !void {
26 var list = std.ArrayList(zigmod.Module).init(gpa);26 var list = std.ArrayList(zigmod.Module).init(gpa);
27 try common.collect_pkgs(top_module, &list);27 try common.collect_pkgs(top_module, &list);
2828
29 std.sort.sort(zigmod.Module, list.items, {}, zigmod.Module.lessThan);29 std.mem.sort(zigmod.Module, list.items, {}, zigmod.Module.lessThan);
3030
31 try create_depszig(gpa, cachepath, dir, top_module, list.items);31 try create_depszig(gpa, cachepath, dir, top_module, list.items);
32}32}
src/cmd/license.zig+1-1
...@@ -29,7 +29,7 @@ pub fn execute(args: [][]u8) !void {...@@ -29,7 +29,7 @@ pub fn execute(args: [][]u8) !void {
29 var master_list = List.init(gpa);29 var master_list = List.init(gpa);
30 errdefer master_list.deinit();30 errdefer master_list.deinit();
31 try common.collect_pkgs(top_module, &master_list);31 try common.collect_pkgs(top_module, &master_list);
32 std.sort.sort(zigmod.Module, master_list.items, {}, zigmod.Module.lessThan);32 std.mem.sort(zigmod.Module, master_list.items, {}, zigmod.Module.lessThan);
3333
34 var map = Map.init(gpa);34 var map = Map.init(gpa);
35 errdefer map.deinit();35 errdefer map.deinit();
src/cmd/zpm.zig+20-21
...@@ -2,7 +2,7 @@ const std = @import("std");...@@ -2,7 +2,7 @@ const std = @import("std");
2const string = []const u8;2const string = []const u8;
3const gpa = std.heap.c_allocator;3const gpa = std.heap.c_allocator;
4const zfetch = @import("zfetch");4const zfetch = @import("zfetch");
5const json = @import("json");5const extras = @import("extras");
66
7const u = @import("./../util/index.zig");7const u = @import("./../util/index.zig");
88
...@@ -55,14 +55,13 @@ pub fn execute(args: [][]u8) !void {...@@ -55,14 +55,13 @@ pub fn execute(args: [][]u8) !void {
55 u.fail("unknown command \"{s}\" for \"zigmod zpm\"", .{args[0]});55 u.fail("unknown command \"{s}\" for \"zigmod zpm\"", .{args[0]});
56}56}
5757
58pub fn server_fetch(url: string) !json.Value {58pub fn server_fetch(url: string) !std.json.ValueTree {
59 const req = try zfetch.Request.init(gpa, url, null);59 const req = try zfetch.Request.init(gpa, url, null);
60 defer req.deinit();60 defer req.deinit();
61 try req.do(.GET, null, null);61 try req.do(.GET, null, null);
62 const r = req.reader();62 const r = req.reader();
63 const body_content = try r.readAllAlloc(gpa, std.math.maxInt(usize));63 const body_content = try r.readAllAlloc(gpa, std.math.maxInt(usize));
64 const val = try json.parse(gpa, body_content);64 return extras.parse_json(gpa, body_content);
65 return val;
66}65}
6766
68pub fn server_fetchArray(url: string) ![]const Package {67pub fn server_fetchArray(url: string) ![]const Package {
...@@ -70,39 +69,39 @@ pub fn server_fetchArray(url: string) ![]const Package {...@@ -70,39 +69,39 @@ pub fn server_fetchArray(url: string) ![]const Package {
70 var list = std.ArrayList(Package).init(gpa);69 var list = std.ArrayList(Package).init(gpa);
71 errdefer list.deinit();70 errdefer list.deinit();
7271
73 for (val.Array) |item| {72 for (val.root.array.items) |item| {
74 if (item.getT("root_file", .String) == null) continue;73 if (item.object.get("root_file") == null) continue;
75 try list.append(Package{74 try list.append(Package{
76 .name = item.getT("name", .String).?,75 .name = item.object.get("name").?.string,
77 .author = item.getT("author", .String).?,76 .author = item.object.get("author").?.string,
78 .description = item.getT("description", .String).?,77 .description = item.object.get("description").?.string,
79 .tags = try valueStrArray(item.getT("tags", .Array).?),78 .tags = try valueStrArray(item.object.get("tags").?.array.items),
80 .git = item.getT("git", .String).?,79 .git = item.object.get("git").?.string,
81 .root_file = item.getT("root_file", .String).?,80 .root_file = item.object.get("root_file").?.string,
82 .source = @intCast(u32, item.getT("source", .Int).?),81 .source = @intCast(u32, item.object.get("source").?.integer),
83 .links = try valueLinks(item.get("links").?),82 .links = try valueLinks(item.object.get("links").?),
84 });83 });
85 }84 }
86 return list.toOwnedSlice();85 return list.toOwnedSlice();
87}86}
8887
89fn valueStrArray(vals: []json.Value) ![]string {88fn valueStrArray(vals: []std.json.Value) ![]string {
90 var list = std.ArrayList(string).init(gpa);89 var list = std.ArrayList(string).init(gpa);
91 errdefer list.deinit();90 errdefer list.deinit();
9291
93 for (vals) |item| {92 for (vals) |item| {
94 if (item != .String) continue;93 if (item != .string) continue;
95 try list.append(item.String);94 try list.append(item.string);
96 }95 }
97 return list.toOwnedSlice();96 return list.toOwnedSlice();
98}97}
9998
100fn valueLinks(vals: json.Value) ![]?string {99fn valueLinks(vals: std.json.Value) ![]?string {
101 var list = std.ArrayList(?string).init(gpa);100 var list = std.ArrayList(?string).init(gpa);
102 errdefer list.deinit();101 errdefer list.deinit();
103102
104 try list.append(vals.getT("github", .String));103 if (vals.object.get("github")) |x| try list.append(x.string);
105 try list.append(vals.getT("aquila", .String));104 if (vals.object.get("aquila")) |x| try list.append(x.string);
106 try list.append(vals.getT("astrolabe", .String));105 if (vals.object.get("astrolabe")) |x| try list.append(x.string);
107 return list.toOwnedSlice();106 return list.toOwnedSlice();
108}107}
src/cmd/zpm/tags.zig+5-5
...@@ -17,8 +17,8 @@ pub fn execute(args: [][]u8) !void {...@@ -17,8 +17,8 @@ pub fn execute(args: [][]u8) !void {
1717
18 const name_col_width = blk: {18 const name_col_width = blk: {
19 var w: usize = 4;19 var w: usize = 4;
20 for (val.Array) |tag| {20 for (val.root.array.items) |tag| {
21 const len = tag.getT("name", .String).?.len;21 const len = tag.object.get("name").?.string.len;
22 if (len > w) {22 if (len > w) {
23 w = len;23 w = len;
24 }24 }
...@@ -30,11 +30,11 @@ pub fn execute(args: [][]u8) !void {...@@ -30,11 +30,11 @@ pub fn execute(args: [][]u8) !void {
30 try print_c_n(out, ' ', name_col_width - 4);30 try print_c_n(out, ' ', name_col_width - 4);
31 try out.writeAll("DESCRIPTION\n");31 try out.writeAll("DESCRIPTION\n");
3232
33 for (val.Array) |tag| {33 for (val.root.array.items) |tag| {
34 const name = tag.getT("name", .String).?;34 const name = tag.object.get("name").?.string;
35 try out.writeAll(name);35 try out.writeAll(name);
36 try print_c_n(out, ' ', name_col_width - name.len);36 try print_c_n(out, ' ', name_col_width - name.len);
37 try out.writeAll(tag.getT("description", .String).?);37 try out.writeAll(tag.object.get("description").?.string);
38 try out.writeAll("\n");38 try out.writeAll("\n");
39 }39 }
40}40}
src/common.zig+1-1
...@@ -297,7 +297,7 @@ pub fn add_files_package(alloc: std.mem.Allocator, cachepath: string, pkg_name:...@@ -297,7 +297,7 @@ pub fn add_files_package(alloc: std.mem.Allocator, cachepath: string, pkg_name:
297 var walker = try dir.walk(alloc);297 var walker = try dir.walk(alloc);
298 defer walker.deinit();298 defer walker.deinit();
299 while (try walker.next()) |p| {299 while (try walker.next()) |p| {
300 if (p.kind == .Directory) {300 if (p.kind == .directory) {
301 continue;301 continue;
302 }302 }
303 const path = try alloc.dupe(u8, p.path);303 const path = try alloc.dupe(u8, p.path);
src/util/funcs.zig+1-1
...@@ -53,7 +53,7 @@ pub fn does_folder_exist(fpath: string) !bool {...@@ -53,7 +53,7 @@ pub fn does_folder_exist(fpath: string) !bool {
53 };53 };
54 defer file.close();54 defer file.close();
55 const s = try file.stat();55 const s = try file.stat();
56 if (s.kind != .Directory) {56 if (s.kind != .directory) {
57 return false;57 return false;
58 }58 }
59 return true;59 return true;
src/util/module.zig+1-1
...@@ -74,7 +74,7 @@ pub const Module = struct {...@@ -74,7 +74,7 @@ pub const Module = struct {
74 try file_list_2.append(_b);74 try file_list_2.append(_b);
75 }75 }
7676
77 std.sort.sort(string, file_list_2.items, void{}, struct {77 std.mem.sort(string, file_list_2.items, void{}, struct {
78 pub fn lt(context: void, lhs: string, rhs: string) bool {78 pub fn lt(context: void, lhs: string, rhs: string) bool {
79 _ = context;79 _ = context;
80 return std.mem.lessThan(u8, lhs, rhs);80 return std.mem.lessThan(u8, lhs, rhs);
zig.mod+1-2
...@@ -3,14 +3,13 @@ name: zigmod...@@ -3,14 +3,13 @@ name: zigmod
3main: src/lib.zig3main: src/lib.zig
4license: MIT4license: MIT
5description: A package manager for the Zig programming language.5description: A package manager for the Zig programming language.
6min_zig_version: 0.11.0-dev.2777+b95cdf0ae6min_zig_version: 0.11.0-dev.3620+c76ce25a6
7dependencies:7dependencies:
8 - src: git https://github.com/nektro/zig-yaml8 - src: git https://github.com/nektro/zig-yaml
9 - src: git https://github.com/nektro/zig-ansi9 - src: git https://github.com/nektro/zig-ansi
10 - src: git https://github.com/ziglibs/known-folders10 - src: git https://github.com/ziglibs/known-folders
11 - src: git https://github.com/nektro/zig-licenses11 - src: git https://github.com/nektro/zig-licenses
12 - src: git https://github.com/truemedian/zfetch12 - src: git https://github.com/truemedian/zfetch
13 - src: git https://github.com/nektro/zig-json
14 - src: git https://github.com/nektro/zig-detect-license13 - src: git https://github.com/nektro/zig-detect-license
15 - src: git https://github.com/nektro/zig-inquirer14 - src: git https://github.com/nektro/zig-inquirer
16 - src: git https://github.com/nektro/arqv-ini15 - src: git https://github.com/nektro/arqv-ini
zigmod.lock+4-5
...@@ -2,18 +2,17 @@...@@ -2,18 +2,17 @@
2git https://github.com/MasterQ32/zig-uri commit-d4299ad6043ad19f2ce0676687b0bff57273eae22git https://github.com/MasterQ32/zig-uri commit-d4299ad6043ad19f2ce0676687b0bff57273eae2
3git https://github.com/marlersoft/zigwin32 commit-b70e7f818d77a0c0f39b0bd9c549e16439ff57803git https://github.com/marlersoft/zigwin32 commit-b70e7f818d77a0c0f39b0bd9c549e16439ff5780
4git https://github.com/nektro/arqv-ini commit-ee395fd34e152d9067def609d86b7af5382b83b14git https://github.com/nektro/arqv-ini commit-ee395fd34e152d9067def609d86b7af5382b83b1
5git https://github.com/nektro/iguanaTLS commit-9356ff1d2edf627b531a2829a679a7b6d908a6ca5git https://github.com/nektro/iguanaTLS commit-e70995575b397f33d798339d4f1656bcdf0ab82f
6git https://github.com/nektro/zig-ansi commit-faf9585bfe5980c24748ee8a3e6a22faaa50b4376git https://github.com/nektro/zig-ansi commit-faf9585bfe5980c24748ee8a3e6a22faaa50b437
7git https://github.com/nektro/zig-detect-license commit-8f13721bd18c0e546841b6f2e11da839550d62877git https://github.com/nektro/zig-detect-license commit-8f13721bd18c0e546841b6f2e11da839550d6287
8git https://github.com/nektro/zig-extras commit-a74468be60283e66e9b20388372394b54219d6b08git https://github.com/nektro/zig-extras commit-ff267312e8d714c9b9d8c44ad3291f6e509dc12f
9git https://github.com/nektro/zig-inquirer commit-5cc2a5565d04fe2c0085f0d6818590e800d9dcf79git https://github.com/nektro/zig-inquirer commit-5cc2a5565d04fe2c0085f0d6818590e800d9dcf7
10git https://github.com/nektro/zig-json commit-b0111b41d725682629b7f899b90500ddad3818bf
11git https://github.com/nektro/zig-leven commit-550cabd5a18ace5e67761bc5b867c10e926f431410git https://github.com/nektro/zig-leven commit-550cabd5a18ace5e67761bc5b867c10e926f4314
12git https://github.com/nektro/zig-licenses commit-c9b8cbf3565675a056ad4e9b57cb4f84020e768011git https://github.com/nektro/zig-licenses commit-c9b8cbf3565675a056ad4e9b57cb4f84020e7680
13git https://github.com/nektro/zig-licenses-text commit-3c07c6e4eb0965dafd0b029c632f823631b3169c12git https://github.com/nektro/zig-licenses-text commit-3c07c6e4eb0965dafd0b029c632f823631b3169c
14git https://github.com/nektro/zig-range commit-4b2f12808aa09be4b27a163efc424dd4e041599213git https://github.com/nektro/zig-range commit-4b2f12808aa09be4b27a163efc424dd4e0415992
15git https://github.com/nektro/zig-time commit-6094c777eb7b7fbadbf5102f3872d3ad0a2a630e14git https://github.com/nektro/zig-time commit-ca9c0e6b644d74c1d549cc2c1ee22113aa021bd8
16git https://github.com/nektro/zig-yaml commit-3f3641e90697546e7f8aeef365815c4ccab168b015git https://github.com/nektro/zig-yaml commit-e56b9fed6c0afd1c4d29bedc08c3899ffe1165e9
17git https://github.com/truemedian/hzzp commit-501386e13b2f7849128f3b271d23de6127b1d9d716git https://github.com/truemedian/hzzp commit-501386e13b2f7849128f3b271d23de6127b1d9d7
18git https://github.com/truemedian/zfetch commit-829973144f680cd16be16923041fa810c1dee41717git https://github.com/truemedian/zfetch commit-829973144f680cd16be16923041fa810c1dee417
19git https://github.com/ziglibs/known-folders commit-d13ba6137084e55f873f6afb67447fe8906cc95118git https://github.com/ziglibs/known-folders commit-d13ba6137084e55f873f6afb67447fe8906cc951