Linux Framebuffer Layer development
 help / color / mirror / Atom feed
* [PATCH] drivers: video: logo: Don't mention the full path of the input in output
@ 2024-04-04 12:18 Lucas Stach
  2024-04-04 13:15 ` Helge Deller
  0 siblings, 1 reply; 4+ messages in thread
From: Lucas Stach @ 2024-04-04 12:18 UTC (permalink / raw)
  To: Helge Deller; +Cc: linux-fbdev, dri-devel, kernel, patchwork-lst

This change strips $abs_srctree of the input file containing the
PNM data in the generated output. The motivation for this change
is Yocto emitting a build warning

    WARNING: linux-foo-6.8-r0 do_package_qa: QA Issue:
    File /usr/src/debug/linux-foo/6.8-r0/drivers/video/logo/logo_linux_clut224.c
    in package linux-foo-src contains reference to TMPDIR

So this change brings us one step closer to make the build result
reproducible independent of the build path.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 drivers/video/logo/pnmtologo.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/video/logo/pnmtologo.c b/drivers/video/logo/pnmtologo.c
index 2434a25afb64..59ccd721e8af 100644
--- a/drivers/video/logo/pnmtologo.c
+++ b/drivers/video/logo/pnmtologo.c
@@ -223,6 +223,18 @@ static inline int is_equal(struct color c1, struct color c2)
 
 static void write_header(void)
 {
+	const char *abs_srctree = getenv("abs_srctree");
+	const char *rel_filename;
+
+	if (abs_srctree &&
+	    !strncmp(abs_srctree, filename, strlen(abs_srctree))) {
+		rel_filename = filename + strlen(abs_srctree);
+		while (*rel_filename == '/')
+			++rel_filename;
+	} else {
+		rel_filename = filename;
+	}
+
 	/* open logo file */
 	if (outputname) {
 		out = fopen(outputname, "w");
@@ -235,7 +247,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", rel_filename);
 	fputs(" *\n", out);
 	fprintf(out, " *  Linux logo %s\n", logoname);
 	fputs(" */\n\n", out);
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] drivers: video: logo: Don't mention the full path of the input in output
  2024-04-04 12:18 [PATCH] drivers: video: logo: Don't mention the full path of the input in output Lucas Stach
@ 2024-04-04 13:15 ` Helge Deller
  2024-04-04 16:44   ` Lucas Stach
  0 siblings, 1 reply; 4+ messages in thread
From: Helge Deller @ 2024-04-04 13:15 UTC (permalink / raw)
  To: Lucas Stach; +Cc: linux-fbdev, dri-devel, kernel, patchwork-lst

On 4/4/24 14:18, Lucas Stach wrote:
> This change strips $abs_srctree of the input file containing the
> PNM data in the generated output. The motivation for this change
> is Yocto emitting a build warning
>
>      WARNING: linux-foo-6.8-r0 do_package_qa: QA Issue:
>      File /usr/src/debug/linux-foo/6.8-r0/drivers/video/logo/logo_linux_clut224.c
>      in package linux-foo-src contains reference to TMPDIR
>
> So this change brings us one step closer to make the build result
> reproducible independent of the build path.
>
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---
>   drivers/video/logo/pnmtologo.c | 14 +++++++++++++-
>   1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/video/logo/pnmtologo.c b/drivers/video/logo/pnmtologo.c
> index 2434a25afb64..59ccd721e8af 100644
> --- a/drivers/video/logo/pnmtologo.c
> +++ b/drivers/video/logo/pnmtologo.c
> @@ -223,6 +223,18 @@ static inline int is_equal(struct color c1, struct color c2)
>
>   static void write_header(void)
>   {
> +	const char *abs_srctree = getenv("abs_srctree");
> +	const char *rel_filename;
> +
> +	if (abs_srctree &&
> +	    !strncmp(abs_srctree, filename, strlen(abs_srctree))) {
> +		rel_filename = filename + strlen(abs_srctree);
> +		while (*rel_filename == '/')
> +			++rel_filename;
> +	} else {
> +		rel_filename = filename;
> +	}
> +
>   	/* open logo file */
>   	if (outputname) {
>   		out = fopen(outputname, "w");
> @@ -235,7 +247,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", rel_filename);

can't you use instead: ?
> +	fprintf(out, " *  It was automatically generated from %s\n", basename(filename));

Helge


>   	fputs(" *\n", out);
>   	fprintf(out, " *  Linux logo %s\n", logoname);
>   	fputs(" */\n\n", out);


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drivers: video: logo: Don't mention the full path of the input in output
  2024-04-04 13:15 ` Helge Deller
@ 2024-04-04 16:44   ` Lucas Stach
  2024-04-04 17:56     ` Helge Deller
  0 siblings, 1 reply; 4+ messages in thread
From: Lucas Stach @ 2024-04-04 16:44 UTC (permalink / raw)
  To: Helge Deller; +Cc: linux-fbdev, dri-devel, kernel, patchwork-lst

Am Donnerstag, dem 04.04.2024 um 15:15 +0200 schrieb Helge Deller:
> On 4/4/24 14:18, Lucas Stach wrote:
> > This change strips $abs_srctree of the input file containing the
> > PNM data in the generated output. The motivation for this change
> > is Yocto emitting a build warning
> > 
> >      WARNING: linux-foo-6.8-r0 do_package_qa: QA Issue:
> >      File /usr/src/debug/linux-foo/6.8-r0/drivers/video/logo/logo_linux_clut224.c
> >      in package linux-foo-src contains reference to TMPDIR
> > 
> > So this change brings us one step closer to make the build result
> > reproducible independent of the build path.
> > 
> > Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> > ---
> >   drivers/video/logo/pnmtologo.c | 14 +++++++++++++-
> >   1 file changed, 13 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/video/logo/pnmtologo.c b/drivers/video/logo/pnmtologo.c
> > index 2434a25afb64..59ccd721e8af 100644
> > --- a/drivers/video/logo/pnmtologo.c
> > +++ b/drivers/video/logo/pnmtologo.c
> > @@ -223,6 +223,18 @@ static inline int is_equal(struct color c1, struct color c2)
> > 
> >   static void write_header(void)
> >   {
> > +	const char *abs_srctree = getenv("abs_srctree");
> > +	const char *rel_filename;
> > +
> > +	if (abs_srctree &&
> > +	    !strncmp(abs_srctree, filename, strlen(abs_srctree))) {
> > +		rel_filename = filename + strlen(abs_srctree);
> > +		while (*rel_filename == '/')
> > +			++rel_filename;
> > +	} else {
> > +		rel_filename = filename;
> > +	}
> > +
> >   	/* open logo file */
> >   	if (outputname) {
> >   		out = fopen(outputname, "w");
> > @@ -235,7 +247,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", rel_filename);
> 
> can't you use instead: ?
> > +	fprintf(out, " *  It was automatically generated from %s\n", basename(filename));
> 
The difference to basename is that this keeps the path in the source
tree intact, e.g. it shortens the absolute path to
"drivers/video/logo/logo_linux_clut224.c", so the comment in the
generated file still has a full reference to the file location in the
source tree. It only strips out the part of the path that is host
dependent.

Regards,
Lucas

> Helge
> 
> 
> >   	fputs(" *\n", out);
> >   	fprintf(out, " *  Linux logo %s\n", logoname);
> >   	fputs(" */\n\n", out);
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drivers: video: logo: Don't mention the full path of the input in output
  2024-04-04 16:44   ` Lucas Stach
@ 2024-04-04 17:56     ` Helge Deller
  0 siblings, 0 replies; 4+ messages in thread
From: Helge Deller @ 2024-04-04 17:56 UTC (permalink / raw)
  To: Lucas Stach; +Cc: linux-fbdev, dri-devel, kernel, patchwork-lst

On 4/4/24 18:44, Lucas Stach wrote:
> Am Donnerstag, dem 04.04.2024 um 15:15 +0200 schrieb Helge Deller:
>> On 4/4/24 14:18, Lucas Stach wrote:
>>> This change strips $abs_srctree of the input file containing the
>>> PNM data in the generated output. The motivation for this change
>>> is Yocto emitting a build warning
>>>
>>>       WARNING: linux-foo-6.8-r0 do_package_qa: QA Issue:
>>>       File /usr/src/debug/linux-foo/6.8-r0/drivers/video/logo/logo_linux_clut224.c
>>>       in package linux-foo-src contains reference to TMPDIR
>>>
>>> So this change brings us one step closer to make the build result
>>> reproducible independent of the build path.
>>>
>>> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
>>> ---
>>>    drivers/video/logo/pnmtologo.c | 14 +++++++++++++-
>>>    1 file changed, 13 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/video/logo/pnmtologo.c b/drivers/video/logo/pnmtologo.c
>>> index 2434a25afb64..59ccd721e8af 100644
>>> --- a/drivers/video/logo/pnmtologo.c
>>> +++ b/drivers/video/logo/pnmtologo.c
>>> @@ -223,6 +223,18 @@ static inline int is_equal(struct color c1, struct color c2)
>>>
>>>    static void write_header(void)
>>>    {
>>> +	const char *abs_srctree = getenv("abs_srctree");
>>> +	const char *rel_filename;
>>> +
>>> +	if (abs_srctree &&
>>> +	    !strncmp(abs_srctree, filename, strlen(abs_srctree))) {
>>> +		rel_filename = filename + strlen(abs_srctree);
>>> +		while (*rel_filename == '/')
>>> +			++rel_filename;
>>> +	} else {
>>> +		rel_filename = filename;
>>> +	}
>>> +
>>>    	/* open logo file */
>>>    	if (outputname) {
>>>    		out = fopen(outputname, "w");
>>> @@ -235,7 +247,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", rel_filename);
>>
>> can't you use instead: ?
>>> +	fprintf(out, " *  It was automatically generated from %s\n", basename(filename));
>>
> The difference to basename is that this keeps the path in the source
> tree intact, e.g. it shortens the absolute path to
> "drivers/video/logo/logo_linux_clut224.c", so the comment in the
> generated file still has a full reference to the file location in the
> source tree. It only strips out the part of the path that is host
> dependent.

That's true, but
a) it's just a comment which is generated, and
b) all source and generated logo files are in the [src|build]/drivers/video/logo/ directory anyway, and
c) the file name already suggests where it is generated from.

So, IMHO basically we could simply drop the whole comment line alltogether as well.

Helge

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-04-04 17:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-04 12:18 [PATCH] drivers: video: logo: Don't mention the full path of the input in output Lucas Stach
2024-04-04 13:15 ` Helge Deller
2024-04-04 16:44   ` Lucas Stach
2024-04-04 17:56     ` Helge Deller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox