blob: b5281b23c08a839c63bd3ba5ca9808843291174d [file] [log] [blame]
Arthur Shece0323a2025-04-01 21:12:02 -07001#!/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 if len(body) + len(l) >= SIZE_LIMIT:
22 body += """\
23[...]
24
25WARNING: The report was trimmed due to size limit of a Gerrit comment.
26Follow the link at the beginning to see the full report.
27"""
28 break
29 body += l
30
31sys.stdout.write(shlex.quote(body))