From 947188a2921c484f9273044ecfe8494b70c90f11 Mon Sep 17 00:00:00 2001 From: Andy Fiddaman Date: Wed, 2 Oct 2024 08:09:04 +0000 Subject: [PATCH] Add synthetic pkg.fmri.name attribute to pkgmogrify (fix build) --- src/modules/mogrify.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/modules/mogrify.py b/src/modules/mogrify.py index 0a55d9efa..d2aabfc22 100755 --- a/src/modules/mogrify.py +++ b/src/modules/mogrify.py @@ -886,15 +886,20 @@ def process_mog( pkg_attrs.setdefault(name, []).append(value) else: pkg_attrs.setdefault(name, []).extend(value) - if name == "pkg.fmri": - pfmri = pkg.fmri.PkgFmri(value) - pkg_attrs.setdefault("pkg.fmri.name", []).append( - pfmri.get_name() - ) comment, a = apply_transforms( transforms, act, pkg_attrs, verbose, filename, lineno ) output.append((comment, a, prepended_macro)) + # Build additional synthetic attributes based on the final pkg.fmri + if act.name == "set" and act.attrs["name"] == "pkg.fmri": + try: + pfmri = pkg.fmri.PkgFmri(value) + pkg_attrs.setdefault("pkg.fmri.name", []).append( + pfmri.get_name() + ) + except: + pass + except RuntimeError as e: process_error( "File {0} line {1:d}: {2}".format(filename, lineno, e), error_cb