diff --git a/src/build.rs b/src/build.rs index ca50c70..b72e002 100644 --- a/src/build.rs +++ b/src/build.rs @@ -23,16 +23,22 @@ pub fn build_source_package(cwd: Option<&Path>) -> Result<(), Box> { } }; - // Build arguments - let mut args = vec!["-S", "-I", "-i", "-nc", "-d"]; + // Build command arguments + let mut command = Command::new("dpkg-buildpackage"); + command + .current_dir(cwd) + .arg("-S") + .arg("-I") + .arg("-i") + .arg("-nc") + .arg("-d"); // If a signing key is found, use it for signing if let Some(key_id) = &signing_key { - args.push("-k"); - args.push(key_id); + command.arg(format!("--sign-keyid={}", key_id)); log::info!("Using GPG key {} for signing", key_id); } else { - args.push("--no-sign"); + command.arg("--no-sign"); log::info!( "No GPG key found for {} ({}), building without signing", maintainer_name, @@ -40,10 +46,7 @@ pub fn build_source_package(cwd: Option<&Path>) -> Result<(), Box> { ); } - let status = Command::new("dpkg-buildpackage") - .current_dir(cwd) - .args(&args) - .status()?; + let status = command.status()?; if !status.success() { return Err(format!("dpkg-buildpackage failed with status: {}", status).into()); diff --git a/src/changelog.rs b/src/changelog.rs index 71481f0..d804b71 100644 --- a/src/changelog.rs +++ b/src/changelog.rs @@ -146,13 +146,13 @@ pub fn parse_changelog_footer(path: &Path) -> Result<(String, String), Box Date) let re = Regex::new(r"--\s*([^<]+?)\s*<([^>]+)>\s*")?; - if let Some(last_match) = re.captures_iter(&content).last() { - let name = last_match + if let Some(first_match) = re.captures_iter(&content).first() { + let name = first_match .get(1) .map_or("", |m| m.as_str()) .trim() .to_string(); - let email = last_match + let email = first_match .get(2) .map_or("", |m| m.as_str()) .trim()