From patchwork Fri Nov 18 09:10:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= X-Patchwork-Id: 696504 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3tKsgF73MZz9t0X for ; Fri, 18 Nov 2016 20:11:21 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 28EAF2F22F; Fri, 18 Nov 2016 09:11:20 +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 pYbK1jqGVYPC; Fri, 18 Nov 2016 09:11:10 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 2F58922D5F; Fri, 18 Nov 2016 09:10:55 +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 B93361C067B for ; Fri, 18 Nov 2016 09:10:30 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id B2B5785927 for ; Fri, 18 Nov 2016 09:10:30 +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 FfNkHnn5X3zD for ; Fri, 18 Nov 2016 09:10:30 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from lupi.sysmic.org (sysmic.org [62.210.89.17]) by whitealder.osuosl.org (Postfix) with ESMTPS id A46FC878D7 for ; Fri, 18 Nov 2016 09:10:29 +0000 (UTC) Received: from lupi.online.net (sysmic.org [62.210.89.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: jezz) by lupi.sysmic.org (Postfix) with ESMTPSA id 350A242654; Fri, 18 Nov 2016 10:10:27 +0100 (CET) From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Pouiller?= To: buildroot@busybox.net Date: Fri, 18 Nov 2016 10:10:18 +0100 Message-Id: <1479460224-6119-10-git-send-email-jezz@sysmic.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1479460224-6119-1-git-send-email-jezz@sysmic.org> References: <1479460224-6119-1-git-send-email-jezz@sysmic.org> MIME-Version: 1.0 Cc: Thomas Petazzoni , =?UTF-8?q?J=C3=A9r=C3=B4me=20Pouiller?= Subject: [Buildroot] [PATCH v2 09/15] fakedate: new package X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 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" `date' is widely used by packages to include build information in their binaries. Unfortunately, this is incompatible with BR2_REPRODUCIBLE. Instead to find all `date' invocation in build process, we add small tool allowing to alway return same date. This work was sponsored by `BA Robotic Systems'. Signed-off-by: Jérôme Pouiller --- package/fakedate/fakedate | 28 ++++++++++++++++++++++++++++ package/fakedate/fakedate.mk | 14 ++++++++++++++ 2 files changed, 42 insertions(+) create mode 100755 package/fakedate/fakedate create mode 100644 package/fakedate/fakedate.mk diff --git a/package/fakedate/fakedate b/package/fakedate/fakedate new file mode 100755 index 0000000..2eded22 --- /dev/null +++ b/package/fakedate/fakedate @@ -0,0 +1,28 @@ +#!/bin/sh +# vim: set sw=4 expandtab: +# +# Licence: GPL +# Created: 2016-11-04 16:31:18+01:00 +# Main authors: +# - Jérôme Pouiller +# + +PATH=/bin:/usr/bin +LOG=/dev/null +if [ -n "$SOURCE_DATE_EPOCH" ]; then + INHIBIT=0 + for i in "$@"; do + case $i in + -d|-[!-]*d|--date=*|-f|-[!-]*f|--file=*) + INHIBIT=1 + ;; + esac + done + if [ $INHIBIT -eq 0 ]; then + echo "date: Warning: using \$SOURCE_DATE_EPOCH instead of true time" >&2 + echo "Catch call to date from `pwd` with parameters: '$@'" >> $LOG + exec date -d "@$SOURCE_DATE_EPOCH" "$@" + fi +fi + +exec date "$@" diff --git a/package/fakedate/fakedate.mk b/package/fakedate/fakedate.mk new file mode 100644 index 0000000..e81ce5d --- /dev/null +++ b/package/fakedate/fakedate.mk @@ -0,0 +1,14 @@ +################################################################################ +# +# fakedate +# +################################################################################ + +# source included in buildroot +HOST_FAKEDATE_LICENSE = GPLv2+ + +define HOST_FAKEDATE_INSTALL_CMDS + $(INSTALL) -D -m 755 package/fakedate/fakedate $(HOST_DIR)/usr/bin/date +endef + +$(eval $(host-generic-package))