build, changelog: fix signing when building source package
Some checks failed
CI / build (push) Failing after 7m8s
Some checks failed
CI / build (push) Failing after 7m8s
This commit is contained in:
21
src/build.rs
21
src/build.rs
@@ -23,16 +23,22 @@ pub fn build_source_package(cwd: Option<&Path>) -> Result<(), Box<dyn Error>> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Build arguments
|
// Build command arguments
|
||||||
let mut args = vec!["-S", "-I", "-i", "-nc", "-d"];
|
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 a signing key is found, use it for signing
|
||||||
if let Some(key_id) = &signing_key {
|
if let Some(key_id) = &signing_key {
|
||||||
args.push("-k");
|
command.arg(format!("--sign-keyid={}", key_id));
|
||||||
args.push(key_id);
|
|
||||||
log::info!("Using GPG key {} for signing", key_id);
|
log::info!("Using GPG key {} for signing", key_id);
|
||||||
} else {
|
} else {
|
||||||
args.push("--no-sign");
|
command.arg("--no-sign");
|
||||||
log::info!(
|
log::info!(
|
||||||
"No GPG key found for {} ({}), building without signing",
|
"No GPG key found for {} ({}), building without signing",
|
||||||
maintainer_name,
|
maintainer_name,
|
||||||
@@ -40,10 +46,7 @@ pub fn build_source_package(cwd: Option<&Path>) -> Result<(), Box<dyn Error>> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let status = Command::new("dpkg-buildpackage")
|
let status = command.status()?;
|
||||||
.current_dir(cwd)
|
|
||||||
.args(&args)
|
|
||||||
.status()?;
|
|
||||||
|
|
||||||
if !status.success() {
|
if !status.success() {
|
||||||
return Err(format!("dpkg-buildpackage failed with status: {}", status).into());
|
return Err(format!("dpkg-buildpackage failed with status: {}", status).into());
|
||||||
|
|||||||
@@ -146,13 +146,13 @@ pub fn parse_changelog_footer(path: &Path) -> Result<(String, String), Box<dyn s
|
|||||||
// Find the last maintainer line (format: -- Name <email> Date)
|
// Find the last maintainer line (format: -- Name <email> Date)
|
||||||
let re = Regex::new(r"--\s*([^<]+?)\s*<([^>]+)>\s*")?;
|
let re = Regex::new(r"--\s*([^<]+?)\s*<([^>]+)>\s*")?;
|
||||||
|
|
||||||
if let Some(last_match) = re.captures_iter(&content).last() {
|
if let Some(first_match) = re.captures_iter(&content).next() {
|
||||||
let name = last_match
|
let name = first_match
|
||||||
.get(1)
|
.get(1)
|
||||||
.map_or("", |m| m.as_str())
|
.map_or("", |m| m.as_str())
|
||||||
.trim()
|
.trim()
|
||||||
.to_string();
|
.to_string();
|
||||||
let email = last_match
|
let email = first_match
|
||||||
.get(2)
|
.get(2)
|
||||||
.map_or("", |m| m.as_str())
|
.map_or("", |m| m.as_str())
|
||||||
.trim()
|
.trim()
|
||||||
|
|||||||
Reference in New Issue
Block a user