diff --git a/README.md b/README.md index 4e024d8..b49eb5d 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,6 @@ A Zig version manager, written in zig. -WARNING: zupper is alpha software! Expect bugs! - ## features - managing multiple zig installations @@ -46,7 +44,8 @@ apt install \ 2. Install the zig toolchain -Zupper requires the development version of Zig (0.12.0 at the time of writing). Make sure you install one of the latest versions of Zig. +Zupper requires the 0.12.0 version of Zig. You can get a compiler from the +[Zig website](https://ziglang.org), or your distribution's package manager. 3. Build it! diff --git a/build.zig.zon b/build.zig.zon index 72738ac..02e4bd1 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -1,7 +1,6 @@ .{ - .paths = .{""}, .name = "zupper", - .version = "0.4.0", + .version = "1.0.0", .paths = .{""}, @@ -11,20 +10,20 @@ .hash = "12203ded54c85878eea7f12744066dcb4397177395ac49a7b2aa365bf6047b623829", }, .known_folders = .{ - .url = "git+https://github.com/ziglibs/known-folders.git#806ba01b872820004c7dec3117cb0db66b206af6", - .hash = "122094b48dea08e241b48d0ec32e3df6965e814091e3cabaff942e62d053f3ff9b5f", + .url = "git+https://github.com/ziglibs/known-folders.git#2aa7f2e9855d45b20072e15107fb379b9380adbe", + .hash = "12209925016f4b5486a713828ead3bcc900fa4f039c93de1894aa7d5253f7633b92c", }, .ansi_term = .{ .url = "git+https://github.com/LordMZTE/ansi-term.git#73c03175068679685535111dbea72cade075719e", .hash = "1220ea86ace34b38e49c1d737c5f857d88346af10695a992b38e10cb0a73b6a19ef7", }, .getty = .{ - .url = "git+https://github.com/getty-zig/getty.git#9ca75378ca4ee1035c68c910df29a756285b2e7c", - .hash = "12202cf984468b0ae05fffde6c4092c125f29315a289d996fb5cc3026bb2912c4ef0", + .url = "https://github.com/getty-zig/getty/archive/d27b9c72c553ee7e9fb383aa955ae1a705cde215.tar.gz", + .hash = "12208cf585a316dddfb837fb7397b0cc4a9974716adf63f856171fbd6e99cb9b131d", }, .getty_json = .{ - .url = "git+https://github.com/getty-zig/json#cc502b4d38dc1fe394f1f4c0dc1839f5a1f7d5b6", - .hash = "12201948b93e19050362d154a606460465fa313bb411f997b8a41a11209ecd78cd85", + .url = "git+https://github.com/getty-zig/json.git#11946ff9d2f159cb06aaf423ce13bd8aa2a481e7", + .hash = "1220829a91cb0804b35dadb6eb453cd9694b16d624e02493dc712ad43fd8681095f1", }, }, } diff --git a/src/args.zig b/src/args.zig index a4382dc..5ab780f 100644 --- a/src/args.zig +++ b/src/args.zig @@ -1,6 +1,6 @@ const std = @import("std"); -pub const version = "0.4.0"; +pub const version = "1.0.0"; pub const Info = struct {}; diff --git a/src/commands/install.zig b/src/commands/install.zig index be1be59..96ba982 100644 --- a/src/commands/install.zig +++ b/src/commands/install.zig @@ -60,15 +60,13 @@ pub fn run( std.log.info("exact version URL: '{s}'", .{exactv_url}); - var exactv_result = http.fetch(alloc, .{ + const exactv_result = http.fetch(.{ .location = .{ .url = exactv_url }, - .response_strategy = .none, .method = .HEAD, }) catch |e| { std.log.err("checking exact version: {}", .{e}); return error.Explained; }; - defer exactv_result.deinit(); if (exactv_result.status.class() != .success) { std.log.info("no such exact version available ({} {s})! available versions: ", .{ diff --git a/src/main.zig b/src/main.zig index 0fa0fa6..0586d70 100644 --- a/src/main.zig +++ b/src/main.zig @@ -3,9 +3,9 @@ const zig_args = @import("zig-args"); const args = @import("args.zig"); const Manifest = @import("Manifest.zig"); -pub const std_options = struct { - pub const logFn = @import("log.zig").log; - pub const log_level = .debug; +pub const std_options = std.Options{ + .log_level = .debug, + .logFn = @import("log.zig").log, }; pub fn main() !u8 { diff --git a/src/net.zig b/src/net.zig index 51724ab..82aca20 100644 --- a/src/net.zig +++ b/src/net.zig @@ -41,15 +41,16 @@ pub fn getVersionIndex(http: *std.http.Client) !getty.de.Result(VersionMap) { const alloc = http.allocator; std.log.info("getting version index", .{}); + var header_buf: [1024 * 4]u8 = undefined; + var req = try http.open( .GET, comptime std.Uri.parse("https://ziglang.org/download/index.json") catch unreachable, - std.http.Headers.init(alloc), // freed by req.deinit - .{}, + .{ .server_header_buffer = &header_buf }, ); defer req.deinit(); - try req.send(.{}); + try req.send(); try req.wait(); return try json.fromReader(alloc, VersionMap, req.reader()); @@ -62,8 +63,6 @@ pub fn downloadVersionTo( url_str: []const u8, target: []const u8, ) !void { - const alloc = http.allocator; - const url = try std.Uri.parse(url_str); std.log.info( @@ -74,10 +73,16 @@ pub fn downloadVersionTo( .{ url_str, target }, ); - var req = try http.open(.GET, url, std.http.Headers.init(alloc), .{}); + var header_buf: [1024 * 4]u8 = undefined; + + var req = try http.open( + .GET, + url, + .{ .server_header_buffer = &header_buf }, + ); defer req.deinit(); - try req.send(.{}); + try req.send(); try req.wait(); const DLState = struct {