build: add buildinfo files for reproducibility
authorPaul Spooren <mail@aparcar.org>
Thu, 13 Jun 2019 00:24:04 +0000 (02:24 +0200)
committerJo-Philipp Wich <jo@mein.io>
Wed, 4 Sep 2019 11:39:13 +0000 (13:39 +0200)
generate feeds.buildinfo and version.buildinfo in build dir after
containing the feed revisions (via ./scripts/feeds list -sf) as well as
the current revision of buildroot (via ./scripts/getver.sh).

With this information it should be possible to reproduce any build,
especially the release builds.

Usage would be to move feeds.buildinfo to feeds.conf and git checkout the
revision hash of version.buildinfo.

Content of feeds.buildinfo would look similar to this:

    src-git routing https://git.openwrt.org/feed/routing.git^bf475d6
    src-git telephony https://git.openwrt.org/feed/telephony.git^470eb8e
    ...

Content of version.buildinfo would look similar to this:

    r10203+1-c12bd3a21b

Without the exact feed revision it is not possible to determine
installed package versions.

Also rename config.seed to config.buildinfo to follow the recommended
style of https://reproducible-builds.org/docs/recording/

Signed-off-by: Paul Spooren <mail@aparcar.org>
(cherry picked from commit 454021581f630d5d04afeb8ff6581c1bda295c87)

Makefile
config/Config-build.in
package/base-files/Makefile

index 5301883061589de7c4a7ffbb5e4a8d4c0588f6c6..ab97eacc9d2bfe9618e9282bcd8f2a4903d02c08 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -89,12 +89,18 @@ prereq: $(target/stamp-prereq) tmp/.prereq_packages
 checksum: FORCE
        $(call sha256sums,$(BIN_DIR),$(CONFIG_BUILDBOT))
 
+buildversion: FORCE
+       $(SCRIPT_DIR)/getver.sh > $(BIN_DIR)/version.buildinfo
+
+feedsversion: FORCE
+       $(SCRIPT_DIR)/feeds list -fs > $(BIN_DIR)/feeds.buildinfo
+
 diffconfig: FORCE
        mkdir -p $(BIN_DIR)
-       $(SCRIPT_DIR)/diffconfig.sh > $(BIN_DIR)/config.seed
+       $(SCRIPT_DIR)/diffconfig.sh > $(BIN_DIR)/config.buildinfo
 
 prepare: .config $(tools/stamp-compile) $(toolchain/stamp-compile)
-       $(_SINGLE)$(SUBMAKE) -r diffconfig
+       $(_SINGLE)$(SUBMAKE) -r diffconfig buildversion feedsversion
 
 world: prepare $(target/stamp-compile) $(package/stamp-compile) $(package/stamp-install) $(target/stamp-install) FORCE
        $(_SINGLE)$(SUBMAKE) -r package/index
index fe916e22eab7d4c54c67e69a7483cbcc99dce249..35341833e35f39284679b048fb954d8498606d3a 100644 (file)
@@ -93,7 +93,7 @@ menu "Global build settings"
                bool "Include build configuration in firmware" if DEVEL
                default n
                help
-                 If enabled, config.seed will be stored in /etc/build.config of firmware.
+                 If enabled, config.buildinfo will be stored in /etc/build.config of firmware.
 
        config COLLECT_KERNEL_DEBUG
                bool
index 7c63d3ef44f72250b3f7374411d650640fceb53b..0fcdc56b922aff14015e348a53278acbd4eb557a 100644 (file)
@@ -198,7 +198,7 @@ define Package/base-files/install
 
        $(if $(CONFIG_INCLUDE_CONFIG), \
                echo -e "# Build configuration for board $(BOARD)/$(SUBTARGET)/$(PROFILE)\n" >$(1)/etc/build.config; \
-               cat $(BIN_DIR)/config.seed >>$(1)/etc/build.config)
+               cat $(BIN_DIR)/config.buildinfo >>$(1)/etc/build.config)
 
        $(if $(CONFIG_CLEAN_IPKG),, \
                mkdir -p $(1)/etc/opkg; \