postgresqlPackages.pgvecto-rs: 0.2.1 -> 0.3.0

This commit is contained in:
Diogo Correia 2024-06-21 23:34:56 +01:00
parent 9d3d0e669c
commit da5ae1bd60
No known key found for this signature in database
GPG Key ID: 12B4F3AC9C065D08
7 changed files with 998 additions and 1273 deletions

View File

@ -56,6 +56,7 @@
# dependency here. Set to false and provide rustfmt in nativeBuildInputs, if you need it, e.g.
# if you include the generated code in the output via postInstall.
, useFakeRustfmt ? true
, usePgTestCheckFeature ? true
, ...
} @ args:
let
@ -96,7 +97,7 @@ let
pg_ctl stop
'';
argsForBuildRustPackage = builtins.removeAttrs args [ "postgresql" "useFakeRustfmt" ];
argsForBuildRustPackage = builtins.removeAttrs args [ "postgresql" "useFakeRustfmt" "usePgTestCheckFeature" ];
# so we don't accidentally `(rustPlatform.buildRustPackage argsForBuildRustPackage) // { ... }` because
# we forgot parentheses
@ -154,7 +155,7 @@ let
RUST_BACKTRACE = "full";
checkNoDefaultFeatures = true;
checkFeatures = (args.checkFeatures or [ ]) ++ [ "pg_test pg${pgrxPostgresMajor}" ];
checkFeatures = (args.checkFeatures or [ ]) ++ (lib.optionals usePgTestCheckFeature [ "pg_test" ]) ++ [ "pg${pgrxPostgresMajor}" ];
};
in
rustPlatform.buildRustPackage finalArgs

View File

@ -71,4 +71,10 @@ in
hash = "sha256-UHIfwOdXoJvR4Svha6ud0FxahP1wPwUtviUwUnTmLXU=";
cargoHash = "sha256-j4HnD8Zt9uhlV5N7ldIy9564o9qFEqs5KfXHmnQ1WEw=";
};
cargo-pgrx_0_12_0_alpha_1 = generic {
version = "0.12.0-alpha.1";
hash = "sha256-0m9oaqjU42RYyttkTihADDrRMjr2WoK/8sInZALeHws=";
cargoHash = "sha256-9XTIcpoCnROP63ZTDgMMMmj0kPggiTazKlKQfCgXKzk=";
};
}

View File

@ -4,16 +4,16 @@ index 8d822e5..8b7e371 100644
+++ b/crates/c/build.rs
@@ -1,9 +1,13 @@
fn main() {
println!("cargo:rerun-if-changed=src/c.h");
println!("cargo:rerun-if-changed=src/c.c");
println!("cargo:rerun-if-changed=src/f16.h");
println!("cargo:rerun-if-changed=src/f16.c");
+ println!("cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS");
cc::Build::new()
- .compiler("clang-16")
+ .compiler("@clang@")
.file("./src/c.c")
.file("./src/f16.c")
+ // read env var set by rustPlatform.bindgenHook
+ .try_flags_from_environment("BINDGEN_EXTRA_CLANG_ARGS")
+ .expect("the BINDGEN_EXTRA_CLANG_ARGS environment variable must be specified and UTF-8")
.opt_level(3)
.debug(true)
.compile("pgvectorsc");
.compile("vectorsc");

View File

@ -1,25 +0,0 @@
diff --git a/Cargo.lock b/Cargo.lock
index a52b978..092bc1d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2788,7 +2788,7 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
[[package]]
name = "std_detect"
version = "0.1.5"
-source = "git+https://github.com/tensorchord/stdarch.git?branch=avx512fp16#db0cdbc9b02074bfddabfd23a4a681f21640eada"
+source = "git+https://github.com/rust-lang/stdarch.git?branch=master#d2b1a070afc72d9ba4df80e055109ede5fc0a81f"
dependencies = [
"cfg-if",
"libc",
diff --git a/crates/detect/Cargo.toml b/crates/detect/Cargo.toml
index b3ac782..c671c6a 100644
--- a/crates/detect/Cargo.toml
+++ b/crates/detect/Cargo.toml
@@ -4,6 +4,6 @@ version.workspace = true
edition.workspace = true
[dependencies]
-std_detect = { git = "https://github.com/tensorchord/stdarch.git", branch = "avx512fp16" }
+std_detect = { git = "https://github.com/rust-lang/stdarch.git", branch = "master" }
ctor = "0.2.6"
rustix.workspace = true

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ lib
, buildPgrxExtension
, cargo-pgrx_0_11_2
, cargo-pgrx_0_12_0_alpha_1
, clang_16
, fetchFromGitHub
, nix-update-script
@ -27,13 +27,13 @@ in
# Upstream only works with a fixed version of cargo-pgrx for each release,
# so we're pinning it here to avoid future incompatibility.
# See https://docs.pgvecto.rs/developers/development.html#environment, step 6
cargo-pgrx = cargo-pgrx_0_11_2;
cargo-pgrx = cargo-pgrx_0_12_0_alpha_1;
rustPlatform = rustPlatform';
}) rec {
inherit postgresql;
pname = "pgvecto-rs";
version = "0.2.1";
version = "0.3.0";
buildInputs = [ openssl ];
nativeBuildInputs = [ pkg-config ];
@ -44,17 +44,13 @@ in
src = ./0001-read-clang-flags-from-environment.diff;
clang = lib.getExe clang;
})
# Fix build failure on rustc 1.78 due to missing feature flag.
# Can (likely) be removed when pgvecto-rs 0.3.0 is released.
# See https://github.com/NixOS/nixpkgs/issues/320131
./0002-std-detect-use-upstream.diff
];
src = fetchFromGitHub {
owner = "tensorchord";
repo = "pgvecto.rs";
rev = "v${version}";
hash = "sha256-kwaGHerEVh6Oxb9jQupSapm7CsKl5CoH6jCv+zbi4FE=";
hash = "sha256-X7BY2Exv0xQNhsS/GA7GNvj9OeVDqVCd/k3lUkXtfgE=";
};
# Package has git dependencies on Cargo.lock (instead of just crate.io dependencies),
@ -62,8 +58,7 @@ in
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
"openai_api_rust-0.1.8" = "sha256-os5Y8KIWXJEYEcNzzT57wFPpEXdZ2Uy9W3j5+hJhhR4=";
"std_detect-0.1.5" = "sha256-Rsy8N0pTJ/3AIHjRyeOeyY7Q9Ho46ZcDmJFurCbRxiQ=";
"pgrx-0.12.0-alpha.1" = "sha256-HSQrAR9DFJsi4ZF4hLiJ1sIy+M9Ygva2+WxeUzflOLk=";
};
};
@ -86,6 +81,9 @@ in
RUSTC_BOOTSTRAP = 1;
};
# This crate does not have the "pg_test" feature
usePgTestCheckFeature = false;
passthru = {
updateScript = nix-update-script { };
tests = {
@ -94,11 +92,8 @@ in
};
meta = with lib; {
# The pgrx 0.11.2 dependency is broken in aarch64-linux: https://github.com/pgcentralfoundation/pgrx/issues/1429
# It is fixed in pgrx 0.11.3, but upstream is still using pgrx 0.11.2
# Additionally, upstream (accidentally) broke support for PostgreSQL 12 and 13 on 0.2.1, but
# they are removing it in 0.3.0 either way: https://github.com/tensorchord/pgvecto.rs/issues/343
broken = (stdenv.isLinux && stdenv.isAarch64) || stdenv.isDarwin || (versionOlder postgresql.version "14");
# Upstream removed support for PostgreSQL 12 and 13 on 0.3.0: https://github.com/tensorchord/pgvecto.rs/issues/343
broken = stdenv.isDarwin || (versionOlder postgresql.version "14");
description = "Scalable, Low-latency and Hybrid-enabled Vector Search in Postgres";
homepage = "https://github.com/tensorchord/pgvecto.rs";
license = licenses.asl20;

View File

@ -16302,6 +16302,7 @@ with pkgs;
cargo-pgrx_0_10_2
cargo-pgrx_0_11_2
cargo-pgrx_0_11_3
cargo-pgrx_0_12_0_alpha_1
;
cargo-pgrx = cargo-pgrx_0_11_2;