[libcamera-devel] libcamera: gen-ipa-pub-key.py: Wrap lines in generated file

Message ID 20200414214819.14112-1-laurent.pinchart@ideasonboard.com
State Accepted
Commit 8defb069eb4a68d62ebf312ec5a76eee162ad970
Headers show
Series
  • [libcamera-devel] libcamera: gen-ipa-pub-key.py: Wrap lines in generated file
Related show

Commit Message

Laurent Pinchart April 14, 2020, 9:48 p.m. UTC
To make the output more readable, break the publicKeyData_ array at 8
bytes boundaries.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/libcamera/gen-ipa-pub-key.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Kieran Bingham April 16, 2020, 2:57 p.m. UTC | #1
Hi Laurent,

On 14/04/2020 22:48, Laurent Pinchart wrote:
> To make the output more readable, break the publicKeyData_ array at 8
> bytes boundaries.
> 

Sure - it certainly prettifies it.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  src/libcamera/gen-ipa-pub-key.py | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/src/libcamera/gen-ipa-pub-key.py b/src/libcamera/gen-ipa-pub-key.py
> index ad575b18c922..a4a1f7b79337 100755
> --- a/src/libcamera/gen-ipa-pub-key.py
> +++ b/src/libcamera/gen-ipa-pub-key.py
> @@ -28,7 +28,9 @@ def main(argv):
>          print('Please install openssl to sign IPA modules')
>          return 1
>  
> -    ipa_key = ', '.join(['0x%02x' % c for c in ret.stdout])
> +    ipa_key = ['0x%02x' % c for c in ret.stdout]
> +    ipa_key = [', '.join(ipa_key[bound:bound + 8]) for bound in range(0, len(ipa_key), 8)]
> +    ipa_key = ',\n\t'.join(ipa_key)
>      data = {'ipa_key': ipa_key}
>  
>      template = open(template, 'rb').read()
>

Patch

diff --git a/src/libcamera/gen-ipa-pub-key.py b/src/libcamera/gen-ipa-pub-key.py
index ad575b18c922..a4a1f7b79337 100755
--- a/src/libcamera/gen-ipa-pub-key.py
+++ b/src/libcamera/gen-ipa-pub-key.py
@@ -28,7 +28,9 @@  def main(argv):
         print('Please install openssl to sign IPA modules')
         return 1
 
-    ipa_key = ', '.join(['0x%02x' % c for c in ret.stdout])
+    ipa_key = ['0x%02x' % c for c in ret.stdout]
+    ipa_key = [', '.join(ipa_key[bound:bound + 8]) for bound in range(0, len(ipa_key), 8)]
+    ipa_key = ',\n\t'.join(ipa_key)
     data = {'ipa_key': ipa_key}
 
     template = open(template, 'rb').read()