summaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs22
1 files changed, 6 insertions, 16 deletions
diff --git a/src/main.rs b/src/main.rs
index ccd20a2..edfcd44 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,11 +1,3 @@
-//! `aur-build` — the operator's command line (§7.2, §12).
-//!
-//! P0 ships the approval path as a CLI subcommand: the same code the web UI
-//! will call in P2, so the invariant "we build exactly what was displayed, or
-//! nothing" is enforced here too. `approve` renders the review, prints it, and
-//! then approves with the hashes it just displayed — it cannot approve a diff it
-//! did not show you.
-
use std::path::PathBuf;
use clap::{Parser, Subcommand};
@@ -119,10 +111,9 @@ enum Cmd {
fn main() -> anyhow::Result<()> {
let cli = Cli::parse();
// `init` is the only command that runs before a config exists. For everything
- // else a missing config is the error it sounds like, not a reason to invent
- // one: the old unconditional fallback turned a typo'd `--root` into a fresh
- // empty server at the wrong path, whose commands then "succeeded" against a
- // database with no subscriptions and no releases in it.
+ // else a missing config is an error, not a reason to invent one: the old
+ // unconditional fallback turned a typo'd `--root` into a fresh empty server
+ // at the wrong path.
let root = cli.root.clone().unwrap_or_else(|| Config::default().root);
let cfg = if matches!(cli.cmd, Cmd::Init { .. }) {
Config::load(&root).unwrap_or_else(|_| Config {
@@ -156,9 +147,8 @@ fn main() -> anyhow::Result<()> {
let stop = std::sync::Arc::new(std::sync::atomic::AtomicBool::new(false));
aur_build::watch::scheduler::spawn_scheduler(std::sync::Arc::new(cfg.clone()), db.clone(), stop.clone());
let _server = aur_build::http::spawn(cfg.clone(), db.clone())?;
- // The dispatcher reaps expired leases before its first claim, so a
- // restart recovers whatever a crash left leased without any special
- // startup routine (§8.2).
+ // The dispatcher reaps expired leases before its first claim, so a restart
+ // recovers whatever a crash left leased (§8.2).
let _pool = aur_build::pipeline::dispatch::Pool::spawn(std::sync::Arc::new(cfg.clone()), db.clone());
println!("serving on http://{} — ctrl-c to stop", cfg.bind);
// Single process, thread per connection: the main thread has nothing to
@@ -259,7 +249,7 @@ fn main() -> anyhow::Result<()> {
}
Cmd::Approve { candidate, yes, note, identity, diff: diff_arg } => {
let c = need_candidate(&ctx.db, candidate)?;
- // Render first, always. The hashes we send are the hashes of what we
+ // Render first, always: the hashes we send are the hashes of what we
// just rendered, unless the operator explicitly names older ones.
let (text, digest) = diff::render_current(&ctx.db, &cfg, &c)?;
candidates::set_diff_digest(&ctx.db, c.id, &digest)?;