From patchwork Thu May 3 21:34:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Angelo Compagnucci X-Patchwork-Id: 908309 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) 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=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b="H1Fwkjuw"; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40cT1Z1t9Kz9s1d for ; Fri, 4 May 2018 07:34:25 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 633AE2604C; Thu, 3 May 2018 21:34:23 +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 1ZpSwXdKbpHU; Thu, 3 May 2018 21:34:22 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 0E28E22871; Thu, 3 May 2018 21:34:22 +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 420861CF03E for ; Thu, 3 May 2018 21:34:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 3F57D22871 for ; Thu, 3 May 2018 21:34:21 +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 QDugx-wxXMnn for ; Thu, 3 May 2018 21:34:20 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr0-f196.google.com (mail-wr0-f196.google.com [209.85.128.196]) by silver.osuosl.org (Postfix) with ESMTPS id B76F421FA6 for ; Thu, 3 May 2018 21:34:19 +0000 (UTC) Received: by mail-wr0-f196.google.com with SMTP id v60-v6so19046216wrc.7 for ; Thu, 03 May 2018 14:34:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id; bh=gITqsPOQkKwxPImtK+dSE6Cgp1ti5b14vHkugLRItEE=; b=H1FwkjuwdA5TlqjWI2TyAFVSkFmpPxdd+UAigXihgPY2WDCJ8rJeaJxf2oGayFbo6B P/utT68NS/sEZ8FG7ZJd0aDSpzPzLhEmINxMaRufQaLtnH1qlIwpmcN8ywi3zxBi5EeA GnwpavUaSeRBnMV2pCZ099XDLDFPnRjXa/oJ8= 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; bh=gITqsPOQkKwxPImtK+dSE6Cgp1ti5b14vHkugLRItEE=; b=U1E+JihPW4SZPrDRmcf813FPLDy5qlTjoZ/3FRaEX8AhNkW2pawqkgCnSbCBtCgWkt +Ul1kgj/yXTaYGKGqXrQ6iC4kGTESUH08l93E7CeOpmUv1C/2P2BNRN3W+k5CHsCHNTM g+gEADcga0ctNKOcRSoeChOae/hzq/yrsQlZJQ09vzfFKamdMbfTqLiA+9IcDyi+vzyr tsm2AP2xmelTJWoaGhJb+IOMztDmmQwfg0o76/iNVOVMgPH+Je+kJCtwWUAwxhhfFxQv E7a/BkfEuO6Wve3lpk79UG4srzL1zIioltB7TaL5dcR6aeY5d5nozKhwwTRkiFEeftWV 4MqQ== X-Gm-Message-State: ALQs6tBPd+SvSp3pUVVJyBd3ktB8EjFrYCLe9TPur5NHDbps/IHR+IWg Dur39xaaOQBf+jRfA+XX9PXjoWiHF5Q= X-Google-Smtp-Source: AB8JxZosEMpP7+JveEOArNDZekPAgbyCqQ8wsH+UehvyIcw/DeqYLcTv/UcTVjuZs+1jNGpQmwJWOA== X-Received: by 2002:adf:b2f5:: with SMTP id g108-v6mr20836952wrd.147.1525383256769; Thu, 03 May 2018 14:34:16 -0700 (PDT) Received: from localhost.localdomain ([89.202.204.147]) by smtp.gmail.com with ESMTPSA id x63sm482173wma.25.2018.05.03.14.34.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 03 May 2018 14:34:16 -0700 (PDT) From: Angelo Compagnucci To: buildroot@buildroot.org Date: Thu, 3 May 2018 23:34:11 +0200 Message-Id: <1525383252-4837-1-git-send-email-angelo@amarulasolutions.com> X-Mailer: git-send-email 2.7.4 Subject: [Buildroot] [PATCH 1/2] Makefile: add tainting support X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Angelo Compagnucci MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Angelo Compagnucci Packages who harms the build reproducibility can declare FOO_TAINTS variable. If a package taints the build it will be added to a list of tainting packages. The build ends with a warning if the tainting packages list is not empty. Moreover, legal info will show a warning in presence of a tainting package. Signed-off-by: Angelo Compagnucci --- Makefile | 11 +++++++++++ package/pkg-generic.mk | 9 +++++++++ 2 files changed, 20 insertions(+) diff --git a/Makefile b/Makefile index c024c65..1b3d987 100644 --- a/Makefile +++ b/Makefile @@ -758,12 +758,22 @@ endif touch $(TARGET_DIR)/usr +# Check here if there are packages declaring they harm +# the reproducibility of the build +.PHONY: check-tainted +check-tainted: +ifneq ($(BR2_TAINTED_BY),) + $(error Buildroot is tainted (by: $(BR2_TAINTED_BY)).) +endif + .PHONY: target-post-image target-post-image: $(TARGETS_ROOTFS) target-finalize @rm -f $(ROOTFS_COMMON_TAR) @$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_IMAGE_SCRIPT)), \ $(call MESSAGE,"Executing post-image script $(s)"); \ $(EXTRA_ENV) $(s) $(BINARIES_DIR) $(call qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep)) + @if [ ! -z "$(BR2_TAINTED_BY)" ]; then \ + echo "WARNING: Buildroot is tainted (by: $(BR2_TAINTED_BY))"; fi .PHONY: source source: $(foreach p,$(PACKAGES),$(p)-all-source) @@ -1070,6 +1080,7 @@ help: @echo ' source - download all sources needed for offline-build' @echo ' external-deps - list external packages used' @echo ' legal-info - generate info about license compliance' + @echo ' check-tainted - check if any selected package harms build reproducibility' @echo ' printvars - dump all the internal variables' @echo @echo ' make V=0|1 - 0 => quiet build (default), 1 => verbose build' diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk index a303dc2..a71ed6a 100644 --- a/package/pkg-generic.mk +++ b/package/pkg-generic.mk @@ -542,6 +542,10 @@ ifndef $(2)_REDISTRIBUTE endif endif +ifdef $(2)_TAINTS + BR2_TAINTED_BY+=$$($(2)_RAWNAME) +endif + $(2)_REDISTRIBUTE ?= YES $(2)_REDIST_SOURCES_DIR = $$(REDIST_SOURCES_DIR_$$(call UPPERCASE,$(4)))/$$($(2)_BASENAME_RAW) @@ -900,6 +904,11 @@ else $(Q)$$(foreach F,$$($(2)_LICENSE_FILES),$$(call legal-license-file,$$($(2)_RAWNAME),$$($(2)_BASENAME_RAW),$$($(2)_PKGDIR),$$(F),$$($(2)_DIR)/$$(F),$$(call UPPERCASE,$(4)))$$(sep)) endif # license files +# Save a legal warning if tainted +ifeq ($$(call qstrip,$$($(2)_TAINTS)),YES) + $(Q)$$(call legal-warning-pkg,$$($(2)_RAWNAME),unknown license for additional modules or dependencies) +endif + ifeq ($$($(2)_SITE_METHOD),local) # Packages without a tarball: don't save and warn @$$(call legal-warning-nosource,$$($(2)_RAWNAME),local)