summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Spooren2026-06-12 14:49:44 +0000
committerChristian Marangi2026-06-19 07:05:00 +0000
commit79b008a28069cd8310177e174f2fe66aad22f271 (patch)
tree05364ee992b3816e23267d67e8592cd011d57039
parent8be3ba900e0146f8b2e32dd263e52678c3bd8aa0 (diff)
downloadopenwrt-79b008a28069cd8310177e174f2fe66aad22f271.tar.gz
build: fixup version.date creation for source archives
Published sources archives may contain a mixture of MTIMEs, so taking the time of the first file found varies based on filesystem order. To fix this, sort all MTIMEs and take the latest. Since piping into a file directly creates that file, we also need to specifically tell `find` to ignore `version.date`. Furthermore, move this prior to the ./src copy step, since for some packages, the OpenWrt build system ships extra ./src files, which would introduce the wrong timestamps again. Fix: e36c2946b7b build: derive PKG_SOURCE_DATE_EPOCH from the unpacked source tree Link: https://github.com/openwrt/openwrt/pull/23756 Signed-off-by: Paul Spooren <mail@aparcar.org> (cherry picked from commit 8ba4c5e99396bdde32480ccbe615427b9f28c648) Link: https://github.com/openwrt/openwrt/pull/23846 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
-rw-r--r--include/package-defaults.mk3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/package-defaults.mk b/include/package-defaults.mk
index 5bb6d1d2f4..43521044d9 100644
--- a/include/package-defaults.mk
+++ b/include/package-defaults.mk
@@ -63,8 +63,9 @@ Build/Patch:=$(Build/Patch/Default)
ifneq ($(strip $(PKG_UNPACK)),)
define Build/Prepare/Default
$(PKG_UNPACK)
+ -find $(PKG_BUILD_DIR) -mindepth 1 -type f -not -name '.*' -not -name 'version.date' -printf '%T@\n' 2>/dev/null |\
+ cut -d. -f1 | sort -n | tail -n1 > $(PKG_BUILD_DIR)/version.date
[ ! -d ./src/ ] || $(CP) ./src/. $(PKG_BUILD_DIR)
- -find $(PKG_BUILD_DIR) -mindepth 1 -type f -printf '%T@\n' 2>/dev/null | head -n1 | cut -d. -f1 > $(PKG_BUILD_DIR)/version.date
$(Build/Patch)
endef
endif