From 69f3c3954e1440ab5b54c6dce6dc6ee90b8a3c57 Mon Sep 17 00:00:00 2001 From: Valentin Haudiquet Date: Fri, 18 Sep 2026 13:10:46 +0200 Subject: [PATCH] new: build the target-distribution menu from supported_dists --- src/distro_info.rs | 7 +++++-- src/new/questions.rs | 15 ++++++++++++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/distro_info.rs b/src/distro_info.rs index a374e57..f23ca2b 100644 --- a/src/distro_info.rs +++ b/src/distro_info.rs @@ -214,9 +214,12 @@ fn parse_series_csv(content: &str) -> Result, Box Vec { - DATA.dist.keys().cloned().collect() + let mut dists: Vec = DATA.dist.keys().cloned().collect(); + dists.sort(); + dists } /// Special changelog distribution marking an entry that has not been diff --git a/src/new/questions.rs b/src/new/questions.rs index ee0d6bd..e7a6c05 100644 --- a/src/new/questions.rs +++ b/src/new/questions.rs @@ -437,17 +437,26 @@ async fn run_wizard(mut cli: NewCli) -> Result> { cli.maintainer = Some(ask_text("Maintainer", &default, validate)?); } - // 11. Target distribution. + // 11. Target distribution. The menu derives from the distro data pkh + // ships (sorted); ubuntu is moved to the front when present so it + // stays the menu's first entry and fallback default as it has always + // been — prompt::select positions on a default value, not an index. if cli.dist.is_none() { let vendor = crate::build::env::current_vendor().to_lowercase(); - let options = vec!["ubuntu".to_string(), "debian".to_string()]; + let mut options = crate::distro_info::supported_dists(); + if let Some(pos) = options.iter().position(|d| d == "ubuntu") + && pos > 0 + { + let ubuntu = options.remove(pos); + options.insert(0, ubuntu); + } let default = if options.contains(&vendor) { vendor } else { "ubuntu".to_string() }; let answer = select_from(DIST_LABEL, &options, &default, |answer| { - answer == "ubuntu" || answer == "debian" + options.contains(&answer.to_string()) })?; cli.dist = Some(answer); }