vrischmann / zig-sqlite

zig-sqlite is a small wrapper around sqlite's C API, making it easier to use with Zig.
MIT License
367 stars 49 forks source link

Can't fetch package using the Official package manager #132

Closed Doomwhite closed 1 year ago

Doomwhite commented 1 year ago

zig-sqlite commit

master

Zig version

0.11.0

Steps to reproduce

I'm getting the following error whenever trying to use the build.zig.zon dependency:

error: Expected response status '200 OK' got '404 Not Found'
     .url = "https://github.com/vrischmann/zig-sqlite/archive/COMMIT.tar.gz",

This is what my dependencies look like:

    .dependencies = .{
    .sqlite = .{
        .url = "https://github.com/vrischmann/zig-sqlite/archive/COMMIT.tar.gz",
    },
    },

My build.zig looks like this:

const sqlite = b.dependency("sqlite", .{
    .target = target,
    .optimize = mode,
});

exe.addModule("sqlite", sqlite.module("sqlite"));

// Sqlite
exe.linkLibC();
exe.linkSystemLibrary("sqlite3");
exe.addPackage(.{ .name = "sqlite", .path = "third_party/zig-sqlite/sqlite.zig" });

Expected behaviour

It to fetch correctly.

vrischmann commented 1 year ago

It's not documented properly but you need to replace the COMMIT part with an actual commit from zig-sqlite, like f101ae075124f77a44444d368c869a5b3d3d4a6f: https://github.com/vrischmann/zig-sqlite/archive/f101ae075124f77a44444d368c869a5b3d3d4a6f.tar.gz

When you want to update the version of zig-sqlite you'll have to change the commit in the URL.

Doomwhite commented 1 year ago

I see, makes sense, I think you also need to add the .hash as well.

Doomwhite commented 1 year ago

There's something else that I'm not sure if I should make a new issue for:

exe.addPackage(.{ .name = "sqlite", .path = "third_party/zig-sqlite/sqlite.zig" });

This syntax is deprecated now and doesn't compile.

vrischmann commented 1 year ago

I see, makes sense, I think you also need to add the .hash as well.

Right, this is also something that's missing from the readme. The official documentation describes the easiest way to get the hash: https://ziglang.org/download/0.11.0/release-notes.html#Package-Management

This syntax is deprecated now and doesn't compile.

True, I'll fix that. Thanks for reporting it.

vrischmann commented 1 year ago

I updated the readme, I'll close this issue now.