launchbadge / sqlx

🧰 The Rust SQL Toolkit. An async, pure Rust SQL crate featuring compile-time checked queries without a DSL. Supports PostgreSQL, MySQL, and SQLite.
Apache License 2.0
12.48k stars 1.18k forks source link

`chrono.clock` feature is not enabled on all crates #3332

Open LecrisUT opened 1 week ago

LecrisUT commented 1 week ago

When running the tests for sqlx-sqlite in Fedora packaging I get the following error:

`chrono::Local` is gated behind `clock` feature

This issue is not detected when running from workspace because sqlx-core includes the clock featureandsqlx-sqlitedepends onsqlx-core. But when building and testing thesqlx-sqlite` crate standalone with all features enable, this issue pops up.

How about either adding the clock feature to the base workspace dependency or adding those features to each crate? Probably there are some other dependencies with similar issues.

CommanderStorm commented 1 week ago

Why do you want sqlx-sqlite in fedora in the first place? It is not like that lib can be linked against.

For anything rust related, using the regular crate is likely a better fit, or am I missing something?

sqlx = { version = "0.7", features = [ "runtime-tokio", "sqlite"] }
LecrisUT commented 1 week ago

Fedora packaging policy is to package each crate individually. The main project that I'm trying to package is atuin which depends on both sqlx and sqlx-sqlite.

People tend to disagree with this non-vendored approach, but this has benefits for distro packagers particularly in the control of security patches.

CommanderStorm commented 1 week ago

From https://docs.fedoraproject.org/en-US/packaging-guidelines/Rust/

Rust projects that are organized as cargo "workspaces"

For [this case], the rust2rpm tool can be used to generate spec files from cargo / crate metadata. It is designed to produce spec files that are in line with the (Rust) Packaging Guidelines

=> I (not a maintainer) would consider that package as an "internal implementation detail" and choose the cargo workspace projects rules for fedora packaging.

atuin which depends on both sqlx and sqlx-sqlite

I only see the following. Am I missing something? https://github.com/atuinsh/atuin/blob/f56a66add9e64151e98ce35c3e85f436927c1ac3/Cargo.toml#L55

LecrisUT commented 1 week ago

Workspace projects are only used when there is no other package that depends on it. That is because the crates cannot be extracted in the current workflow and sometimes projects do not have version sync on the workspace. Unfortunately sqlx is used as a crate so it needs to be broken down.

For atuin see this section. The direct dependency is sqlx[sqlite], but in order to package that, sqlx-sqlite is needed among the other dependencies.