[SeaBIOS] [PATCH] Use SOURCE_DATE_EPOCH to facilitate reproducible builds

Lawrence Hunter via SeaBIOS posted 1 patch 3 weeks ago
scripts/buildversion.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
[SeaBIOS] [PATCH] Use SOURCE_DATE_EPOCH to facilitate reproducible builds
Posted by Lawrence Hunter via SeaBIOS 3 weeks ago
https://reproducible-builds.org/docs/source-date-epoch/

Without this change the timestamp varies between builds and cannot be
checked for reproducibility

Signed-off-by: Lawrence Hunter <lawrence.hunter@codethink.co.uk>
---
 scripts/buildversion.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scripts/buildversion.py b/scripts/buildversion.py
index 8875497c..80951973 100755
--- a/scripts/buildversion.py
+++ b/scripts/buildversion.py
@@ -125,7 +125,10 @@ def main():
         if not ver:
             ver = "?"
     if not cleanbuild:
-        btime = time.strftime("%Y%m%d_%H%M%S")
+        btime = time.strftime(
+            "%Y%m%d_%H%M%S",
+            time.localtime(int(os.environ.get('SOURCE_DATE_EPOCH', time.time())))
+        )
         hostname = socket.gethostname()
         ver = "%s-%s-%s" % (ver, btime, hostname)
     write_version(outfile, ver + options.extra, toolstr)
-- 
2.54.0

_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org
[SeaBIOS] Re: [PATCH] Use SOURCE_DATE_EPOCH to facilitate reproducible builds
Posted by Kevin O'Connor via SeaBIOS 1 day, 5 hours ago
On Mon, Sep 28, 2026 at 03:41:02PM +0100, Lawrence Hunter via SeaBIOS wrote:
> https://reproducible-builds.org/docs/source-date-epoch/
> 
> Without this change the timestamp varies between builds and cannot be
> checked for reproducibility

FYI, the behavior you described is the intended behavior.  The build
only includes the build timestamp if the build can't identify a
pristine git environment for the code.  This is intended because
during it is very useful to know exactly which development effort was
deployed during testing.

If you want to make a reproducible build I would recommend committing
all changes to your local git repository - the build should then be
reproducible.

-Kevin

_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org
[SeaBIOS] Re: [PATCH] Use SOURCE_DATE_EPOCH to facilitate reproducible builds
Posted by Lawrence Hunter via SeaBIOS 1 day, 3 hours ago
Hello,

I understand your point; however, this assumption breaks if any patches are applied during the build process. For example the integration tool buildstream may apply project specific source patches but does not then commit the changes leading to the timestamp being included and non-reproducibility. This change just makes it so that is no longer an issue, if SOURCE_DATE_EPOCH is specified, simplifying the process. 

All the best,
Lawrence Hunter


> On 18 Oct 2026, at 19:14, Kevin O'Connor via SeaBIOS <seabios@seabios.org> wrote:
> 
> On Mon, Sep 28, 2026 at 03:41:02PM +0100, Lawrence Hunter via SeaBIOS wrote:
>> https://reproducible-builds.org/docs/source-date-epoch/
>> 
>> Without this change the timestamp varies between builds and cannot be
>> checked for reproducibility
> 
> FYI, the behavior you described is the intended behavior.  The build
> only includes the build timestamp if the build can't identify a
> pristine git environment for the code.  This is intended because
> during it is very useful to know exactly which development effort was
> deployed during testing.
> 
> If you want to make a reproducible build I would recommend committing
> all changes to your local git repository - the build should then be
> reproducible.
> 
> -Kevin
> 
> 
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org