Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Apr 2023 17:59:47 GMT
From:      "Stephen J. Kiernan" <stevek@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: a50d73d5782a - main - loader: Change version calculation to be more consistent.
Message-ID:  <202304191759.33JHxlGe038548@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by stevek:

URL: https://cgit.FreeBSD.org/src/commit/?id=a50d73d5782a351ad83e8d1f84d11720a12e70d3

commit a50d73d5782a351ad83e8d1f84d11720a12e70d3
Author:     Stephen J. Kiernan <stevek@FreeBSD.org>
AuthorDate: 2023-04-17 23:27:54 +0000
Commit:     Stephen J. Kiernan <stevek@FreeBSD.org>
CommitDate: 2023-04-19 17:58:53 +0000

    loader: Change version calculation to be more consistent.
    
    Use 1000 * major + minor when calculating the version number that
    gets set in the Ficl environment or lua loader property. This allows
    for more room if the minor number needs to go above 9.
    
    Add loader.version property to lua loader.
    
    Reviewed by:    imp
    Obtained from:  Juniper Networks, Inc.
    Differential Revision: https://reviews.freebsd.org/D39631
---
 stand/common/bootstrap.h    | 1 +
 stand/common/interp_forth.c | 1 -
 stand/common/newvers.sh     | 2 +-
 stand/liblua/lutils.c       | 2 ++
 4 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/stand/common/bootstrap.h b/stand/common/bootstrap.h
index 80c1a2352b3c..d62a936e6ff0 100644
--- a/stand/common/bootstrap.h
+++ b/stand/common/bootstrap.h
@@ -182,6 +182,7 @@ extern int isapnp_readport;
  * Version information
  */
 extern char bootprog_info[];
+extern unsigned bootprog_rev;
 
 /*
  * Interpreter information
diff --git a/stand/common/interp_forth.c b/stand/common/interp_forth.c
index 19f1c75dc191..edf21e53dc18 100644
--- a/stand/common/interp_forth.c
+++ b/stand/common/interp_forth.c
@@ -33,7 +33,6 @@ __FBSDID("$FreeBSD$");
 #include "bootstrap.h"
 #include "ficl.h"
 
-extern unsigned bootprog_rev;
 INTERP_DEFINE("4th");
 
 /* #define BFORTH_DEBUG */
diff --git a/stand/common/newvers.sh b/stand/common/newvers.sh
index 714adba6c9cb..1a3ceb91af17 100755
--- a/stand/common/newvers.sh
+++ b/stand/common/newvers.sh
@@ -57,6 +57,6 @@ fi
 
 cat > $tempfile <<EOF
 char bootprog_info[] = "$bootprog_info";
-unsigned bootprog_rev = ${r%%.*}${r##*.};
+unsigned bootprog_rev = ${r%%.*} * 1000 + ${r##*.};
 EOF
 mv $tempfile vers.c
diff --git a/stand/liblua/lutils.c b/stand/liblua/lutils.c
index 1649ac9fd508..8ae77b523270 100644
--- a/stand/liblua/lutils.c
+++ b/stand/liblua/lutils.c
@@ -593,6 +593,8 @@ luaopen_loader(lua_State *L)
 	lua_setfield(L, -2, "machine_arch");
 	lua_pushstring(L, LUA_PATH);
 	lua_setfield(L, -2, "lua_path");
+	lua_pushinteger(L, bootprog_rev);
+	lua_setfield(L, -2, "version");
 	/* Set global printc to loader.printc */
 	lua_register(L, "printc", lua_printc);
 	return 1;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202304191759.33JHxlGe038548>