[PATCHv3] Fix copyright year
diff mbox series

Message ID 20241015165006.1547318-2-libcamerabmw+ml@lsmod.de
State Accepted
Commit ae51d304685787041fdc862d1391d53c2df7d0da
Headers show
Series
  • [PATCHv3] Fix copyright year
Related show

Commit Message

Bernhard M. Wiedemann Oct. 15, 2024, 4:50 p.m. UTC
From: "Bernhard M. Wiedemann" <bwiedemann@suse.de>

without this patch, openSUSE's debugsource package would vary over time,
breaking reproducible builds.
Also a copyright of 2025 is factually wrong,
because nobody did anything copyright-worthy in that year.
If updating the year manually is too hard (it is optional anyway),
using the mtime of input file(s) could work as well.

By moving the year to tracepoints.h.in it can easily be updated
along with the content.

The diff was:
/usr/src/debug/libcamera-0.3.1/x86_64-suse-linux/include/libcamera/internal/tracepoints.h       2024-08-20 09:37:46.000000000 +0200
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 /*
- * Copyright (C) 2024, Google Inc.
+ * Copyright (C) 2025, Google Inc.

Signed-off-by: Bernhard M. Wiedemann <bwiedemann@suse.de>
---
 include/libcamera/internal/tracepoints.h.in | 2 +-
 utils/codegen/gen-tp-header.py              | 4 +---
 2 files changed, 2 insertions(+), 4 deletions(-)

Comments

Laurent Pinchart Oct. 16, 2024, 5:15 p.m. UTC | #1
Hi Bernhard,

Thank you for the patch.

The subject line should read

libcamera: tracepoints: Fix copyright year for reproducible builds

or something like that. checkstyle.py should have mentioned that the
subject line is missing a prefix. You can automate running checkstyle.py
by installing the git post-commit hook with

cp utils/hooks/post-commit .git/hooks/post-commit

On Tue, Oct 15, 2024 at 06:50:07PM +0200, libcamerabmw+ml@lsmod.de wrote:
> From: "Bernhard M. Wiedemann" <bwiedemann@suse.de>
> 
> without this patch, openSUSE's debugsource package would vary over time,
> breaking reproducible builds.
> Also a copyright of 2025 is factually wrong,
> because nobody did anything copyright-worthy in that year.
> If updating the year manually is too hard (it is optional anyway),
> using the mtime of input file(s) could work as well.
> 
> By moving the year to tracepoints.h.in it can easily be updated
> along with the content.
> 
> The diff was:
> /usr/src/debug/libcamera-0.3.1/x86_64-suse-linux/include/libcamera/internal/tracepoints.h       2024-08-20 09:37:46.000000000 +0200
> @@ -1,6 +1,6 @@
>  /* SPDX-License-Identifier: LGPL-2.1-or-later */
>  /*
> - * Copyright (C) 2024, Google Inc.
> + * Copyright (C) 2025, Google Inc.

I have a hard time parsing the commit message, I don't see where "2025"
comes from here. Also, now that we've settled on not updating the year,
I think the mention of mtime is not applicable anymore. How about the
following commit message ?

---
libcamera: tracepoints: Fix copyright year for reproducible builds

The tracepoints.h file is generated from the tracepoints.h.in template
by the gen-tp-header.py script. The template contains a {{year}}
placeholder for the copyright year, which the script fills with the
current year. This breaks reproducible builds with at least the openSUSE
debugsource package.

As the gen-tp-header.py script doesn't add any copyrightable contents to
the tracepoints.h file, fix this by replacing the {{year}} placeholder
with the year of the last copyright-worthy change to tracepoints.h.in.
---

If you're fine with this, you can reply with an ack instead of sending a
v4 and I'll update the commit message when applying the patch.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> Signed-off-by: Bernhard M. Wiedemann <bwiedemann@suse.de>
> ---
>  include/libcamera/internal/tracepoints.h.in | 2 +-
>  utils/codegen/gen-tp-header.py              | 4 +---
>  2 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/include/libcamera/internal/tracepoints.h.in b/include/libcamera/internal/tracepoints.h.in
> index f0962091..385f9f54 100644
> --- a/include/libcamera/internal/tracepoints.h.in
> +++ b/include/libcamera/internal/tracepoints.h.in
> @@ -1,6 +1,6 @@
>  /* SPDX-License-Identifier: LGPL-2.1-or-later */
>  /*
> - * Copyright (C) {{year}}, Google Inc.
> + * Copyright (C) 2020, Google Inc.
>   *
>   * Tracepoints with lttng
>   *
> diff --git a/utils/codegen/gen-tp-header.py b/utils/codegen/gen-tp-header.py
> index 83606c32..6769c7ce 100755
> --- a/utils/codegen/gen-tp-header.py
> +++ b/utils/codegen/gen-tp-header.py
> @@ -6,7 +6,6 @@
>  #
>  # Generate header file to contain lttng tracepoints
>  
> -import datetime
>  import jinja2
>  import pathlib
>  import os
> @@ -20,7 +19,6 @@ def main(argv):
>      output = argv[2]
>      template = argv[3]
>  
> -    year = datetime.datetime.now().year
>      path = pathlib.Path(output).absolute().relative_to(argv[1])
>  
>      source = ''
> @@ -28,7 +26,7 @@ def main(argv):
>          source += open(fname, 'r', encoding='utf-8').read() + '\n\n'
>  
>      template = jinja2.Template(open(template, 'r', encoding='utf-8').read())
> -    string = template.render(year=year, path=path, source=source)
> +    string = template.render(path=path, source=source)
>  
>      f = open(output, 'w', encoding='utf-8').write(string)
>
Bernhard M. Wiedemann Oct. 17, 2024, 2:46 a.m. UTC | #2
On 16/10/2024 19.15, Laurent Pinchart wrote:
> The template contains a {{year}} placeholder

Ack.

Though I would use past tense:
The template contained a {{year}} placeholder
Kieran Bingham Oct. 17, 2024, 1:39 p.m. UTC | #3
Quoting Bernhard M. Wiedemann (2024-10-17 03:46:10)
> 
> 
> On 16/10/2024 19.15, Laurent Pinchart wrote:
> > The template contains a {{year}} placeholder
> 
> Ack.
> 
> Though I would use past tense:
> The template contained a {{year}} placeholder

We use the imperative for commit messages. i.e.

"The template contains a {{year}} place holder which prevents
reproducible builds. Change it to be a hardcoded value based on the
actual copyright modifications..."

This patch is 'doing' the change, it didn't do it in the past.

https://cbea.ms/git-commit/#imperative (Well, all of those points) are
my usual reference for writing commit messages.

--
Kieran

Patch
diff mbox series

diff --git a/include/libcamera/internal/tracepoints.h.in b/include/libcamera/internal/tracepoints.h.in
index f0962091..385f9f54 100644
--- a/include/libcamera/internal/tracepoints.h.in
+++ b/include/libcamera/internal/tracepoints.h.in
@@ -1,6 +1,6 @@ 
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 /*
- * Copyright (C) {{year}}, Google Inc.
+ * Copyright (C) 2020, Google Inc.
  *
  * Tracepoints with lttng
  *
diff --git a/utils/codegen/gen-tp-header.py b/utils/codegen/gen-tp-header.py
index 83606c32..6769c7ce 100755
--- a/utils/codegen/gen-tp-header.py
+++ b/utils/codegen/gen-tp-header.py
@@ -6,7 +6,6 @@ 
 #
 # Generate header file to contain lttng tracepoints
 
-import datetime
 import jinja2
 import pathlib
 import os
@@ -20,7 +19,6 @@  def main(argv):
     output = argv[2]
     template = argv[3]
 
-    year = datetime.datetime.now().year
     path = pathlib.Path(output).absolute().relative_to(argv[1])
 
     source = ''
@@ -28,7 +26,7 @@  def main(argv):
         source += open(fname, 'r', encoding='utf-8').read() + '\n\n'
 
     template = jinja2.Template(open(template, 'r', encoding='utf-8').read())
-    string = template.render(year=year, path=path, source=source)
+    string = template.render(path=path, source=source)
 
     f = open(output, 'w', encoding='utf-8').write(string)