From patchwork Fri Nov 3 14:40:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Einar_J=C3=B3n?= X-Patchwork-Id: 833909 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yT4Pq6d7Tz9s8J for ; Sat, 4 Nov 2017 01:40:46 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id E6F9586E8F; Fri, 3 Nov 2017 14:40:44 +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 w8fPz97BiK6H; Fri, 3 Nov 2017 14:40:44 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 3001386AA8; Fri, 3 Nov 2017 14:40:44 +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 119B61C218D for ; Fri, 3 Nov 2017 14:40:43 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 0DE6986E9D for ; Fri, 3 Nov 2017 14:40:43 +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 2spXrnpEjvXc for ; Fri, 3 Nov 2017 14:40:42 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from n4.nabble.com (n4.nabble.com [162.253.133.72]) by whitealder.osuosl.org (Postfix) with ESMTP id 49BD986CB9 for ; Fri, 3 Nov 2017 14:40:42 +0000 (UTC) Received: from mben.nabble.com (localhost [127.0.0.1]) by n4.nabble.com (Postfix) with ESMTP id A7B7E158868C4 for ; Fri, 3 Nov 2017 07:40:41 -0700 (MST) Date: Fri, 3 Nov 2017 07:40:41 -0700 (MST) From: =?utf-8?q?Einar_J=C3=B3n_Gunnarsson?= To: buildroot@busybox.net Message-ID: <1509720041684-0.post@n4.nabble.com> MIME-Version: 1.0 Subject: [Buildroot] BR2_REPRODUCIBLE issues 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: , Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Hello all. I've been using BR2_REPRODUCIBLE, and it mostly works. But when it is using a git repo, I have the following issues with creating SOURCE_DATE_EPOCH: 1) It uses $(GIT), but the GIT variable is only defined in line 487: "include package/Makefile.in". Note that this is done around line 250 in $(TOPDIR)/Makefile, so sometimes $(GIT) is unset then getting BR2_VERSION_GIT_EPOCH 2) It always uses the last git commit to calculate the date. So any commit changes the timestamp, while the non-git timestamp stays the same. This makes the whole thing almost useless. If the git log command could take a parameter, you could make reproducible builds based on e.g. tag 2017.08, which would be much more useful. Regards, Einar Jón An idea for a patch made against origin/next - feel free to do whatever with it. if BR2_REPRODUCIBLE_CUSTOM_REPO_VERSION is empty, the behaviour is unchanged from before. Maybe setting the default value of BR2_REPRODUCIBLE_CUSTOM_REPO_VERSION to the last major tag version might make sense. ------ From ba5e36391f698946e6b5e02c4e7ab389f88f1373 Mon Sep 17 00:00:00 2001 From: Einar Jon Gunnarsson Date: Fri, 3 Nov 2017 15:15:16 +0100 Subject: [PATCH] BR2_REPRODUCIBLE can use a custom git commit --- Config.in | 12 ++++++++++++ Makefile | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) endif -- 1.9.1 -- Sent from: http://buildroot-busybox.2317881.n4.nabble.com/ diff --git a/Config.in b/Config.in index e395995..faab671 100644 --- a/Config.in +++ b/Config.in @@ -726,6 +726,18 @@ config BR2_REPRODUCIBLE This is labeled as an experimental feature, as not all packages behave properly to ensure reproducibility. +if BR2_REPRODUCIBLE + +config BR2_REPRODUCIBLE_CUSTOM_REPO_VERSION + string "Git version for reproducible builds" + help + Revision to use in the typical format used by Git + E.G. a sha id, a tag, branch, .. + Uses the last commit if empty. + Only useful if TOPDIR is a git repository. + +endif + endmenu endmenu diff --git a/Makefile b/Makefile index 6d4aeca..a19d20e 100644 --- a/Makefile +++ b/Makefile @@ -253,7 +253,8 @@ export TZ = UTC export LANG = C export LC_ALL = C export GZIP = -n -BR2_VERSION_GIT_EPOCH = $(shell GIT_DIR=$(TOPDIR)/.git $(GIT) log -1 --format=%at) +GIT := $(call qstrip,$(BR2_GIT)) +BR2_VERSION_GIT_EPOCH = $(shell GIT_DIR=$(TOPDIR)/.git $(GIT) log -1 --format=%at $(BR2_REPRODUCIBLE_CUSTOM_REPO_VERSION)) export SOURCE_DATE_EPOCH = $(if $(wildcard $(TOPDIR)/.git),$(BR2_VERSION_GIT_EPOCH),$(BR2_VERSION_EPOCH)) DEPENDENCIES_HOST_PREREQ += host-fakedate