From patchwork Sat Mar 7 07:56:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiko Thiery X-Patchwork-Id: 1250849 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.137; helo=fraxinus.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.a=rsa-sha256 header.s=20161025 header.b=Wl1cHvGe; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48ZGzM1yTtz9sPK for ; Sat, 7 Mar 2020 18:57:03 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 2951C86FB7; Sat, 7 Mar 2020 07:56:57 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ECWY28cILf1m; Sat, 7 Mar 2020 07:56:55 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 5AEAF86F58; Sat, 7 Mar 2020 07:56:55 +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 583731BF42C for ; Sat, 7 Mar 2020 07:56:49 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 4F98F1FE2F for ; Sat, 7 Mar 2020 07:56:49 +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 WYTWuw6LNTUS for ; Sat, 7 Mar 2020 07:56:48 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by silver.osuosl.org (Postfix) with ESMTPS id 5EEDF20356 for ; Sat, 7 Mar 2020 07:56:48 +0000 (UTC) Received: by mail-wm1-f65.google.com with SMTP id p9so4829404wmc.2 for ; Fri, 06 Mar 2020 23:56:48 -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=F/7kEDsmJS9hhS2CnUu+S0cmS1hL0U33l9oiAd27Ppc=; b=Wl1cHvGe4nptx6+QXvZvtwYmSJqMMLGREYy+zeccn7Pc3quSbcz3vfWrv9WWWbL8DQ +xjOLqQMaWks4iBS6JpJhr0PmttlORCQBu6EQSZCQj16fKeRx0TYbZ3Z8SKkIeXoEv2T o2hxywIeX1c9/xSS1D3djTGJy0++FZ4AeKR70l+ZdzaU5TA5JdTeNX27QOgtGOXxJNlk zp8Gs+qCtwTnGg8iYFve+tcGoT9mGeGbtxx8t8AEZoVJ7s81E5unMdavu85y88CZOezk mXAKE5aOi/e8fRN07RgU+kMuXbs7vXTwFDRluEt9BROMyN6xidiOgXxAnWD+HFVKSf1b jVDg== 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=F/7kEDsmJS9hhS2CnUu+S0cmS1hL0U33l9oiAd27Ppc=; b=YmSA3Qg/6xYZBEU1McDmU7/DzNp1E8n4j3PwOOQS7W2Sb3jwx2CuHnDPiEYhwDrtz6 wNRvl3pcoyiVBQclLvvoF8NKDznIy727EIBywMsorzmb3PmFTpXC9Mz1kWlk6zEnA3PN 8U8FGZOz+8JjzvQjjtbMLEmRKQY+znOqZ+BuU0rxQcsud3QluHSB2zhRPgkxtorVu+8F kOJOe06aR3RQAjgyJwisV9FXWEW0ZksmaNS8Oz26aZmiSzlYZ0x24qrNausSh8JF64ZW ka0gUKDOsopA09+OGOgfjv8z4AieZSh0FrTes8oITaCHOiufM9BSc6WnrcnuQvbzqpSw O7/w== X-Gm-Message-State: ANhLgQ0+hkLsez1n2jwVC3LttQO3GiRmiVfrSPGBJ7lLw3U2J1qFUP1Q 8zUQO8TtO0Bhzb7qwpXIxONtJFHZ X-Google-Smtp-Source: ADFU+vtsm4BreomZjIturjMfKB5TC86AVouy5c9DY49sLN5AdjghGkfdkPBVwZLytIe9LxIC+7rcPQ== X-Received: by 2002:a05:600c:301:: with SMTP id q1mr8784587wmd.182.1583567806638; Fri, 06 Mar 2020 23:56:46 -0800 (PST) Received: from t450s.fritz.box (ip5f58981a.dynamic.kabel-deutschland.de. [95.88.152.26]) by smtp.gmail.com with ESMTPSA id g129sm19189071wmg.12.2020.03.06.23.56.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Mar 2020 23:56:46 -0800 (PST) From: Heiko Thiery To: buildroot@buildroot.org Date: Sat, 7 Mar 2020 08:56:30 +0100 Message-Id: <20200307075633.7514-10-heiko.thiery@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200307075633.7514-1-heiko.thiery@gmail.com> References: <20200307075633.7514-1-heiko.thiery@gmail.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH v5 09/12] support/scripts/pkg-stats: add support for license hash check 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 , Thomas Petazzoni , Titouan Christophe Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Store the names of license files and check if they are in the hash file. Signed-off-by: Heiko Thiery --- support/scripts/pkg-stats | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats index a15d0ec24b..8849c7a1c3 100755 --- a/support/scripts/pkg-stats +++ b/support/scripts/pkg-stats @@ -85,7 +85,7 @@ def get_defconfig_list(): class Package: all_licenses = dict() - all_license_files = list() + all_license_files = dict() all_versions = dict() all_ignored_cves = dict() @@ -98,6 +98,7 @@ class Package: self.has_license = False self.has_license_files = False self.has_hash = False + self.license_files = None self.patch_files = [] self.warnings = 0 self.current_version = None @@ -159,6 +160,7 @@ class Package: self.license = self.all_licenses[var] self.status['license'] = ("ok", "found") if var in self.all_license_files: + self.license_files = self.all_license_files[var].split(' ') self.status['license-files'] = ("ok", "found") def set_hash_info(self): @@ -166,8 +168,18 @@ class Package: Fills in the .status['hash'] field """ hashpath = self.path.replace(".mk", ".hash") + self.status['hash-license'] = ("na", "no hash file") if os.path.exists(hashpath): self.status['hash'] = ("ok", "found") + self.status['hash-license'] = ("error", "no license in hash file") + # check if license files are in hash file + if self.license_files is not None: + self.status['hash-license'] = ("ok", "found") + with open(hashpath) as f: + content = f.read() + for license in self.license_files: + if content.find(license) == -1: + self.status['hash-license'] = ("error", "license missing in hash file") else: self.status['hash'] = ("error", "missing") @@ -449,7 +461,7 @@ def package_init_make_info(): if pkgvar.endswith("_MANIFEST_LICENSE_FILES"): continue pkgvar = pkgvar[:-14] - Package.all_license_files.append(pkgvar) + Package.all_license_files[pkgvar] = value elif pkgvar.endswith("_VERSION"): if pkgvar.endswith("_DL_VERSION"):