Skip to contentSkip to conversation

libtracefs: support reproducible builds

PATCH Changqing Li 2 participants 2 messages Nov 20, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi, Khem, Richard

This issue and also refer https://git.openembedded.org/openembedded-core/commit/?id=8898f97b4acc9d5c2c6583c91d05327f9093133e,

both issues caused by randomly mtime of the sources checkout by git.

So I thought maybe change the mtime of files during upack is better,  change  like this:

lib/bb/fetch2/git.py +0 -0
index 0fcdb19df..c4da45fc6 100644
@@ -752,6 +752,8 @@ class Git(FetchMethod):

             else:
                 runfetchcmd("%s checkout %s" % (ud.basecmd, ud.revision), d, workdir=destdir)

+            runfetchcmd("%s restore-mtime" % ud.basecmd, d, workdir=destdir) +
         return True

     def clean(self, ud, d):

But restore-mtime is not a git command,  need to install git-restore-mtime,  another option is modify all the files by "touch -d "last commit time"".

What is your suggestion? if you agree fix from fetch2/gitt.py,  I can send a patch.

//changqing

Quoted 46 lines · Changqing Li via lists.openembedded.org

From: Changqing Li<[email protected]>

[snip of Makefile]

  # bison will create both sqlhist.tab.c and sqlhist.tab.h
sqlhist.tab.h:
sqlhist.tab.c: sqlhist.y sqlhist.tab.h
     bison --debug -v --report-file=bison.report -d -o $@ $<
[snip]

sources of libtracefs is fetched by git, the mtime of sqlhist.y, sqlhist.tab.c is random. so sometimes, sqlhist.tab.c is regenerated, sometimes, sqlhist.tab.c in original sources in used. bison used to gernerate sqlhist.tab.c by upstream libtracefs maybe has different version with the build host one. This make the final libtracefs.so not reproducible. This fix touch sqlhist.tab.c to make it has the newest mtime, and sqlhist.tab.c is not regenerated during build.

---
  meta-oe/recipes-kernel/libtracefs/libtracefs_1.8.2.bb | 4 ++++
  1 file changed, 4 insertions(+)
meta-oe/recipes-kernel/libtracefs/libtracefs_1.8.2.bb +4 -1
index b6bae96896..35eabc7b11 100644
@@ -16,6 +16,10 @@ SRC_URI = "git://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git;branch=${BP
 
  inherit pkgconfig bash-completion
 
+do_compile:prepend() {
+    touch ${S}/src/sqlhist.tab.c
+}
+
  do_install() {
      oe_runmake install DESTDIR=${D} pkgconfig_dir=${libdir}/pkgconfig
  }
 
-=-=-=-=-=-=-=-=-=-=-=-

Links: You receive all messages sent to this group.
View/Reply Online (#121928):https://lists.openembedded.org/g/openembedded-devel/message/121928 Mute This Topic:https://lists.openembedded.org/mt/116387556/3616873
Group Owner:[email protected] Unsubscribe:https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw
Quoted 22 lines · Changqing Li

Hi, Khem, Richard

This issue and also refer https://git.openembedded.org/openembedded- core/commit/?id=8898f97b4acc9d5c2c6583c91d05327f9093133e,

both issues caused by randomly mtime of the sources checkout by git.

So I thought maybe change the mtime of files during upack is better, change  like this:

lib/bb/fetch2/git.py +2 -0
index 0fcdb19df..c4da45fc6 100644
@@ -752,6 +752,8 @@ class Git(FetchMethod):
              else:
                  runfetchcmd("%s checkout %s" % (ud.basecmd, 
 ud.revision), d, workdir=destdir)
 
+            runfetchcmd("%s restore-mtime" % ud.basecmd, d, 
 workdir=destdir)
+
          return True
Quoted 6 lines

     def clean(self, ud, d):

But restore-mtime is not a git command,  need to install git-restore- mtime,  another option is modify all the files by "touch -d "last commit time"".

What is your suggestion? if you agree fix from fetch2/gitt.py,  I can send a patch.

git restore-mtime has few limitations to consider, e.g. it might have
issues with shallow clones. It works with tracked files only, so if we
patch a git tree using quilt and patch adds a file to the tree, this might not be something it will consider, uncommitted changes resulting from patches are going to be ignored as well.

touch -d "last commit time" might be interesting to pursue.

Quoted 49 lines

//changqing

Quoted 46 lines · Changqing Li via lists.openembedded.org

From: Changqing Li<[email protected]>

[snip of Makefile]

  # bison will create both sqlhist.tab.c and sqlhist.tab.h
sqlhist.tab.h:
sqlhist.tab.c: sqlhist.y sqlhist.tab.h
     bison --debug -v --report-file=bison.report -d -o $@ $<
[snip]

sources of libtracefs is fetched by git, the mtime of sqlhist.y, sqlhist.tab.c is random. so sometimes, sqlhist.tab.c is regenerated, sometimes, sqlhist.tab.c in original sources in used. bison used to gernerate sqlhist.tab.c by upstream libtracefs maybe has different version with the build host one. This make the final libtracefs.so not reproducible. This fix touch sqlhist.tab.c to make it has the newest mtime, and sqlhist.tab.c is not regenerated during build.

---
  meta-oe/recipes-kernel/libtracefs/libtracefs_1.8.2.bb | 4 ++++
  1 file changed, 4 insertions(+)
meta-oe/recipes-kernel/libtracefs/libtracefs_1.8.2.bb +4 -1
index b6bae96896..35eabc7b11 100644
@@ -16,6 +16,10 @@ SRC_URI = "git://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git;branch=${BP
 
  inherit pkgconfig bash-completion
 
+do_compile:prepend() {
+    touch ${S}/src/sqlhist.tab.c
+}
+
  do_install() {
      oe_runmake install DESTDIR=${D} pkgconfig_dir=${libdir}/pkgconfig
  }
 
-=-=-=-=-=-=-=-=-=-=-=-

Links: You receive all messages sent to this group.
View/Reply Online (#121928):https://lists.openembedded.org/g/openembedded-devel/message/121928 Mute This Topic:https://lists.openembedded.org/mt/116387556/3616873
Group Owner:[email protected] Unsubscribe:https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-