From 7b3f92f6f3caa15bda19f557f5eb33405dcd7147 Mon Sep 17 00:00:00 2001 From: Ondřej Nosek Date: Jan 22 2025 03:01:20 +0000 Subject: `clog` is duplicating changelog lines `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 --- diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py index dfccad3..5b77453 100644 --- a/pyrpkg/__init__.py +++ b/pyrpkg/__init__.py @@ -2643,7 +2643,10 @@ class Commands(object): # Command contains workaround (undefines _changelog_trimtime) described at: # https://github.com/rpm-software-management/rpm/issues/1301 # It caused, that older changelog records were not displayed. - cmd = ["rpm"] + self.rpmdefines + ["-q", "--qf", "%{CHANGELOGTEXT}\n", + # + # [%{CHANGELOGTEXT}] is an array that contains all changelog records in a specfile + # tag is placed between changelogs records to be able to extract the first one + cmd = ["rpm"] + self.rpmdefines + ["-q", "--qf", "[%{CHANGELOGTEXT}\n]", "--undefine", "_changelog_trimtime", "--specfile", "%s" % spec_file] proc = subprocess.Popen(cmd, @@ -2660,6 +2663,8 @@ class Commands(object): clog_lines = [] buf = six.StringIO(stdout) for line in buf: + if line.startswith(""): + break if line == '\n' or line.startswith('$'): continue if line == '(none)\n':