Patrick Williams | 8e7b46e | 2023-05-01 14:19:06 -0500 | [diff] [blame^] | 1 | From 348ea441db84a211d4fca7ef5544b5cd06a8a872 Mon Sep 17 00:00:00 2001 |
| 2 | From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com> |
| 3 | Date: Tue, 4 Apr 2023 15:26:07 +0200 |
| 4 | Subject: [PATCH] tracetool: use relative paths for '#line' preprocessor |
| 5 | directives |
| 6 | |
| 7 | The event filename is an absolute path. Convert it to a relative path when |
| 8 | writing '#line' directives, to preserve reproducibility of the generated |
| 9 | output when different base paths are used. |
| 10 | |
| 11 | Upstream-Status: Pending |
| 12 | |
| 13 | --- |
| 14 | scripts/tracetool/backend/ftrace.py | 4 +++- |
| 15 | scripts/tracetool/backend/log.py | 4 +++- |
| 16 | scripts/tracetool/backend/syslog.py | 4 +++- |
| 17 | 3 files changed, 9 insertions(+), 3 deletions(-) |
| 18 | |
| 19 | diff --git a/scripts/tracetool/backend/ftrace.py b/scripts/tracetool/backend/ftrace.py |
| 20 | index 5fa30ccc08..baed2ae61c 100644 |
| 21 | --- a/scripts/tracetool/backend/ftrace.py |
| 22 | +++ b/scripts/tracetool/backend/ftrace.py |
| 23 | @@ -12,6 +12,8 @@ |
| 24 | __email__ = "stefanha@redhat.com" |
| 25 | |
| 26 | |
| 27 | +import os.path |
| 28 | + |
| 29 | from tracetool import out |
| 30 | |
| 31 | |
| 32 | @@ -45,7 +47,7 @@ def generate_h(event, group): |
| 33 | args=event.args, |
| 34 | event_id="TRACE_" + event.name.upper(), |
| 35 | event_lineno=event.lineno, |
| 36 | - event_filename=event.filename, |
| 37 | + event_filename=os.path.relpath(event.filename), |
| 38 | fmt=event.fmt.rstrip("\n"), |
| 39 | argnames=argnames) |
| 40 | |
| 41 | diff --git a/scripts/tracetool/backend/log.py b/scripts/tracetool/backend/log.py |
| 42 | index 17ba1cd90e..de27b7e62e 100644 |
| 43 | --- a/scripts/tracetool/backend/log.py |
| 44 | +++ b/scripts/tracetool/backend/log.py |
| 45 | @@ -12,6 +12,8 @@ |
| 46 | __email__ = "stefanha@redhat.com" |
| 47 | |
| 48 | |
| 49 | +import os.path |
| 50 | + |
| 51 | from tracetool import out |
| 52 | |
| 53 | |
| 54 | @@ -53,7 +55,7 @@ def generate_h(event, group): |
| 55 | ' }', |
| 56 | cond=cond, |
| 57 | event_lineno=event.lineno, |
| 58 | - event_filename=event.filename, |
| 59 | + event_filename=os.path.relpath(event.filename), |
| 60 | name=event.name, |
| 61 | fmt=event.fmt.rstrip("\n"), |
| 62 | argnames=argnames) |
| 63 | diff --git a/scripts/tracetool/backend/syslog.py b/scripts/tracetool/backend/syslog.py |
| 64 | index 5a3a00fe31..012970f6cc 100644 |
| 65 | --- a/scripts/tracetool/backend/syslog.py |
| 66 | +++ b/scripts/tracetool/backend/syslog.py |
| 67 | @@ -12,6 +12,8 @@ |
| 68 | __email__ = "stefanha@redhat.com" |
| 69 | |
| 70 | |
| 71 | +import os.path |
| 72 | + |
| 73 | from tracetool import out |
| 74 | |
| 75 | |
| 76 | @@ -41,7 +43,7 @@ def generate_h(event, group): |
| 77 | ' }', |
| 78 | cond=cond, |
| 79 | event_lineno=event.lineno, |
| 80 | - event_filename=event.filename, |
| 81 | + event_filename=os.path.relpath(event.filename), |
| 82 | name=event.name, |
| 83 | fmt=event.fmt.rstrip("\n"), |
| 84 | argnames=argnames) |
| 85 | -- |
| 86 | 2.39.2 |
| 87 | |