From patchwork Mon Mar 2 14:50:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiko Thiery X-Patchwork-Id: 1247685 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.138; helo=whitealder.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=iT9wvGHI; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48WNPC4LWpz9sPK for ; Tue, 3 Mar 2020 01:50:55 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 5650C86174; Mon, 2 Mar 2020 14:50:51 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id g7vOoFINKvK7; Mon, 2 Mar 2020 14:50:47 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 7722185F9B; Mon, 2 Mar 2020 14:50:47 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 7C8DF1BF39F for ; Mon, 2 Mar 2020 14:50:46 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 7325F85F9B for ; Mon, 2 Mar 2020 14:50:46 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lVRTlbg4Oh6L for ; Mon, 2 Mar 2020 14:50:45 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by whitealder.osuosl.org (Postfix) with ESMTPS id 3950D8357B for ; Mon, 2 Mar 2020 14:50:44 +0000 (UTC) Received: by mail-wr1-f67.google.com with SMTP id z15so39329wrl.1 for ; Mon, 02 Mar 2020 06:50:44 -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=nKgjmAFM/r9ZpK3yJHqkR6dUo3I5ls2QWfO5NRTGJGU=; b=iT9wvGHIhOqtyxfHrKXKwOXPSMiG0GAhgZ9wxlmEuYgTGbsM9O03R1MqPXHbkhCRXu lkL2s5G2qKhOeHwJ9bZrryu1knt0scRDcd3hRHwczINLjdzstzJY1eQ2dwbl/c7bqCZD U3vNN4Qrqq4Sqs/0qjORQUS1OXMbirfnYnaGPfwlqxrGjR0j6RfEHDiwV3cFilCDistK mwSD450nsZKPZy54jfoFk94qIm8Jfnk3IHYFyn0K2A++K4PaQYX35GKsouBNEmR4KjwE upits2NTCZEMUVKHo/Y7eo6mm4AKy16lkfpJQuUfcW09qPRlUg0MxIinYb+F1pA8z+xe Gltw== 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=nKgjmAFM/r9ZpK3yJHqkR6dUo3I5ls2QWfO5NRTGJGU=; b=Z7dMxDvYHsELqG/8c1WAFuO9uma0hBT/MqOF80wvqQB0QPrzkKFujiIGfo/DHM7RZ6 9WGSyqjQzAEGy2XtRxvygMzxD3A+fF1XuOTvQudM3GUuYiJ2M5kXss5GC/uCBd5g0yfj 2rmlWufYe7RAWD7LMNe+V7SXLr/zs4GpTqKaPjkD5KVvzLOvl9eC+POvGJOBMN3e0/RQ 0ldtTngFb8PBuYqYPyWW1jm8prfJcavT2BRn0a5auyJi/e79rqGhHhqDdzPOPW1jtGvw mwhuX0JSp/yEOHpMarWK9behYFqmwLhmeoO2DnCOmZxxoPDU1olkcrC/2akiCEqMKHE3 S8vQ== X-Gm-Message-State: ANhLgQ3AR76sFOSlAT/8Jlo1rMDSAiVDM9sj7EWd0FLfer0k9OuX92iS 5IVTxEvVWOhs5+efdYN1kVCOFqU7 X-Google-Smtp-Source: ADFU+vsll6xkLuFiPS3mhHZp6+TVT6FdFBw/i0l56JunHjUK6VKlaT1lrNbJCV5UdCVSDOuKRZYmrg== X-Received: by 2002:a5d:4b50:: with SMTP id w16mr4739wrs.230.1583160642543; Mon, 02 Mar 2020 06:50:42 -0800 (PST) Received: from hthiery01.sab.local ([213.135.10.150]) by smtp.gmail.com with ESMTPSA id h17sm29648355wro.52.2020.03.02.06.50.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Mar 2020 06:50:41 -0800 (PST) From: Heiko Thiery To: buildroot@buildroot.org Date: Mon, 2 Mar 2020 15:50:11 +0100 Message-Id: <20200302145013.9574-10-heiko.thiery@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200302145013.9574-1-heiko.thiery@gmail.com> References: <20200302145013.9574-1-heiko.thiery@gmail.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH v4 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 432090c251..c9287b416e 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"):