blob: 1ef005287699dd16533e1ae9c3b65e615e3f2e64 [file] [log] [blame]
Paul Sokolovsky73717982022-12-28 19:51:47 +03001#!/usr/bin/env python3
2#
3# Copyright (c) 2022 Arm Limited. All rights reserved.
4#
5# SPDX-License-Identifier: BSD-3-Clause
6
7# Script to prepare a textual body of a comment to pass on the command line
8# to Gerrit: limit it to acceptable size and quote properly.
9
10import sys
11import shlex
12
13
14SIZE_LIMIT = 16000
15
16
17body = ""
18
19with open(sys.argv[1], "r") as f:
20 for l in f:
21 body += l
22 if len(body) >= SIZE_LIMIT:
23 body += """\
24[...]
25
26WARNING: The report was trimmed due to size limit of a Gerrit comment.
27Follow the link at the beginning to see the full report.
28"""
29 break
30
31sys.stdout.write(shlex.quote(body))