changelog: parse entries with a shared limit-based helper
Replace parse_previous_version/parse_previous_version_from_str with parse_changelog_entries(path, limit: Option<usize>), parsing up to the given number of entries (None: the whole file) newest-first through the same strict entry parser instead of a header-only scan. The single-entry helpers stay as thin wrappers, and callers needing the previous entry now get its full source name and version, not just the raw string.
This commit is contained in:
+7
-2
@@ -255,7 +255,12 @@ pub fn run_source_build(
|
||||
// ------------------------------------------------------------------
|
||||
// 2. Metadata resolution
|
||||
// ------------------------------------------------------------------
|
||||
let entry = crate::debian::parse_changelog_entry(&changelog_path)?;
|
||||
// The current entry plus the one below it: the previous entry drives
|
||||
// both the binNMU metadata references and the orig-tarball inclusion
|
||||
// decision.
|
||||
let mut entries = crate::debian::changelog::parse_changelog_entries(&changelog_path, Some(2))?;
|
||||
let entry = entries.remove(0);
|
||||
let previous_entry = entries.into_iter().next();
|
||||
let ctrl = ControlInfo::parse(&control_path)?;
|
||||
|
||||
if let Some(u) = &ui {
|
||||
@@ -265,7 +270,7 @@ pub fn run_source_build(
|
||||
// binNMU builds reference the *previous* (source) version in their
|
||||
// artifact metadata, like dpkg-genchanges/genbuildinfo do.
|
||||
let previous_version = if entry.binary_only {
|
||||
crate::debian::changelog::parse_previous_version(&changelog_path)?
|
||||
previous_entry.as_ref().map(|e| e.version.full())
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user