From 3c51dd31bc99fac24282484cc7c17bc6849e9a46 Mon Sep 17 00:00:00 2001 From: Tpt Date: Sat, 9 Sep 2023 09:44:13 +0200 Subject: [PATCH] Move back MSRV to 1.67 but keep Cargo.lock to 1.70 Allows to build on Debian unstable while using latest dependencies --- .github/workflows/artifacts.yml | 2 +- .github/workflows/tests.yml | 137 ++++++------------ Cargo.lock | 111 +++++++------- Cargo.toml | 2 +- cli/Cargo.toml | 18 +-- fuzz/Cargo.toml | 3 +- fuzz/fuzz_targets/sparql_eval.rs | 15 +- js/Cargo.toml | 6 +- lib/Cargo.toml | 29 ++-- lib/oxrdfio/Cargo.toml | 4 +- lib/oxrdfxml/Cargo.toml | 6 +- lib/oxsdatatypes/Cargo.toml | 2 +- lib/oxsdatatypes/src/date_time.rs | 1 + lib/oxsdatatypes/src/double.rs | 2 +- lib/oxsdatatypes/src/float.rs | 2 +- lib/oxttl/Cargo.toml | 6 +- lib/sparesults/Cargo.toml | 2 +- lib/sparql-smith/Cargo.toml | 2 +- lib/src/storage/backend/rocksdb.rs | 41 +++--- lints/test_debian_compatibility.py | 116 +++++++++++++++ .../test_spec_links.py | 4 +- oxrocksdb-sys/Cargo.toml | 6 +- python/src/io.rs | 14 +- testsuite/Cargo.toml | 5 +- testsuite/src/sparql_evaluator.rs | 17 +-- 25 files changed, 317 insertions(+), 236 deletions(-) create mode 100644 lints/test_debian_compatibility.py rename test_spec_links.py => lints/test_spec_links.py (95%) diff --git a/.github/workflows/artifacts.yml b/.github/workflows/artifacts.yml index d963f2d0..3951704e 100644 --- a/.github/workflows/artifacts.yml +++ b/.github/workflows/artifacts.yml @@ -22,7 +22,7 @@ jobs: submodules: true - run: rustup update && rustup target add aarch64-unknown-linux-gnu - run: | - sudo apt update && sudo apt install -y g++-aarch64-linux-gnu + sudo apt update && sudo apt-get install -y g++-aarch64-linux-gnu echo -e "\n\n[target.aarch64-unknown-linux-gnu]\nlinker = \"aarch64-linux-gnu-gcc\"" >> .cargo/config.toml - uses: Swatinem/rust-cache@v2 - run: cargo build --release diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index edf5cd42..f811899f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -26,75 +26,7 @@ jobs: - uses: actions/checkout@v3 with: submodules: true - - run: rustup update && rustup component add clippy - - uses: Swatinem/rust-cache@v2 - - run: cargo clippy - working-directory: ./lib/oxsdatatypes - - run: cargo clippy - working-directory: ./lib/oxrdf - - run: cargo clippy - working-directory: ./lib/oxrdfxml - - run: cargo clippy - working-directory: ./lib/oxttl - - run: cargo clippy - working-directory: ./lib/oxrdfio - - run: cargo clippy - working-directory: ./lib/sparesults - - run: cargo clippy - working-directory: ./lib/spargebra - - run: cargo clippy - working-directory: ./lib/sparopt - - run: cargo clippy - working-directory: ./lib - - run: cargo clippy --all-targets --all-features - working-directory: ./lib - - run: cargo clippy - working-directory: ./python - - run: cargo clippy - working-directory: ./cli - - run: cargo clippy - working-directory: ./testsuite - - clippy_wasm_js: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: true - - run: rustup update && rustup target add wasm32-unknown-unknown && rustup component add clippy - - uses: Swatinem/rust-cache@v2 - - run: cargo clippy --lib --tests --target wasm32-unknown-unknown - working-directory: ./js - - clippy_wasi: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: true - - run: rustup update && rustup target add wasm32-wasi && rustup component add clippy - - uses: Swatinem/rust-cache@v2 - - run: cargo clippy --lib --tests --target wasm32-wasi - working-directory: ./lib - - clippy_wasm_unknown: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: true - - run: rustup update && rustup target add wasm32-unknown-unknown && rustup component add clippy - - uses: Swatinem/rust-cache@v2 - - run: cargo clippy --lib --tests --target wasm32-unknown-unknown --features getrandom/custom --features oxsdatatypes/custom-now - working-directory: ./lib - - clippy_msv: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: true - - run: rustup update && rustup override set 1.70.0 && rustup component add clippy + - run: rustup update && rustup default 1.70.0 && rustup component add clippy - uses: Swatinem/rust-cache@v2 - run: cargo clippy -- -D warnings -D clippy::all working-directory: ./lib/oxsdatatypes @@ -123,28 +55,39 @@ jobs: - run: cargo clippy -- -D warnings -D clippy::all working-directory: ./testsuite - clippy_msv_wasm_js: + clippy_wasm_js: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 with: submodules: true - - run: rustup update && rustup override set 1.70.0 && rustup target add wasm32-unknown-unknown && rustup component add clippy + - run: rustup update && rustup default 1.70.0 && rustup target add wasm32-unknown-unknown && rustup component add clippy - uses: Swatinem/rust-cache@v2 - run: cargo clippy --lib --tests --target wasm32-unknown-unknown -- -D warnings -D clippy::all working-directory: ./js - clippy_msv_wasi: + clippy_wasi: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 with: submodules: true - - run: rustup update && rustup override set 1.70.0 && rustup target add wasm32-wasi && rustup component add clippy + - run: rustup update && rustup default 1.70.0 && rustup target add wasm32-wasi && rustup component add clippy - uses: Swatinem/rust-cache@v2 - run: cargo clippy --lib --tests --target wasm32-wasi -- -D warnings -D clippy::all working-directory: ./lib + clippy_wasm_unknown: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - run: rustup update && rustup default 1.70.0 && rustup target add wasm32-unknown-unknown && rustup component add clippy + - uses: Swatinem/rust-cache@v2 + - run: cargo clippy --lib --tests --target wasm32-unknown-unknown --features getrandom/custom --features oxsdatatypes/custom-now -- -D warnings -D clippy::all + working-directory: ./lib + deny: runs-on: ubuntu-latest steps: @@ -175,8 +118,17 @@ jobs: - run: rustup update - uses: Swatinem/rust-cache@v2 - run: cargo test - env: - RUST_BACKTRACE: 1 + + test_linux_msv: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - run: rustup update && rustup toolchain install nightly && rustup default 1.67.0 + - uses: Swatinem/rust-cache@v2 + - run: rm Cargo.lock && cargo +nightly update -Z direct-minimal-versions + - run: cargo test address_sanitizer: runs-on: ubuntu-latest @@ -184,12 +136,11 @@ jobs: - uses: actions/checkout@v3 with: submodules: true - - run: rustup update && rustup override set nightly - - run: sudo apt install -y llvm + - run: rustup update && rustup default nightly + - run: sudo apt-get install -y llvm - uses: Swatinem/rust-cache@v2 - run: cargo test --tests --target x86_64-unknown-linux-gnu --workspace --exclude pyoxigraph --exclude oxigraph-testsuite --exclude oxigraph-cli env: - RUST_BACKTRACE: 1 RUSTFLAGS: -Z sanitizer=address test_windows: @@ -225,18 +176,7 @@ jobs: - uses: actions/checkout@v3 with: submodules: true - - run: rustup update - - uses: Swatinem/rust-cache@v2 - - run: cargo doc --all-features - working-directory: ./lib - - rustdoc_msrv: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: true - - run: rustup update && rustup override set 1.70.0 + - run: rustup update && rustup default 1.70.0 - uses: Swatinem/rust-cache@v2 - run: cargo doc --all-features working-directory: ./lib @@ -300,7 +240,7 @@ jobs: - uses: actions/checkout@v3 with: submodules: true - - run: rustup update + - run: rustup update && rustup toolchain install nightly && rustup default 1.67.0 - uses: Swatinem/rust-cache@v2 - uses: actions/setup-python@v4 with: @@ -308,6 +248,7 @@ jobs: cache: pip cache-dependency-path: '**/requirements.dev.txt' - run: pip install -r python/requirements.dev.txt + - run: rm Cargo.lock && cargo +nightly update -Z direct-minimal-versions - run: maturin build -m python/Cargo.toml - run: pip install --no-index --find-links=target/wheels/ pyoxigraph - run: rm -r target/wheels @@ -346,7 +287,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - run: sudo apt install -y clang-format + - run: sudo apt-get install -y clang-format - run: clang-format --Werror --dry-run oxrocksdb-sys/api/* fuzz_changes: @@ -423,11 +364,19 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - run: sudo apt install -y shellcheck + - run: sudo apt-get install -y shellcheck - run: git grep -l '^#\( *shellcheck \|!\(/bin/\|/usr/bin/env \)\(sh\|bash\|dash\|ksh\)\)' | xargs shellcheck spec_links: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - run: python test_spec_links.py + - run: python lints/test_spec_links.py + + debian_compatibility: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: rustup update + - uses: Swatinem/rust-cache@v2 + - run: python lints/test_debian_compatibility.py diff --git a/Cargo.lock b/Cargo.lock index 63a066a1..e9b6b056 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -19,9 +19,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "aho-corasick" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6748e8def348ed4d14996fa801f4122cd763fff530258cdc03f64b25f89d3a5a" +checksum = "0c378d78423fdad8089616f827526ee33c19f2fddbd5de1629152c9593ba4783" dependencies = [ "memchr", ] @@ -154,9 +154,9 @@ checksum = "414dcefbc63d77c526a76b3afcf6fbb9b5e2791c19c3aa2297733208750c6e53" [[package]] name = "bindgen" -version = "0.66.1" +version = "0.68.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2b84e06fc203107bfbad243f4aba2af864eb7db3b1cf46ea0a023b0b433d2a7" +checksum = "726e4313eb6ec35d2730258ad4e15b547ee75d6afaa1361a922e78e59b7d8078" dependencies = [ "bitflags 2.4.0", "cexpr", @@ -171,7 +171,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.29", + "syn 2.0.31", "which", ] @@ -198,9 +198,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.6.0" +version = "1.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05" +checksum = "4c2f7349907b712260e64b0afe2f84692af14a454be26187d9df565c7f69266a" dependencies = [ "memchr", "regex-automata", @@ -215,9 +215,9 @@ checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" [[package]] name = "bytes" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "cast" @@ -290,20 +290,19 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.0" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d5f1946157a96594eb2d2c10eb7ad9a2b27518cb3000209dec700c35df9197d" +checksum = "6a13b88d2c62ff462f88e4a121f17a82c1af05693a2f192b5c38d14de73c19f6" dependencies = [ "clap_builder", "clap_derive", - "once_cell", ] [[package]] name = "clap_builder" -version = "4.4.0" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78116e32a042dd73c2901f0dc30790d20ff3447f3e3472fad359e8c3d282bcd6" +checksum = "2bb9faaa7c2ef94b2743a21f5a29e6f0010dff4caa69ac8e9d6cf8b6fa74da08" dependencies = [ "anstream", "anstyle", @@ -313,14 +312,14 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.4.0" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9fd1a5729c4548118d7d70ff234a44868d00489a4b6597b0b020918a0e91a1a" +checksum = "0862016ff20d69b84ef8247369fabf5c008a7417002411897d40ee1f4532b873" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.31", ] [[package]] @@ -482,7 +481,7 @@ checksum = "53e0efad4403bfc52dc201159c4b842a246a14b98c64b55dfd0f2d89729dfeb8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.31", ] [[package]] @@ -515,9 +514,9 @@ checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "errno" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f" +checksum = "136526188508e25c6fef639d7927dfb3e0e3084488bf202267829cf7fc23dbdd" dependencies = [ "errno-dragonfly", "libc", @@ -678,6 +677,15 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "home" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" +dependencies = [ + "windows-sys", +] + [[package]] name = "httparse" version = "1.8.0" @@ -838,9 +846,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.5.0" +version = "2.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c" [[package]] name = "memoffset" @@ -903,9 +911,9 @@ dependencies = [ [[package]] name = "object" -version = "0.32.0" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ac5bbd07aea88c60a577a1ce218075ffd59208b2d7ca97adf9bfc5aeb21ebe" +checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" dependencies = [ "memchr", ] @@ -952,6 +960,7 @@ dependencies = [ "hex", "js-sys", "json-event-parser", + "lazy_static", "libc", "md-5", "oxhttp", @@ -1008,6 +1017,7 @@ dependencies = [ "anyhow", "clap", "criterion", + "lazy_static", "oxigraph", "oxttl", "rio_api", @@ -1229,12 +1239,12 @@ dependencies = [ [[package]] name = "prettyplease" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c64d9ba0963cdcea2e1b2230fbae2bab30eb25a174be395c41e764bfb65dd62" +checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" dependencies = [ "proc-macro2", - "syn 2.0.29", + "syn 2.0.31", ] [[package]] @@ -1396,9 +1406,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.9.4" +version = "1.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12de2eff854e5fa4b1295edd650e227e9d8fb0c9e90b12e7f36d6a6811791a29" +checksum = "697061221ea1b4a94a624f67d0ae2bfe4e22b8a17b6a192afb11046542cc8c47" dependencies = [ "aho-corasick", "memchr", @@ -1408,9 +1418,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49530408a136e16e5b486e883fbb6ba058e8e4e8ae6621a77b048b314336e629" +checksum = "c2f401f4955220693b56f8ec66ee9c78abffd8d1c4f23dc41a23839eb88f0795" dependencies = [ "aho-corasick", "memchr", @@ -1469,9 +1479,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustix" -version = "0.38.9" +version = "0.38.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bfe0f2582b4931a45d1fa608f8a8722e8b3c7ac54dd6d5f3b3212791fedef49" +checksum = "c0c3dde1fc030af041adc40e79c0e7fbcf431dd24870053d187d7c66e4b87453" dependencies = [ "bitflags 2.4.0", "errno", @@ -1482,9 +1492,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.6" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d1feddffcfcc0b33f5c6ce9a29e341e4cd59c3f78e7ee45f4a40c038b1d6cbb" +checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8" dependencies = [ "log", "ring", @@ -1603,7 +1613,7 @@ checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.31", ] [[package]] @@ -1641,9 +1651,9 @@ dependencies = [ [[package]] name = "shlex" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" +checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380" [[package]] name = "siphasher" @@ -1718,9 +1728,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.29" +version = "2.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" +checksum = "718fa2415bcb8d8bd775917a1bf12a7931b6dfa890753378538118181e0cb398" dependencies = [ "proc-macro2", "quote", @@ -1855,7 +1865,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.31", ] [[package]] @@ -1905,9 +1915,9 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "url" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" +checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" dependencies = [ "form_urlencoded", "idna", @@ -1937,9 +1947,9 @@ dependencies = [ [[package]] name = "walkdir" -version = "2.3.3" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" +checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" dependencies = [ "same-file", "winapi-util", @@ -1972,7 +1982,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.31", "wasm-bindgen-shared", ] @@ -1994,7 +2004,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.31", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2017,13 +2027,14 @@ dependencies = [ [[package]] name = "which" -version = "4.4.0" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2441c784c52b289a054b7201fc93253e288f094e2f4be9058343127c4226a269" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" dependencies = [ "either", - "libc", + "home", "once_cell", + "rustix", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 8264afa9..0d6bc83e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ authors = ["Tpt "] license = "MIT OR Apache-2.0" homepage = "https://oxigraph.org/" edition = "2021" -rust-version = "1.70" +rust-version = "1.67" [profile.release] lto = true diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 62c6b40b..486a46bf 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -19,18 +19,18 @@ name = "oxigraph" path = "src/main.rs" [dependencies] -anyhow = "1" -oxhttp = { version = "0.1", features = ["rayon"] } -clap = { version = "4", features = ["derive"] } +anyhow = "1.0.72" +oxhttp = { version = "0.1.7", features = ["rayon"] } +clap = { version = ">=4.0, <5.0", features = ["derive"] } oxigraph = { version = "0.4.0-alpha.1-dev", path = "../lib", features = ["http_client"] } rand = "0.8" -url = "2" +url = "2.4" oxiri = "0.2" -flate2 = "1" -rayon-core = "1" +flate2 = "1.0" +rayon-core = "1.11" [dev-dependencies] -assert_cmd = "2" -assert_fs = "1" +assert_cmd = "2.0" +assert_fs = "1.0" escargot = "0.5" -predicates = "3" +predicates = ">=2.0, <4.0" diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index 4e41ea60..900b0b92 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -8,7 +8,8 @@ edition = "2021" cargo-fuzz = true [dependencies] -anyhow = "1" +anyhow = "1.0.72" +lazy_static = "1.4" libfuzzer-sys = "0.4" oxrdf = { path = "../lib/oxrdf", features = ["rdf-star"] } oxttl = { path = "../lib/oxttl", features = ["rdf-star"] } diff --git a/fuzz/fuzz_targets/sparql_eval.rs b/fuzz/fuzz_targets/sparql_eval.rs index 24c8a176..5b52f4bd 100644 --- a/fuzz/fuzz_targets/sparql_eval.rs +++ b/fuzz/fuzz_targets/sparql_eval.rs @@ -1,26 +1,27 @@ #![no_main] +use lazy_static::lazy_static; use libfuzzer_sys::fuzz_target; use oxigraph::io::RdfFormat; use oxigraph::sparql::{Query, QueryOptions, QueryResults, QuerySolutionIter}; use oxigraph::store::Store; -use std::sync::OnceLock; -fuzz_target!(|data: sparql_smith::Query| { - static STORE: OnceLock = OnceLock::new(); - let store = STORE.get_or_init(|| { +lazy_static! { + static ref STORE: Store = { let store = Store::new().unwrap(); store .load_dataset(sparql_smith::DATA_TRIG.as_bytes(), RdfFormat::TriG, None) .unwrap(); store - }); + }; +} +fuzz_target!(|data: sparql_smith::Query| { let query_str = data.to_string(); if let Ok(query) = Query::parse(&query_str, None) { let options = QueryOptions::default(); - let with_opt = store.query_opt(query.clone(), options.clone()).unwrap(); - let without_opt = store + let with_opt = STORE.query_opt(query.clone(), options.clone()).unwrap(); + let without_opt = STORE .query_opt(query, options.without_optimizations()) .unwrap(); match (with_opt, without_opt) { diff --git a/js/Cargo.toml b/js/Cargo.toml index 0fa31d8f..bfc2ffd5 100644 --- a/js/Cargo.toml +++ b/js/Cargo.toml @@ -17,6 +17,6 @@ name = "oxigraph" [dependencies] oxigraph = { version = "0.4.0-alpha.1-dev", path="../lib", features = ["js"] } -wasm-bindgen = "0.2" -js-sys = "0.3" -console_error_panic_hook = "0.1" +wasm-bindgen = "0.2.83" +js-sys = "0.3.60" +console_error_panic_hook = "0.1.7" diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 2c37165f..0ed6e9a9 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -22,36 +22,37 @@ http_client = ["oxhttp", "oxhttp/rustls"] rocksdb_debug = [] [dependencies] -rand = "0.8" -md-5 = "0.10" -sha1 = "0.10" -sha2 = "0.10" digest = "0.10" -regex = "1" -oxilangtag = "0.1" -oxiri = "0.2" hex = "0.4" -siphasher = "1" json-event-parser = "0.1" +lazy_static = "1.4" +md-5 = "0.10" +oxilangtag = "0.1" +oxiri = "0.2" oxrdf = { version = "0.2.0-alpha.1-dev", path = "oxrdf", features = ["rdf-star", "oxsdatatypes"] } -oxsdatatypes = { version = "0.2.0-alpha.1-dev", path="oxsdatatypes" } oxrdfio = { version = "0.1.0-alpha.1-dev", path = "oxrdfio", features = ["rdf-star"] } +oxsdatatypes = { version = "0.2.0-alpha.1-dev", path="oxsdatatypes" } +rand = "0.8" +regex = "1.7" +sha1 = "0.10" +sha2 = "0.10" +siphasher = ">=0.3, <2.0" +sparesults = { version = "0.2.0-alpha.1-dev", path = "sparesults", features = ["rdf-star"] } spargebra = { version = "0.3.0-alpha.1-dev", path = "spargebra", features = ["rdf-star", "sep-0002", "sep-0006"] } sparopt = { version = "0.1.0-alpha.1-dev", path="sparopt", features = ["rdf-star", "sep-0002", "sep-0006"] } -sparesults = { version = "0.2.0-alpha.1-dev", path = "sparesults", features = ["rdf-star"] } [target.'cfg(not(target_family = "wasm"))'.dependencies] -libc = "0.2" +libc = "0.2.147" oxrocksdb-sys = { version = "0.4.0-alpha.1-dev", path="../oxrocksdb-sys" } -oxhttp = { version = "0.1", optional = true } +oxhttp = { version = "0.1.7", optional = true } [target.'cfg(all(target_family = "wasm", target_os = "unknown"))'.dependencies] getrandom = "0.2" -js-sys = { version = "0.3", optional = true } +js-sys = { version = "0.3.60", optional = true } [target.'cfg(not(target_family = "wasm"))'.dev-dependencies] criterion = "0.5" -oxhttp = "0.1" +oxhttp = "0.1.7" zstd = "0.12" [package.metadata.docs.rs] diff --git a/lib/oxrdfio/Cargo.toml b/lib/oxrdfio/Cargo.toml index 1ca0ce17..45683a5e 100644 --- a/lib/oxrdfio/Cargo.toml +++ b/lib/oxrdfio/Cargo.toml @@ -23,10 +23,10 @@ rdf-star = ["oxrdf/rdf-star", "oxttl/rdf-star"] oxrdf = { version = "0.2.0-alpha.1-dev", path = "../oxrdf" } oxrdfxml = { version = "0.1.0-alpha.1-dev", path = "../oxrdfxml" } oxttl = { version = "0.1.0-alpha.1-dev", path = "../oxttl" } -tokio = { version = "1", optional = true, features = ["io-util"] } +tokio = { version = "1.29", optional = true, features = ["io-util"] } [dev-dependencies] -tokio = { version = "1", features = ["rt", "macros"] } +tokio = { version = "1.29", features = ["rt", "macros"] } [package.metadata.docs.rs] all-features = true diff --git a/lib/oxrdfxml/Cargo.toml b/lib/oxrdfxml/Cargo.toml index fa7ef2b1..83739b35 100644 --- a/lib/oxrdfxml/Cargo.toml +++ b/lib/oxrdfxml/Cargo.toml @@ -22,11 +22,11 @@ async-tokio = ["dep:tokio", "quick-xml/async-tokio"] oxrdf = { version = "0.2.0-alpha.1-dev", path = "../oxrdf" } oxilangtag = "0.1" oxiri = "0.2" -quick-xml = "0.30" -tokio = { version = "1", optional = true, features = ["io-util"] } +quick-xml = ">=0.29, <0.31" +tokio = { version = "1.29", optional = true, features = ["io-util"] } [dev-dependencies] -tokio = { version = "1", features = ["rt", "macros"] } +tokio = { version = "1.29", features = ["rt", "macros"] } [package.metadata.docs.rs] all-features = true diff --git a/lib/oxsdatatypes/Cargo.toml b/lib/oxsdatatypes/Cargo.toml index 64b974a9..10f9f4f2 100644 --- a/lib/oxsdatatypes/Cargo.toml +++ b/lib/oxsdatatypes/Cargo.toml @@ -19,7 +19,7 @@ js = ["js-sys"] custom-now = [] [target.'cfg(all(target_family = "wasm", target_os = "unknown"))'.dependencies] -js-sys = { version = "0.3", optional = true } +js-sys = { version = "0.3.60", optional = true } [package.metadata.docs.rs] all-features = true diff --git a/lib/oxsdatatypes/src/date_time.rs b/lib/oxsdatatypes/src/date_time.rs index 00920b43..6c525794 100644 --- a/lib/oxsdatatypes/src/date_time.rs +++ b/lib/oxsdatatypes/src/date_time.rs @@ -1867,6 +1867,7 @@ pub fn since_unix_epoch() -> Duration { fn custom_ox_now() -> Duration; } + // SAFETY: Must be defined, if not compilation fails unsafe { custom_ox_now() } } diff --git a/lib/oxsdatatypes/src/double.rs b/lib/oxsdatatypes/src/double.rs index bc040738..6e3f890e 100644 --- a/lib/oxsdatatypes/src/double.rs +++ b/lib/oxsdatatypes/src/double.rs @@ -173,7 +173,7 @@ impl From for Double { impl From for Double { #[inline] fn from(value: Boolean) -> Self { - f64::from(bool::from(value)).into() + if bool::from(value) { 1. } else { 0. }.into() } } diff --git a/lib/oxsdatatypes/src/float.rs b/lib/oxsdatatypes/src/float.rs index 996a6401..ce88c0e4 100644 --- a/lib/oxsdatatypes/src/float.rs +++ b/lib/oxsdatatypes/src/float.rs @@ -153,7 +153,7 @@ impl From for Float { impl From for Float { #[inline] fn from(value: Boolean) -> Self { - f32::from(bool::from(value)).into() + if bool::from(value) { 1. } else { 0. }.into() } } diff --git a/lib/oxttl/Cargo.toml b/lib/oxttl/Cargo.toml index 0cc2741b..98b583bf 100644 --- a/lib/oxttl/Cargo.toml +++ b/lib/oxttl/Cargo.toml @@ -20,14 +20,14 @@ rdf-star = ["oxrdf/rdf-star"] async-tokio = ["dep:tokio"] [dependencies] -memchr = "2" +memchr = "2.5" oxrdf = { version = "0.2.0-alpha.1-dev", path = "../oxrdf" } oxiri = "0.2" oxilangtag = "0.1" -tokio = { version = "1", optional = true, features = ["io-util"] } +tokio = { version = "1.29", optional = true, features = ["io-util"] } [dev-dependencies] -tokio = { version = "1", features = ["rt", "macros"] } +tokio = { version = "1.29", features = ["rt", "macros"] } [package.metadata.docs.rs] all-features = true diff --git a/lib/sparesults/Cargo.toml b/lib/sparesults/Cargo.toml index 8cee3164..0a7904db 100644 --- a/lib/sparesults/Cargo.toml +++ b/lib/sparesults/Cargo.toml @@ -21,7 +21,7 @@ rdf-star = ["oxrdf/rdf-star"] [dependencies] json-event-parser = "0.1" oxrdf = { version = "0.2.0-alpha.1-dev", path="../oxrdf" } -quick-xml = "0.30" +quick-xml = ">=0.29, <0.31" [package.metadata.docs.rs] all-features = true diff --git a/lib/sparql-smith/Cargo.toml b/lib/sparql-smith/Cargo.toml index 5fe5e33c..22d361d6 100644 --- a/lib/sparql-smith/Cargo.toml +++ b/lib/sparql-smith/Cargo.toml @@ -21,4 +21,4 @@ order = [] sep-0006 = [] [dependencies] -arbitrary = { version = "1", features = ["derive"] } +arbitrary = { version = "1.3", features = ["derive"] } diff --git a/lib/src/storage/backend/rocksdb.rs b/lib/src/storage/backend/rocksdb.rs index 6d065059..4360e3e6 100644 --- a/lib/src/storage/backend/rocksdb.rs +++ b/lib/src/storage/backend/rocksdb.rs @@ -9,6 +9,7 @@ )] use crate::storage::error::{CorruptionError, StorageError}; +use lazy_static::lazy_static; use libc::{self, c_void, free}; use oxrocksdb_sys::*; use rand::random; @@ -25,7 +26,7 @@ use std::marker::PhantomData; use std::ops::Deref; use std::path::{Path, PathBuf}; use std::rc::{Rc, Weak}; -use std::sync::{Arc, OnceLock}; +use std::sync::Arc; use std::thread::{available_parallelism, yield_now}; use std::{ptr, slice}; @@ -56,6 +57,23 @@ macro_rules! ffi_result_impl { }} } +lazy_static! { + static ref ROCKSDB_ENV: UnsafeEnv = { + unsafe { + let env = rocksdb_create_default_env(); + assert!(!env.is_null(), "rocksdb_create_default_env returned null"); + UnsafeEnv(env) + } + }; + static ref ROCKSDB_MEM_ENV: UnsafeEnv = { + unsafe { + let env = rocksdb_create_mem_env(); + assert!(!env.is_null(), "rocksdb_create_mem_env returned null"); + UnsafeEnv(env) + } + }; +} + pub struct ColumnFamilyDefinition { pub name: &'static str, pub use_iter: bool, @@ -454,9 +472,6 @@ impl Db { limit_max_open_files: bool, in_memory: bool, ) -> Result<*mut rocksdb_options_t, StorageError> { - static ROCKSDB_ENV: OnceLock = OnceLock::new(); - static ROCKSDB_MEM_ENV: OnceLock = OnceLock::new(); - unsafe { let options = rocksdb_options_create(); assert!(!options.is_null(), "rocksdb_options_create returned null"); @@ -493,19 +508,10 @@ impl Db { rocksdb_options_set_env( options, if in_memory { - ROCKSDB_MEM_ENV.get_or_init(|| { - let env = rocksdb_create_mem_env(); - assert!(!env.is_null(), "rocksdb_create_mem_env returned null"); - UnsafeEnv(env) - }) + ROCKSDB_MEM_ENV.0 } else { - ROCKSDB_ENV.get_or_init(|| { - let env = rocksdb_create_default_env(); - assert!(!env.is_null(), "rocksdb_create_default_env returned null"); - UnsafeEnv(env) - }) - } - .0, + ROCKSDB_ENV.0 + }, ); Ok(options) } @@ -1394,8 +1400,7 @@ impl From for StorageError { struct UnsafeEnv(*mut rocksdb_env_t); -// Hack for OnceCell. OK because only written in OnceCell and used in a thread-safe way by RocksDB -unsafe impl Send for UnsafeEnv {} +// Hack for lazy_static. OK because only written in lazy static and used in a thread-safe way by RocksDB unsafe impl Sync for UnsafeEnv {} fn path_to_cstring(path: &Path) -> Result { diff --git a/lints/test_debian_compatibility.py b/lints/test_debian_compatibility.py new file mode 100644 index 00000000..ec11b319 --- /dev/null +++ b/lints/test_debian_compatibility.py @@ -0,0 +1,116 @@ +import json +import subprocess +from pathlib import Path +from urllib.request import urlopen + +TARGET_DEBIAN_VERSIONS = ["sid"] +IGNORE_PACKAGES = {"oxigraph-js", "oxigraph-testsuite", "pyoxigraph", "sparql-smith"} +ALLOWED_MISSING_PACKAGES = {"escargot", "quick-xml"} + +base_path = Path(__file__).parent.parent + +cargo_metadata = json.loads( + subprocess.check_output(["cargo", "metadata", "--format-version", "1"]) +) +package_by_id = {package["id"]: package for package in cargo_metadata["packages"]} +workspace_packages = { + package_id.split(" ")[0] + for package_id in cargo_metadata["workspace_default_members"] +} +debian_cache = {} +errors = set() + + +def parse_version(version): + return tuple(int(e) for e in version.split("-")[0].split(".")) + + +for package_id in cargo_metadata["workspace_default_members"]: + package = package_by_id[package_id] + if package["name"] in IGNORE_PACKAGES: + continue + for dependency in package["dependencies"]: + if ( + dependency["name"] in workspace_packages + or dependency["name"] in ALLOWED_MISSING_PACKAGES + ): + continue + candidate_debian_name = f"rust-{dependency['name'].replace('_', '-')}" + if dependency["name"] not in debian_cache: + with urlopen( + f"https://sources.debian.org/api/src/{candidate_debian_name}/" + ) as response: + debian_package = json.loads(response.read().decode()) + debian_cache[candidate_debian_name] = debian_package + debian_package = debian_cache[candidate_debian_name] + if "error" in debian_package: + errors.add(f"No Debian package found for {dependency['name']}") + continue + for target_debian_suite in TARGET_DEBIAN_VERSIONS: + debian_version = next( + ( + debian_version + for debian_version in debian_package["versions"] + if target_debian_suite in debian_version["suites"] + ), + None, + ) + if debian_version is None: + errors.add( + f"The debian package {debian_package['package']} does not support {target_debian_suite}" + ) + continue + + # We check the debian version is compatible with the req version + parsed_debian_version = parse_version(debian_version["version"]) + for range_element in dependency["req"].split(","): + range_element = range_element.strip() + if range_element.startswith("^"): + first_found = False + for expected, actual in zip( + parse_version(range_element[1:]), parsed_debian_version + ): + if first_found: + if actual > expected: + break # Done + if actual < expected: + errors.add( + f"The debian package {debian_package['package']} version {debian_version['version']} is not compatible with requirement {range_element}" + ) + break + else: + if actual != expected: + errors.add( + f"The debian package {debian_package['package']} version {debian_version['version']} is not compatible with requirement {range_element}" + ) + if expected != 0: + first_found = True + elif range_element.startswith(">="): + if not parsed_debian_version >= parse_version(range_element[2:]): + errors.add( + f"The debian package {debian_package['package']} version {debian_version['version']} is not compatible with requirement {range_element}" + ) + elif range_element.startswith(">"): + if not parsed_debian_version > parse_version(range_element[1:]): + errors.add( + f"The debian package {debian_package['package']} version {debian_version['version']} is not compatible with requirement {range_element}" + ) + elif range_element.startswith("<="): + if not parsed_debian_version <= parse_version(range_element[2:]): + errors.add( + f"The debian package {debian_package['package']} version {debian_version['version']} is not compatible with requirement {range_element}" + ) + elif range_element.startswith("<"): + if not parsed_debian_version < parse_version(range_element[1:]): + errors.add( + f"The debian package {debian_package['package']} version {debian_version['version']} is not compatible with requirement {range_element}" + ) + else: + errors.add( + f"The requirement {range_element} of {dependency['name']} is not supported by this script" + ) + +for error in sorted(errors): + print(error) +if errors: + exit(1) diff --git a/test_spec_links.py b/lints/test_spec_links.py similarity index 95% rename from test_spec_links.py rename to lints/test_spec_links.py index 76fb2e88..a0d2c2e9 100644 --- a/test_spec_links.py +++ b/lints/test_spec_links.py @@ -10,12 +10,12 @@ LINK_REGEXES = { r"<(https?://(w3c.github.io|www.w3.org)/[^>]+)>`_", # reStructuredText } -base_path = Path(__file__).parent +base_path = Path(__file__).parent.parent spec_cache = {} errors = set() for ext in ("md", "rs", "rst"): - for file in Path(__file__).parent.rglob(f"*.{ext}"): + for file in base_path.rglob(f"*.{ext}"): content = file.read_text() for link_regex in LINK_REGEXES: for m in re.finditer(link_regex, content): diff --git a/oxrocksdb-sys/Cargo.toml b/oxrocksdb-sys/Cargo.toml index e91881e9..70e03ff3 100644 --- a/oxrocksdb-sys/Cargo.toml +++ b/oxrocksdb-sys/Cargo.toml @@ -15,8 +15,8 @@ build = "build.rs" links = "rocksdb" [dependencies] -libc = "0.2" +libc = "0.2.147" [build-dependencies] -bindgen = "0.66" -cc = { version = "1", features = ["parallel"] } +bindgen = ">=0.60, <0.69" +cc = { version = "1.0.73", features = ["parallel"] } diff --git a/python/src/io.rs b/python/src/io.rs index 86f39992..9bd957c6 100644 --- a/python/src/io.rs +++ b/python/src/io.rs @@ -12,7 +12,6 @@ use std::error::Error; use std::fs::File; use std::io::{self, BufWriter, Cursor, Read, Write}; use std::path::{Path, PathBuf}; -use std::sync::OnceLock; pub fn add_to_module(module: &PyModule) -> PyResult<()> { module.add_wrapped(wrap_pyfunction!(parse))?; @@ -325,7 +324,7 @@ pub fn map_parse_error(error: ParseError, file_path: Option) -> PyErr { match error { ParseError::Syntax(error) => { // Python 3.9 does not support end line and end column - if python_version() >= (3, 10, 0) { + if python_version() >= (3, 10) { let params = if let Some(location) = error.location() { ( file_path, @@ -382,12 +381,9 @@ pub fn allow_threads_unsafe(f: impl FnOnce() -> T) -> T { f() } -fn python_version() -> (u8, u8, u8) { - static VERSION: OnceLock<(u8, u8, u8)> = OnceLock::new(); - *VERSION.get_or_init(|| { - Python::with_gil(|py| { - let v = py.version_info(); - (v.major, v.minor, v.patch) - }) +fn python_version() -> (u8, u8) { + Python::with_gil(|py| { + let v = py.version_info(); + (v.major, v.minor) }) } diff --git a/testsuite/Cargo.toml b/testsuite/Cargo.toml index 3a473001..47c3ce2e 100644 --- a/testsuite/Cargo.toml +++ b/testsuite/Cargo.toml @@ -11,8 +11,9 @@ rust-version.workspace = true publish = false [dependencies] -anyhow = "1" -clap = { version = "4", features = ["derive"] } +anyhow = "1.0.72" +clap = { version = ">=4.0, <5.0", features = ["derive"] } +lazy_static = "1.4" oxigraph = { path = "../lib" } oxttl = { path= "../lib/oxttl" } sparopt = { path = "../lib/sparopt" } diff --git a/testsuite/src/sparql_evaluator.rs b/testsuite/src/sparql_evaluator.rs index 67081be6..d5b4d265 100644 --- a/testsuite/src/sparql_evaluator.rs +++ b/testsuite/src/sparql_evaluator.rs @@ -4,6 +4,7 @@ use crate::manifest::*; use crate::report::{dataset_diff, format_diff}; use crate::vocab::*; use anyhow::{anyhow, bail, ensure, Error, Result}; +use lazy_static::lazy_static; use oxigraph::model::vocab::*; use oxigraph::model::*; use oxigraph::sparql::results::QueryResultsFormat; @@ -15,7 +16,7 @@ use std::fmt::Write; use std::io::{self, BufReader, Cursor}; use std::ops::Deref; use std::str::FromStr; -use std::sync::{Arc, Mutex, OnceLock}; +use std::sync::{Arc, Mutex}; pub fn register_sparql_tests(evaluator: &mut TestEvaluator) { evaluator.register( @@ -739,11 +740,13 @@ fn evaluate_query_optimization_test(test: &Test) -> Result<()> { Ok(()) } -// Pool of stores to avoid allocating/deallocating them a lot -static STORE_POOL: OnceLock>> = OnceLock::new(); +lazy_static! { + // Pool of stores to avoid allocating/deallocating them a lot + static ref STORE_POOL: Mutex> = Mutex::new(Vec::new()); +} fn get_store() -> Result { - let store = if let Some(store) = STORE_POOL.get_or_init(Mutex::default).lock().unwrap().pop() { + let store = if let Some(store) = STORE_POOL.lock().unwrap().pop() { store } else { Store::new()? @@ -758,11 +761,7 @@ struct StoreRef { impl Drop for StoreRef { fn drop(&mut self) { if self.store.clear().is_ok() { - STORE_POOL - .get_or_init(Mutex::default) - .lock() - .unwrap() - .push(self.store.clone()) + STORE_POOL.lock().unwrap().push(self.store.clone()) } } }