From 3995e1daab77066680aa4cc7e4515dcf0e2c12f1 Mon Sep 17 00:00:00 2001 From: Hajime Tazaki Date: Thu, 26 Dec 2024 14:25:47 +0900 Subject: [PATCH 1/3] lkl: fix windows build on pip installation recent pip (version 23.0 or later) cannot install packages to a host system without explicit option thus, failed under github actions. This commit fixes this issue. Link: https://github.com/pypa/pip/issues/11381 Signed-off-by: Hajime Tazaki --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 817fd82c23eaff..2b5114ca55ac05 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,6 +25,7 @@ jobs: - displayTargetName: windows-2019 os: windows runs_on: windows-2019 + pip_option: --break-system-packages shell: msys2 {0} - displayTargetName: clang-build os: unix @@ -58,7 +59,7 @@ jobs: echo "/usr/lib/ccache/bin:/usr/lib/ccache:/mingw64/bin:${{ github.workspace }}/bin" >> $GITHUB_PATH echo "export PATH=/usr/lib/ccache/bin:/usr/lib/ccache:/mingw64/bin:${{ github.workspace }}/bin:$PATH" >> $HOME/.bashrc - - uses: msys2/setup-msys2@v2 + - uses: msys2/setup-msys2@v2.26.0 if: runner.os == 'Windows' with: msystem: MSYS @@ -77,7 +78,7 @@ jobs: if: runner.os == 'Linux' uses: actions/checkout@v4 - name: Install pip dependencies - run: pip install yamlish junit-xml + run: pip install ${{ matrix.pip_option }} yamlish junit-xml - name: Install openvpn if: runner.os == 'Windows' shell: pwsh From 9ea6634d723dbe9e054e7358493f8c158a1d178d Mon Sep 17 00:00:00 2001 From: Hajime Tazaki Date: Thu, 26 Dec 2024 16:53:39 +0900 Subject: [PATCH 2/3] lkl: fix python warnings on escape sequence This commit fixes the warnings (i.e., SyntaxWarning: invalid escape sequence) shown in later python version (after 3.12) during installation process of header files. Signed-off-by: Hajime Tazaki --- arch/lkl/scripts/headers_install.py | 30 ++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/arch/lkl/scripts/headers_install.py b/arch/lkl/scripts/headers_install.py index 6c9ff82bff2e9d..2c8a5b8d9e5811 100755 --- a/arch/lkl/scripts/headers_install.py +++ b/arch/lkl/scripts/headers_install.py @@ -63,11 +63,11 @@ def find_ml_symbols(regexp, store): def find_enums(block_regexp, symbol_regexp, store): for h in headers: # remove comments - content = re.sub(re.compile("(\/\*(\*(?!\/)|[^*])*\*\/)", re.S|re.M), " ", open(h).read()) + content = re.sub(re.compile(r"(\/\*(\*(?!\/)|[^*])*\*\/)", re.S|re.M), " ", open(h).read()) # remove preprocesor lines clean_content = "" for l in content.split("\n"): - if re.match("\s*#", l): + if re.match(r"\s*#", l): continue clean_content += l + "\n" for i in block_regexp.finditer(clean_content): @@ -103,11 +103,11 @@ def lkl_prefix(w): def replace(h): content = open(h).read() for i in includes: - search_str = "(#[ \t]*include[ \t]*[<\"][ \t]*)" + i + "([ \t]*[>\"])" + search_str = r"(#[ \t]*include[ \t]*[<\"][ \t]*)" + i + r"([ \t]*[>\"])" replace_str = "\\1" + "lkl/" + i + "\\2" content = re.sub(search_str, replace_str, content) tmp = "" - for w in re.split("(\W+)", content): + for w in re.split(r"(\W+)", content): if w in defines: w = lkl_prefix(w) tmp += w @@ -116,11 +116,11 @@ def replace(h): # XXX: cleaner way? if s == 'TAG': continue - search_str = "(\W?struct\s+)" + s + "(\W)" + search_str = r"(\W?struct\s+)" + s + r"(\W)" replace_str = "\\1" + lkl_prefix(s) + "\\2" content = re.sub(search_str, replace_str, content, flags = re.MULTILINE) for s in unions: - search_str = "(\W?union\s+)" + s + "(\W)" + search_str = r"(\W?union\s+)" + s + r"(\W)" replace_str = "\\1" + lkl_prefix(s) + "\\2" content = re.sub(search_str, replace_str, content, flags = re.MULTILINE) open(h, 'w').write(content) @@ -162,25 +162,25 @@ def replace(h): structs = set() unions = set() -p = re.compile("#[ \t]*define[ \t]*(\w+)") +p = re.compile(r"#[ \t]*define[ \t]*(\w+)") find_symbols(p, defines) -p = re.compile("typedef.*(\(\*(\w+)\)\(.*\)\s*|\W+(\w+)\s*|\s+(\w+)\(.*\)\s*);") +p = re.compile(r"typedef.*(\(\*(\w+)\)\(.*\)\s*|\W+(\w+)\s*|\s+(\w+)\(.*\)\s*);") find_symbols(p, defines) -p = re.compile("typedef\s+(struct|union)\s+\w*\s*{[^\\{\}]*}\W*(\w+)\s*;", re.M|re.S) +p = re.compile(r"typedef\s+(struct|union)\s+\w*\s*{[^\\{\}]*}\W*(\w+)\s*;", re.M|re.S) find_ml_symbols(p, defines) defines.add("siginfo_t") defines.add("sigevent_t") -p = re.compile("struct\s+(\w+)\s*\{") +p = re.compile(r"struct\s+(\w+)\s*\{") find_symbols(p, structs) structs.add("iovec") -p = re.compile("union\s+(\w+)\s*\{") +p = re.compile(r"union\s+(\w+)\s*\{") find_symbols(p, unions) -p = re.compile("static\s+__inline__(\s+\w+)+\s+(\w+)\([^)]*\)\s") +p = re.compile(r"static\s+__inline__(\s+\w+)+\s+(\w+)\([^)]*\)\s") find_symbols(p, defines) -p = re.compile("static\s+__always_inline(\s+\w+)+\s+(\w+)\([^)]*\)\s") +p = re.compile(r"static\s+__always_inline(\s+\w+)+\s+(\w+)\([^)]*\)\s") find_symbols(p, defines) -p = re.compile("enum\s+(\w*)\s*{([^}]*)}", re.M|re.S) -q = re.compile("(\w+)\s*(,|=[^,]*|$)", re.M|re.S) +p = re.compile(r"enum\s+(\w*)\s*{([^}]*)}", re.M|re.S) +q = re.compile(r"(\w+)\s*(,|=[^,]*|$)", re.M|re.S) find_enums(p, q, defines) # needed for i386 From 1c2c85de6905588340acf33fb5ba63c9b39bd267 Mon Sep 17 00:00:00 2001 From: Hajime Tazaki Date: Thu, 26 Dec 2024 16:56:23 +0900 Subject: [PATCH 3/3] lkl: fix windows python issue (freeze_support) On windows build, python script should declar freeze_support() according to the document. This commit adds this line to our headers_install.py script. Link: https://docs.python.org/3.13/library/multiprocessing.html#multiprocessing.freeze_support Signed-off-by: Hajime Tazaki --- arch/lkl/scripts/headers_install.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/arch/lkl/scripts/headers_install.py b/arch/lkl/scripts/headers_install.py index 2c8a5b8d9e5811..e676566f52aa85 100755 --- a/arch/lkl/scripts/headers_install.py +++ b/arch/lkl/scripts/headers_install.py @@ -190,11 +190,13 @@ def process_header(h): print(" REPLACE\t%s" % (out_dir + "/" + os.path.basename(h))) replace(h) -p = multiprocessing.Pool(args.jobs) -try: - p.map_async(process_header, headers).wait(999999) - p.close() -except: - p.terminate() -finally: - p.join() +if __name__ == '__main__': + multiprocessing.freeze_support() + p = multiprocessing.Pool(args.jobs) + try: + p.map_async(process_header, headers).wait(999999) + p.close() + except: + p.terminate() + finally: + p.join()