Skip to content

Commit 0becbcf

Browse files
Fix (pre-truncate) file mtimes in the docker container (#44)
The OpenWrt build hashes file timestamps at full (sub-second) precision to determine if packages need to be rebuilt. While the container is being built, these will reflect the actual time when those files were checked out from the feed. However when the files are baked into the container layer, the file timestamps end up being truncated to second precision, causing the stamp hashes to change. To avoid this, set them all to a fixed non-fractional timestamp. Also fix a typo in the feed install line.
1 parent 5b137b8 commit 0becbcf

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

.containers/matter-openwrt-build/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@ ARG CFG_PACKAGES="glib2 libopenssl libubus libavahi-client"
99
RUN set -x && \
1010
grep -w 'base\|packages' feeds.conf.default | sed -e 's|git.openwrt.org/[^/]*|github.com/openwrt|' >feeds.conf && \
1111
./scripts/feeds update -a && \
12-
./scripts/feeds install ./scripts/feeds install $(echo "${SRC_PACKAGES}" | sed 's|/host||g') && \
12+
./scripts/feeds install $(echo "${SRC_PACKAGES}" | sed 's|/host||g') && \
1313
echo "CONFIG_ALL=n" >.config && \
1414
echo "CONFIG_AUTOREMOVE=n" >>.config && \
1515
echo "CONFIG_AUTOREBUILD=n" >>.config && \
1616
for pkg in ${CFG_PACKAGES}; do echo "CONFIG_PACKAGE_${pkg}=y"; done >>.config && \
17+
: "Normalize timestamps to avoid spurious rebuilds due to Docker layer mtime truncation" && \
18+
SDE=$(sed -n 's/^SOURCE_DATE_EPOCH:=//p' include/version.mk) && test -n "$SDE" && \
19+
find .config feeds -exec touch -h -d "@$SDE" {} + && \
1720
make defconfig && \
1821
for pkg in ${SRC_PACKAGES}; do make -j "$(nproc)" "package/${pkg}/compile"; done

0 commit comments

Comments
 (0)