| Message ID | 20260311104359.194321-1-liu.ming50@gmail.com |
|---|---|
| State | New |
| Headers | show |
| Series | rootfs-postcommands.bbclass: use DATETIME as system timestamp | expand |
On Wed, 2026-03-11 at 11:43 +0100, Ming Liu via lists.openembedded.org wrote: > DATETIME is being used in BUILD_ID and some other places to mark the > build time, let's use it as system timestamp, to have a consistent > system-wide timestamp. > > Signed-off-by: Ming Liu <liu.ming50@gmail.com> > --- > meta/classes-recipe/rootfs-postcommands.bbclass | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/meta/classes-recipe/rootfs-postcommands.bbclass b/meta/classes-recipe/rootfs-postcommands.bbclass > index f0c7ee658d..43001e09b5 100644 > --- a/meta/classes-recipe/rootfs-postcommands.bbclass > +++ b/meta/classes-recipe/rootfs-postcommands.bbclass > @@ -424,11 +424,12 @@ rootfs_update_timestamp () { > # Convert UTC into %4Y%2m%2d%2H%2M%2S > sformatted=`date -u -d @${REPRODUCIBLE_TIMESTAMP_ROOTFS} +%4Y%2m%2d%2H%2M%2S` > else > - sformatted=`date -u +%4Y%2m%2d%2H%2M%2S` > + sformatted=${DATETIME} > fi > echo $sformatted > ${IMAGE_ROOTFS}/etc/timestamp > bbnote "rootfs_update_timestamp: set /etc/timestamp to $sformatted" > } > +rootfs_update_timestamp[vardepsexclude] = "DATETIME" This could be a little tricky as this timestamp is meant to be the latest thing in the image. DATETIME is fixed when the build starts and therefore if files are modified during the image, those could have a later values. I'm therefore not sure this is a good idea. Cheers, Richard
OK, that’s a good point, please ignore it. //Ming Liu On Wed, 2026-03-11 at 11:43 +0100, Ming Liu via lists.openembedded.org > wrote: > > DATETIME is being used in BUILD_ID and some other places to mark the > > build time, let's use it as system timestamp, to have a consistent > > system-wide timestamp. > > > > Signed-off-by: Ming Liu <liu.ming50@gmail.com> > > --- > > meta/classes-recipe/rootfs-postcommands.bbclass | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/meta/classes-recipe/rootfs-postcommands.bbclass > b/meta/classes-recipe/rootfs-postcommands.bbclass > > index f0c7ee658d..43001e09b5 100644 > > --- a/meta/classes-recipe/rootfs-postcommands.bbclass > > +++ b/meta/classes-recipe/rootfs-postcommands.bbclass > > @@ -424,11 +424,12 @@ rootfs_update_timestamp () { > > # Convert UTC into %4Y%2m%2d%2H%2M%2S > > sformatted=`date -u -d @${REPRODUCIBLE_TIMESTAMP_ROOTFS} > +%4Y%2m%2d%2H%2M%2S` > > else > > - sformatted=`date -u +%4Y%2m%2d%2H%2M%2S` > > + sformatted=${DATETIME} > > fi > > echo $sformatted > ${IMAGE_ROOTFS}/etc/timestamp > > bbnote "rootfs_update_timestamp: set /etc/timestamp to $sformatted" > > } > > +rootfs_update_timestamp[vardepsexclude] = "DATETIME" > > This could be a little tricky as this timestamp is meant to be the > latest thing in the image. DATETIME is fixed when the build starts and > therefore if files are modified during the image, those could have a > later values. > > I'm therefore not sure this is a good idea. > > Cheers, > > Richard >
diff --git a/meta/classes-recipe/rootfs-postcommands.bbclass b/meta/classes-recipe/rootfs-postcommands.bbclass index f0c7ee658d..43001e09b5 100644 --- a/meta/classes-recipe/rootfs-postcommands.bbclass +++ b/meta/classes-recipe/rootfs-postcommands.bbclass @@ -424,11 +424,12 @@ rootfs_update_timestamp () { # Convert UTC into %4Y%2m%2d%2H%2M%2S sformatted=`date -u -d @${REPRODUCIBLE_TIMESTAMP_ROOTFS} +%4Y%2m%2d%2H%2M%2S` else - sformatted=`date -u +%4Y%2m%2d%2H%2M%2S` + sformatted=${DATETIME} fi echo $sformatted > ${IMAGE_ROOTFS}/etc/timestamp bbnote "rootfs_update_timestamp: set /etc/timestamp to $sformatted" } +rootfs_update_timestamp[vardepsexclude] = "DATETIME" # Prevent X from being started rootfs_no_x_startup () {
DATETIME is being used in BUILD_ID and some other places to mark the build time, let's use it as system timestamp, to have a consistent system-wide timestamp. Signed-off-by: Ming Liu <liu.ming50@gmail.com> --- meta/classes-recipe/rootfs-postcommands.bbclass | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)