Skip to content

Commit

Permalink
debian-packaging: make tokio an optional dependency
Browse files Browse the repository at this point in the history
Closes #15.
  • Loading branch information
russelltg authored and indygreg committed Nov 2, 2024
1 parent 4a26fb1 commit 131a286
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions debian-packaging/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Released on ReleaseDate.

* Fixed compile error when building without the `http` feature.
* MSRV 1.70 -> 1.75.
* `tokio` is now an optional dependency and is dependent on the `http` feature.
* `async-std` 1.12 -> 1.13.
* `async-tar` 0.4 -> 0.5.
* `bytes` 1.5 -> 1.8.
Expand Down
5 changes: 3 additions & 2 deletions debian-packaging/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ strum = { version = "0.26.3", features = ["derive"] }
strum_macros = "0.26.4"
tar = "0.4.43"
thiserror = "1.0.66"
tokio = { version = "1.41.0", features = ["macros"] }
tokio = { version = "1.41.0", default-features = false, optional = true }
url = "2.5.2"
xz2 = { version = "0.1.7", features = ["static"] }
zstd = "0.13.2"
Expand Down Expand Up @@ -71,8 +71,9 @@ features = ["rustls"]
glob = "0.3.1"
indoc = "2.0.5"
tempfile = "3.13.0"
tokio = { version = "1.41.0", features = ["macros", "rt"] }

[features]
default = ["http", "s3"]
http = ["reqwest"]
s3 = ["rusoto_core", "rusoto_s3"]
s3 = ["dep:rusoto_core", "dep:rusoto_s3", "dep:tokio"]
7 changes: 5 additions & 2 deletions debian-packaging/src/repository/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1131,13 +1131,15 @@ async fn get_path_and_copy<'a, 'b>(

#[cfg(test)]
mod test {
#[cfg(feature = "http")]
use crate::repository::http::HttpRepositoryClient;
use {
super::*,
crate::{
io::PathMappingDataResolver,
repository::{
http::HttpRepositoryClient, RepositoryPathVerification,
RepositoryPathVerificationState, RepositoryRootReader, RepositoryWrite,
RepositoryPathVerification, RepositoryPathVerificationState, RepositoryRootReader,
RepositoryWrite,
},
signing_key::{create_self_signed_key, signing_secret_key_params_builder},
},
Expand Down Expand Up @@ -1210,6 +1212,7 @@ mod test {
}

#[tokio::test]
#[cfg(feature = "http")]
async fn bullseye_binary_packages_reader() -> Result<()> {
let root = HttpRepositoryClient::new(BULLSEYE_URL).unwrap();
let release = root.release_reader("bullseye").await.unwrap();
Expand Down
4 changes: 3 additions & 1 deletion debian-packaging/src/repository/copier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -657,15 +657,17 @@ mod test {
use {
super::*,
crate::repository::{
http::HttpRepositoryClient,
proxy_writer::{ProxyVerifyBehavior, ProxyWriter},
sink_writer::SinkWriter,
},
};
#[cfg(feature = "http")]
use crate::repository::http::HttpRepositoryClient;

const DEBIAN_URL: &str = "http://snapshot.debian.org/archive/debian/20211120T085721Z";

#[tokio::test]
#[cfg(feature = "http")]
async fn bullseye_copy() -> Result<()> {
let root =
Box::new(HttpRepositoryClient::new(DEBIAN_URL)?) as Box<dyn RepositoryRootReader>;
Expand Down

0 comments on commit 131a286

Please sign in to comment.