From e90357ab308cd6ce3c5aa4cc8d4c8fb9babb78ab Mon Sep 17 00:00:00 2001 From: Rain Date: Sat, 27 Sep 2025 03:10:03 +0000 Subject: [PATCH 1/3] [spr] changes to main this commit is based on Created using spr 1.3.6-beta.1 [skip ci] --- Cargo.lock | 2 +- Cargo.toml | 1 + xtask/Cargo.toml | 2 +- xtask/src/main.rs | 50 +++++++++++++++++++---------------------------- 4 files changed, 23 insertions(+), 32 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e29e35a..a679715 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5116,8 +5116,8 @@ dependencies = [ "anyhow", "camino", "chrono", + "clap 4.5.45", "omicron-zone-package", - "structopt", "tokio", ] diff --git a/Cargo.toml b/Cargo.toml index 2bdfaab..1fe9862 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,6 +29,7 @@ dpd-client = { git = "https://github.com/oxidecomputer/dendrite", branch = "main anyhow = "1.0" camino = { version = "1.1", features = ["serde1"] } chrono = "0.4" +clap = { version = "4.5.45", features = ["derive"] } dropshot = "0.16.3" futures = "0.3" http = "0.2.9" diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index e3109fb..d3cd01b 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -7,6 +7,6 @@ edition = "2018" anyhow.workspace = true camino.workspace = true chrono.workspace = true +clap.workspace = true omicron-zone-package.workspace = true -structopt.workspace = true tokio.workspace = true diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 2ff482d..6ef275d 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -8,10 +8,9 @@ use std::fs; #[cfg(target_os = "illumos")] use std::io::Read; use std::path::Path; -use std::str::FromStr; use anyhow::{anyhow, Context, Result}; -use structopt::*; +use clap::{Parser, ValueEnum}; #[cfg(target_os = "illumos")] mod illumos; @@ -25,40 +24,31 @@ use linux as plat; // Possible formats for a bundled dendrite distro. Currently the two "zone" // package formats are helios-only. -#[derive(PartialEq, Debug)] +#[derive(PartialEq, Clone, Debug, ValueEnum)] pub enum DistFormat { - Native, // .deb or .p5p, depending on the platform - Omicron, // package to be included in an omicron zone - Global, // package to run standalone in the global zone + /// .deb or .p5p, depending on the platform + #[value(alias = "n")] + Native, + /// package to be included in an omicron zone + #[value(alias = "o")] + Omicron, + /// package to run standalone in the global zone + #[value(alias = "g")] + Global, } -type ParseError = &'static str; -impl FromStr for DistFormat { - type Err = ParseError; - fn from_str(format: &str) -> Result { - match format { - "native" | "n" => Ok(DistFormat::Native), - "omicron" | "o" => Ok(DistFormat::Omicron), - "global" | "g" => Ok(DistFormat::Global), - _ => Err("Could not parse distribution format"), - } - } -} - -#[derive(Debug, StructOpt)] -#[structopt(name = "xtask", about = "lldp xtask support")] +#[derive(Debug, Parser)] +/// lldp xtask support +#[clap(name = "xtask")] enum Xtasks { - #[structopt(about = "build an installable dataplane controller package")] + /// build an installable dataplane controller package Dist { - #[structopt(short, long, help = "package release bits ")] + /// package release bits + #[clap(short, long)] release: bool, - #[structopt( - short, - long, - help = "package format: omicron, global zone, os-native", - default_value = "native" - )] + /// package format: omicron, global zone, os-native + #[clap(short, long, default_value = "native")] format: DistFormat, }, } @@ -103,7 +93,7 @@ fn collect_binaries(release: bool, dst: &str) -> Result<()> { #[tokio::main] async fn main() { - let task = Xtasks::from_args(); + let task = Xtasks::parse(); if let Err(e) = match task { Xtasks::Dist { release, format } => plat::dist(release, format).await, } { From a90c379dbfea43fc5f7115ee1a3b20d54b557433 Mon Sep 17 00:00:00 2001 From: Rain Date: Tue, 30 Sep 2025 20:51:26 +0000 Subject: [PATCH 2/3] update dropshot-api-manager Created using spr 1.3.6-beta.1 --- Cargo.lock | 31 +++++++++++++++++++++++-------- Cargo.toml | 6 +++--- lldpd/src/api_server.rs | 8 ++++---- xtask/src/main.rs | 2 +- 4 files changed, 31 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 267fd39..5d96d34 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -789,6 +789,20 @@ dependencies = [ "uuid", ] +[[package]] +name = "drift" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43eb40edecda6106744f5e4f3d4dc78b3adf19d3cfb2d81cc4faa007da91e527" +dependencies = [ + "anyhow", + "indexmap", + "openapiv3", + "regex", + "serde", + "serde_json", +] + [[package]] name = "dropshot" version = "0.16.4" @@ -842,15 +856,16 @@ dependencies = [ [[package]] name = "dropshot-api-manager" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d474d07200f53202c71a43f124d00417b06ed9a230ffaadbb4eec4fb50f032a" +checksum = "2f448e29400392b55ed2c0133c79841e1bc1bc771e6e20841cb1a5c70a77ef65" dependencies = [ "anyhow", "atomicwrites", "camino", "clap 4.5.45", "debug-ignore", + "drift", "dropshot", "dropshot-api-manager-types", "fs-err", @@ -871,9 +886,9 @@ dependencies = [ [[package]] name = "dropshot-api-manager-types" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3c52409870cf11bd9e96b86213502ad7412e50017c9e7bd14eaf1f4791517d5" +checksum = "1b913840b90fcccce6afbdb146acf39aa3243b8510e255a70572e53a964fc96a" dependencies = [ "anyhow", "camino", @@ -3082,9 +3097,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.11.1" +version = "1.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +checksum = "8b5288124840bee7b386bc413c487869b360b2b4ec421ea56425128692f2a82c" dependencies = [ "aho-corasick", "memchr", @@ -3094,9 +3109,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.9" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +checksum = "833eb9ce86d40ef33cb1306d8accf7bc8ec2bfea4355cbdebb3df68b40925cad" dependencies = [ "aho-corasick", "memchr", diff --git a/Cargo.toml b/Cargo.toml index b597a6e..a222442 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,9 +31,9 @@ anyhow = "1.0" camino = { version = "1.1", features = ["serde1"] } chrono = "0.4" clap = { version = "4.5.45", features = ["derive"] } -dropshot = "0.16.3" -dropshot-api-manager = "0.2.0" -dropshot-api-manager-types = "0.2.0" +dropshot = "0.16.4" +dropshot-api-manager = "0.2.1" +dropshot-api-manager-types = "0.2.1" futures = "0.3" http = "0.2.9" omicron-zone-package = "0.11.1" diff --git a/lldpd/src/api_server.rs b/lldpd/src/api_server.rs index 450b745..cdc4518 100644 --- a/lldpd/src/api_server.rs +++ b/lldpd/src/api_server.rs @@ -652,6 +652,10 @@ pub async fn api_server_manager( } } +pub fn http_api() -> dropshot::ApiDescription> { + lldpd_api_mod::api_description::().unwrap() +} + #[cfg(test)] mod tests { use crate::api_server::build_info; @@ -672,7 +676,3 @@ mod tests { assert_eq!(info.git_sha, ours); } } - -pub fn http_api() -> dropshot::ApiDescription> { - lldpd_api_mod::api_description::().unwrap() -} diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 1929e94..1205052 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -44,7 +44,7 @@ pub enum DistFormat { #[clap(name = "xtask")] enum Xtasks { /// manage OpenAPI documents - Openapi(external::External), + Openapi(Box), /// build an installable dataplane controller package Dist { /// package release bits From 351689dc0f8077d873b6e993654b6006aed5bbd4 Mon Sep 17 00:00:00 2001 From: Rain Date: Tue, 7 Oct 2025 18:27:24 +0000 Subject: [PATCH 3/3] update dropshot-api-manager Created using spr 1.3.6-beta.1 --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a222442..d2e9f13 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,8 +32,8 @@ camino = { version = "1.1", features = ["serde1"] } chrono = "0.4" clap = { version = "4.5.45", features = ["derive"] } dropshot = "0.16.4" -dropshot-api-manager = "0.2.1" -dropshot-api-manager-types = "0.2.1" +dropshot-api-manager = "0.2.2" +dropshot-api-manager-types = "0.2.2" futures = "0.3" http = "0.2.9" omicron-zone-package = "0.11.1"