#729 `clog` is duplicating changelog lines
Merged by onosek. Opened by onosek.
onosek/rpkg changelog_array  into  master

Download 729.patch

clog have to read the tag CHANGELOGTEXT (not macro) appropriately
as an array: --qf '[%{CHANGELOGTEXT}\n]'.
Whole array is read, so the is used to extract the first
changelog.

Fixes: https://pagure.io/fedpkg/issue/581
Resolves: rhbz#2310713
JIRA: RHELCMP-14285

Signed-off-by: Ondřej Nosek onosek@redhat.com

rebased onto 1f26177becfc0fe9ac60d4eca001cb7cebe8455d

Pull-Request has been merged by onosek

Just FWIW, you could also access the data using the rpm python bindings, its already used for similar purposes in get_build_arches_from* etc. Eg

>>> import rpm
>>> spec = rpm.spec('popt.spec')
>>> spec.sourceHeader['CHANGELOGTEXT'][0]
'- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild'

Thanks, @pmatilai, your approach looks cleaner!
I already merged the fix, but I will consider changing it.
What I am afraid of a little are the other arguments of the current rpm query command. It has defined macros (self.rpmdefines) and macro _changelog_trimtime undefined. It is a long time ago and I don't remember what would the consequences of removing this stuff :-).
At least _changelog_trimtime was the subject of another issue in the past.
https://github.com/rpm-software-management/rpm/issues/1301

Yeah those defines do matter, and also one needs to be aware that parsing the spec will affect the state of the calling process - macros defined/undefined by the spec etc. Which is something you don't need to worry about with just calling rpmspec in an external process. Probably the reason SpecFile class in rpkg does it the way it does.

Metadata