diff --git a/CHANGES/2363.bugfix b/CHANGES/2363.bugfix new file mode 100644 index 000000000..7c712d6b6 --- /dev/null +++ b/CHANGES/2363.bugfix @@ -0,0 +1 @@ +Fixed an edge case with the changelog limit. diff --git a/pulp_rpm/app/metadata_parsing.py b/pulp_rpm/app/metadata_parsing.py index 060e3274a..600685a00 100644 --- a/pulp_rpm/app/metadata_parsing.py +++ b/pulp_rpm/app/metadata_parsing.py @@ -126,6 +126,9 @@ def process_other_package_element(element): text = subelement.text changelogs.append((author, date, text)) + # make sure the changelogs are sorted by date + changelogs.sort(key=lambda t: t[1]) + if settings.KEEP_CHANGELOG_LIMIT is not None: # always keep at least one changelog, even if the limit is set to 0 changelog_limit = settings.KEEP_CHANGELOG_LIMIT or 1