mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH] ptxd_lib_template: image-fit: Add second replacement run
@ 2024-10-22  8:27 Alexander Dahl
  2024-10-22 12:26 ` Michael Olbrich
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Dahl @ 2024-10-22  8:27 UTC (permalink / raw)
  To: ptxdist; +Cc: Roland Hieber

The @PACKAGE@ inside of $CODE_SIGNING_VARS was not replaced before,
leading to output in the make rule like this:

  IMAGE_@PACKAGE@_SIGN_ROLE       := # TODO: role name of the code signing provider, passed to cs_get_uri
  IMAGE_@PACKAGE@_KEY_NAME_HINT   := # TODO: key-name-hint property in the signature node of the FIT image

After a second replacement run on the already created rule, it looks
like this now (for image fit package named 'foo'):

  IMAGE_FOO_SIGN_ROLE     := # TODO: role name of the code signing provider, passed to cs_get_uri
  IMAGE_FOO_KEY_NAME_HINT := # TODO: key-name-hint property in the signature node of the FIT image

Fixes: c9659e6c318f ("templates: add template for custom FIT images")
Signed-off-by: Alexander Dahl <ada@thorsis.com>
---
 scripts/lib/ptxd_lib_template.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/scripts/lib/ptxd_lib_template.sh b/scripts/lib/ptxd_lib_template.sh
index cc512faa1..163f4c828 100644
--- a/scripts/lib/ptxd_lib_template.sh
+++ b/scripts/lib/ptxd_lib_template.sh
@@ -625,6 +625,10 @@ IMAGE_@PACKAGE@_KEY_NAME_HINT	:= # TODO: key-name-hint property in the signature
 	;;
     esac
     ptxd_template_write_platform_rules
+    # second replacement run for @PACKAGE@ nested in CODE_SIGNING_VARS
+    filename="${PTXDIST_PLATFORMCONFIGDIR}/rules/${class}${package_filename}.make"
+    tmpfile="$(mktemp "${PTXDIST_TEMPDIR}/template_new_image_fit.XXXXXXXX")"
+    ptxd_replace_magic "${filename}" > "${tmpfile}" && mv "${tmpfile}" "${filename}"
 }
 export -f ptxd_template_new_image_fit
 ptxd_template_help_list[${#ptxd_template_help_list[@]}]="image-fit"

base-commit: 49049c01b0a932c74c77b64f1b42c85141fec8e4
-- 
2.39.5




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [ptxdist] [PATCH] ptxd_lib_template: image-fit: Add second replacement run
  2024-10-22  8:27 [ptxdist] [PATCH] ptxd_lib_template: image-fit: Add second replacement run Alexander Dahl
@ 2024-10-22 12:26 ` Michael Olbrich
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Olbrich @ 2024-10-22 12:26 UTC (permalink / raw)
  To: Alexander Dahl; +Cc: ptxdist, Roland Hieber

On Tue, Oct 22, 2024 at 10:27:30AM +0200, Alexander Dahl wrote:
> The @PACKAGE@ inside of $CODE_SIGNING_VARS was not replaced before,
> leading to output in the make rule like this:
> 
>   IMAGE_@PACKAGE@_SIGN_ROLE       := # TODO: role name of the code signing provider, passed to cs_get_uri
>   IMAGE_@PACKAGE@_KEY_NAME_HINT   := # TODO: key-name-hint property in the signature node of the FIT image

This is define directly in scripts/lib/ptxd_lib_template.sh. I think it
would be better to replace that there:

  IMAGE_${PACKAGE}_SIGN_ROLE       := # TODO: role name of the code signing provider, passed to cs_get_uri
  IMAGE_${PACKAGE}_KEY_NAME_HINT   := # TODO: key-name-hint property in the signature node of the FIT image

Michael

> 
> After a second replacement run on the already created rule, it looks
> like this now (for image fit package named 'foo'):
> 
>   IMAGE_FOO_SIGN_ROLE     := # TODO: role name of the code signing provider, passed to cs_get_uri
>   IMAGE_FOO_KEY_NAME_HINT := # TODO: key-name-hint property in the signature node of the FIT image
> 
> Fixes: c9659e6c318f ("templates: add template for custom FIT images")
> Signed-off-by: Alexander Dahl <ada@thorsis.com>
> ---
>  scripts/lib/ptxd_lib_template.sh | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/scripts/lib/ptxd_lib_template.sh b/scripts/lib/ptxd_lib_template.sh
> index cc512faa1..163f4c828 100644
> --- a/scripts/lib/ptxd_lib_template.sh
> +++ b/scripts/lib/ptxd_lib_template.sh
> @@ -625,6 +625,10 @@ IMAGE_@PACKAGE@_KEY_NAME_HINT	:= # TODO: key-name-hint property in the signature
>  	;;
>      esac
>      ptxd_template_write_platform_rules
> +    # second replacement run for @PACKAGE@ nested in CODE_SIGNING_VARS
> +    filename="${PTXDIST_PLATFORMCONFIGDIR}/rules/${class}${package_filename}.make"
> +    tmpfile="$(mktemp "${PTXDIST_TEMPDIR}/template_new_image_fit.XXXXXXXX")"
> +    ptxd_replace_magic "${filename}" > "${tmpfile}" && mv "${tmpfile}" "${filename}"
>  }
>  export -f ptxd_template_new_image_fit
>  ptxd_template_help_list[${#ptxd_template_help_list[@]}]="image-fit"
> 
> base-commit: 49049c01b0a932c74c77b64f1b42c85141fec8e4
> -- 
> 2.39.5
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-10-22 12:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-22  8:27 [ptxdist] [PATCH] ptxd_lib_template: image-fit: Add second replacement run Alexander Dahl
2024-10-22 12:26 ` Michael Olbrich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox