From patchwork Fri Jan 3 15:18:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiko Thiery X-Patchwork-Id: 1217356 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=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="FaDOFUSB"; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47q7q54Jj0z9sRW for ; Sat, 4 Jan 2020 02:19:13 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 5003C21FA8; Fri, 3 Jan 2020 15:19:10 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bISa-pF2p5Gt; Fri, 3 Jan 2020 15:19:06 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 10CB020445; Fri, 3 Jan 2020 15:19:06 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 5815E1BF599 for ; Fri, 3 Jan 2020 15:19:02 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 54AD620445 for ; Fri, 3 Jan 2020 15:19:02 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NAosLsx2hSS2 for ; Fri, 3 Jan 2020 15:19:01 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) by silver.osuosl.org (Postfix) with ESMTPS id 53C772036D for ; Fri, 3 Jan 2020 15:19:01 +0000 (UTC) Received: by mail-wr1-f42.google.com with SMTP id y17so42781911wrh.5 for ; Fri, 03 Jan 2020 07:19:01 -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=nD75AeRFSX+JC7ffpzS/BXqPWtPEY325AXgAd/t3N34=; b=FaDOFUSBDRbAIDjgOprPAB2QaLSz2Lmby5678ydKoan4T4wm+f51ZtWsLez1DWCJc5 xY77ggjybkssiaUs6XJnMpxOMN1t5tI/UtG8ElEKl1tHf6bd/H5F0INueZgAAS+DEjQX fD4hpK9+BI+GBAn9zcqbsoNtxA7dzJlNW6A4feVrilIZ2xsYEl/WScoogViba5FdZdkH J5vlkhfHdPGZod5s5osNpkx0xyY8HcB7hQ7112LhdOcf64js37e+6ADYboAlXp9DYS6V O17rCZPKhxaGHnHTGlC9e/b5aaz3HPKNbfYRQ2JSpOWYd2kynmCa4cYcNcbnZAdhDX5w pGIg== 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=nD75AeRFSX+JC7ffpzS/BXqPWtPEY325AXgAd/t3N34=; b=WLCBARQWlXQSMQjXk82gnbXLpUgKhi1kWy2xldNsPDV9KxaMhMdfYl/PHCis4fkFHv qGl1M1wTorCAaOt+wsiTyP52np8/GmndaDbQ3qpL6F4BqoELaq5vX+J/dosgjdPWWOhX ONWdgqFEiMLk2KjW/h6aIqsxwCsGIPAUAx+toB/ClYmTXiwoJ1axKrCSVSRWNYZTIh66 Sj/YRHKX4nOtnVZ0Jg4mzHJ1c0fQ5SB4H5fcStOmcWZd5TNRlPxO818NKxVtBXNTaLby K7ZoHmKRxUqKPi93uk40VRspPXvsUbNu/jYAs5O3NGqRh1dUNur+Rekg+X7s3hgi0q4a 5ReQ== X-Gm-Message-State: APjAAAWZn4u2jX8Xs2ahx/KlPPwhH5optSQTt6Lj5JyxH4OWCkea6VUQ NYzSD33M/VPFx7Hjinih/j54qJ5e X-Google-Smtp-Source: APXvYqzJep/zfDZsCAaABFpXEb3dpBo/e/iqWigjw3wjjbl5QcDcuPa9fO6APF8a88KhRkTxNZ0WhQ== X-Received: by 2002:a5d:44cd:: with SMTP id z13mr88900272wrr.104.1578064739538; Fri, 03 Jan 2020 07:18:59 -0800 (PST) Received: from hthiery01.sab.local ([213.135.10.150]) by smtp.gmail.com with ESMTPSA id u16sm12460565wmj.41.2020.01.03.07.18.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2020 07:18:58 -0800 (PST) From: Heiko Thiery To: buildroot@buildroot.org Date: Fri, 3 Jan 2020 16:18:40 +0100 Message-Id: <20200103151849.10956-4-heiko.thiery@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200103151849.10956-1-heiko.thiery@gmail.com> References: <20200103151849.10956-1-heiko.thiery@gmail.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH 03/11] support/scripts/pkg-stats: store patch info in a hash 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: Heiko Thiery Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" This patch changes the variable to store the patch count to a hash. This variable holds the patch count of the packages as well a list of the patch file names. Signed-off-by: Heiko Thiery --- support/scripts/pkg-stats | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats index 9cfbcf1acc..92fc01d655 100755 --- a/support/scripts/pkg-stats +++ b/support/scripts/pkg-stats @@ -56,7 +56,7 @@ class Package: self.has_license = False self.has_license_files = False self.has_hash = False - self.patch_count = 0 + self.patches = {'count':0, 'files': None} self.warnings = 0 self.current_version = None self.url = None @@ -115,17 +115,16 @@ class Package: """ Fills in the .has_hash field """ - hashpath = self.path.replace(".mk", ".hash") + hashpath = os.path.join(self.pkg_path, self.name + '.hash') self.has_hash = os.path.exists(hashpath) def set_patch_count(self): """ Fills in the .patch_count field """ - self.patch_count = 0 - pkgdir = os.path.dirname(self.path) - for subdir, _, _ in os.walk(pkgdir): - self.patch_count += len(fnmatch.filter(os.listdir(subdir), '*.patch')) + for subdir, _, _ in os.walk(self.pkg_path): + self.patches['files'] = fnmatch.filter(os.listdir(subdir), '*.patch') + self.patches['count'] = len(self.patches['files']) def set_current_version(self): """ @@ -160,7 +159,7 @@ class Package: def __str__(self): return "%s (path='%s', license='%s', license_files='%s', hash='%s', patches=%d)" % \ - (self.name, self.path, self.has_license, self.has_license_files, self.has_hash, self.patch_count) + (self.name, self.path, self.has_license, self.has_license_files, self.has_hash, self.patches['count']) def get_pkglist(npackages, package_list): @@ -390,7 +389,7 @@ def calculate_stats(packages): stats["version-uptodate"] += 1 else: stats["version-not-uptodate"] += 1 - stats["patches"] += pkg.patch_count + stats["patches"] += pkg.patches['count'] return stats @@ -495,14 +494,14 @@ def dump_html_pkg(f, pkg): # Patch count td_class = ["centered"] - if pkg.patch_count == 0: + if pkg.patches['count'] == 0: td_class.append("nopatches") - elif pkg.patch_count < 5: + elif pkg.patches['count'] < 5: td_class.append("somepatches") else: td_class.append("lotsofpatches") f.write(" %s\n" % - (" ".join(td_class), str(pkg.patch_count))) + (" ".join(td_class), str(pkg.patches['count']))) # Infrastructure infra = infra_str(pkg.infras)