File: documentation-use-relative-source-paths-in-abi-documentation.patch

package info (click to toggle)
linux 6.12.43-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,676,260 kB
  • sloc: ansic: 25,921,022; asm: 269,579; sh: 136,424; python: 65,440; makefile: 55,721; perl: 37,752; xml: 19,284; cpp: 5,895; yacc: 4,927; lex: 2,939; awk: 1,594; sed: 28; ruby: 25
file content (32 lines) | stat: -rw-r--r-- 1,166 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
From: Ben Hutchings <benh@debian.org>
Date: Mon, 16 Sep 2024 00:07:04 +0200
Subject: Documentation: Use relative source filenames in ABI documentation

Currently the ABI documentation files contain absolute source
filenames, which makes them unreproducible if the build directory can
vary.

Remove the source base directory ($srctree) from the source filenames
shown in the documentation.

Signed-off-by: Ben Hutchings <benh@debian.org>
---
--- a/Documentation/sphinx/kernel_abi.py
+++ b/Documentation/sphinx/kernel_abi.py
@@ -103,6 +103,7 @@ class KernelCmd(Directive):
             lines = code_block + "\n\n"
 
         line_regex = re.compile(r"^\.\. LINENO (\S+)\#([0-9]+)$")
+        srctree = os.path.abspath(os.environ["srctree"])
         ln = 0
         n = 0
         f = fname
@@ -127,7 +128,7 @@ class KernelCmd(Directive):
                 # sphinx counts lines from 0
                 ln = int(match.group(2)) - 1
             else:
-                content.append(line, f, ln)
+                content.append(line, os.path.relpath(f, srctree), ln)
 
         kernellog.info(self.state.document.settings.env.app, "%s: parsed %i lines" % (fname, n))