From b0f24d016026acb507640d7049fc994b1d0c8aa6 Mon Sep 17 00:00:00 2001 From: Bas Zalmstra Date: Tue, 26 Sep 2023 10:48:08 +0200 Subject: [PATCH] fix: index to seperate crate and ci issues --- .github/workflows/rust-compile.yml | 3 -- Cargo.lock | 20 ++++++++++++ crates/index/Cargo.toml | 32 +++++++++++++++++++ .../src/bin/index.rs => index/src/main.rs} | 6 ++-- crates/rattler_installs_packages/Cargo.toml | 9 +++--- crates/rip/Cargo.toml | 19 ++++------- 6 files changed, 66 insertions(+), 23 deletions(-) create mode 100644 crates/index/Cargo.toml rename crates/{rip/src/bin/index.rs => index/src/main.rs} (99%) diff --git a/.github/workflows/rust-compile.yml b/.github/workflows/rust-compile.yml index 5e46cdf8..1ad11f08 100644 --- a/.github/workflows/rust-compile.yml +++ b/.github/workflows/rust-compile.yml @@ -14,7 +14,6 @@ env: RUST_BACKTRACE: 1 RUSTFLAGS: "-D warnings" CARGO_TERM_COLOR: always - DEFAULT_FEATURES: jobs: check-rustdoc-links: @@ -105,7 +104,6 @@ jobs: run: > cargo build --all-targets - --features ${{ env.DEFAULT_FEATURES }} ${{ steps.build-options.outputs.CARGO_BUILD_OPTIONS}} - name: Disable testing the tools crate if cross compiling @@ -119,7 +117,6 @@ jobs: run: > cargo test --workspace - --features ${{ env.DEFAULT_FEATURES }} ${{ steps.build-options.outputs.CARGO_BUILD_OPTIONS}} ${{ steps.test-options.outputs.CARGO_TEST_OPTIONS}} -- diff --git a/Cargo.lock b/Cargo.lock index 429f23da..b963bdcc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1104,6 +1104,26 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "index" +version = "0.1.0" +dependencies = [ + "clap 4.4.4", + "dirs", + "indexmap 2.0.0", + "indicatif", + "miette", + "rand", + "rattler_installs_packages", + "rip", + "rusqlite", + "serde_json", + "tokio", + "tracing", + "tracing-subscriber", + "url", +] + [[package]] name = "indexmap" version = "1.9.3" diff --git a/crates/index/Cargo.toml b/crates/index/Cargo.toml new file mode 100644 index 00000000..1385743a --- /dev/null +++ b/crates/index/Cargo.toml @@ -0,0 +1,32 @@ +[package] +name = "index" +authors = ["Tim de Jager "] +version.workspace = true +categories.workspace = true +homepage.workspace = true +repository.workspace = true +license.workspace = true +edition.workspace = true +readme.workspace = true +rust-version.workspace = true + +[dependencies] +clap = { version = "4.3.23", features = ["derive"] } +dirs = "5.0.1" +indexmap = "2.0.0" +indicatif = "0.17.6" +miette = { version = "5.10.0", features = ["fancy"] } +rand = "0.8.4" +rattler_installs_packages = { path = "../rattler_installs_packages" } +rip = { path = "../rip" } +rusqlite = { version = "0.29.0", features = ["bundled"] } +serde_json = "1.0.107" +tokio = { version = "1.29.1", features = ["rt", "macros", "rt-multi-thread"] } +tracing = "0.1.37" +tracing-subscriber = { version = "0.3.17", features = ["env-filter"] } +url = "2.4.0" + + +[package.metadata.release] +# Dont publish the binary +release = false diff --git a/crates/rip/src/bin/index.rs b/crates/index/src/main.rs similarity index 99% rename from crates/rip/src/bin/index.rs rename to crates/index/src/main.rs index de252713..ba630f68 100644 --- a/crates/rip/src/bin/index.rs +++ b/crates/index/src/main.rs @@ -51,7 +51,7 @@ pub async fn index(index_url: Url) -> Result<(), miette::Error> { &[normalize_index_url(index_url)], cache_dir.clone(), ) - .into_diagnostic()?; + .into_diagnostic()?; let mut names = package_db.get_package_names().await?; names.shuffle(&mut rand::thread_rng()); @@ -65,7 +65,7 @@ pub async fn index(index_url: Url) -> Result<(), miette::Error> { "CREATE UNIQUE INDEX IF NOT EXISTS idx_name_version ON `metadata` (`name`, `version`)", (), ) - .into_diagnostic()?; + .into_diagnostic()?; let mut insert_stmt = conn.prepare("INSERT INTO metadata (name, version, requires_dist, requires_python, extras) VALUES (?, ?, ?, ?, ?)").into_diagnostic()?; let mut request = conn @@ -180,7 +180,7 @@ pub fn query_extras() -> Result<(), miette::Error> { let requires_dist = serde_json::from_str::>( requirement.into_diagnostic()?.as_str(), ) - .into_diagnostic()?; + .into_diagnostic()?; total += requires_dist.len(); for req in requires_dist { if !req.extras.is_empty() { diff --git a/crates/rattler_installs_packages/Cargo.toml b/crates/rattler_installs_packages/Cargo.toml index f779fd81..35da225d 100644 --- a/crates/rattler_installs_packages/Cargo.toml +++ b/crates/rattler_installs_packages/Cargo.toml @@ -38,20 +38,19 @@ serde_with = "3.0.0" smallvec = { version = "1.11.0", features = ["const_generics", "const_new"] } tempfile = "3.6.0" thiserror = "1.0.43" +tl = "0.7.7" tokio = { version = "1.29.1" } tokio-util = { version = "0.7.8", features = ["compat"] } tracing = { version = "0.1.37", default-features = false, features = ["attributes"] } url = { version = "2.4.0", features = ["serde"] } zip = "0.6.6" -tl = "0.7.7" - [dev-dependencies] -tokio = { version = "1.29.1", features = ["rt", "macros"] } -miette = { version = "5.9.0", features = ["fancy"] } +criterion = "0.3" insta = { version = "1.30.0", features = ["ron"] } +miette = { version = "5.9.0", features = ["fancy"] } once_cell = "1.18.0" -criterion = "0.3" +tokio = { version = "1.29.1", features = ["rt", "macros"] } [[bench]] name = "html" diff --git a/crates/rip/Cargo.toml b/crates/rip/Cargo.toml index 7882108a..5386129c 100644 --- a/crates/rip/Cargo.toml +++ b/crates/rip/Cargo.toml @@ -11,11 +11,6 @@ license.workspace = true readme.workspace = true default-run = "rip" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[[bin]] -name = "index" - [dependencies] clap = { version = "4.3.23", features = ["derive"] } console = { version = "0.15.7", features = ["windows-console-colors"] } @@ -24,19 +19,19 @@ indexmap = "2.0.0" indicatif = "0.17.6" itertools = "0.11.0" miette = { version = "5.10.0", features = ["fancy"] } +rand = "0.8.4" rattler_installs_packages = { path = "../rattler_installs_packages" } -resolvo = "0.1.0" reqwest = "0.11.19" +resolvo = "0.1.0" +rusqlite = { version = "0.29.0", features = ["bundled"] } +serde = "1.0.188" +serde_json = "1.0.107" +serde_with = "3.0.0" tabwriter = { version = "1.2.1", features = ["ansi_formatting"] } tokio = { version = "1.29.1", features = ["rt", "macros", "rt-multi-thread"] } tracing = "0.1.37" -tracing-subscriber = { version = "0.3.17", features = ["env-filter"]} +tracing-subscriber = { version = "0.3.17", features = ["env-filter"] } url = "2.4.0" -rand = "0.8.4" -serde = "1.0.188" -serde_with = "3.0.0" -serde_json = "1.0.107" -rusqlite = { version = "0.29.0", features = ["bundled"] } [package.metadata.release] # Dont publish the binary