Refactor handling of the version string
Hello All!
This patchset computes a universally-available version string for packages to use.
The so-available version string contains the current buildroot version, and if the local buildroot tree is a git clone, then a git signature is appended.
Converted users:
- menuconfig, to show the version in the main title, and save the version string in the commented headers of .config
- /etc/br-version on the target
- toolchains will push that version string in the gcc pkg-version
[PATCH 1/8] Makefile: move .NOTPARALLEL
[PATCH 2/8] Makefile: move version string from Config.in into Makefile [PATCH 3/8] package/config: update quilt series
[PATCH 4/8] Makefile: compute the version string for all to use
[PATCH 5/8] Makefile: use global version string in /etc/br-version [PATCH 6/8] config: use global version string
[PATCH 7/8] toolchain/internal: use global BR2 version string for gcc version string [PATCH 8/8] toolchain/crosstool-ng: use global BR2 version string
Regards,
Yann E. MORIN.
PATCH 1/8 Makefile: move .NOTPARALLEL
Move it down, users should not mess with it.
--- Makefile | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-)
Makefile +4 -3
@@ -18,13 +18,14 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -# This top-level Makefile can *not* be executed in parallel -.NOTPARALLEL: - #-------------------------------------------------------------- # Just run 'make menuconfig', configure stuff, then run 'make'. # You shouldn't need to mess with anything beyond this point... #-------------------------------------------------------------- + +# This top-level Makefile can *not* be executed in parallel +.NOTPARALLEL: + # absolute path TOPDIR:=$(shell pwd) CONFIG_CONFIG_IN=Config.in
Signature · 1 line
1.7.1
PATCH 2/8 Makefile: move version string from Config.in into Makefile
In reply to Yann E. MORINThis re-instates writing the version string in .config headers, and no longer provides it as a kconfig symbol in .config (it is now a variable in the Makefile, and in the environment).
We use the full version string, that contains the local signature.
--- Config.in | 2 +- Makefile | 8 +++++--- package/config/confdata.c | 4 ++++ .../patches/01-kconfig-kernel-to-buildroot.patch | 12 ++++++------ 4 files changed, 16 insertions(+), 10 deletions(-)
Config.in +1 -1
@@ -8,7 +8,7 @@ config BR2_HAVE_DOT_CONFIG config BR2_VERSION string - default "2010.11-git" + option env="BR2_VERSION" source "target/Config.in.arch" source "target/device/Config.in"
Makefile +5 -3
@@ -23,6 +23,9 @@ # You shouldn't need to mess with anything beyond this point... #-------------------------------------------------------------- +# Set and export the version string +export BR2_VERSION:=2010.11-git + # This top-level Makefile can *not* be executed in parallel .NOTPARALLEL:
@@ -631,9 +634,8 @@ help: @echo 'See docs/README and docs/buildroot.html for further details' @echo -release: - OUT=buildroot-$$(grep -A2 BR2_VERSION $(CONFIG_CONFIG_IN)|grep default|cut -f2 -d\"); \ - git archive --format=tar --prefix=$$OUT/ master|gzip -9 >$$OUT.tar.gz +release: OUT=buildroot-$(BR2_VERSION) + git archive --format=tar --prefix=$(OUT)/ master|gzip -9 >$(OUT).tar.gz .PHONY: $(noconfig_targets)
package/config/confdata.c +4 -0
@@ -586,8 +586,10 @@ int conf_write(const char *name)fprintf (out,_ ("#\n" "# Automatically generated make config: don't edit\n" +"# Buildroot version: %s\n" "%s%s" "#\n" ), +sym_get_string_value (sym), use_timestamp ?"# " :"" , use_timestamp ?ctime (&now) :"" );
@@ -831,8 +833,10 @@ int conf_write_autoconf(void)time (&now);fprintf (out,"#\n" "# Automatically generated make config: don't edit\n" +"# Buildroot version: %s\n" "# %s" "#\n" , +sym_get_string_value (sym),ctime (&now));fprintf (tristate,"#\n" "# Automatically generated - do not edit\n"
package/config/patches/01-kconfig-kernel-to-buildroot.patch +6 -6
@@ -69,18 +69,16 @@ Index: config/confdata.c sym_calc_value(sym); time(&now); env = getenv("KCONFIG_NOTIMESTAMP"); -@@ -588,10 +588,8 @@ +@@ -588,7 +588,7 @@ fprintf(out, _("#\n" "# Automatically generated make config: don't edit\n" - "# Linux kernel version: %s\n" ++ "# Buildroot version: %s\n" "%s%s" "#\n"), -- sym_get_string_value(sym), - use_timestamp ? "# " : "", - use_timestamp ? ctime(&now) : ""); - -@@ -802,25 +800,23 @@ + sym_get_string_value(sym), +@@ -802,25 +802,25 @@ return 1; }
@@ -91,9 +89,11 @@ Index: config/confdata.c fprintf(out, "#\n" "# Automatically generated make config: don't edit\n" - "# Linux kernel version: %s\n" ++ "# Buildroot version: %s\n" "# %s" "#\n", - sym_get_string_value(sym), ctime(&now)); ++ sym_get_string_value(sym), + ctime(&now)); fprintf(tristate, "#\n" "# Automatically generated - do not edit\n"
Signature · 1 line
1.7.1
PATCH 2/8 Makefile: move version string from Config.in into Makefile
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Yann" == Yann E MORIN <[email protected]> writes:
Yann> This re-instates writing the version string in .config headers, and no Yann> longer provides it as a kconfig symbol in .config (it is now a variable Yann> in the Makefile, and in the environment).
Yann> We use the full version string, that contains the local signature.
No, that is only added in 4/8.
Signature · 1 line
Bye, Peter Korsgaard
PATCH 3/8 package/config: update quilt series
In reply to Yann E. MORINUpdate the patches so they apply without offset
--- .../patches/03-change-config-option-prefix.patch | 10 +++++----- .../patches/09-implement-kconfig-probability.patch | 4 ++-- .../patches/14-support-out-of-tree-config.patch | 12 ++++++------ 3 files changed, 13 insertions(+), 13 deletions(-)
package/config/patches/03-change-config-option-prefix.patch +5 -5
@@ -2,10 +2,10 @@ confdata.c | 49 +++++++++++++++++++++++-------------------------- 1 file changed, 23 insertions(+), 26 deletions(-) -Index: config.new/confdata.c +Index: config/confdata.c =================================================================== ---- config.new.orig/confdata.c -+++ config.new/confdata.c +--- config.orig/confdata.c ++++ config/confdata.c @@ -11,6 +11,7 @@ #include <string.h> #include <time.h>
@@ -128,7 +128,7 @@ Index: config.new/confdata.c break; case S_OTHER: case S_UNKNOWN: -@@ -834,14 +831,14 @@ +@@ -838,14 +835,14 @@ case no: break; case mod:
@@ -147,7 +147,7 @@ Index: config.new/confdata.c break; } break; -@@ -851,12 +848,12 @@ +@@ -855,12 +852,12 @@ case S_HEX: str = sym_get_string_value(sym); if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) {
package/config/patches/09-implement-kconfig-probability.patch +2 -2
@@ -6,7 +6,7 @@ Index: config/confdata.c =================================================================== --- config.orig/confdata.c +++ config/confdata.c -@@ -977,7 +977,16 @@ +@@ -981,7 +981,16 @@ void conf_set_all_new_symbols(enum conf_def_mode mode) { struct symbol *sym, *csym;
@@ -24,7 +24,7 @@ Index: config/confdata.c for_all_symbols(i, sym) { if (sym_has_value(sym)) -@@ -996,8 +1005,15 @@ +@@ -1000,8 +1009,15 @@ sym->def[S_DEF_USER].tri = no; break; case def_random:
package/config/patches/14-support-out-of-tree-config.patch +6 -6
@@ -41,7 +41,7 @@ Index: config/confdata.c dirname[0] = 0; if (name && name[0]) { struct stat st; -@@ -656,6 +657,7 @@ +@@ -658,6 +659,7 @@ { const char *name; char path[128];
@@ -49,7 +49,7 @@ Index: config/confdata.c char *s, *d, c; struct symbol *sym; struct stat sb; -@@ -664,8 +666,20 @@ +@@ -666,8 +668,20 @@ name = conf_get_autoconfig_name(); conf_read_simple(name, S_DEF_AUTO);
@@ -72,7 +72,7 @@ Index: config/confdata.c res = 0; for_all_symbols(i, sym) { -@@ -758,9 +772,11 @@ +@@ -760,9 +774,11 @@ close(fd); } out:
@@ -87,7 +87,7 @@ Index: config/confdata.c return res; } -@@ -772,25 +788,38 @@ +@@ -774,25 +790,38 @@ FILE *out, *tristate, *out_h; time_t now; int i;
@@ -130,7 +130,7 @@ Index: config/confdata.c if (!out_h) { fclose(out); fclose(tristate); -@@ -811,8 +840,7 @@ +@@ -815,8 +844,7 @@ fprintf(out_h, "/*\n" " * Automatically generated C config: don't edit\n" " * %s"
@@ -140,7 +140,7 @@ Index: config/confdata.c ctime(&now)); for_all_symbols(i, sym) { -@@ -866,19 +894,22 @@ +@@ -870,19 +898,22 @@ name = getenv("KCONFIG_AUTOHEADER"); if (!name) name = "include/generated/autoconf.h";
Signature · 1 line
1.7.1
PATCH 4/8 Makefile: compute the version string for all to use
In reply to Yann E. MORINSome packages use the buildroot version string (to set thier own version string). Computing the version string globally will makes it easy for them to use it instead of re-computing it in every packages.
--- Makefile | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
Makefile +4 -0
@@ -35,6 +35,10 @@ CONFIG_CONFIG_IN=Config.in CONFIG=package/config DATE:=$(shell date +%Y%m%d) +# Compute the full local version string so packages can use it as-is +# Need to export it, so it can be got from environment in children (eg. mconf) +export BR2_VERSION_FULL:=$(BR2_VERSION)$(shell $(TOPDIR)/scripts/setlocalversion) + noconfig_targets:=menuconfig nconfig gconfig xconfig config oldconfig randconfig \ defconfig %_defconfig savedefconfig allyesconfig allnoconfig silentoldconfig release \ randpackageconfig allyespackageconfig allnopackageconfig \
Signature · 1 line
1.7.1
PATCH 5/8 Makefile: use global version string in /etc/br-version
In reply to Yann E. MORIN--- Makefile | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
Makefile +1 -2
@@ -413,8 +413,7 @@ endif else \ /sbin/ldconfig -r $(TARGET_DIR); \ fi - echo $(BR2_VERSION)$(shell $(TOPDIR)/scripts/setlocalversion) > \ - $(TARGET_DIR)/etc/br-version + echo $(BR2_VERSION_FULL) > $(TARGET_DIR)/etc/br-version ifneq ($(BR2_ROOTFS_POST_BUILD_SCRIPT),"") $(BR2_ROOTFS_POST_BUILD_SCRIPT) $(TARGET_DIR)
Signature · 1 line
1.7.1
PATCH 6/8 config: use global version string
In reply to Yann E. MORIN--- Config.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Config.in +1 -1
@@ -8,7 +8,7 @@ config BR2_HAVE_DOT_CONFIG config BR2_VERSION string - option env="BR2_VERSION" + option env="BR2_VERSION_FULL" source "target/Config.in.arch" source "target/device/Config.in"
Signature · 1 line
1.7.1
PATCH 7/8 toolchain/internal: use global BR2 version string for gcc version string
In reply to Yann E. MORIN--- toolchain/gcc/gcc-uclibc-4.x.mk | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
toolchain/gcc/gcc-uclibc-4.x.mk +1 -2
@@ -39,8 +39,7 @@ GCC_SRC_DIR:=$(GCC_DIR) # Branding works on >= 4.3 ifneq ($(findstring x4.2.,x$(GCC_VERSION)),x4.2.) -BUILDROOT_VERSION_STRING=$(call qstrip,$(BR2_VERSION)) -EXTRA_GCC_CONFIG_OPTIONS+=--with-pkgversion="Buildroot $(BUILDROOT_VERSION_STRING)" \ +EXTRA_GCC_CONFIG_OPTIONS+=--with-pkgversion="Buildroot $(BR2_VERSION_FULL)" \ --with-bugurl="http://bugs.buildroot.net/" endif
Signature · 1 line
1.7.1
PATCH 8/8 toolchain/crosstool-ng: use global BR2 version string
In reply to Yann E. MORIN--- toolchain/toolchain-crosstool-ng/crosstool-ng.mk | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
toolchain/toolchain-crosstool-ng/crosstool-ng.mk +1 -1
@@ -161,7 +161,7 @@ CTNG_FIX_DOT_CONFIG_SED += s:^\# (CT_ARCH_$(CTNG_BIT)) is not set:\1=y:; CTNG_FIX_DOT_CONFIG_SED += s:^\# (CT_ARCH_USE_MMU) is not set:\1=y:; CTNG_FIX_DOT_CONFIG_SED += s:^(CT_TARGET_VENDOR)=.*:\1="buildroot_ctng":; CTNG_FIX_DOT_CONFIG_SED += s:^(CT_TARGET_ALIAS)=.*:\1="$(REAL_GNU_TARGET_NAME)":; -CTNG_FIX_DOT_CONFIG_SED += s:^(CT_CC_PKGVERSION)="(.*)":\1="crosstool-NG $(CTNG_VERSION) - buildroot $(call qstrip,$(BR2_VERSION))":; +CTNG_FIX_DOT_CONFIG_SED += s:^(CT_CC_PKGVERSION)="(.*)":\1="crosstool-NG $(CTNG_VERSION) - buildroot $(BR2_VERSION_FULL)":; ifneq ($(call qstrip,$(BR2_PACKAGE_GDB_SERVER))$(call qstrip,$(BR2_PACKAGE_GDB_HOST)),) CTNG_FIX_DOT_CONFIG_SED += s:^(CT_DEBUG_gdb)=.*:\# \1 is not set:; endif
Signature · 1 line
1.7.1
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Yann" == Yann E MORIN <[email protected]> writes:
Yann> Hello All!
Yann> This patchset computes a universally-available version string for Yann> packages to use.
Committed, thanks! (with minor changes).
Signature · 1 line
Bye, Peter Korsgaard