Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

copyright: Apply substitutions only to current-year entries, and disallow future year insertion #12516

Conversation

jayaddison
Copy link
Contributor

@jayaddison jayaddison commented Jul 7, 2024

Feature or Bugfix

  • Bugfix

Purpose

  • Allow downstream projects to opt-out of copyright year substitution using a configuration setting.
  • Reduce the number of cases where substitution occurs -- ideally only to cases where the downstream project has configured the current year to appear dynamically in conf.py.
  • Achieve both of the above without directly affecting the number of downstream projects that build reproducibly.

Detail

  • Adds a default-enabled copyright_build_year_substitution config setting.
  • Only replaces copyright years that match the system's local clock time year. This is intended to match against the vast majority of downstream dynamic conf.py copyright notices that are configured to contain datetime.today().year or similar as current-year.
  • Only replace copyright years when the SOURCE_DATE_EPOCH (build time) is greater than less than the matching copyright notice year.
    • Rationale: an end-year in a copyright line represents a publication year. It isn't valid to project a copyright line's end-year value into the future.

Relates

Edit: logical fixup for greater-than vs less-than condition.
Edit: typo fixup
Edit: remove config setting changes

…tution:

  1. The ``SOURCE_DATE_EPOCH`` year must be greater than the local system-clock year.

  2. The year(s) to be substituted must match the local system-clock year.
@jayaddison jayaddison marked this pull request as ready for review July 7, 2024 21:18
doc/usage/configuration.rst Outdated Show resolved Hide resolved
@jayaddison jayaddison changed the title Config: add further preconditions before copyright notice year substitution occurs. [config] Add further preconditions before copyright notice year substitution occurs. Jul 8, 2024
@jayaddison
Copy link
Contributor Author

  • Opening initially in 'draft' status because I'd like feedback on it - I'll likely also reference the suggested logic here in an upcoming Reproducible Builds mailing list thread.

A belated note that this discussion has begun, and can be found at: https://lists.reproducible-builds.org/pipermail/rb-general/2024-July/003458.html

@jayaddison

This comment was marked as outdated.

@jayaddison jayaddison changed the title [config] Add further preconditions before copyright notice year substitution occurs. [config] Add further preconditions before copyright notice year substitution occurs Jul 23, 2024
@jayaddison jayaddison changed the title [config] Add further preconditions before copyright notice year substitution occurs config: Add further preconditions before copyright notice year substitution occurs Aug 5, 2024
jayaddison and others added 4 commits September 28, 2024 22:16
…ution-preconditions

Conflicts:
	CHANGES.rst
	tests/test_config/test_config.py
	tests/test_config/test_correct_year.py
…ution-preconditions

# Conflicts:
#	CHANGES.rst
@AA-Turner
Copy link
Member

AA-Turner commented Oct 3, 2024

I've pushed a commit to simplify the replacements a bit, but I'm not happy with the tests at present -- we should keep the current tests and add the new ones on top, rather than replacing. I'm working on this now.

A

…ution-preconditions

# Conflicts:
#	tests/test_config/test_config.py
#	tests/test_config/test_correct_year.py
@AA-Turner
Copy link
Member

I'm happier with the current state, but will hold off on merging in case I've missed a test case or scenerio that you think is important to test.

A

CHANGES.rst Outdated Show resolved Hide resolved
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
@jayaddison jayaddison changed the title config: Add further preconditions before copyright notice year substitution occurs config: Only perform copyright substitution on entries that match the system clock year Oct 3, 2024
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
@jayaddison jayaddison changed the title config: Only perform copyright substitution on entries that match the system clock year config: Limit copyright substitution to entries matching the system clock year, and prevent substitution of future years Oct 3, 2024
@jayaddison jayaddison changed the title config: Limit copyright substitution to entries matching the system clock year, and prevent substitution of future years copyright: Apply substitutions only to current-year entries, and disallow future year insertion Oct 3, 2024
@jayaddison
Copy link
Contributor Author

@AA-Turner Ok, this is ready from my perspective. Thanks for adding some momentum to it.

@AA-Turner AA-Turner merged commit a84f700 into sphinx-doc:master Oct 4, 2024
23 checks passed
@AA-Turner
Copy link
Member

Thank you @jayaddison -- I'll update #12910, do review that PR if you have time.

A

@jayaddison
Copy link
Contributor Author

Thanks very much @AA-Turner - and will do 👍

@jayaddison jayaddison deleted the issue-12451/reproducible-copyright-substitution-preconditions branch October 4, 2024 09:56
@AA-Turner AA-Turner added this to the 8.1.x milestone Oct 6, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[config] Support more precise build-year copyright substitution
2 participants