From patchwork Mon Oct 23 08:39:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bernhard M. Wiedemann" X-Patchwork-Id: 1853571 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=slof-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=patchwork.ozlabs.org) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SDTCd4KcMz202k for ; Mon, 23 Oct 2023 19:40:12 +1100 (AEDT) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4SDTCb496Lz2ykC for ; Mon, 23 Oct 2023 19:40:11 +1100 (AEDT) X-Original-To: slof@lists.ozlabs.org Delivered-To: slof@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=suse.de (client-ip=195.135.220.29; helo=smtp-out2.suse.de; envelope-from=bwiedemann@suse.de; receiver=lists.ozlabs.org) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4SDTCW0Fxyz2yQL for ; Mon, 23 Oct 2023 19:40:06 +1100 (AEDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 3C88C1FE11; Mon, 23 Oct 2023 08:40:03 +0000 (UTC) Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 024802CF3D; Mon, 23 Oct 2023 08:40:02 +0000 (UTC) Received: by wotan.suse.de (Postfix, from userid 16894) id D872766D8; Mon, 23 Oct 2023 08:40:02 +0000 (UTC) From: "Bernhard M. Wiedemann" To: slof@lists.ozlabs.org Date: Mon, 23 Oct 2023 08:39:49 +0000 Message-Id: <20231023083949.26204-1-bwiedemann@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20cbe1d9-f26a-48e2-b3b0-e37a42e6ddf9@redhat.com> References: <20cbe1d9-f26a-48e2-b3b0-e37a42e6ddf9@redhat.com> MIME-Version: 1.0 X-Spam-Level: ***** X-Spamd-Bar: +++++ Authentication-Results: smtp-out2.suse.de; dkim=none; dmarc=none; spf=softfail (smtp-out2.suse.de: 149.44.160.134 is neither permitted nor denied by domain of bwiedemann@suse.de) smtp.mailfrom=bwiedemann@suse.de X-Rspamd-Server: rspamd2 X-Spamd-Result: default: False [5.49 / 50.00]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; TO_DN_SOME(0.00)[]; R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.20)[suse.de]; BROKEN_CONTENT_TYPE(1.50)[]; R_SPF_SOFTFAIL(0.60)[~all:c]; NEURAL_HAM_LONG(-3.00)[-1.000]; TO_MATCH_ENVRCPT_SOME(0.00)[]; VIOLATED_DIRECT_SPF(3.50)[]; MX_GOOD(-0.01)[]; NEURAL_HAM_SHORT(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; RWL_MAILSPIKE_GOOD(0.00)[149.44.160.134:from]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.20)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; BAYES_HAM(-0.00)[20.06%] X-Spam-Score: 5.49 X-Rspamd-Queue-Id: 3C88C1FE11 X-Spam-Flag: NO Subject: [SLOF] [PATCH] Allow to override build date with SOURCE_DATE_EPOCH X-BeenThere: slof@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Patches for https://github.com/aik/SLOF" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth Errors-To: slof-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "SLOF" in order to make builds reproducible. See https://reproducible-builds.org/ for why this is good and https://reproducible-builds.org/specs/source-date-epoch/ for the definition of this variable. Without this patch, openSUSE's qemu package always varied between builds. This patch was done while working on reproducible builds for openSUSE. This is an alternative to https://lists.ozlabs.org/pipermail/slof/2023-October/002895.html Signed-off-by: Bernhard M. Wiedemann Reviewed-by: Thomas Huth --- romfs/tools/create_crc.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/romfs/tools/create_crc.c b/romfs/tools/create_crc.c index abc373b..9122e3c 100644 --- a/romfs/tools/create_crc.c +++ b/romfs/tools/create_crc.c @@ -95,7 +95,13 @@ createHeaderImage(int notime) if (!notime) { /* read time and write it into data stream */ - if ((caltime = time(NULL)) == -1) { + char *source_date_epoch; + /* This assumes that (if used) the SOURCE_DATE_EPOCH environment variable + will contain a correct, positive integer in the time_t range */ + if ((source_date_epoch = getenv("SOURCE_DATE_EPOCH")) == NULL || + (caltime = (time_t)strtoll(source_date_epoch, NULL, 10)) <= 0) + time(&caltime); + if (caltime == -1) { printf("time error\n"); } if ((tm = localtime(&caltime)) == NULL) {