From patchwork Wed Mar 3 15:04:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas De Schampheleire X-Patchwork-Id: 1446732 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=gz5NjHPq; dkim-atps=neutral Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DrKpR6mTgz9sSC for ; Thu, 4 Mar 2021 03:54:07 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 5CE6E46FD7; Wed, 3 Mar 2021 16:54:05 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Yqjex6l5pzwj; Wed, 3 Mar 2021 16:54:04 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp4.osuosl.org (Postfix) with ESMTP id 649624700B; Wed, 3 Mar 2021 16:54:03 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 189021BF4E3 for ; Wed, 3 Mar 2021 16:54:02 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id F0C4540119 for ; Wed, 3 Mar 2021 16:54:01 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp2.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4_uzONutCxYn for ; Wed, 3 Mar 2021 16:54:01 +0000 (UTC) X-Greylist: delayed 01:25:39 by SQLgrey-1.8.0 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by smtp2.osuosl.org (Postfix) with ESMTPS id EBD12400F4 for ; Wed, 3 Mar 2021 16:54:00 +0000 (UTC) Received: by mail-wr1-x433.google.com with SMTP id u14so24459872wri.3 for ; Wed, 03 Mar 2021 08:54:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9wsodYG8p/cBDwXvCoqWmk9ojwJgMYXne0w0JvE6VLA=; b=gz5NjHPqZ6dYJYrRIy9zTpqsJOcTxRObytQBEZ5QOJyTg360CyMTuwCk3k1VWmPnt+ zyA7Sq9+QQ0Z+pBkMmEIFB9TNhnFhoofMMhWQAHXIRnjolmnr4GviNpzfIDYWxdFyC4o Ay9IwJEnDbPcpQWEgv76te55xodmtEAv7V7Bf80rJui4Ei6FxAAeS8Zbgn6qTwAOq34+ XEJs4RNNokWecqBSVntAmZbvL/G8rQp16ay6bDisrsTvAhlf34leb8d8bFtJz6gqzLtr zgQh8hp53lWHOUtFnR1S58BydP/RILbsTsQ4dcRHE1+td4LqzJ+zW7JTEpJie1FIvGJV FTiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9wsodYG8p/cBDwXvCoqWmk9ojwJgMYXne0w0JvE6VLA=; b=V20Bw6lMuo0v3pBTSML6sEDVRqssouNWXWwFLOaBqTb8juRQydCSx8K0/OrW5tE+/Q q8Qj1yb3KnLRl+gBHDS/CuO/bkoO2v729CRIoeuUpZd9KYfb18XyH0ZDxiLPorDbNXzR uSQsTWi/UI6r0SlMWujylu1O0xYJpbO7HLlX34YfMGNQq+eHOqYiZnZxQmeH6Mhuy2Bn cbDXRodKsIUcS1qLTsSH23Bn7o0DVuLzq/8RfFk5vKWQ/3P0P9mgtv4mm7zFLlWDd4yS gr3Kl3z/OfHyEA+52hDqyrnJfvaMk5xu1DsKhavFvTtLeQfiuLL+2wvGlqMjgIZIIOUX tWFw== X-Gm-Message-State: AOAM532kwqapjLD+ECckpqsOpyOaY01JJ34jiMUVe/PJHv+9HN39p6uf k5ET3lKqh2f4VBrtXqcQdd8eavElh3sSwSEQ X-Google-Smtp-Source: ABdhPJyP53PIie3rKMJhb/U6ucU8YIkrns03+h2nA9bxc6wT0XPkCK9OVhZpSsn9P8g7on7Av8t5MQ== X-Received: by 2002:a17:906:c081:: with SMTP id f1mr26351650ejz.97.1614783906917; Wed, 03 Mar 2021 07:05:06 -0800 (PST) Received: from localhost (ptr-5gw9txf6g5tndjqqqz.18120a2.ip6.access.telenet.be. [2a02:1810:510:3800:1b15:18e4:57d1:eb]) by smtp.gmail.com with ESMTPSA id eo22sm14878299ejc.0.2021.03.03.07.05.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Mar 2021 07:05:06 -0800 (PST) From: Thomas De Schampheleire To: buildroot@buildroot.org Date: Wed, 3 Mar 2021 16:04:51 +0100 Message-Id: <20210303150451.7963-2-patrickdepinguin@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210303150451.7963-1-patrickdepinguin@gmail.com> References: <20210303150451.7963-1-patrickdepinguin@gmail.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCHv2 2/2] utils/size-stats-compare: add package name in detail output X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Yann E . MORIN" , Thomas De Schampheleire Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Thomas De Schampheleire size-stats-compare gives an overview of the size increase/decrease between two cases, based on packages-file-list.txt. The 'detail' mode gives info per file, otherwise per package. But sometimes, you want the detailed per-file info, but only for a specific package. Since the detailed output no longer lists the package name, you cannot simply grep for it. A workaround was to filter the input packages-file-list.txt's first, and then pass these filtered versions to size-stats-compare. Make this easier by adding the package name next to the filename in detailed output. This allows grep'ing normally. For example: $ utils/size-stats-compare orig new -t 100 -d | grep ebtables -67712 removed ebtables lib/ebtables/libebtc.so -66764 removed ebtables lib/ebtables/libebt_nat.so -66752 removed ebtables sbin/ebtables -66704 removed ebtables lib/ebtables/libebt_arp.so -66700 removed ebtables lib/ebtables/libebt_stp.so -66700 removed ebtables lib/ebtables/libebt_among.so -66684 removed ebtables lib/ebtables/libebt_ip.so -66676 removed ebtables lib/ebtables/libebt_limit.so -66656 removed ebtables lib/ebtables/libebt_log.so -66648 removed ebtables lib/ebtables/libebt_mark.so -66636 removed ebtables lib/ebtables/libebt_pkttype.so -66604 removed ebtables lib/ebtables/libebt_vlan.so -66588 removed ebtables lib/ebtables/libebt_ulog.so -66588 removed ebtables lib/ebtables/libebt_nflog.so -66584 removed ebtables lib/ebtables/libebt_arpreply.so -66544 removed ebtables lib/ebtables/libebt_ip6.so -66540 removed ebtables lib/ebtables/libebt_802_3.so -66536 removed ebtables lib/ebtables/libebt_standard.so -66524 removed ebtables lib/ebtables/libebt_mark_m.so -66524 removed ebtables lib/ebtables/libebt_redirect.so -66452 removed ebtables lib/ebtables/libebtable_filter.so -66452 removed ebtables lib/ebtables/libebtable_broute.so -66452 removed ebtables lib/ebtables/libebtable_nat.so 45 ebtables etc/ethertypes 66752 added ebtables usr/sbin/ebtablesd 66752 added ebtables usr/sbin/ebtables-legacy 66752 added ebtables usr/sbin/ebtablesu 200840 added ebtables usr/lib/libebtc.so.0.0.0 Signed-off-by: Thomas De Schampheleire --- v2: move package name in front of filename (comment by Yann) utils/size-stats-compare | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/utils/size-stats-compare b/utils/size-stats-compare index de67b72587..ffe894e839 100755 --- a/utils/size-stats-compare +++ b/utils/size-stats-compare @@ -40,9 +40,9 @@ def read_file_size_csv(inputf, detail=None): for row in reader: if detail: - sizes[row[0]] = int(row[2]) + sizes[(row[0], row[1])] = int(row[2]) else: - sizes[row[1]] = int(row[3]) + sizes[(None, row[1])] = int(row[3]) return sizes @@ -73,20 +73,28 @@ def print_results(result, threshold): from six import iteritems list_result = list(iteritems(result)) - # result is a dictionary: name -> (flag, size difference) - # list_result is a list of tuples: (name, (flag, size difference)) + # result is a dictionary: (filename, pkgname) -> (flag, size difference) + # list_result is a list of tuples: ((filename, pkgname), (flag, size difference)) + # filename may be None if no detail is requested. + + maxpkgname=max(len(pkgname) for filename, pkgname in result) for entry in sorted(list_result, key=lambda entry: entry[1][1]): data = dict( - name=entry[0], + filename=entry[0][0], + pkgname=entry[0][1], action=entry[1][0], size=entry[1][1], + maxpkgname=maxpkgname, ) if threshold is not None and abs(data['size']) <= threshold: continue - print('{size:12d} {action:7s} {name}'.format(**data)) + if data['filename']: + print('{size:12d} {action:7s} {pkgname:{maxpkgname}s} {filename}'.format(**data)) + else: + print('{size:12d} {action:7s} {pkgname}'.format(**data)) # main ######################################################################### @@ -133,5 +141,5 @@ print('Size difference per %s (bytes), threshold = %s' % (keyword, args.threshol print(80*'-') print_results(delta, args.threshold) print(80*'-') -print_results({'TOTAL': ('', sum(new_sizes.values()) - sum(old_sizes.values()))}, +print_results({(None, 'TOTAL'): ('', sum(new_sizes.values()) - sum(old_sizes.values()))}, threshold=None)