From nobody Sat Nov 15 15:41:39 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1749766591; cv=none; d=zohomail.com; s=zohoarc; b=MVe+cUk+rtwW9PLQXIyF0w5kV1p5zJkym9iM/URzZ83E29Sv+3/XQbUonKtSLCfnwzAT1IKTHMobz7sM1O1+SDtyykhAc+OQXVjlBGug0ufwCWm8FrHC3+/+SLnYJgjAYZTtv2CvHtgcLItMBOakQuKsZmmKvE7llk3SzVulcvI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749766591; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=gVUqMWdXGopLtTJgsDYEUFW5shw7i3ZthEogkgqiY0Y=; b=jv4gMhW7IbK1K8X3AXwBmnUobkHvTYkMTDIyPTtZljNIXfuVLEkROfI2AmqR1T0G9IQtLSMhxFV4j3OPY8elsIuPMVkXKweh2NRS2J/olTj73eni9EsWJQUskK4nV6diKixp6xTRz4XG6Y+M5o08wc2y1DpfU6khKpsNDwfezds= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1749766591312209.2009307295025; Thu, 12 Jun 2025 15:16:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uPqDU-0006xZ-71; Thu, 12 Jun 2025 18:16:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uPqDT-0006xC-5b for qemu-devel@nongnu.org; Thu, 12 Jun 2025 18:16:11 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uPqDP-0003eQ-Vm for qemu-devel@nongnu.org; Thu, 12 Jun 2025 18:16:10 -0400 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-3a4fea34e07so922427f8f.1 for ; Thu, 12 Jun 2025 15:16:06 -0700 (PDT) Received: from localhost.localdomain (p200300ed8f252b003d090f81614e5ac5.dip0.t-ipconnect.de. [2003:ed:8f25:2b00:3d09:f81:614e:5ac5]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a568b08c7csm510431f8f.50.2025.06.12.15.16.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Jun 2025 15:16:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1749766565; x=1750371365; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=gVUqMWdXGopLtTJgsDYEUFW5shw7i3ZthEogkgqiY0Y=; b=JsviI3sYNUbD8viKJlrhZ/Wb+hQvItK9NfYaoevqLvPSZUtGxfai1FD4QLoHvr0IFe M+E0BM30WT3GaRsnklkf1sR7ANpiNa0IuYI5hd/XLaTgLQ58EhhpHmGdxZKY0VnmDhBj v2DI0lxIdKrCcZYPDwqbFabuaxgWXcvMmljQ25PWZt2fQMSXYadw1hS/7vsE4mIEkNCd P8+NrEs/k8j+6OUiZ5oZYXtf6mTHVkOd3PSryX/71K3W7nDYG4j7JApAv7Jr/dwzCn1m K/PE0y6KyGkwDnjDiCa4diLDmvXdshOPJ461mHHiVFgzSSe9fXGdg1k7lX3xbskAkMPs Xnkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749766565; x=1750371365; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=gVUqMWdXGopLtTJgsDYEUFW5shw7i3ZthEogkgqiY0Y=; b=V6bGbYsD5aTjlQ/xjXNjif69dZS+LQ3hfpCq8OoBXHj9DobLv7jQd6r4k3YyJSsth2 ZTWmCpsHsLYpr63qaI8tz/OA4c6bTcAYpN1814lfZ/a9vDiYtNffV1kPV22UenAyKFEF bzgHnYLQRGTyhcRw+dwGCY9orNBJvAcFN85qtX4eIJKXUfCXj5EIzWdc0/Lek6ML92Cw Nu2Z89WX7nvVeLiZ2xJEssTgzeo2V+TTO51p6cAyGa/wmoZ2wxVhlpnD2xemh9uzkmQT ge28CQBtKSlSXuxkm/fcTDGQD9+BSjIxZL0ecn9jf8m06sks+qe/yp0GLBm9fz0gz2hs 2uXQ== X-Gm-Message-State: AOJu0Yxh9gIyOkB7CXtUPGKzkuTR8dnt2g8+ORqt2Cvl+/ZjB6UDVuBu SrQ7bg4RHxWI8belfUQwEh5N4UVx8lCLXuyH/YU7oPUXpeeuRWh0Ls47kBCC1iZC X-Gm-Gg: ASbGncuF8Twm5EzW1BE5RJ6ZRH25GiNH6F4XUYtG32uWZb925jerTP75eEaFu2U3f+Y KlzlWXPYjYk7gSCnuGaYOJmbiLegcS9V4b4IcI7lYAlVR3tKozVeNO6HjJMz6g41MAYNIRtG/IW dEnBvfRnAsFeqTxwCgUwqrYSVHfQ974qrcUnpFdEmZYAhETUVSnU118l5gCHlyR52FrOb1Gm/bj ds1+UH19l5LXW5LWPR/Ta9lRTWxusKCq9m4a2/YDN8KFDkdSIZERf16YZ4JsikWOju7THOOmjFy QWSkjQPsqW3r+pu5rFZfIud/BOq/e3huyCZmrQuummRoJG2fEGWCutAF5AKlfmY6TuGwn3hirUy ZnFnZYnb/7O7iwEvWpbEfl8Ihe8rL1zQOnuY+IQwAiGUoRSkXLe53Akx/1Q3cV8umT1WcLSuRkQ U= X-Google-Smtp-Source: AGHT+IFfjf8ujDBh7TpBi5CJp/avGNGsVgMElhEdrClDGLQFOLDrd4bcqI2otdH5IkSwSV86EvAuxQ== X-Received: by 2002:a5d:5f44:0:b0:3a5:26fd:d46f with SMTP id ffacd0b85a97d-3a5687571b2mr524602f8f.32.1749766564821; Thu, 12 Jun 2025 15:16:04 -0700 (PDT) From: oltolm To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi , Mads Ynddal , Pierrick Bouvier , oltolm Subject: [PATCH v4] meson: fix Windows build Date: Fri, 13 Jun 2025 00:15:22 +0200 Message-ID: <20250612221521.1109-2-oleg.tolmatcev@gmail.com> X-Mailer: git-send-email 2.49.0.windows.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=oleg.tolmatcev@gmail.com; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1749766593370116600 The build fails on Windows. Replace calls to Unix programs like =C2=B4cat= =C2=B4, =C2=B4sed=C2=B4 and =C2=B4true=C2=B4 with calls to =C2=B4python=C2=B4 and w= rap calls to =C2=B4os.path.relpath=C2=B4 in try-except because it can fail when the two = paths are on different drives. Make sure to convert the Windows paths to Unix paths to prevent warnings in generated files. Signed-off-by: oltolm --- contrib/plugins/meson.build | 2 +- plugins/meson.build | 2 +- scripts/tracetool/__init__.py | 15 ++++++++++++--- scripts/tracetool/backend/ftrace.py | 4 +--- scripts/tracetool/backend/log.py | 4 +--- scripts/tracetool/backend/syslog.py | 4 +--- tests/functional/meson.build | 2 +- tests/include/meson.build | 2 +- tests/tcg/plugins/meson.build | 2 +- trace/meson.build | 5 +++-- 10 files changed, 23 insertions(+), 19 deletions(-) diff --git a/contrib/plugins/meson.build b/contrib/plugins/meson.build index fa8a426c8..1876bc784 100644 --- a/contrib/plugins/meson.build +++ b/contrib/plugins/meson.build @@ -24,7 +24,7 @@ endif if t.length() > 0 alias_target('contrib-plugins', t) else - run_target('contrib-plugins', command: find_program('true')) + run_target('contrib-plugins', command: [python, '-c', '']) endif =20 plugin_modules +=3D t diff --git a/plugins/meson.build b/plugins/meson.build index b20edfbab..62c991d87 100644 --- a/plugins/meson.build +++ b/plugins/meson.build @@ -33,7 +33,7 @@ if host_os =3D=3D 'windows' input: qemu_plugin_symbols, output: 'qemu_plugin_api.def', capture: true, - command: ['sed', '-e', '0,/^/s//EXPORTS/; s/[{};]//g', '@INPUT@']) + command: [python, '-c', 'import fileinput, re; print("EXPORTS", end=3D= ""); [print(re.sub(r"[{};]", "", line), end=3D"") for line in fileinput.inp= ut()]', '@INPUT@']) =20 # then use dlltool to assemble a delaylib. # The delaylib will have an "imaginary" name (qemu.exe), that is used by= the diff --git a/scripts/tracetool/__init__.py b/scripts/tracetool/__init__.py index bc03238c0..6dfcbf71e 100644 --- a/scripts/tracetool/__init__.py +++ b/scripts/tracetool/__init__.py @@ -12,12 +12,14 @@ __email__ =3D "stefanha@redhat.com" =20 =20 +import os import re import sys import weakref +from pathlib import PurePath =20 -import tracetool.format import tracetool.backend +import tracetool.format =20 =20 def error_write(*lines): @@ -36,7 +38,7 @@ def error(*lines): =20 def out_open(filename): global out_filename, out_fobj - out_filename =3D filename + out_filename =3D posix_relpath(filename) out_fobj =3D open(filename, 'wt') =20 def out(*lines, **kwargs): @@ -308,7 +310,7 @@ def build(line_str, lineno, filename): fmt =3D [fmt_trans, fmt] args =3D Arguments.build(groups["args"]) =20 - return Event(name, props, fmt, args, lineno, filename) + return Event(name, props, fmt, args, lineno, posix_relpath(filenam= e)) =20 def __repr__(self): """Evaluable string representation for this object.""" @@ -447,3 +449,10 @@ def generate(events, group, format, backends, tracetool.backend.dtrace.PROBEPREFIX =3D probe_prefix =20 tracetool.format.generate(events, format, backend, group) + +def posix_relpath(path, start=3DNone): + try: + path =3D os.path.relpath(path, start) + except ValueError: + pass + return PurePath(path).as_posix() diff --git a/scripts/tracetool/backend/ftrace.py b/scripts/tracetool/backen= d/ftrace.py index baed2ae61..5fa30ccc0 100644 --- a/scripts/tracetool/backend/ftrace.py +++ b/scripts/tracetool/backend/ftrace.py @@ -12,8 +12,6 @@ __email__ =3D "stefanha@redhat.com" =20 =20 -import os.path - from tracetool import out =20 =20 @@ -47,7 +45,7 @@ def generate_h(event, group): args=3Devent.args, event_id=3D"TRACE_" + event.name.upper(), event_lineno=3Devent.lineno, - event_filename=3Dos.path.relpath(event.filename), + event_filename=3Devent.filename, fmt=3Devent.fmt.rstrip("\n"), argnames=3Dargnames) =20 diff --git a/scripts/tracetool/backend/log.py b/scripts/tracetool/backend/l= og.py index de27b7e62..17ba1cd90 100644 --- a/scripts/tracetool/backend/log.py +++ b/scripts/tracetool/backend/log.py @@ -12,8 +12,6 @@ __email__ =3D "stefanha@redhat.com" =20 =20 -import os.path - from tracetool import out =20 =20 @@ -55,7 +53,7 @@ def generate_h(event, group): ' }', cond=3Dcond, event_lineno=3Devent.lineno, - event_filename=3Dos.path.relpath(event.filename), + event_filename=3Devent.filename, name=3Devent.name, fmt=3Devent.fmt.rstrip("\n"), argnames=3Dargnames) diff --git a/scripts/tracetool/backend/syslog.py b/scripts/tracetool/backen= d/syslog.py index 012970f6c..5a3a00fe3 100644 --- a/scripts/tracetool/backend/syslog.py +++ b/scripts/tracetool/backend/syslog.py @@ -12,8 +12,6 @@ __email__ =3D "stefanha@redhat.com" =20 =20 -import os.path - from tracetool import out =20 =20 @@ -43,7 +41,7 @@ def generate_h(event, group): ' }', cond=3Dcond, event_lineno=3Devent.lineno, - event_filename=3Dos.path.relpath(event.filename), + event_filename=3Devent.filename, name=3Devent.name, fmt=3Devent.fmt.rstrip("\n"), argnames=3Dargnames) diff --git a/tests/functional/meson.build b/tests/functional/meson.build index 557d59ddf..de03a41de 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -414,4 +414,4 @@ endforeach =20 run_target('precache-functional', depends: precache_all, - command: ['true']) + command: [python, '-c', '']) diff --git a/tests/include/meson.build b/tests/include/meson.build index 9abba308f..8e8d1ec4e 100644 --- a/tests/include/meson.build +++ b/tests/include/meson.build @@ -13,4 +13,4 @@ test_qapi_outputs_extra =3D [ test_qapi_files_extra =3D custom_target('QAPI test (include)', output: test_qapi_outputs_extra, input: test_qapi_files, - command: 'true') + command: [python, '-c', '']) diff --git a/tests/tcg/plugins/meson.build b/tests/tcg/plugins/meson.build index 41f02f2c7..029342282 100644 --- a/tests/tcg/plugins/meson.build +++ b/tests/tcg/plugins/meson.build @@ -17,7 +17,7 @@ endif if t.length() > 0 alias_target('test-plugins', t) else - run_target('test-plugins', command: find_program('true')) + run_target('test-plugins', command: [python, '-c', '']) endif =20 plugin_modules +=3D t diff --git a/trace/meson.build b/trace/meson.build index 3df454935..9c42a57a0 100644 --- a/trace/meson.build +++ b/trace/meson.build @@ -4,7 +4,7 @@ trace_events_files =3D [] foreach item : [ '.' ] + trace_events_subdirs + qapi_trace_events if item in qapi_trace_events trace_events_file =3D item - group_name =3D item.full_path().split('/')[-1].underscorify() + group_name =3D fs.name(item).underscorify() else trace_events_file =3D meson.project_source_root() / item / 'trace-even= ts' group_name =3D item =3D=3D '.' ? 'root' : item.underscorify() @@ -57,10 +57,11 @@ foreach item : [ '.' ] + trace_events_subdirs + qapi_tr= ace_events endif endforeach =20 +cat =3D [ python, '-c', 'import fileinput; [print(line, end=3D"") for line= in fileinput.input()]', '@INPUT@' ] trace_events_all =3D custom_target('trace-events-all', output: 'trace-events-all', input: trace_events_files, - command: [ 'cat', '@INPUT@' ], + command: cat, capture: true, install: get_option('trace_backends') != =3D [ 'nop' ], install_dir: qemu_datadir) --=20 2.49.0.windows.1