Skip to content

Commit

Permalink
rpmbuild: return epoch value after macro expansion
Browse files Browse the repository at this point in the history
See fedora-copr#2848 (comment)

On @nforro's recommendation, we should return the expanded value.

> I think it would be safer to use spec.rpm_spec.sourceHeader.epoch
> (which also gives you an integer). Or use
> spec.tags(spec.parsed_sections.package).content.epoch.expanded_value.
  • Loading branch information
FrostyX committed Aug 10, 2023
1 parent eea79b8 commit 8fbdff8
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions rpmbuild/copr_rpmbuild/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,10 +407,18 @@ def __init__(self, path):

def __getattr__(self, name):
value = getattr(self.tags, name).value
if name == "epoch" and value is not None:
return int(value)
return value

@property
def epoch(self):
"""
Evaluated %{epoch} as integer or None
"""
value = self.safe_attr("epoch")
if value in [None, ""]:
return None
return int(value)

@property
def exclusivearch(self):
"""
Expand Down

0 comments on commit 8fbdff8

Please sign in to comment.