Skip to content

Commit 37eedcc

Browse files
jessp01nforro
andcommitted
Address #491
add_changelog_entry(): Incorrect evr expansion Use the tags() context manager directly for better performance Co-authored-by: Nikola Forró <[email protected]>
1 parent 9ef003e commit 37eedcc

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

specfile/specfile.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,11 +611,16 @@ def add_changelog_entry(
611611
if self.contains_autochangelog(section):
612612
continue
613613
if evr is None:
614-
epoch_prefix = f"{self.expanded_epoch}:" if self.expanded_epoch else ""
615-
evr = f"{epoch_prefix}{self.expanded_version}-{self.expanded_release}"
614+
with self.tags() as tags:
615+
try:
616+
evr = f"{tags.epoch.expanded_value}:"
617+
except AttributeError:
618+
evr = ""
619+
evr += f"{tags.version.expanded_value}-{tags.release.expanded_value}"
616620
with self.changelog(section) as changelog:
617621
if changelog is None:
618622
return
623+
evr = self.expand(evr, extra_macros=[("dist", "")])
619624
if isinstance(entry, str):
620625
entry = [entry]
621626
if timestamp is None:

0 commit comments

Comments
 (0)