From b6b9a770a329ddc7dc5db284081d08d766112424 Mon Sep 17 00:00:00 2001 From: Aire-One Date: Sat, 22 Jan 2022 12:14:39 +0100 Subject: [PATCH 1/8] add(gh-actions) Lua 5.4 matrix --- .github/workflows/main.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 603eaf2b..562a62cd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,6 +28,12 @@ jobs: fail-fast: false matrix: include: + - test_name: "lua5.4" + lua_version: "5.4" + lua_name: "lua5.4" + lua_include: "/usr/local/include" + manual_screens: true + - test_name: "codecov-lua5.3" lua_version: "5.3" lua_name: "lua5.3" From 50c3301357b3e589490b4423754898380c53be70 Mon Sep 17 00:00:00 2001 From: Aire-One Date: Sat, 22 Jan 2022 13:22:07 +0100 Subject: [PATCH 2/8] add(gh-actions) Build and Install Lua 5.4 step Ubuntu 20.04 hasn't a Lua 5.4 package. For now, GitHub actions run with this version of Ubuntu. We can manually build and install Lua 5.4 in the pipeline, waiting for GitHub to release a newer version of Ubuntu for their Actions. --- .github/workflows/main.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 562a62cd..17ad1e41 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -142,12 +142,24 @@ jobs: run: sudo dpkg -i /var/cache/apt/archives/*.deb - name: Install Lua packages + if: matrix.lua_version != '5.4' run: | if [ "${{ matrix.lua_name }}" = "luajit" ]; then sudo apt-get install libluajit-5.1-dev luajit fi sudo apt-get install liblua${{ matrix.lua_version }}-dev lua${{ matrix.lua_version }} + # Ubuntu 20.04 hasn't a package for Lua 5.4, we need to build it from source. + - name: Build and Install Lua 5.4 + if: matrix.lua_version == '5.4' + run: | + wget -O /tmp/lua-5.4.3.tar.gz http://www.lua.org/ftp/lua-5.4.3.tar.gz + tar -xf /tmp/lua-5.4.3.tar.gz -C /tmp + cd /tmp/lua-5.4.3 + make all + make test + sudo make install + - name: Cache luarocks id: cache-luarocks uses: actions/cache@v2 From a4ca3fdd4346a08b89a09734c75d1ff7647cdce7 Mon Sep 17 00:00:00 2001 From: Aire-One Date: Sat, 22 Jan 2022 14:32:12 +0100 Subject: [PATCH 3/8] add(gh-actions) Lua5.4 Build and Install LGI step The latest packaged version of LGI doesn't support Lua 5.4. We need to build the git master version. --- .github/workflows/main.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 17ad1e41..abce4894 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -207,9 +207,21 @@ jobs: cd /tmp/xcb-errors sudo make install + # Only LGI git master supports Lua 5.4. We need to build it from source. + - name: Build and Install LGI + if: matrix.lua_version == '5.4' + run: | + wget -O /tmp/lgi.zip https://github.com/pavouk/lgi/archive/refs/heads/master.zip + unzip /tmp/lgi.zip -d /tmp + cd /tmp/lgi-master + make all + sudo make install + - name: Install rocks run: | - sudo -H luarocks install lgi ${{ matrix.lgi_version }} + if [ "${{ matrix.lua_name }}" != "lua5.4" ]; then + sudo -H luarocks install lgi ${{ matrix.lgi_version }} + fi sudo -H luarocks install ldoc sudo -H luarocks install busted From a826d79682ef2711a57a10fa6105d0f2b1a4f1cc Mon Sep 17 00:00:00 2001 From: Aire-One Date: Sat, 22 Jan 2022 14:18:05 +0100 Subject: [PATCH 4/8] bump(gh-actions) luarocks 3.8.0 Luarocks have some fixes to support Lua 5.4. We need to use the latest version. --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index abce4894..533e8ac4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -166,12 +166,12 @@ jobs: with: path: /tmp/luarocks # The build input for luarocks changes per test, so we need separate caches - key: ${{ github.workflow }}-${{ runner.os }}-${{ matrix.test_name }}-luarocks-3.5.0 + key: ${{ github.workflow }}-${{ runner.os }}-${{ matrix.test_name }}-luarocks-3.8.0 - name: Install fresh Luarocks if: steps.cache-luarocks.outputs.cache-hit != 'true' run: | - wget -O /tmp/luarocks.tar.gz https://github.com/luarocks/luarocks/archive/v3.5.0.tar.gz + wget -O /tmp/luarocks.tar.gz https://github.com/luarocks/luarocks/archive/v3.8.0.tar.gz mkdir /tmp/luarocks tar -xf /tmp/luarocks.tar.gz -C /tmp/luarocks --strip-components=1 cd /tmp/luarocks From 12262322c4a35af6ff807f3353a06188620569bc Mon Sep 17 00:00:00 2001 From: Aire-One Date: Sat, 22 Jan 2022 16:09:10 +0100 Subject: [PATCH 5/8] chore: Allow Lua 5.4 to build and run Co-authored-by: Emmanuel Lepage Vallee --- awesomeConfig.cmake | 6 +++--- luaa.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/awesomeConfig.cmake b/awesomeConfig.cmake index 5f292aaa..592c2b25 100644 --- a/awesomeConfig.cmake +++ b/awesomeConfig.cmake @@ -73,9 +73,9 @@ if (NOT LUA_FOUND) endif() set(LUA_FULL_VERSION "${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}.${LUA_VERSION_PATCH}") -# 5.1 <= LUA_VERSION < 5.4 -if(NOT ((LUA_FULL_VERSION VERSION_EQUAL 5.1.0 OR LUA_FULL_VERSION VERSION_GREATER 5.1.0) AND LUA_FULL_VERSION VERSION_LESS 5.4.0)) - message(FATAL_ERROR "Awesome only supports Lua versions 5.1-5.3, please refer to" +# 5.1 <= LUA_VERSION < 5.5 +if(NOT ((LUA_FULL_VERSION VERSION_EQUAL 5.1.0 OR LUA_FULL_VERSION VERSION_GREATER 5.1.0) AND LUA_FULL_VERSION VERSION_LESS 5.5.0)) + message(FATAL_ERROR "Awesome only supports Lua versions 5.1-5.4, please refer to" "https://awesomewm.org/apidoc/documentation/10-building-and-testing.md.html#Building") endif() diff --git a/luaa.h b/luaa.h index fae07270..04e28342 100644 --- a/luaa.h +++ b/luaa.h @@ -31,8 +31,8 @@ #include "common/lualib.h" #include "common/luaclass.h" -#if !(501 <= LUA_VERSION_NUM && LUA_VERSION_NUM < 504) -#error "Awesome only supports Lua versions 5.1-5.3 and LuaJIT2, please refer to https://awesomewm.org/apidoc/documentation/10-building-and-testing.md.html#Building" +#if !(501 <= LUA_VERSION_NUM && LUA_VERSION_NUM < 505) +#error "Awesome only supports Lua versions 5.1-5.4 and LuaJIT2, please refer to https://awesomewm.org/apidoc/documentation/10-building-and-testing.md.html#Building" #endif #define luaA_deprecate(L, repl) \ From c330413c21d6fd39c497bfb689ed705f7913dd36 Mon Sep 17 00:00:00 2001 From: Aire-One Date: Sat, 22 Jan 2022 16:38:14 +0100 Subject: [PATCH 6/8] fix(gh-actions) Lua 5.4 lib --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 533e8ac4..9d21b320 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -31,6 +31,7 @@ jobs: - test_name: "lua5.4" lua_version: "5.4" lua_name: "lua5.4" + lua_library: "/usr/local/lib/liblua.a" lua_include: "/usr/local/include" manual_screens: true From d0b9938da122292fd85db51a2a7468c3ee710699 Mon Sep 17 00:00:00 2001 From: Aire-One Date: Sat, 22 Jan 2022 17:21:39 +0100 Subject: [PATCH 7/8] fix(gh-actions) LGI install to Lua 5.4 location --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9d21b320..39ad3cdd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -215,6 +215,7 @@ jobs: wget -O /tmp/lgi.zip https://github.com/pavouk/lgi/archive/refs/heads/master.zip unzip /tmp/lgi.zip -d /tmp cd /tmp/lgi-master + sed -i 's/5.1/5.4/' lgi/Makefile make all sudo make install From b807bbae5603526257db4127da1b1761c9eb8763 Mon Sep 17 00:00:00 2001 From: Aire-One Date: Sat, 22 Jan 2022 17:31:53 +0100 Subject: [PATCH 8/8] fix(awesome) randomness Close #3123, close #3124 Co-authored-by: Emmanuel Lepage Vallee --- awesome.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/awesome.c b/awesome.c index 24ee52d8..570a4d3a 100644 --- a/awesome.c +++ b/awesome.c @@ -84,10 +84,16 @@ init_rng(void) lua_getfield(L, -1, "randomseed"); /* Push a seed */ - lua_pushnumber(L, g_random_int() + g_random_double()); + lua_pushnumber(L, g_random_int()); /* Call math.randomseed */ - lua_call(L, 1, 0); + if(lua_pcall(L, 1, 0, 0)) + { + warn("Random number generator initialization failed: %s", lua_tostring(L, -1)); + /* Remove error function and error string */ + lua_pop(L, 2); + return; + } /* Remove "math" global */ lua_pop(L, 1);