Skip to content

Commit 723fc59

Browse files
committed
add build set-toolchain subcommand
1 parent b0a0861 commit 723fc59

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/bin/cratesfyi.rs

+14-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use docs_rs::db::{self, add_path_into_database, Overrides, Pool, PoolClient};
1212
use docs_rs::repositories::RepositoryStatsUpdater;
1313
use docs_rs::utils::{
1414
get_config, get_crate_pattern_and_priority, list_crate_priorities, queue_builder,
15-
remove_crate_priority, set_crate_priority, ConfigName,
15+
remove_crate_priority, set_config, set_crate_priority, ConfigName,
1616
};
1717
use docs_rs::{
1818
start_background_metrics_webserver, start_web_server, BuildQueue, Config, Context, Index,
@@ -383,6 +383,10 @@ enum BuildSubcommand {
383383
/// Adds essential files for the installed version of rustc
384384
AddEssentialFiles,
385385

386+
SetToolchain {
387+
toolchain_name: String,
388+
},
389+
386390
/// Locks the daemon, preventing it from building new crates
387391
Lock,
388392

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

466+
Self::SetToolchain { toolchain_name } => {
467+
let mut conn = ctx
468+
.pool()?
469+
.get()
470+
.context("failed to get a database connection")?;
471+
set_config(&mut conn, ConfigName::Toolchain, toolchain_name)
472+
.context("failed to set toolchain in database")?;
473+
}
474+
462475
Self::Lock => build_queue.lock().context("Failed to lock")?,
463476
Self::Unlock => build_queue.unlock().context("Failed to unlock")?,
464477
}

0 commit comments

Comments
 (0)