authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-12-24 19:03:28 -08:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-12-24 19:03:28 -08:00
log871fced6184a0b08d52532c20554008e46b27834
treefaa45d25157a741a269f016cf97b540cc799e52d
parent3963f4a00d3283500db05895bf3c9c1d52f16a8d

update to Zig 0.9.0

closes #40

14 files changed, 47 insertions(+), 47 deletions(-)

.circleci/config.yml+1-1
......@@ -15,7 +15,7 @@ jobs:
1515 - run: git submodule update --init --recursive
1616
1717 - run: apt -y install xz-utils jq
18 - run: ./download_zig.sh 0.9.0-dev.1815+20e19e75f
18 - run: ./download_zig.sh 0.9.0
1919 - run: zig version
2020 - run: zig env
2121 - run: zig build -Dbootstrap
.github/workflows/nightly.yml+1-1
......@@ -28,7 +28,7 @@ jobs:
2828 - name: Setup Zig
2929 uses: goto-bus-stop/setup-zig@v1
3030 with:
31 version: 0.9.0-dev.1815+20e19e75f
31 version: "0.9.0"
3232
3333 - run: zig version
3434 - run: zig env
README.md+1-1
......@@ -17,7 +17,7 @@ A package manager for the Zig programming language.
1717- https://github.com/nektro/zigmod/releases
1818
1919## Built With
20- Zig master `0.9.0-dev.1524+d2f9646d9`
20- Zig master `0.9.0`
2121- See [`zig.mod`](./zig.mod)
2222
2323### Build from Source
docs/README.md+1-1
......@@ -10,7 +10,7 @@ The rest of this documentation will assume you already have Zig installed.
1010
1111As 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.9.0-dev.1524+d2f9646d9`.
13The earliest Zig release this Zigmod was verified to work with is `0.9.0`.
1414
1515## Download
1616You may download a precompiled binary from https://github.com/nektro/zigmod/releases or build the project from source.
src/cmd/aq.zig+1-1
......@@ -20,7 +20,7 @@ pub const server_root = "https://aquila.red";
2020
2121pub fn execute(args: [][]u8) !void {
2222 if (args.len == 0) {
23 std.debug.warn("{s}\n", .{
23 std.debug.print("{s}\n", .{
2424 \\This is a subcommand for use with https://github.com/nektro/aquila instances but has no default behavior on its own aside from showing you this nice help text.
2525 \\
2626 \\The default remote is https://aquila.red.
src/cmd/zpm.zig+1-1
......@@ -30,7 +30,7 @@ pub const Package = struct {
3030
3131pub fn execute(args: [][]u8) !void {
3232 if (args.len == 0) {
33 std.debug.warn("{s}\n", .{
33 std.debug.print("{s}\n", .{
3434 \\This is a subcommand for use with https://github.com/zigtools/zpm-server instances but has no default behavior on its own aside from showing you this nice help text.
3535 \\
3636 \\The default remote is https://zpm.random-projects.net/.
src/common.zig+4-4
......@@ -19,7 +19,7 @@ pub const CollectOptions = struct {
1919 log: bool,
2020 update: bool,
2121 lock: ?[]const [4]string = null,
22 alloc: *std.mem.Allocator,
22 alloc: std.mem.Allocator,
2323 already_fetched: *std.ArrayList(string) = undefined,
2424
2525 pub fn init(self: *CollectOptions) !void {
......@@ -286,7 +286,7 @@ pub fn get_module_from_dep(d: *zigmod.Dep, cachepath: string, options: *CollectO
286286 }
287287}
288288
289pub fn add_files_package(alloc: *std.mem.Allocator, cachepath: string, pkg_name: string, mdir: std.fs.Dir, dirs: []const string) !zigmod.Module {
289pub fn add_files_package(alloc: std.mem.Allocator, cachepath: string, pkg_name: string, mdir: std.fs.Dir, dirs: []const string) !zigmod.Module {
290290 const fname = try std.mem.join(alloc, "", &.{ pkg_name, ".zig" });
291291
292292 const map = &std.StringHashMap(string).init(alloc);
......@@ -300,7 +300,7 @@ pub fn add_files_package(alloc: *std.mem.Allocator, cachepath: string, pkg_name:
300300 if (p.kind == .Directory) {
301301 continue;
302302 }
303 const path = try std.mem.dupe(alloc, u8, p.path);
303 const path = try alloc.dupe(u8, p.path);
304304 try map.put(path, try std.fmt.allocPrint(alloc, "{s}/{s}", .{ dir_path, path }));
305305 }
306306 }
......@@ -350,7 +350,7 @@ pub fn add_files_package(alloc: *std.mem.Allocator, cachepath: string, pkg_name:
350350 return (try get_module_from_dep(&d, filesdestpath, &options)).?;
351351}
352352
353pub fn parse_lockfile(alloc: *std.mem.Allocator, dir: std.fs.Dir) ![]const [4]string {
353pub fn parse_lockfile(alloc: std.mem.Allocator, dir: std.fs.Dir) ![]const [4]string {
354354 var list = std.ArrayList([4]string).init(alloc);
355355 const max = std.math.maxInt(usize);
356356 const f = try dir.openFile("zigmod.lock", .{});
src/util/dep.zig+1-1
......@@ -12,7 +12,7 @@ const yaml = @import("./yaml.zig");
1212pub const Dep = struct {
1313 const Self = @This();
1414
15 alloc: *std.mem.Allocator,
15 alloc: std.mem.Allocator,
1616 type: zigmod.DepType,
1717 path: string,
1818 id: string,
src/util/dep_type.zig+3-3
......@@ -32,7 +32,7 @@ pub const DepType = enum {
3232 // hypercore, // https://hypercore-protocol.org/
3333
3434 // zig fmt: on
35 pub fn pull(self: DepType, alloc: *std.mem.Allocator, rpath: string, dpath: string) !void {
35 pub fn pull(self: DepType, alloc: std.mem.Allocator, rpath: string, dpath: string) !void {
3636 switch (self) {
3737 .local => {},
3838 .system_lib => {},
......@@ -57,7 +57,7 @@ pub const DepType = enum {
5757 }
5858
5959 // zig fmt: on
60 pub fn update(self: DepType, alloc: *std.mem.Allocator, dpath: string, rpath: string) !void {
60 pub fn update(self: DepType, alloc: std.mem.Allocator, dpath: string, rpath: string) !void {
6161 _ = rpath;
6262
6363 switch (self) {
......@@ -77,7 +77,7 @@ pub const DepType = enum {
7777 }
7878
7979 // zig fmt: on
80 pub fn exact_version(self: DepType, alloc: *std.mem.Allocator, mpath: string) !string {
80 pub fn exact_version(self: DepType, alloc: std.mem.Allocator, mpath: string) !string {
8181 var mdir = try std.fs.cwd().openDir(mpath, .{});
8282 defer mdir.close();
8383 return switch (self) {
src/util/funcs.zig+11-11
......@@ -37,7 +37,7 @@ pub fn try_index(comptime T: type, array: []T, n: usize, def: T) T {
3737 return array[n];
3838}
3939
40pub fn split(alloc: *std.mem.Allocator, in: string, delim: string) ![]string {
40pub fn split(alloc: std.mem.Allocator, in: string, delim: string) ![]string {
4141 var list = std.ArrayList(string).init(alloc);
4242 defer list.deinit();
4343
......@@ -113,7 +113,7 @@ pub fn list_contains_gen(comptime T: type, haystack: []const T, needle: T) bool
113113 return false;
114114}
115115
116pub fn file_list(alloc: *std.mem.Allocator, dpath: string) ![]const string {
116pub fn file_list(alloc: std.mem.Allocator, dpath: string) ![]const string {
117117 var list = std.ArrayList(string).init(alloc);
118118 defer list.deinit();
119119
......@@ -133,7 +133,7 @@ pub fn file_list(alloc: *std.mem.Allocator, dpath: string) ![]const string {
133133 return list.toOwnedSlice();
134134}
135135
136pub fn run_cmd_raw(alloc: *std.mem.Allocator, dir: ?string, args: []const string) !std.ChildProcess.ExecResult {
136pub fn run_cmd_raw(alloc: std.mem.Allocator, dir: ?string, args: []const string) !std.ChildProcess.ExecResult {
137137 return std.ChildProcess.exec(.{ .allocator = alloc, .cwd = dir, .argv = args, .max_output_bytes = std.math.maxInt(usize) }) catch |e| switch (e) {
138138 error.FileNotFound => {
139139 u.fail("\"{s}\" command not found", .{args[0]});
......@@ -142,14 +142,14 @@ pub fn run_cmd_raw(alloc: *std.mem.Allocator, dir: ?string, args: []const string
142142 };
143143}
144144
145pub fn run_cmd(alloc: *std.mem.Allocator, dir: ?string, args: []const string) !u32 {
145pub fn run_cmd(alloc: std.mem.Allocator, dir: ?string, args: []const string) !u32 {
146146 const result = try run_cmd_raw(alloc, dir, args);
147147 alloc.free(result.stdout);
148148 alloc.free(result.stderr);
149149 return result.term.Exited;
150150}
151151
152pub fn list_remove(alloc: *std.mem.Allocator, input: []string, search: string) ![]string {
152pub fn list_remove(alloc: std.mem.Allocator, input: []string, search: string) ![]string {
153153 var list = std.ArrayList(string).init(alloc);
154154 defer list.deinit();
155155 for (input) |item| {
......@@ -169,7 +169,7 @@ pub fn last(in: []string) !string {
169169
170170const alphabet = "0123456789abcdefghijklmnopqrstuvwxyz";
171171
172pub fn random_string(alloc: *std.mem.Allocator, len: usize) !string {
172pub fn random_string(alloc: std.mem.Allocator, len: usize) !string {
173173 const now = @intCast(u64, std.time.nanoTimestamp());
174174 var rand = std.rand.DefaultPrng.init(now);
175175 const r = &rand.random();
......@@ -206,7 +206,7 @@ pub const HashFn = enum {
206206 sha512,
207207};
208208
209pub fn validate_hash(alloc: *std.mem.Allocator, input: string, file_path: string) !bool {
209pub fn validate_hash(alloc: std.mem.Allocator, input: string, file_path: string) !bool {
210210 const hash = parse_split(HashFn, "-").do(input) catch return false;
211211 const file = try std.fs.cwd().openFile(file_path, .{});
212212 defer file.close();
......@@ -224,7 +224,7 @@ pub fn validate_hash(alloc: *std.mem.Allocator, input: string, file_path: string
224224 return result;
225225}
226226
227pub fn do_hash(alloc: *std.mem.Allocator, comptime algo: type, data: string) !string {
227pub fn do_hash(alloc: std.mem.Allocator, comptime algo: type, data: string) !string {
228228 const h = &algo.init(.{});
229229 var out: [algo.digest_length]u8 = undefined;
230230 h.update(data);
......@@ -234,7 +234,7 @@ pub fn do_hash(alloc: *std.mem.Allocator, comptime algo: type, data: string) !st
234234}
235235
236236/// Returns the result of running `git rev-parse HEAD`
237pub fn git_rev_HEAD(alloc: *std.mem.Allocator, dir: std.fs.Dir) !string {
237pub fn git_rev_HEAD(alloc: std.mem.Allocator, dir: std.fs.Dir) !string {
238238 const max = std.math.maxInt(usize);
239239 const dirg = try dir.openDir(".git", .{});
240240 const h = std.mem.trim(u8, try dirg.readFileAlloc(alloc, "HEAD", max), "\n");
......@@ -248,7 +248,7 @@ pub fn slice(comptime T: type, input: []const T, from: usize, to: usize) []const
248248 return input[f..t];
249249}
250250
251pub fn detect_pkgname(alloc: *std.mem.Allocator, override: string, dir: string) !string {
251pub fn detect_pkgname(alloc: std.mem.Allocator, override: string, dir: string) !string {
252252 if (override.len > 0) {
253253 return override;
254254 }
......@@ -264,7 +264,7 @@ pub fn detect_pkgname(alloc: *std.mem.Allocator, override: string, dir: string)
264264 return name;
265265}
266266
267pub fn detct_mainfile(alloc: *std.mem.Allocator, override: string, dir: ?std.fs.Dir, name: string) !string {
267pub fn detct_mainfile(alloc: std.mem.Allocator, override: string, dir: ?std.fs.Dir, name: string) !string {
268268 if (override.len > 0) {
269269 if (try does_file_exist(dir, override)) {
270270 if (std.mem.endsWith(u8, override, ".zig")) {
src/util/modfile.zig+4-4
......@@ -28,7 +28,7 @@ pub const ModFile = struct {
2828 rootdeps: []zigmod.Dep,
2929 builddeps: []zigmod.Dep,
3030
31 pub fn init(alloc: *std.mem.Allocator, mpath: string) !Self {
31 pub fn init(alloc: std.mem.Allocator, mpath: string) !Self {
3232 const file = try std.fs.cwd().openFile(mpath, .{});
3333 defer file.close();
3434 const input = try file.reader().readAllAlloc(alloc, mb);
......@@ -36,7 +36,7 @@ pub const ModFile = struct {
3636 return from_mapping(alloc, doc.mapping);
3737 }
3838
39 pub fn from_dir(alloc: *std.mem.Allocator, dir: std.fs.Dir) !Self {
39 pub fn from_dir(alloc: std.mem.Allocator, dir: std.fs.Dir) !Self {
4040 const file = try dir.openFile("zig.mod", .{});
4141 defer file.close();
4242 const input = try file.reader().readAllAlloc(alloc, mb);
......@@ -44,7 +44,7 @@ pub const ModFile = struct {
4444 return from_mapping(alloc, doc.mapping);
4545 }
4646
47 pub fn from_mapping(alloc: *std.mem.Allocator, mapping: yaml.Mapping) !Self {
47 pub fn from_mapping(alloc: std.mem.Allocator, mapping: yaml.Mapping) !Self {
4848 const id = mapping.get_string("id");
4949 const name = mapping.get("name").?.string;
5050 const main = mapping.get_string("main");
......@@ -69,7 +69,7 @@ pub const ModFile = struct {
6969 };
7070 }
7171
72 fn dep_list_by_name(alloc: *std.mem.Allocator, mapping: yaml.Mapping, props: []const string, for_build: bool) anyerror![]zigmod.Dep {
72 fn dep_list_by_name(alloc: std.mem.Allocator, mapping: yaml.Mapping, props: []const string, for_build: bool) anyerror![]zigmod.Dep {
7373 var dep_list = std.ArrayList(zigmod.Dep).init(alloc);
7474 defer dep_list.deinit();
7575
src/util/module.zig+2-2
......@@ -11,7 +11,7 @@ const common = @import("./../common.zig");
1111//
1212
1313pub const Module = struct {
14 alloc: *std.mem.Allocator,
14 alloc: std.mem.Allocator,
1515 is_sys_lib: bool,
1616 id: string,
1717 name: string,
......@@ -27,7 +27,7 @@ pub const Module = struct {
2727 dep: ?zigmod.Dep,
2828 for_build: bool = false,
2929
30 pub fn from(alloc: *std.mem.Allocator, dep: zigmod.Dep, modpath: string, options: *common.CollectOptions) !Module {
30 pub fn from(alloc: std.mem.Allocator, dep: zigmod.Dep, modpath: string, options: *common.CollectOptions) !Module {
3131 var moddeps = std.ArrayList(Module).init(alloc);
3232 defer moddeps.deinit();
3333
src/util/yaml.zig+3-3
......@@ -110,7 +110,7 @@ pub const Mapping = struct {
110110 return if (self.get(k)) |v| v.string else "";
111111 }
112112
113 pub fn get_string_array(self: Mapping, alloc: *std.mem.Allocator, k: string) ![]string {
113 pub fn get_string_array(self: Mapping, alloc: std.mem.Allocator, k: string) ![]string {
114114 var list = std.ArrayList(string).init(alloc);
115115 defer list.deinit();
116116 if (self.get(k)) |val| {
......@@ -145,7 +145,7 @@ pub const TokenList = []const Token;
145145//
146146//
147147
148pub fn parse(alloc: *std.mem.Allocator, input: string) !Document {
148pub fn parse(alloc: std.mem.Allocator, input: string) !Document {
149149 var parser: c.yaml_parser_t = undefined;
150150 _ = c.yaml_parser_initialize(&parser);
151151 defer c.yaml_parser_delete(&parser);
......@@ -182,7 +182,7 @@ pub fn parse(alloc: *std.mem.Allocator, input: string) !Document {
182182}
183183
184184pub const Parser = struct {
185 alloc: *std.mem.Allocator,
185 alloc: std.mem.Allocator,
186186 tokens: TokenList,
187187 lines: []const string,
188188 index: usize,
zigmod.lock+13-13
......@@ -1,20 +1,20 @@
112
22git https://github.com/yaml/libyaml tag-0.2.5
3git https://github.com/nektro/iguanaTLS commit-a48976beb7135b472ce8aa2f276df3b8eb775440
3git https://github.com/nektro/iguanaTLS commit-d49c382a52c2c10dee940d22c3e0a034d0cbac5a
44git https://github.com/nektro/zig-ansi commit-d4a53bcac5b87abecc65491109ec22aaf5f3dc2f
5git https://github.com/ziglibs/known-folders commit-f299244d787a02dd49bc8b10b8c2722a13655c48
5git https://github.com/ziglibs/known-folders commit-9db1b99219c767d5e24994b1525273fe4031e464
66git https://github.com/nektro/zig-licenses commit-c9b8cbf3565675a056ad4e9b57cb4f84020e7680
7git https://github.com/truemedian/zfetch commit-77fdd34e90db02f1224cdc7e5231ecd004ff1200
8git https://github.com/truemedian/hzzp commit-91ab8e741992e8db30b3ee1cd9e7cd5a072ca294
9git https://github.com/MasterQ32/zig-network commit-7b0be9a4cde7169531872ee1ca6a75ad3f15cc7c
10git https://github.com/MasterQ32/zig-uri commit-52cdd2061bec0579519f0d30280597f3a1db8b75
11git https://github.com/nektro/zig-json commit-7f0e661371d41cfdc8b1649ed00e7a750c82e57a
12git https://github.com/nektro/zig-extras commit-090ee5f1834af4ed7714101b24d7daec84572390
7git https://github.com/truemedian/zfetch commit-d7c0424d4251f23c9e3f87878e4d8687128a5d13
8git https://github.com/truemedian/hzzp commit-bf5aaf224e94561e035a631c3c40fbf02faa27d2
9git https://github.com/MasterQ32/zig-network commit-b9c52822f3bb3ce25164a2f1f6eedee4d1c0a279
10git https://github.com/MasterQ32/zig-uri commit-01155026c8362bb75dcab10bafc31abff0c8bac4
11git https://github.com/nektro/zig-json commit-908ecfa6d611f3ee0d9d89434e7494a653cfd5e1
12git https://github.com/nektro/zig-extras commit-3db31a0787846ce5b3133fe02f9cbcaa815ae80b
1313git https://github.com/nektro/zig-range commit-890ca308fe09b3d5c866d5cfb3b3d7a95dbf939f
14git https://github.com/nektro/zig-detect-license commit-d4544410f811c402b866f21f63588d1aae1b2d90
14git https://github.com/nektro/zig-detect-license commit-fe045f9399c532d01ff87d956d8387017636f675
1515git https://github.com/nektro/zig-licenses-text commit-3c07c6e4eb0965dafd0b029c632f823631b3169c
16git https://github.com/nektro/zig-leven commit-8e9f827117ab1418578b692a2325754cc3ee692d
16git https://github.com/nektro/zig-leven commit-ab852cf74fa0b4edc530d925f0654b62c60365bf
1717git https://github.com/nektro/zig-fs-check commit-dcd8da90fcb8bf3c9887e713bf0ec072bc897dd5
18git https://github.com/nektro/zig-inquirer commit-9a068122c59ac2785f330c37bf4412aed644ed37
19git https://github.com/arqv/ini commit-0880475514e8b73dee515843cb4db3ee663174e8
20git https://github.com/marlersoft/zigwin32 commit-7685bb92610ba4f34e0077eb2b6263fa6f1f36c5
18git https://github.com/nektro/zig-inquirer commit-14c3492c46f9765c3e77436741794d1a3118cbee
19git https://github.com/arqv/ini commit-b93f5b5ff9449f9af68ae3081f6a5e858b6698d9
20git https://github.com/marlersoft/zigwin32 commit-a74c9dae6a1ccd361eb9a1d146a09c08d22f02b0