From patchwork Fri Aug 14 20:21:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Spooren X-Patchwork-Id: 1345197 X-Patchwork-Delegate: jow@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aparcar.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=K0yBC1mX; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BSvzh0SkNz9sTK for ; Sat, 15 Aug 2020 06:24:13 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=oahhZUSw2IcxxmXDuYmZu2cc0BGl28bf/Y3s+oj2BeY=; b=K0yBC1mX9HLgEDYZ3tjWgi3Dy 7n3ACwXQ6wSJTamDHdoxOEAq9YGg4t75nyaDw/9uDfVANZ6AA0iUw+RGatAZ8RPeDOno8izTZaaFZ y87MQzys/4ODEAD/YjHqc/qfpvnyCzZkpH8GgZDlI3uML0r5OS682ljbnS0RYWG25i2U3n9eI6fvT +Da2kzrHUb53xwoMSdAEEV+eug7BBA7WryeMc1keQmmgMy8behqptLE0yGJT0nif9GM3sJikgu+Me 3m3IZH6LY6AF7ew3k2N4jTQXqvTCNiYXqklPGmaFatvZy+UlBI6sX/RUyoGZoqo/KBFWVCZP5u9T2 MgpY8X3ZQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k6gDX-0000Ry-31; Fri, 14 Aug 2020 20:22:23 +0000 Received: from relay5-d.mail.gandi.net ([217.70.183.197]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k6gDS-0000QY-TS for openwrt-devel@lists.openwrt.org; Fri, 14 Aug 2020 20:22:19 +0000 X-Originating-IP: 72.234.141.215 Received: from dawn.lan (udp224251uds.hawaiiantel.net [72.234.141.215]) (Authenticated sender: mail@aparcar.org) by relay5-d.mail.gandi.net (Postfix) with ESMTPA id 337151C0005; Fri, 14 Aug 2020 20:22:15 +0000 (UTC) From: Paul Spooren To: openwrt-devel@lists.openwrt.org Subject: [PATCH v2 3/4] build: store granular timestamps in packages Date: Fri, 14 Aug 2020 10:21:57 -1000 Message-Id: <20200814202158.3270944-4-mail@aparcar.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200814202158.3270944-1-mail@aparcar.org> References: <20200814202158.3270944-1-mail@aparcar.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200814_162219_088878_36D6878A X-CRM114-Status: GOOD ( 10.56 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [217.70.183.197 listed in wl.mailspike.net] -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [217.70.183.197 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jo@mein.io, Paul Spooren Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org With the new `SOURCE` argument of `get_source_date_epoch` it is possible to set package timestamps based on actual package changes rather thane $TOPDIR changes. This commit adds a new variable PKG_SOURCE_DATE_EPOCH which is used by the `ipkg` build script. As a fallback the existing SOURCE_DATE_EPOCH is used or as last resort the current time. The redundant checks for `.git/` and `.svn/` are removed. Signed-off-by: Paul Spooren --- include/package-ipkg.mk | 1 + scripts/ipkg-build | 12 +++--------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk index 622cbf3223..6cdc6fa312 100644 --- a/include/package-ipkg.mk +++ b/include/package-ipkg.mk @@ -196,6 +196,7 @@ $(_endef) $$(IPKG_$(1)) : export CONTROL=$$(Package/$(1)/CONTROL) $$(IPKG_$(1)) : export DESCRIPTION=$$(Package/$(1)/description) $$(IPKG_$(1)) : export PATH=$$(TARGET_PATH_PKG) + $$(IPKG_$(1)) : export PKG_SOURCE_DATE_EPOCH=$(shell $(TOPDIR)/scripts/get_source_date_epoch.sh $(SOURCE)) $(PKG_INFO_DIR)/$(1).provides $$(IPKG_$(1)): $(STAMP_BUILT) $(INCLUDE_DIR)/package-ipkg.mk @rm -rf $$(IDIR_$(1)); \ $$(call remove_ipkg_files,$(1),$$(call opkg_package_files,$(call gen_ipkg_wildcard,$(1)))) diff --git a/scripts/ipkg-build b/scripts/ipkg-build index 6e027bc546..979be0d253 100755 --- a/scripts/ipkg-build +++ b/scripts/ipkg-build @@ -16,16 +16,10 @@ TAR="${TAR:-$(command -v tar)}" GZIP="$(command -v gzip)" # try to use fixed source epoch -if [ -n "$SOURCE_DATE_EPOCH" ]; then +if [ -n "$PKG_SOURCE_DATE_EPOCH" ]; then + TIMESTAMP=$(date --date="@$PKG_SOURCE_DATE_EPOCH") +elif [ -n "$SOURCE_DATE_EPOCH" ]; then TIMESTAMP=$(date --date="@$SOURCE_DATE_EPOCH") - -# look up date of last commit -elif [ -d "$TOPDIR/.git" ]; then - GIT="$(command -v git)" - TIMESTAMP=$(cd $TOPDIR; $GIT log -1 -s --format=%ci) -elif [ -d "$TOPDIR/.svn" ]; then - SVN="$(command -v svn)" - TIMESTAMP=$($SVN info "$TOPDIR" | sed -n "s/^Last Changed Date: \(.*\)/\1/p") else TIMESTAMP=$(date) fi