aboutsummaryrefslogtreecommitdiffstats
path: root/patches/misc/pnmtologo-use-relocatable-file-name.patch
blob: bcfb5904fdd37ab9e99a642cd470c22c9c851c4b (plain)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
From 4da597cafebb4d6743da1dd54099dadb6c356e08 Mon Sep 17 00:00:00 2001
From: Bruce Ashfield <bruce.ashfield@gmail.com>
Date: Thu, 14 Jul 2022 14:43:46 -0400
Subject: [PATCH] pnmtologo: use relocatable file name

The logo generation utility is capturing the source of the logo
in the generated .c file. The source file is absolute (as passed
by make), so the full path is captured.

This makes the source fail reproducibility tests.

We use basename() to just get the source file name, and use
that in the generated .c file.

Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
---
 drivers/video/logo/pnmtologo.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/video/logo/pnmtologo.c b/drivers/video/logo/pnmtologo.c
index ada5ef6e51b7..7527be845443 100644
--- a/drivers/video/logo/pnmtologo.c
+++ b/drivers/video/logo/pnmtologo.c
@@ -13,7 +13,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-
+#include <libgen.h>
 
 static const char *programname;
 static const char *filename;
@@ -223,6 +223,7 @@ static inline int is_equal(struct color c1, struct color c2)
 
 static void write_header(void)
 {
+	char *filename_basename = basename(filename);
 	/* open logo file */
 	if (outputname) {
 		out = fopen(outputname, "w");
@@ -235,7 +236,7 @@ static void write_header(void)
 	fputs("/*\n", out);
 	fputs(" *  DO NOT EDIT THIS FILE!\n", out);
 	fputs(" *\n", out);
-	fprintf(out, " *  It was automatically generated from %s\n", filename);
+	fprintf(out, " *  It was automatically generated from %s\n", filename_basename);
 	fputs(" *\n", out);
 	fprintf(out, " *  Linux logo %s\n", logoname);
 	fputs(" */\n\n", out);
-- 
2.34.1