Skip to content

Commit 82367da

Browse files
committed
fix: disable duckdb on musl targets
1 parent 46582fb commit 82367da

File tree

4 files changed

+38
-7
lines changed

4 files changed

+38
-7
lines changed

.cargo/config.toml

Lines changed: 0 additions & 2 deletions
This file was deleted.

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,16 @@ tokio-postgres = "0.7.13"
2424
mysql_async = { version = "0.36.1", default-features = false, features = ["rustls-tls", "default-rustls"] }
2525
humantime = "2.2.0"
2626
clickhouse = { version = "0.13.3", features = ["rustls-tls"] }
27-
duckdb = { version = "1.4.4", features = ["bundled"] }
2827
libsql = { version = "0.9.19", features = ["remote"] }
2928
tiberius = { version = "0.12.3", default-features = false, features = ["rustls", "tds73", "tokio", "tokio-util"] }
3029
tokio-util = "0.7.15"
3130
tokio-postgres-rustls = "0.13.0"
3231
rustls = "0.23"
3332
webpki-roots = "1.0"
3433

34+
[target.'cfg(not(target_env = "musl"))'.dependencies]
35+
duckdb = { version = "1.4.4", features = ["bundled"] }
36+
3537
[profile.release]
3638
strip = true
3739
opt-level = "z"

dist-workspace.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,3 @@ install-updater = true
1717
install-path = "CARGO_HOME"
1818
# Skip checking whether the specified configuration files are up to date
1919
allow-dirty = ["ci"]
20-
21-
[dist.dependencies.apt]
22-
musl-tools = { version = '*', targets = ["x86_64-unknown-linux-musl"] }
23-
musl-dev = { version = '*', targets = ["x86_64-unknown-linux-musl"] }

src/main.rs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,20 +80,23 @@ enum Command {
8080
},
8181

8282
/// A local DuckDB database.
83+
#[cfg(not(target_env = "musl"))]
8384
Duckdb {
8485
/// Path to the the duckdb file.
8586
#[arg(env)]
8687
database: String,
8788
},
8889

8990
/// A local Parquet file.
91+
#[cfg(not(target_env = "musl"))]
9092
Parquet {
9193
/// Path to the parquet file.
9294
#[arg(env)]
9395
file: String,
9496
},
9597

9698
/// A local CSV file.
99+
#[cfg(not(target_env = "musl"))]
97100
Csv {
98101
/// Path to the CSV file.
99102
#[arg(env)]
@@ -153,12 +156,15 @@ async fn main() -> color_eyre::Result<()> {
153156
AllDbs::Postgres(postgres::Db::open(url, schema, args.timeout.into()).await?)
154157
}
155158
Command::Mysql { url } => AllDbs::Mysql(mysql::Db::open(url, args.timeout.into()).await?),
159+
#[cfg(not(target_env = "musl"))]
156160
Command::Duckdb { database } => {
157161
AllDbs::Duckdb(duckdb::Db::open(database, args.timeout.into()).await?)
158162
}
163+
#[cfg(not(target_env = "musl"))]
159164
Command::Parquet { file } => {
160165
AllDbs::Parquet(parquet::Db::open(file, args.timeout.into()).await?)
161166
}
167+
#[cfg(not(target_env = "musl"))]
162168
Command::Csv { file } => AllDbs::Csv(csv::Db::open(file, args.timeout.into()).await?),
163169
Command::Clickhouse {
164170
url,
@@ -355,8 +361,11 @@ enum AllDbs {
355361
Libsql(libsql::Db),
356362
Postgres(postgres::Db),
357363
Mysql(mysql::Db),
364+
#[cfg(not(target_env = "musl"))]
358365
Duckdb(duckdb::Db),
366+
#[cfg(not(target_env = "musl"))]
359367
Parquet(parquet::Db),
368+
#[cfg(not(target_env = "musl"))]
360369
Csv(csv::Db),
361370
Clickhouse(Box<clickhouse::Db>),
362371
MsSql(mssql::Db),
@@ -369,8 +378,11 @@ impl Database for AllDbs {
369378
AllDbs::Libsql(x) => x.overview().await,
370379
AllDbs::Postgres(x) => x.overview().await,
371380
AllDbs::Mysql(x) => x.overview().await,
381+
#[cfg(not(target_env = "musl"))]
372382
AllDbs::Duckdb(x) => x.overview().await,
383+
#[cfg(not(target_env = "musl"))]
373384
AllDbs::Parquet(x) => x.overview().await,
385+
#[cfg(not(target_env = "musl"))]
374386
AllDbs::Csv(x) => x.overview().await,
375387
AllDbs::Clickhouse(x) => x.overview().await,
376388
AllDbs::MsSql(x) => x.overview().await,
@@ -383,8 +395,11 @@ impl Database for AllDbs {
383395
AllDbs::Libsql(x) => x.tables().await,
384396
AllDbs::Postgres(x) => x.tables().await,
385397
AllDbs::Mysql(x) => x.tables().await,
398+
#[cfg(not(target_env = "musl"))]
386399
AllDbs::Duckdb(x) => x.tables().await,
400+
#[cfg(not(target_env = "musl"))]
387401
AllDbs::Parquet(x) => x.tables().await,
402+
#[cfg(not(target_env = "musl"))]
388403
AllDbs::Csv(x) => x.tables().await,
389404
AllDbs::Clickhouse(x) => x.tables().await,
390405
AllDbs::MsSql(x) => x.tables().await,
@@ -397,8 +412,11 @@ impl Database for AllDbs {
397412
AllDbs::Libsql(x) => x.table(name).await,
398413
AllDbs::Postgres(x) => x.table(name).await,
399414
AllDbs::Mysql(x) => x.table(name).await,
415+
#[cfg(not(target_env = "musl"))]
400416
AllDbs::Duckdb(x) => x.table(name).await,
417+
#[cfg(not(target_env = "musl"))]
401418
AllDbs::Parquet(x) => x.table(name).await,
419+
#[cfg(not(target_env = "musl"))]
402420
AllDbs::Csv(x) => x.table(name).await,
403421
AllDbs::Clickhouse(x) => x.table(name).await,
404422
AllDbs::MsSql(x) => x.table(name).await,
@@ -415,8 +433,11 @@ impl Database for AllDbs {
415433
AllDbs::Libsql(x) => x.table_data(name, page).await,
416434
AllDbs::Postgres(x) => x.table_data(name, page).await,
417435
AllDbs::Mysql(x) => x.table_data(name, page).await,
436+
#[cfg(not(target_env = "musl"))]
418437
AllDbs::Duckdb(x) => x.table_data(name, page).await,
438+
#[cfg(not(target_env = "musl"))]
419439
AllDbs::Parquet(x) => x.table_data(name, page).await,
440+
#[cfg(not(target_env = "musl"))]
420441
AllDbs::Csv(x) => x.table_data(name, page).await,
421442
AllDbs::Clickhouse(x) => x.table_data(name, page).await,
422443
AllDbs::MsSql(x) => x.table_data(name, page).await,
@@ -429,8 +450,11 @@ impl Database for AllDbs {
429450
AllDbs::Libsql(x) => x.tables_with_columns().await,
430451
AllDbs::Postgres(x) => x.tables_with_columns().await,
431452
AllDbs::Mysql(x) => x.tables_with_columns().await,
453+
#[cfg(not(target_env = "musl"))]
432454
AllDbs::Duckdb(x) => x.tables_with_columns().await,
455+
#[cfg(not(target_env = "musl"))]
433456
AllDbs::Parquet(x) => x.tables_with_columns().await,
457+
#[cfg(not(target_env = "musl"))]
434458
AllDbs::Csv(x) => x.tables_with_columns().await,
435459
AllDbs::Clickhouse(x) => x.tables_with_columns().await,
436460
AllDbs::MsSql(x) => x.tables_with_columns().await,
@@ -443,8 +467,11 @@ impl Database for AllDbs {
443467
AllDbs::Libsql(x) => x.query(query).await,
444468
AllDbs::Postgres(x) => x.query(query).await,
445469
AllDbs::Mysql(x) => x.query(query).await,
470+
#[cfg(not(target_env = "musl"))]
446471
AllDbs::Duckdb(x) => x.query(query).await,
472+
#[cfg(not(target_env = "musl"))]
447473
AllDbs::Parquet(x) => x.query(query).await,
474+
#[cfg(not(target_env = "musl"))]
448475
AllDbs::Csv(x) => x.query(query).await,
449476
AllDbs::Clickhouse(x) => x.query(query).await,
450477
AllDbs::MsSql(x) => x.query(query).await,
@@ -457,8 +484,11 @@ impl Database for AllDbs {
457484
AllDbs::Libsql(x) => x.erd().await,
458485
AllDbs::Postgres(x) => x.erd().await,
459486
AllDbs::Mysql(x) => x.erd().await,
487+
#[cfg(not(target_env = "musl"))]
460488
AllDbs::Duckdb(x) => x.erd().await,
489+
#[cfg(not(target_env = "musl"))]
461490
AllDbs::Parquet(x) => x.erd().await,
491+
#[cfg(not(target_env = "musl"))]
462492
AllDbs::Csv(x) => x.erd().await,
463493
AllDbs::Clickhouse(x) => x.erd().await,
464494
AllDbs::MsSql(x) => x.erd().await,
@@ -2751,6 +2781,7 @@ mod mysql {
27512781
}
27522782
}
27532783

2784+
#[cfg(not(target_env = "musl"))]
27542785
mod duckdb {
27552786
use color_eyre::eyre;
27562787
use color_eyre::eyre::OptionExt;
@@ -3235,6 +3266,7 @@ mod duckdb {
32353266
}
32363267
}
32373268

3269+
#[cfg(not(target_env = "musl"))]
32383270
mod parquet {
32393271
use color_eyre::eyre;
32403272
use color_eyre::eyre::OptionExt;
@@ -3562,6 +3594,7 @@ mod parquet {
35623594
}
35633595
}
35643596

3597+
#[cfg(not(target_env = "musl"))]
35653598
mod csv {
35663599
use color_eyre::eyre;
35673600
use color_eyre::eyre::OptionExt;
@@ -5003,6 +5036,7 @@ mod mssql {
50035036
}
50045037

50055038
mod helpers {
5039+
#[cfg(not(target_env = "musl"))]
50065040
use duckdb::types::ValueRef as DuckdbValue;
50075041
use libsql::Value as LibsqlValue;
50085042
use tiberius::ColumnData;
@@ -5042,6 +5076,7 @@ mod helpers {
50425076
}
50435077
}
50445078

5079+
#[cfg(not(target_env = "musl"))]
50455080
pub fn duckdb_value_to_json(v: DuckdbValue) -> serde_json::Value {
50465081
use DuckdbValue::*;
50475082
match v {

0 commit comments

Comments
 (0)