chore: update to Zig 0.12.0 and bump version to 1.0.0
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
LordMZTE 2024-04-28 19:00:30 +02:00
parent ed72799023
commit 02fd112b65
Signed by: LordMZTE
GPG key ID: B64802DC33A64FF6
6 changed files with 26 additions and 25 deletions

View file

@ -2,8 +2,6 @@
A Zig version manager, written in zig. A Zig version manager, written in zig.
WARNING: zupper is alpha software! Expect bugs!
## features ## features
- managing multiple zig installations - managing multiple zig installations
@ -46,7 +44,8 @@ apt install \
2. Install the zig toolchain 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! 3. Build it!

View file

@ -1,7 +1,6 @@
.{ .{
.paths = .{""},
.name = "zupper", .name = "zupper",
.version = "0.4.0", .version = "1.0.0",
.paths = .{""}, .paths = .{""},
@ -11,20 +10,20 @@
.hash = "12203ded54c85878eea7f12744066dcb4397177395ac49a7b2aa365bf6047b623829", .hash = "12203ded54c85878eea7f12744066dcb4397177395ac49a7b2aa365bf6047b623829",
}, },
.known_folders = .{ .known_folders = .{
.url = "git+https://github.com/ziglibs/known-folders.git#806ba01b872820004c7dec3117cb0db66b206af6", .url = "git+https://github.com/ziglibs/known-folders.git#2aa7f2e9855d45b20072e15107fb379b9380adbe",
.hash = "122094b48dea08e241b48d0ec32e3df6965e814091e3cabaff942e62d053f3ff9b5f", .hash = "12209925016f4b5486a713828ead3bcc900fa4f039c93de1894aa7d5253f7633b92c",
}, },
.ansi_term = .{ .ansi_term = .{
.url = "git+https://github.com/LordMZTE/ansi-term.git#73c03175068679685535111dbea72cade075719e", .url = "git+https://github.com/LordMZTE/ansi-term.git#73c03175068679685535111dbea72cade075719e",
.hash = "1220ea86ace34b38e49c1d737c5f857d88346af10695a992b38e10cb0a73b6a19ef7", .hash = "1220ea86ace34b38e49c1d737c5f857d88346af10695a992b38e10cb0a73b6a19ef7",
}, },
.getty = .{ .getty = .{
.url = "git+https://github.com/getty-zig/getty.git#9ca75378ca4ee1035c68c910df29a756285b2e7c", .url = "https://github.com/getty-zig/getty/archive/d27b9c72c553ee7e9fb383aa955ae1a705cde215.tar.gz",
.hash = "12202cf984468b0ae05fffde6c4092c125f29315a289d996fb5cc3026bb2912c4ef0", .hash = "12208cf585a316dddfb837fb7397b0cc4a9974716adf63f856171fbd6e99cb9b131d",
}, },
.getty_json = .{ .getty_json = .{
.url = "git+https://github.com/getty-zig/json#cc502b4d38dc1fe394f1f4c0dc1839f5a1f7d5b6", .url = "git+https://github.com/getty-zig/json.git#11946ff9d2f159cb06aaf423ce13bd8aa2a481e7",
.hash = "12201948b93e19050362d154a606460465fa313bb411f997b8a41a11209ecd78cd85", .hash = "1220829a91cb0804b35dadb6eb453cd9694b16d624e02493dc712ad43fd8681095f1",
}, },
}, },
} }

View file

@ -1,6 +1,6 @@
const std = @import("std"); const std = @import("std");
pub const version = "0.4.0"; pub const version = "1.0.0";
pub const Info = struct {}; pub const Info = struct {};

View file

@ -60,15 +60,13 @@ pub fn run(
std.log.info("exact version URL: '{s}'", .{exactv_url}); std.log.info("exact version URL: '{s}'", .{exactv_url});
var exactv_result = http.fetch(alloc, .{ const exactv_result = http.fetch(.{
.location = .{ .url = exactv_url }, .location = .{ .url = exactv_url },
.response_strategy = .none,
.method = .HEAD, .method = .HEAD,
}) catch |e| { }) catch |e| {
std.log.err("checking exact version: {}", .{e}); std.log.err("checking exact version: {}", .{e});
return error.Explained; return error.Explained;
}; };
defer exactv_result.deinit();
if (exactv_result.status.class() != .success) { if (exactv_result.status.class() != .success) {
std.log.info("no such exact version available ({} {s})! available versions: ", .{ std.log.info("no such exact version available ({} {s})! available versions: ", .{

View file

@ -3,9 +3,9 @@ const zig_args = @import("zig-args");
const args = @import("args.zig"); const args = @import("args.zig");
const Manifest = @import("Manifest.zig"); const Manifest = @import("Manifest.zig");
pub const std_options = struct { pub const std_options = std.Options{
pub const logFn = @import("log.zig").log; .log_level = .debug,
pub const log_level = .debug; .logFn = @import("log.zig").log,
}; };
pub fn main() !u8 { pub fn main() !u8 {

View file

@ -41,15 +41,16 @@ pub fn getVersionIndex(http: *std.http.Client) !getty.de.Result(VersionMap) {
const alloc = http.allocator; const alloc = http.allocator;
std.log.info("getting version index", .{}); std.log.info("getting version index", .{});
var header_buf: [1024 * 4]u8 = undefined;
var req = try http.open( var req = try http.open(
.GET, .GET,
comptime std.Uri.parse("https://ziglang.org/download/index.json") catch unreachable, 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(); defer req.deinit();
try req.send(.{}); try req.send();
try req.wait(); try req.wait();
return try json.fromReader(alloc, VersionMap, req.reader()); return try json.fromReader(alloc, VersionMap, req.reader());
@ -62,8 +63,6 @@ pub fn downloadVersionTo(
url_str: []const u8, url_str: []const u8,
target: []const u8, target: []const u8,
) !void { ) !void {
const alloc = http.allocator;
const url = try std.Uri.parse(url_str); const url = try std.Uri.parse(url_str);
std.log.info( std.log.info(
@ -74,10 +73,16 @@ pub fn downloadVersionTo(
.{ url_str, target }, .{ 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(); defer req.deinit();
try req.send(.{}); try req.send();
try req.wait(); try req.wait();
const DLState = struct { const DLState = struct {