blob: b5281b23c08a839c63bd3ba5ca9808843291174d [file] [log] [blame]
Paul Sokolovsky3c98fe02023-07-02 12:42:59 +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:
Paul Sokolovsky17215382023-08-03 14:41:04 +030021 if len(body) + len(l) >= SIZE_LIMIT:
Paul Sokolovsky3c98fe02023-07-02 12:42:59 +030022 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
Paul Sokolovsky17215382023-08-03 14:41:04 +030029 body += l
Paul Sokolovsky3c98fe02023-07-02 12:42:59 +030030
31sys.stdout.write(shlex.quote(body))