Improve reproducible build documentation
cover Improve reproducible build documentation
This adds documentation for the BUILD_REPRODUCIBLE_BINARIES (mentioned in the 3.4 migration notes) and SOURCE_DATE_EPOCH variables, as well as for the "reproducible_build" class.
Let me know if you wish to extend the description of SOURCE_DATE_EPOCH to give more details about how the value is computed by reproducible_build.bbclass. Should we extract the comments from reproducible_build.bbclass?
I could also mention REPRODUCIBLE_TIMESTAMP_ROOTFS, but since it's not overriden in any recipe in Poky, my first choice is not to mention it, not to add to many details to the documentation.
Your opinion?
Michael Opdenacker (3):
ref-manual: document BUILD_REPRODUCIBLE_BINARIES
ref-manual: document "reproducible_build" class and SOURCE_DATE_EPOCH
test-manual: how to enable reproducible builds
.../migration-guides/migration-3.1.rst | 5 ++-- .../migration-guides/migration-3.4.rst | 2 +- documentation/ref-manual/classes.rst | 12 ++++++++ documentation/ref-manual/variables.rst | 30 +++++++++++++++++++ .../test-manual/reproducible-builds.rst | 12 ++++++++ 5 files changed, 58 insertions(+), 3 deletions(-)
Signature · 1 line
2.25.1
PATCH 1/3 ref-manual: document BUILD_REPRODUCIBLE_BINARIES
--- documentation/migration-guides/migration-3.4.rst | 2 +- documentation/ref-manual/variables.rst | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-)
documentation/migration-guides/migration-3.4.rst +1 -1
@@ -243,7 +243,7 @@ Miscellaneous re-enable it, set ``AVAHI_GTK = "gtk3"`` in a bbappend for the ``avahi`` recipe or in your custom distro configuration file. -- Setting the ``BUILD_REPRODUCIBLE_BINARIES`` variable to "0" no longer +- Setting the :term:`BUILD_REPRODUCIBLE_BINARIES` variable to "0" no longer uses a strangely old fallback date of April 2011, it instead disables building reproducible binaries as you would logically expect.
documentation/ref-manual/variables.rst +13 -0
@@ -906,6 +906,19 @@ system and gives an overview of their function and contents. :term:`TARGET_PREFIX` when building for ``native`` recipes. + :term:`BUILD_REPRODUCIBLE_BINARIES` + This variable allows the image building classes and recipes to produce + :ref:`reproducible binaries <test-manual/reproducible-builds:reproducible builds>` + + If you inherit the + :ref:`reproducible-build <ref-classes-reproducible-build>` class, + which is the case of the Poky reference distribution, this sets this + variable to "1". + + If your build inherits this classs but you wish to disable reproducible + binary generation for specific packages or images, you can set this + variable to "0" in the corresponding recipes. + :term:`BUILD_STRIP` Specifies the command to be used to strip debugging symbols from binaries produced for the build host. By default, :term:`BUILD_STRIP`
Signature · 1 line
2.25.1
PATCH 2/3 ref-manual: document "reproducible_build" class and SOURCE_DATE_EPOCH
In reply to Michael Opdenacker--- .../migration-guides/migration-3.1.rst | 5 +++-- documentation/ref-manual/classes.rst | 12 ++++++++++++ documentation/ref-manual/variables.rst | 17 +++++++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-)
documentation/migration-guides/migration-3.1.rst +3 -2
@@ -55,8 +55,9 @@ Reproducible builds now enabled by default In order to avoid unnecessary differences in output files (aiding binary reproducibility), the Poky distribution configuration -(``DISTRO = "poky"``) now inherits the ``reproducible_build`` class by -default. +(``DISTRO = "poky"``) now inherits the +:ref:`reproducible-build <ref-classes-reproducible-build>` class +by default. .. _migration-3.1-ptest-feature-impact:
documentation/ref-manual/classes.rst +12 -0
@@ -2209,6 +2209,18 @@ commit, and log. From the information, report files using a JSON format are created and stored in ``${``\ :term:`LOG_DIR`\ ``}/error-report``. +.. _ref-classes-reproducible-build: + +``reproducible_build.bbclass`` +============================== + +The ``reproducible_build.bbclass`` class enables +:ref:`test-manual/reproducible-builds:reproducible builds` by computing +a :term:`SOURCE_DATE_EPOCH` value in each component's build environment, so +that the build is independent from the time when the component was built. + +Poky inherits this class by default since version 3.1. + .. _ref-classes-rm-work: ``rm_work.bbclass``
documentation/ref-manual/variables.rst +17 -0
@@ -6938,6 +6938,23 @@ system and gives an overview of their function and contents. You will see this variable referenced in the default values of ``FILES:${PN}-dev``. + :term:`SOURCE_DATE_EPOCH` + This defines a date expressed in number of seconds since + the UNIX EPOCH (01 Jan 1970 00:00:00 UTC), which is used by + multiple build systems to force a timestamp in built binaries. + Many upstream projects already support this variable. + + You will find more details in the `official specifications + <https://reproducible-builds.org/specs/source-date-epoch/>`__. + + A value for each recipe is computed from the sources by + the :ref:`reproducible-build <ref-classes-reproducible-build>` class. + + If a recipe wishes to override the default behavior, it should set its + own :term:`SOURCE_DATE_EPOCH` value:: + + SOURCE_DATE_EPOCH = "1613559011" + :term:`SOURCE_MIRROR_FETCH` When you are fetching files to create a mirror of sources (i.e. creating a source mirror), setting :term:`SOURCE_MIRROR_FETCH` to "1" in
Signature · 1 line
2.25.1
PATCH 3/3 test-manual: how to enable reproducible builds
In reply to Michael Opdenacker--- documentation/test-manual/reproducible-builds.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+)
documentation/test-manual/reproducible-builds.rst +12 -0
@@ -44,6 +44,18 @@ same. before finalizing your production images. It would be too late if you only address this issue when the first updates are required. +================ +How to enable it +================ + +You can enable build reproducibility by inheriting the +:ref:`reproducible-build <ref-classes-reproducible-build>` class +in the configuration for your distribution. + +This is what the Poky reference distribution does:: + + INHERIT += "reproducible_build" + =================== How we implement it ===================
Signature · 1 line
2.25.1
Quoted 8 lines · Michael Opdenacker
This adds documentation for the
BUILD_REPRODUCIBLE_BINARIES(mentioned in the 3.4 migration notes) andSOURCE_DATE_EPOCHvariables, as well as for the "reproducible_build" class.Let me know if you wish to extend the description of
SOURCE_DATE_EPOCHto give more details about how the value is computed by reproducible_build.bbclass. Should we extract the comments from reproducible_build.bbclass?
Quoted 5 lines
I could also mention
REPRODUCIBLE_TIMESTAMP_ROOTFS, but since it's not overriden in any recipe in Poky, my first choice is not to mention it, not to add to many details to the documentation.Your opinion?
Richard just enabled the behavior by default in master, so the bbclass and BUILD_REPRODUCIBLE_BINARIES variable are gone there. It likely makes sense to still document them for honister (and potentially earlier).
Scott
Hi Scott,
Quoted 10 lines · Scott Murray
Quoted 8 lines · Michael Opdenacker
This adds documentation for the
BUILD_REPRODUCIBLE_BINARIES(mentioned in the 3.4 migration notes) andSOURCE_DATE_EPOCHvariables, as well as for the "reproducible_build" class.Let me know if you wish to extend the description of
SOURCE_DATE_EPOCHto give more details about how the value is computed by reproducible_build.bbclass. Should we extract the comments from reproducible_build.bbclass?
Quoted 8 lines
Quoted 5 lines
I could also mention
REPRODUCIBLE_TIMESTAMP_ROOTFS, but since it's not overriden in any recipe in Poky, my first choice is not to mention it, not to add to many details to the documentation.Your opinion?
Richard just enabled the behavior by default in master, so the bbclass and
BUILD_REPRODUCIBLE_BINARIESvariable are gone there. It likely makes sense to still document them for honister (and potentially earlier).
Oops, bad timing then. Good that this can be useful at least for Honister. I'll submit this on honister-next (coming soon). I though my version of Poky was recent enough, I missed the latest commits. I'll pay extra attention to the patches then.
Many thanks!
Cheers
Michael.
Signature · 3 lines
Michael Opdenacker, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Quoted 18 lines · Michael Opdenacker
Hi Scott,
Quoted 15 lines · Scott Murray
Quoted 13 lines · Michael Opdenacker
This adds documentation for the
BUILD_REPRODUCIBLE_BINARIES(mentioned in the 3.4 migration notes) andSOURCE_DATE_EPOCHvariables, as well as for the "reproducible_build" class.Let me know if you wish to extend the description of
SOURCE_DATE_EPOCHto give more details about how the value is computed by reproducible_build.bbclass. Should we extract the comments from reproducible_build.bbclass?I could also mention
REPRODUCIBLE_TIMESTAMP_ROOTFS, but since it's not overriden in any recipe in Poky, my first choice is not to mention it, not to add to many details to the documentation.Your opinion?
Quoted 8 lines
Quoted 3 lines
Richard just enabled the behavior by default in master, so the bbclass and
BUILD_REPRODUCIBLE_BINARIESvariable are gone there. It likely makes sense to still document them for honister (and potentially earlier).Oops, bad timing then. Good that this can be useful at least for Honister. I'll submit this on honister-next (coming soon). I though my version of Poky was recent enough, I missed the latest commits. I'll pay extra attention to the patches then.
Just one note, the SOURCE_DATE_EPOCH piece of patch 2 is still applicable, and definitely should go into master.
Cheers,
Scott
Hi Scott,
Quoted 2 lines · Scott Murray
Just one note, the
SOURCE_DATE_EPOCHpiece of patch 2 is still applicable, and definitely should go into master.
Done, merged into master-next.
Thanks!
Michael.
Signature · 3 lines
Michael Opdenacker, Bootlin Embedded Linux and Kernel engineering https://bootlin.com