Custom package files timestamp in IPK

I'm beginning to develop custom package in OpenWrt 21.02 SDK. How can I set buildtime timestamp to built files in resulting IPK.

seems this would render a non-reproducible build.

I want it just for this custom package, not for whole build.

Not sure if this works with SDK, but it works with the full toolchain for the image itself (and the files in the image)

See SOURCE_DATE_EPOCH shell variable and version.date file.

Hello again.
I found solution for SDK. This change does not affect any other stuff but custom packages added directly to package directory ( not by feed script ).

  1. Add following line to your package Makefile:
    IPK_FILES_TIMESTAMP:=$(shell date +%s)
    If you want to set constant timestamp:
    IPK_FILES_TIMESTAMP:=1635191094

  2. Replace in file /include/package.mk the line:

PKG_SOURCE_DATE_EPOCH:=$(if $(DUMP),,$(shell $(TOPDIR)/scripts/get_source_date_epoch.sh $(CURDIR)))

with

ifdef IPK_FILES_TIMESTAMP
  PKG_SOURCE_DATE_EPOCH:=$(IPK_FILES_TIMESTAMP)
else
  PKG_SOURCE_DATE_EPOCH:=$(if $(DUMP),,$(shell $(TOPDIR)/scripts/get_source_date_epoch.sh $(CURDIR)))
endif

Thats's it.

1 Like

If your problem is solved, please consider marking this topic as [Solved]. See How to mark a topic as [Solved] for a short how-to.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.