diff mbox series

[1/2] keytable: Add source information in generated keymaps

Message ID 20190701163813.25032-1-hadess@hadess.net (mailing list archive)
State New, archived
Headers show
Series [1/2] keytable: Add source information in generated keymaps | expand

Commit Message

Bastien Nocera July 1, 2019, 4:38 p.m. UTC
Add comments to mention that keymap files are generated, and that
they shouldn't be modified by hand. Also list which tool was used
to generate them and the kernel source filename.

Signed-off-by: Bastien Nocera <hadess@hadess.net>
---
 utils/keytable/gen_keytables.pl | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Sean Young July 3, 2019, 3:33 p.m. UTC | #1
On Mon, Jul 01, 2019 at 06:38:12PM +0200, Bastien Nocera wrote:
> Add comments to mention that keymap files are generated, and that
> they shouldn't be modified by hand. Also list which tool was used
> to generate them and the kernel source filename.
> 
> Signed-off-by: Bastien Nocera <hadess@hadess.net>
> ---
>  utils/keytable/gen_keytables.pl | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/utils/keytable/gen_keytables.pl b/utils/keytable/gen_keytables.pl
> index 4124e366..3dc74ba6 100755
> --- a/utils/keytable/gen_keytables.pl
> +++ b/utils/keytable/gen_keytables.pl
> @@ -36,10 +36,17 @@ sub flush($$)
>  	my $filename = shift;
>  	my $legacy = shift;
>  	my $defined;
> +	my $relative_filename = $filename;
>  
>  	return if (!$keyname || !$out);
> -	print "Creating $dir/$keyname.toml\n";
> +	$relative_filename =~ s/^$kernel_dir//;
> +	$relative_filename =~ s/^\///;
> +	print "Creating $dir/$keyname.toml from $relative_filename\n";
>  	open OUT, ">$dir/$keyname.toml";
> +	print OUT "# This file is a generated data file, do not modify manually\n";
> +	print OUT "#\n";
> +	print OUT "# Generated with gen_keytables.pl in v4l-utils\n";
> +	print OUT "# using $relative_filename as a source file\n";

This is only relevant for a developer who is wanting to upstream their
keymap changes to v4l-utils. If it should be documented somewhere it
should be in the v4l-utils repo itself, so that anyone generating
patches will notice before spending too much time making a patch on the
keymaps directory.

Also some remotes do not have definitions in the kernel, only in v4l-utils.

For an end user who is trying to patch their keymap this is confusing. Someone
who just wants to patch their keymap for their remote might be put off
by this message; can they not simply edit the toml file?

NAK, I'm afraid.

>  	print OUT "[[protocols]]\n";
>  	print OUT "name = \"$keyname\"\n";
>  	print OUT "protocol = \"$type\"\n";
> -- 
> 2.21.0


Sean
Bastien Nocera July 4, 2019, 1:22 p.m. UTC | #2
On Wed, 2019-07-03 at 16:33 +0100, Sean Young wrote:
> On Mon, Jul 01, 2019 at 06:38:12PM +0200, Bastien Nocera wrote:
> > Add comments to mention that keymap files are generated, and that
> > they shouldn't be modified by hand. Also list which tool was used
> > to generate them and the kernel source filename.
> > 
> > Signed-off-by: Bastien Nocera <hadess@hadess.net>
> > ---
> >  utils/keytable/gen_keytables.pl | 9 ++++++++-
> >  1 file changed, 8 insertions(+), 1 deletion(-)
> > 
> > diff --git a/utils/keytable/gen_keytables.pl
> > b/utils/keytable/gen_keytables.pl
> > index 4124e366..3dc74ba6 100755
> > --- a/utils/keytable/gen_keytables.pl
> > +++ b/utils/keytable/gen_keytables.pl
> > @@ -36,10 +36,17 @@ sub flush($$)
> >  	my $filename = shift;
> >  	my $legacy = shift;
> >  	my $defined;
> > +	my $relative_filename = $filename;
> >  
> >  	return if (!$keyname || !$out);
> > -	print "Creating $dir/$keyname.toml\n";
> > +	$relative_filename =~ s/^$kernel_dir//;
> > +	$relative_filename =~ s/^\///;
> > +	print "Creating $dir/$keyname.toml from $relative_filename\n";
> >  	open OUT, ">$dir/$keyname.toml";
> > +	print OUT "# This file is a generated data file, do not modify
> > manually\n";
> > +	print OUT "#\n";
> > +	print OUT "# Generated with gen_keytables.pl in v4l-utils\n";
> > +	print OUT "# using $relative_filename as a source file\n";
> 
> This is only relevant for a developer who is wanting to upstream
> their
> keymap changes to v4l-utils.

It's only relevant to you. Or the chump that tried to do things well
(me). I wouldn't have wasted this much time writing tests, or making
patches if there had been a bit of guidance on how you wanted those
problems fixed. I'll let you create a README for that instead.

I'll send the "check" patch again.
diff mbox series

Patch

diff --git a/utils/keytable/gen_keytables.pl b/utils/keytable/gen_keytables.pl
index 4124e366..3dc74ba6 100755
--- a/utils/keytable/gen_keytables.pl
+++ b/utils/keytable/gen_keytables.pl
@@ -36,10 +36,17 @@  sub flush($$)
 	my $filename = shift;
 	my $legacy = shift;
 	my $defined;
+	my $relative_filename = $filename;
 
 	return if (!$keyname || !$out);
-	print "Creating $dir/$keyname.toml\n";
+	$relative_filename =~ s/^$kernel_dir//;
+	$relative_filename =~ s/^\///;
+	print "Creating $dir/$keyname.toml from $relative_filename\n";
 	open OUT, ">$dir/$keyname.toml";
+	print OUT "# This file is a generated data file, do not modify manually\n";
+	print OUT "#\n";
+	print OUT "# Generated with gen_keytables.pl in v4l-utils\n";
+	print OUT "# using $relative_filename as a source file\n";
 	print OUT "[[protocols]]\n";
 	print OUT "name = \"$keyname\"\n";
 	print OUT "protocol = \"$type\"\n";