changelog: report through the log instead of printing to stdout
generate_entry's status messages become log lines, and the unmet build-dependency diagnostics travel inside the UnmetBuildDependencies error (its Display carries the full report) instead of being printed to stderr by the library: the caller renders both like any other outcome.
This commit is contained in:
+3
-1
@@ -389,7 +389,9 @@ pub fn run_source_build(
|
||||
};
|
||||
let report = crate::debian::deps::check_build_depends(&ctrl, &check_opts)?;
|
||||
if !report.is_ok() {
|
||||
eprintln!("{}", report.message());
|
||||
// The diagnostics travel inside the error (its Display carries
|
||||
// report.message()); main renders it and maps the type to exit
|
||||
// status 3, like dpkg-buildpackage.
|
||||
return Err(Box::new(crate::debian::deps::UnmetBuildDependencies(
|
||||
report,
|
||||
)));
|
||||
|
||||
+2
-2
@@ -20,7 +20,7 @@ pub fn generate_entry(
|
||||
|
||||
// Parse existing changelog to get current (old) version
|
||||
let (package, old_version, series) = parse_changelog_header(&changelog_path)?;
|
||||
println!("Found package: {}, version: {}", package, old_version);
|
||||
log::info!("Found package: {}, version: {}", package, old_version);
|
||||
|
||||
// Open git repo, and find commits since last version tag
|
||||
let repo_path = if let Some(path) = cwd {
|
||||
@@ -56,7 +56,7 @@ pub fn generate_entry(
|
||||
|
||||
prepend_to_file(&changelog_path, &new_entry)?;
|
||||
|
||||
println!("Added new changelog entry to {}", changelog_path.display());
|
||||
log::info!("Added new changelog entry to {}", changelog_path.display());
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
+5
-1
@@ -890,7 +890,11 @@ pub struct UnmetBuildDependencies(pub UnmetReport);
|
||||
|
||||
impl std::fmt::Display for UnmetBuildDependencies {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "build dependencies/conflicts unsatisfied; aborting")
|
||||
write!(
|
||||
f,
|
||||
"build dependencies/conflicts unsatisfied; aborting\n{}",
|
||||
self.0.message()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user