From patchwork Tue Jul 12 12:11:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Rini X-Patchwork-Id: 1655367 X-Patchwork-Delegate: wd@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.a=rsa-sha256 header.s=google header.b=ohchrj2b; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lj03R6vjrz9sFs for ; Tue, 12 Jul 2022 22:11:31 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3F9828415E; Tue, 12 Jul 2022 14:11:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="ohchrj2b"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3423383FE5; Tue, 12 Jul 2022 14:11:23 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-qv1-xf31.google.com (mail-qv1-xf31.google.com [IPv6:2607:f8b0:4864:20::f31]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 37EE484159 for ; Tue, 12 Jul 2022 14:11:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qv1-xf31.google.com with SMTP id m10so1124904qvu.4 for ; Tue, 12 Jul 2022 05:11:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=NADT9j/YnxA87MrwLRJerp9Yr9JFbzRA7k41SooWiio=; b=ohchrj2bQDjJve/Zo8T7yTaolLGkQoVjKNSdefPugWXL2cwiGo6VL5lmfMsYBQueXB MzRHSDrtrOOcbcyk5TV9GlIhmuctq3VyGRc4D2LsPw23QoSWc8AxqIR1+hN3U2X0WuSH o6N9D2XhAa4+d2m4pepQO3EywxSyrza1HWEpo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=NADT9j/YnxA87MrwLRJerp9Yr9JFbzRA7k41SooWiio=; b=4nQr/C3L3QzbaeaPHAtIUS+taph0QECNQ8nmqNnGeYeXMptWhjhg0j8QfgmHsPhmiV oHr6Uu6nDPZzpOKD/Aowr3O2Ns1zqAVKK3BHKX073F+3fiyqgyLQFJen9Qo0I4i0KieT merxHvMHslv7QimYLDbH/C1wDHRN6S1gjAeK08sb79SJteljrLW9Y7K1VDBjSIjHKmeH TYqgGtdBlLT1g0QnF+o6uEH7NoTp+C/jM6Q6MJ7i0IKjTxkHnBJVL+gDnDG84U3d5sbO yn39h/tqrv2/t9sWge4bRCyyxC0OMTcOoq/9k1Cw1ImsPRvEUd5s8tjbj8vmUYbkYKkx GTYA== X-Gm-Message-State: AJIora+leKmmzIcRNEzSkgG/id2r5KrlyTAx1e1fWglZZlN69P8TnPif HiI6YYN7ixxxzZMXvVp+x6vDSpqrXqslSg== X-Google-Smtp-Source: AGRyM1ss76gI/emlndb+B4yRW6LAWqKVh8A303iC9Bdhg2z8972S42iSidTdNKeuf+Jrtc5uZ5ilZw== X-Received: by 2002:a05:6214:d62:b0:472:f9c3:c9be with SMTP id 2-20020a0562140d6200b00472f9c3c9bemr17474806qvs.70.1657627877475; Tue, 12 Jul 2022 05:11:17 -0700 (PDT) Received: from bill-the-cat.lan (cpe-65-184-195-139.ec.res.rr.com. [65.184.195.139]) by smtp.gmail.com with ESMTPSA id u20-20020a05622a011400b0031ea53f4c5esm7504509qtw.83.2022.07.12.05.11.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jul 2022 05:11:17 -0700 (PDT) From: Tom Rini To: u-boot@lists.denx.de Cc: wd@denx.de Subject: [gitdm PATCH] reports.py: Add very basic rST output Date: Tue, 12 Jul 2022 08:11:16 -0400 Message-Id: <20220712121116.3048662-1-trini@konsulko.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Add a -R option to gitdm to allow for reStructuredText output and add some very simple table generation. We assume that whatever uses this output will take care of adding a header, so we only concern ourselves with making tables. Given the longest section title is 58 characters, we use 60 as the magic number to write/pad all of our first columns to, and use "Amount" for the second column. Signed-off-by: Tom Rini --- gitdm | 5 ++++- reports.py | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/gitdm b/gitdm index b837f0aafe27..3568d08f55af 100755 --- a/gitdm +++ b/gitdm @@ -59,6 +59,7 @@ FileReport = None # -D Output date statistics # -f file Write touched-files report to # -h hfile HTML output to hfile +# -R rfile reStructuredText output to rfile # -H file Export individual developer raw data as CSV # -l count Maximum length for output lists # -n Use numstats instead of generated patch from git log @@ -80,7 +81,7 @@ def ParseOpts(): global ReportByFileType, ReportUnknowns, CompanyFilter, FileReport global HackersCSV - opts, rest = getopt.getopt(sys.argv[1:], 'ab:dC:c:Df:H:h:l:no:p:r:stUuwx:yz') + opts, rest = getopt.getopt(sys.argv[1:], 'ab:dC:c:Df:H:h:l:no:p:r:R:stUuwx:yz') for opt in opts: if opt[0] == '-a': AkpmOverLt = 1 @@ -111,6 +112,8 @@ def ParseOpts(): elif opt[0] == '-r': print('Filter on "%s"' % (opt[1])) FileFilter = re.compile(opt[1]) + elif opt[0] == '-R': + reports.SetrSTOutput(open(opt[1], 'w')) elif opt[0] == '-s': AuthorSOBs = 0 elif opt[0] == '-t': diff --git a/reports.py b/reports.py index 39c237bdae00..3ed21f29c6ac 100644 --- a/reports.py +++ b/reports.py @@ -14,6 +14,7 @@ import sys Outfile = sys.stdout HTMLfile = None +rSTfile = None ListCount = 999999 @@ -25,6 +26,10 @@ def SetHTMLOutput(file): global HTMLfile HTMLfile = file +def SetrSTOutput(file): + global rSTfile + rSTfile = file + def SetMaxList(max): global ListCount ListCount = max @@ -44,6 +49,9 @@ def BeginReport(title): Outfile.write('\n%s\n' % title) if HTMLfile: HTMLfile.write(THead % title) + if rSTfile: + rSTfile.write('%s %s\n%-60s %s\n%s %s\n' % + ('=' * 60, '======', title, 'Amount', '=' * 60, '======')) TRow = ' %s%d%.1f%%\n' TRowStr = ' %s%d%s\n' @@ -54,6 +62,8 @@ def ReportLine(text, count, pct): Outfile.write ('%-25s %4d (%.1f%%)\n' % (text, count, pct)) if HTMLfile: HTMLfile.write(TRow % (text, count, pct)) + if rSTfile: + rSTfile.write("%-60s %4d (%.1f%%)\n" % (text.strip(), count, pct)) def ReportLineStr(text, count, extra): if count == 0: @@ -61,10 +71,14 @@ def ReportLineStr(text, count, extra): Outfile.write ('%-25s %4d %s\n' % (text, count, extra)) if HTMLfile: HTMLfile.write(TRowStr % (text, count, extra)) + if rSTfile: + rSTfile.write('* %s with %d %s\n' % (text, count, extra)) def EndReport(): if HTMLfile: HTMLfile.write('\n\n') + if rSTfile: + rSTfile.write('%s ======\n\n' % ('=' * 60)) # # Comparison and report generation functions.