[RFC] docs: Add a copyright.c template we can copy when making new files.

Submitted by Kenneth Graunke on Oct. 19, 2018, 5:51 p.m.

Details

Message ID 20181019175136.10433-1-kenneth@whitecape.org
State New
Headers show
Series "docs: Add a copyright.c template we can copy when making new files." ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Kenneth Graunke Oct. 19, 2018, 5:51 p.m.
Usually when making a new file, people copy some random other file
to get the copyright header comments.  Unfortunately, some of them
are commented in a decades-old style, are word wrapped poorly, or
worse, have a few subtle variations in the text.  While we've tried
to clean those up, we're not going to get every copy to be perfect.

Instead, this commit adds docs/copyright.c, which contains a copy of
the license header which is well-formatted and has the correct text.
The idea is that you can start from this when making a new file, which
should help with consistency.
---
 docs/copyright.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 docs/copyright.c

Hey all,

I noticed when writing my new Iris driver that I had a couple subtle
variations of copyright headers creep in, even in a brand new project.
Mostly word wrapping differences.  To combat that, I made a copyright.c
and made sure to use it when I created new files.  It seemed to help.

So, the thinking is to just actually put that in the project under docs.
Maybe it helps other people as well?

 --Ken

Patch hide | download patch | download mbox

diff --git a/docs/copyright.c b/docs/copyright.c
new file mode 100644
index 00000000000..db92f27e641
--- /dev/null
+++ b/docs/copyright.c
@@ -0,0 +1,22 @@ 
+/*
+ * Copyright © 2018 <Insert Name Here>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+

Comments

Sounds like a good idea to me.

Acked-by: Matt Turner <mattst88@gmail.com>
On Fri, Oct 19, 2018 at 10:51:36AM -0700, Kenneth Graunke wrote:
> Usually when making a new file, people copy some random other file
> to get the copyright header comments.  Unfortunately, some of them
> are commented in a decades-old style, are word wrapped poorly, or
> worse, have a few subtle variations in the text.  While we've tried
> to clean those up, we're not going to get every copy to be perfect.
> 
> Instead, this commit adds docs/copyright.c, which contains a copy of
> the license header which is well-formatted and has the correct text.
> The idea is that you can start from this when making a new file, which
> should help with consistency.
> ---
>  docs/copyright.c | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
>  create mode 100644 docs/copyright.c
> 
> Hey all,
> 
> I noticed when writing my new Iris driver that I had a couple subtle
> variations of copyright headers creep in, even in a brand new project.
> Mostly word wrapping differences.  To combat that, I made a copyright.c
> and made sure to use it when I created new files.  It seemed to help.
> 
> So, the thinking is to just actually put that in the project under docs.
> Maybe it helps other people as well?
> 

Should we let people know about this file by adding a note in
docs/devinfo.html?

To help people who don't always keep up w/ the documentation, I was
initially thinking we could add a git hook. I think that'd cause
problems when importing code from elsewhere, though.

>  --Ken
> 
> diff --git a/docs/copyright.c b/docs/copyright.c
> new file mode 100644
> index 00000000000..db92f27e641
> --- /dev/null
> +++ b/docs/copyright.c
> @@ -0,0 +1,22 @@
> +/*
> + * Copyright © 2018 <Insert Name Here>
		   ^
		   <Insert Year Here> ?

-Nanley

> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice shall be included
> + * in all copies or substantial portions of the Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
> + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> + * DEALINGS IN THE SOFTWARE.
> + */
> +
> -- 
> 2.19.0
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Quoting Kenneth Graunke (2018-10-19 18:51:36)
> Usually when making a new file, people copy some random other file
> to get the copyright header comments.  Unfortunately, some of them
> are commented in a decades-old style, are word wrapped poorly, or
> worse, have a few subtle variations in the text.  While we've tried
> to clean those up, we're not going to get every copy to be perfect.
> 
> Instead, this commit adds docs/copyright.c, which contains a copy of
> the license header which is well-formatted and has the correct text.
> The idea is that you can start from this when making a new file, which
> should help with consistency.
> ---
>  docs/copyright.c | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
>  create mode 100644 docs/copyright.c
> 
> Hey all,
> 
> I noticed when writing my new Iris driver that I had a couple subtle
> variations of copyright headers creep in, even in a brand new project.
> Mostly word wrapping differences.  To combat that, I made a copyright.c
> and made sure to use it when I created new files.  It seemed to help.
> 
> So, the thinking is to just actually put that in the project under docs.
> Maybe it helps other people as well?

May I suggest spdx.org and in particular using a format such as

/* SPDX: MIT */

with a toplevel description of what the link means. From a dev point of
view, it's much quicker to see what licence variant is being used and
even harder for mistakes to creep in.
-Chris
On Friday, 2018-10-19 20:43:44 +0100, Chris Wilson wrote:
> Quoting Kenneth Graunke (2018-10-19 18:51:36)
> > Usually when making a new file, people copy some random other file
> > to get the copyright header comments.  Unfortunately, some of them
> > are commented in a decades-old style, are word wrapped poorly, or
> > worse, have a few subtle variations in the text.  While we've tried
> > to clean those up, we're not going to get every copy to be perfect.
> > 
> > Instead, this commit adds docs/copyright.c, which contains a copy of
> > the license header which is well-formatted and has the correct text.
> > The idea is that you can start from this when making a new file, which
> > should help with consistency.
> > ---
> >  docs/copyright.c | 22 ++++++++++++++++++++++
> >  1 file changed, 22 insertions(+)
> >  create mode 100644 docs/copyright.c
> > 
> > Hey all,
> > 
> > I noticed when writing my new Iris driver that I had a couple subtle
> > variations of copyright headers creep in, even in a brand new project.
> > Mostly word wrapping differences.  To combat that, I made a copyright.c
> > and made sure to use it when I created new files.  It seemed to help.
> > 
> > So, the thinking is to just actually put that in the project under docs.
> > Maybe it helps other people as well?
> 
> May I suggest spdx.org and in particular using a format such as
> 
> /* SPDX: MIT */
> 
> with a toplevel description of what the link means. From a dev point of
> view, it's much quicker to see what licence variant is being used and
> even harder for mistakes to creep in.
> -Chris

Agreed, this actually solves the issue. I had been thinking about
replacing all the variants of MIT copies around Mesa et al since a year
or so ago when that was done in the kernel, but I had kinda forgotten
about it.

As is, you're essentially suggesting https://xkcd.com/927
I think removing the source of the problem is a much better solution ;)