Skip to content

Commit 2c31c21

Browse files
authored
Merge pull request #498 from citrus-it/fmri
Add synthetic pkg.fmri.name attribute to pkgmogrify (fix build)
2 parents 4c0b4e2 + 947188a commit 2c31c21

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/modules/mogrify.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -886,15 +886,20 @@ def process_mog(
886886
pkg_attrs.setdefault(name, []).append(value)
887887
else:
888888
pkg_attrs.setdefault(name, []).extend(value)
889-
if name == "pkg.fmri":
890-
pfmri = pkg.fmri.PkgFmri(value)
891-
pkg_attrs.setdefault("pkg.fmri.name", []).append(
892-
pfmri.get_name()
893-
)
894889
comment, a = apply_transforms(
895890
transforms, act, pkg_attrs, verbose, filename, lineno
896891
)
897892
output.append((comment, a, prepended_macro))
893+
# Build additional synthetic attributes based on the final pkg.fmri
894+
if act.name == "set" and act.attrs["name"] == "pkg.fmri":
895+
try:
896+
pfmri = pkg.fmri.PkgFmri(value)
897+
pkg_attrs.setdefault("pkg.fmri.name", []).append(
898+
pfmri.get_name()
899+
)
900+
except:
901+
pass
902+
898903
except RuntimeError as e:
899904
process_error(
900905
"File {0} line {1:d}: {2}".format(filename, lineno, e), error_cb

0 commit comments

Comments
 (0)