Skip to content

Commit

Permalink
add build set-toolchain subcommand
Browse files Browse the repository at this point in the history
  • Loading branch information
syphar committed Oct 6, 2023
1 parent b0a0861 commit 723fc59
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/bin/cratesfyi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use docs_rs::db::{self, add_path_into_database, Overrides, Pool, PoolClient};
use docs_rs::repositories::RepositoryStatsUpdater;
use docs_rs::utils::{
get_config, get_crate_pattern_and_priority, list_crate_priorities, queue_builder,
remove_crate_priority, set_crate_priority, ConfigName,
remove_crate_priority, set_config, set_crate_priority, ConfigName,
};
use docs_rs::{
start_background_metrics_webserver, start_web_server, BuildQueue, Config, Context, Index,
Expand Down Expand Up @@ -383,6 +383,10 @@ enum BuildSubcommand {
/// Adds essential files for the installed version of rustc
AddEssentialFiles,

SetToolchain {
toolchain_name: String,
},

/// Locks the daemon, preventing it from building new crates
Lock,

Expand Down Expand Up @@ -459,6 +463,15 @@ impl BuildSubcommand {
.context("failed to add essential files")?;
}

Self::SetToolchain { toolchain_name } => {
let mut conn = ctx
.pool()?
.get()
.context("failed to get a database connection")?;
set_config(&mut conn, ConfigName::Toolchain, toolchain_name)
.context("failed to set toolchain in database")?;
}

Self::Lock => build_queue.lock().context("Failed to lock")?,
Self::Unlock => build_queue.unlock().context("Failed to unlock")?,
}
Expand Down

0 comments on commit 723fc59

Please sign in to comment.