boot/uboot: add a setlocalversion rsync hook when overriding srcdir
PATCH 1/2 boot/uboot: add a setlocalversion rsync hook when overriding srcdir
From: Charles Hardin <[email protected]>
During development the override srcdir is often used with a local git repo and branch. To help track the builds used in those flows it is useful to have the scm version available as part of the info. With this hook, the auto generated version include will include the example.
#define PLAIN_VERSION "2018.03-01358-gbda75d6a8b"
#define U_BOOT_VERSION "U-Boot " PLAIN_VERSION--- boot/uboot/uboot.mk | 12 ++++++++++++ 1 file changed, 12 insertions(+)
boot/uboot/uboot.mk +12 -0
@@ -40,6 +40,18 @@ UBOOT_SITE = https://ftp.denx.de/pub/u-boot UBOOT_SOURCE = u-boot-$(UBOOT_VERSION).tar.bz2 endif +ifneq ($(UBOOT_OVERRIDE_SRCDIR),) +define UBOOT_OVERRIDE_SRCDIR_SETLOCALVERSION + (cd $(@D); \ + if [ -x ./scripts/setlocalversion ]; then \ + ./scripts/setlocalversion --save-scmversion \ + $(abspath $(UBOOT_OVERRIDE_SRCDIR)) ||:; \ + fi) +endef + +UBOOT_POST_RSYNC_HOOKS += UBOOT_OVERRIDE_SRCDIR_SETLOCALVERSION +endif + ifeq ($(BR2_TARGET_UBOOT)$(BR2_TARGET_UBOOT_LATEST_VERSION),y) BR_NO_CHECK_HASH_FOR += $(UBOOT_SOURCE) endif
Signature · 6 lines
2.37.1 (Apple Git-137.1) _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 1/2 linux: create a scmversion file based on the custom repo variables
From: Charles Hardin <[email protected]>
When using the custom repositories, the archive creation will omit the source history to get reproducible hashes. This has the side effect of making the setlocalversion scripts within the builds to not create the tracking information as expected. So, just generate a .scmversion so that kernels will be labelled with where buildroot referenced them.
For example (line wrapped)
#define UTS_RELEASE "5.4.70-repo-version-" \
"92c23d10d0031e0a13244a1a97e7530d3b53fc6e"--- linux/linux.mk | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
linux/linux.mk +14 -0
@@ -596,6 +596,20 @@ endif ifeq ($(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_REPO_URL)),) $(error No custom repo URL set. Check your BR2_LINUX_KERNEL_CUSTOM_REPO_URL setting) endif + +# Create a custom scm version file to reflect the source version since the +# archive will omit source directories like .git to maintain reproducible +# hashes for the archives +LINUX_CUSTOM_REPO_SCMVERSION = \ + "-repo-version-$(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION))" +define LINUX_CUSTOM_REPO_SCMVERSION_HOOK + (cd $(@D); \ + if [ ! -f .scmversion ]; then \ + echo $(LINUX_CUSTOM_REPO_SCMVERSION) > .scmversion; \ + fi) +endef + +LINUX_POST_EXTRACT_HOOKS += LINUX_CUSTOM_REPO_SCMVERSION_HOOK endif ifeq ($(BR_BUILDING),y)
Signature · 6 lines
2.37.1 (Apple Git-137.1) _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 2/2 boot/uboot: create a scmversion file based on the custom repo variables
In reply to Charles HardinFrom: Charles Hardin <[email protected]>
When using the custom repositories, the archive creation will omit the source history to get reproducible hashes. This has the side effect of making the setlocalversion scripts within the builds to not create the tracking information as expected. So, just generate a .scmversion so that kernels will be labelled with where buildroot referenced them.
Example (line wrapped)
#define PLAIN_VERSION "2018.03-repo-version-" \
"d72b9d0908364a64718b652b75e4cac9b85cf0c3"--- boot/uboot/uboot.mk | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
boot/uboot/uboot.mk +15 -2
@@ -526,12 +526,25 @@ endif # BR2_TARGET_UBOOT_CUSTOM_TARBALL ifeq ($(BR2_TARGET_UBOOT_CUSTOM_GIT)$(BR2_TARGET_UBOOT_CUSTOM_HG),y) ifeq ($(call qstrip,$(BR2_TARGET_UBOOT_CUSTOM_REPO_URL)),) $(error No custom U-Boot repository URL specified. Check your BR2_TARGET_UBOOT_CUSTOM_REPO_URL setting) -endif # qstrip BR2_TARGET_UBOOT_CUSTOM_CUSTOM_REPO_URL +endif # qstrip BR2_TARGET_UBOOT_CUSTOM_REPO_URL ifeq ($(call qstrip,$(BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION)),) $(error No custom U-Boot repository version specified. Check your BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION setting) -endif # qstrip BR2_TARGET_UBOOT_CUSTOM_CUSTOM_REPO_VERSION +endif # qstrip BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION endif # BR2_TARGET_UBOOT_CUSTOM_GIT || BR2_TARGET_UBOOT_CUSTOM_HG +# Create a custom scm version file to reflect the source version since the +# archive will omit source directories like .git to maintain reproducible +# hashes for the archives +UBOOT_CUSTOM_REPO_SCMVERSION = \ + "-repo-version-$(call qstrip,$(BR2_UBOOT_CUSTOM_REPO_VERSION))" +define UBOOT_CUSTOM_REPO_SCMVERSION_HOOK + (cd $(@D); \ + if [ ! -f .scmversion ]; then \ + echo $(UBOOT_CUSTOM_REPO_SCMVERSION) > .scmversion; \ + fi) +endef + +UBOOT_POST_EXTRACT_HOOKS += UBOOT_CUSTOM_REPO_SCMVERSION_HOOK endif # BR2_TARGET_UBOOT && BR_BUILDING ifeq ($(BR2_TARGET_UBOOT_BUILD_SYSTEM_LEGACY),y)
Signature · 6 lines
2.37.1 (Apple Git-137.1) _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 2/2 linux: add a setlocalversion rsync hook when overriding srcdir
In reply to Charles HardinFrom: Charles Hardin <[email protected]>
During development the override srcdir is often used with a local git repo and branch. To help track the builds used in those flows it is useful to have the scm version available as part of the info. With this hook, the auto generated version include will include the example.
#define UTS_RELEASE "5.4.70-00031-g92c23d10d003"
--- linux/linux.mk | 12 ++++++++++++ 1 file changed, 12 insertions(+)
linux/linux.mk +12 -0
@@ -46,6 +46,18 @@ LINUX_SITE = $(BR2_KERNEL_MIRROR)/linux/kernel/v$(firstword $(subst ., ,$(LINUX_ endif endif +ifneq ($(LINUX_OVERRIDE_SRCDIR),) +define LINUX_OVERRIDE_SRCDIR_SETLOCALVERSION + (cd $(@D); \ + if [ -x ./scripts/setlocalversion ]; then \ + ./scripts/setlocalversion --save-scmversion \ + $(abspath $(LINUX_OVERRIDE_SRCDIR)) ||:; \ + fi) +endef + +LINUX_POST_RSYNC_HOOKS += LINUX_OVERRIDE_SRCDIR_SETLOCALVERSION +endif + ifeq ($(BR2_LINUX_KERNEL)$(BR2_LINUX_KERNEL_LATEST_VERSION),y) BR_NO_CHECK_HASH_FOR += $(LINUX_SOURCE) endif
Signature · 6 lines
2.37.1 (Apple Git-137.1) _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot