From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Roque Arcudia Hernandez <roqueh@google.com>
Cc: jansene@google.com, stefanha@redhat.com, mads@ynddal.dk,
qemu-devel@nongnu.org
Subject: Re: [PATCH] scripts/tracetool:Use posix paths in trace event generation
Date: Mon, 4 Nov 2024 09:15:45 +0000 [thread overview]
Message-ID: <ZyiQTQC7l0qgLE1j@redhat.com> (raw)
In-Reply-To: <20241101205616.3332303-1-roqueh@google.com>
On Fri, Nov 01, 2024 at 08:56:16PM +0000, Roque Arcudia Hernandez wrote:
> On windows machines the path seperator is '\\' (backslash) which causes
> the tracetool generator to output line information in the source code
> with the '\\' character. This in turn confuses the compiler, causing
> build breaks.
>
> We now will always use posix paths, so the paths will use a '/'
> (forward) slash.
>
> Signed-off-by: Erwin Jansen <jansene@google.com>
> Signed-off-by: Roque Arcudia Hernandez <roqueh@google.com>
> ---
> scripts/tracetool/__init__.py | 3 ++-
> scripts/tracetool/backend/ftrace.py | 5 +++--
> scripts/tracetool/backend/log.py | 5 +++--
> scripts/tracetool/backend/syslog.py | 6 +++---
> 4 files changed, 11 insertions(+), 8 deletions(-)
>
> diff --git a/scripts/tracetool/__init__.py b/scripts/tracetool/__init__.py
> index bc03238c0f..ccab820532 100644
> --- a/scripts/tracetool/__init__.py
> +++ b/scripts/tracetool/__init__.py
> @@ -15,6 +15,7 @@
> import re
> import sys
> import weakref
> +from pathlib import Path
>
> import tracetool.format
> import tracetool.backend
> @@ -55,7 +56,7 @@ def out(*lines, **kwargs):
> for l in lines:
> kwargs['out_lineno'] = out_lineno
> kwargs['out_next_lineno'] = out_lineno + 1
> - kwargs['out_filename'] = out_filename
> + kwargs['out_filename'] = Path(out_filename).as_posix()
> output.append(l % kwargs)
> out_lineno += 1
>
> diff --git a/scripts/tracetool/backend/ftrace.py b/scripts/tracetool/backend/ftrace.py
> index baed2ae61c..940c9be980 100644
> --- a/scripts/tracetool/backend/ftrace.py
> +++ b/scripts/tracetool/backend/ftrace.py
> @@ -12,7 +12,8 @@
> __email__ = "stefanha@redhat.com"
>
>
> -import os.path
> +from os.path import relpath
> +from pathlib import Path
There is no need to use os.path here - the Path object has
the 'relative_to' method.
>
> from tracetool import out
>
> @@ -47,7 +48,7 @@ def generate_h(event, group):
> args=event.args,
> event_id="TRACE_" + event.name.upper(),
> event_lineno=event.lineno,
> - event_filename=os.path.relpath(event.filename),
> + event_filename=Path(relpath(event.filename)).as_posix(),
> fmt=event.fmt.rstrip("\n"),
> argnames=argnames)
>
> diff --git a/scripts/tracetool/backend/log.py b/scripts/tracetool/backend/log.py
> index de27b7e62e..626840eef7 100644
> --- a/scripts/tracetool/backend/log.py
> +++ b/scripts/tracetool/backend/log.py
> @@ -12,7 +12,8 @@
> __email__ = "stefanha@redhat.com"
>
>
> -import os.path
> +from pathlib import Path
> +from os.path import relpath
>
> from tracetool import out
>
> @@ -55,7 +56,7 @@ def generate_h(event, group):
> ' }',
> cond=cond,
> event_lineno=event.lineno,
> - event_filename=os.path.relpath(event.filename),
> + event_filename=Path(relpath(event.filename)).as_posix(),
> name=event.name,
> fmt=event.fmt.rstrip("\n"),
> argnames=argnames)
> diff --git a/scripts/tracetool/backend/syslog.py b/scripts/tracetool/backend/syslog.py
> index 012970f6cc..32e4bba4f9 100644
> --- a/scripts/tracetool/backend/syslog.py
> +++ b/scripts/tracetool/backend/syslog.py
> @@ -11,8 +11,8 @@
> __maintainer__ = "Stefan Hajnoczi"
> __email__ = "stefanha@redhat.com"
>
> -
> -import os.path
> +from os.path import relpath
> +from pathlib import Path
>
> from tracetool import out
>
> @@ -43,7 +43,7 @@ def generate_h(event, group):
> ' }',
> cond=cond,
> event_lineno=event.lineno,
> - event_filename=os.path.relpath(event.filename),
> + event_filename=Path(relpath(event.filename)).as_posix(),
> name=event.name,
> fmt=event.fmt.rstrip("\n"),
> argnames=argnames)
> --
> 2.47.0.163.g1226f6d8fa-goog
>
>
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
prev parent reply other threads:[~2024-11-04 9:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-01 20:56 [PATCH] scripts/tracetool:Use posix paths in trace event generation Roque Arcudia Hernandez
2024-11-04 9:15 ` Daniel P. Berrangé [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZyiQTQC7l0qgLE1j@redhat.com \
--to=berrange@redhat.com \
--cc=jansene@google.com \
--cc=mads@ynddal.dk \
--cc=qemu-devel@nongnu.org \
--cc=roqueh@google.com \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).