#9567 closed task (fixed)
Script to update Trac copyright date in license header of source files
Reported by: | anonymous | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | low | Milestone: | 1.0.18 |
Component: | project | Version: | |
Severity: | minor | Keywords: | bitesized |
Cc: | Thijs Triemstra | Branch: | |
Release Notes: | |||
API Changes: |
Added |
||
Internal Changes: |
Description
Copyright © 2003-2008 Edgewall Software All rights reserved.
http://trac.edgewall.org/wiki/TracLicense
update this :)
Attachments (1)
Change History (32)
comment:1 by , 14 years ago
Milestone: | → not applicable |
---|
comment:3 by , 14 years ago
Only if the patch contains a script that automates the process on the source files :)
comment:4 by , 14 years ago
Summary: | Trac License → Script to update Trac copyright date in license header of source files |
---|
Adding more details to summary.
follow-up: 7 comment:5 by , 14 years ago
Cc: | added; removed |
---|---|
Milestone: | not applicable → 0.12.2 |
Can the attached patch be applied to 0.12.2 before it's released?
comment:7 by , 14 years ago
Replying to thijstriemstra:
Can the attached patch be applied to 0.12.2 before it's released?
TracLicense was updated. The user-visible copyright years have been updated in [10502]. As for the copyrights at the top of the files, I would still prefer having a script that automates the process, to be placed in contrib
.
comment:8 by , 14 years ago
Milestone: | 0.12.2 → not applicable |
---|
Moving it back to it's old milestone.
comment:9 by , 12 years ago
Priority: | highest → low |
---|---|
Severity: | critical → minor |
comment:10 by , 11 years ago
Cc: | added |
---|
comment:11 by , 11 years ago
Cc: | removed |
---|---|
Milestone: | not applicable → 1.0.3 |
Owner: | set to |
Status: | new → assigned |
comment:12 by , 10 years ago
Milestone: | 1.0.3 → next-stable-1.0.x |
---|---|
Owner: | removed |
Status: | assigned → new |
comment:13 by , 9 years ago
Milestone: | next-stable-1.0.x → next-major-releases |
---|
comment:14 by , 9 years ago
Keywords: | bitesized added |
---|
comment:15 by , 6 years ago
Milestone: | next-major-releases → 1.0.18 |
---|
Here is a sed
one-liner for updating py files copyright to YEAR:
$ YEAR=2018 find . -name "*.py" -type f -exec sed -i '' 's/^\(# Copyright .*20[01][0-9]-\)\(20[01][0-9]\)\( Edgewall\)/\1'$YEAR'\3/g' {} \;
comment:16 by , 6 years ago
comment:17 by , 6 years ago
Owner: | set to |
---|---|
Status: | new → assigned |
comment:18 by , 6 years ago
API Changes: | modified (diff) |
---|
Proposed changes:
-
Makefile
diff --git a/Makefile b/Makefile index 2742b2b6a..35356de85 100644
a b define HELP_release 586 586 release-clean remove the packages 587 587 588 588 update-help fetches latest help/guide from Edgewall 589 update-copyright update copyright year in file headers 589 590 checksum MD5 and SHA1 checksums of packages of given version 590 591 upload scp the packages of given version to user@lynx:~/dist 591 592 … … endef 595 596 export HELP_release 596 597 597 598 .PHONY: release release-src wheel dist release-exe wininst 598 .PHONY: release-clean checksum update- help upload599 .PHONY: release-clean checksum update-copyright update-help upload 599 600 600 601 ifeq "$(OS)" "Windows_NT" 601 602 release: release-exe … … else 664 665 ) 665 666 endif 666 667 668 copyright_re := "s/^($$PREFIX)(Copyright \(C\) 20[01][0-9])(-20[01][0-9])?$\ 669 ( Edgewall Software)/\1\2-$(year)\4/g" 670 671 update-copyright: 672 ifeq "$(year)" "" 673 $(error "specify year= on the make command-line") 674 else 675 @PREFIX="<!--! "; find . -type f -name "*.html" \ 676 -exec sed -i '' -E $(copyright_re) {} \; 677 @PREFIX="\# "; find . -type f \ 678 \( -name "*.py" -o -name "*.ps1" -o -name "*.cgi" -o -name "*.fcgi" \) \ 679 -exec sed -i '' -E $(copyright_re) {} \; 680 @PREFIX="\# "; sed -i '' -E $(copyright_re) \ 681 contrib/trac-svn-hook contrib/trac-pre-commit-hook 682 @PREFIX=":: "; sed -i '' -E $(copyright_re) \ 683 contrib/trac-svn-post-commit-hook.cmd 684 @PREFIX=; sed -i '' -E $(copyright_re) COPYING 685 endif 686 667 687 update-help: 668 688 @python contrib/checkwiki.py -d --prefix=$(prefix) 669 689 @python contrib/wiki2rst.py TracUpgrade > UPGRADE
Let me know if you notice any other files that need an update of the year in the file header.
DONE Update TracDev/ReleaseChecklist#Otherrepositoryfiles.
comment:19 by , 6 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Makefile changes committed in [16809:16811].
File header changes in [16812:16814].
comment:20 by , 6 years ago
For reference, I used the trick in SO:50863019/121694 to split the copyright_re
regex across multiple lines. There are some warnings about using the undocumented/undefined behavior, but if this fails in the future it will be easy to modify.
follow-up: 22 comment:21 by , 6 years ago
How about a python contrib/update-copyright.py
based on SO?
comment:22 by , 6 years ago
Replying to anonymous:
How about a
python contrib/update-copyright.py
based on SO?
+1. The -i
option of sed
is not portable between BSD sed and GNU sed.
$ sed --version | head -1 sed (GNU sed) 4.2.2 $ make update-copyright year=2019 sed: can't read s/^(<!--! )(Copyright \(C\) 20[01][0-9])(-20[01][0-9])?( Edgewall Software)$/\1\2-2019\4/g: No such file or directory ... sed: can't read s/^(\# )(Copyright \(C\) 20[01][0-9])(-20[01][0-9])?( Edgewall Software)$/\1\2-2019\4/g: No such file or directory Makefile:675: recipe for target 'update-copyright' failed make: *** [update-copyright] Error 2
Other suggestions:
- Copyright years in
*.po
files should be replaced. - In addition, I think it is good that copyright years in about.html and console.py would be replaced by
update-copyright
task.
comment:23 by , 6 years ago
The suggestions and porting to Python sound good to me, but I'm probably not going to spend any more time on this in the near future since the sed
in the makefile gets the job done for me on OSX and there are numerous other things to work on.
comment:24 by , 6 years ago
I tried compatibility fix without porting to Python script, [aa4a860a8/jomae.git] (jomae.git@t9567.1). Tested with OSX 10.14.3 and Ubuntu 16.04.5.
comment:25 by , 6 years ago
Those changes work well for me on OSX 10.14.3. Thanks for fixing the issue.
Edited TracDev/ReleaseChecklist@137.
comment:27 by , 5 years ago
make update-copyright
needs to adapt to Jinja2 templates. I'll push the change later.
-
Makefile
diff --git a/Makefile b/Makefile index cd4c5a4cc..bef73981e 100644
a b else 776 776 && echo 1), \ 777 777 sed --in-place= -r -e, \ 778 778 sed -i '' -E)) 779 @PREFIX="<!--! "; find . -type f -name "*.html" \ 779 @PREFIX="<!--!\s+"; find . -type f -name "*.html" \ 780 -exec $(SED) $(copyright_re) {} \; 781 @PREFIX="\{\#\s+"; find . -type f -name "*.html" \ 780 782 -exec $(SED) $(copyright_re) {} \; 781 783 @PREFIX="\# "; find . -type f \ 782 784 \( -name "*.py" -o -name "*.po" -o -name "*.pot" -o \
follow-up: 31 comment:28 by , 5 years ago
comment:27 change committed to 1.4-stable in r17292, merged to trunk in r17293.
comment:29 by , 5 years ago
Copyright line of trunk/contrib/trac-svn-post-commit-hook.cmd@17023 isn't getting updated when running make update-copyright
on OSX. The svn:eol-style
is CRLF (11490). Options:
- Change
svn:eol-style
to native. - Modify the regex:
-
Makefile
diff --git a/Makefile b/Makefile index bef73981e..1e2117ac2 100644
a b else 765 765 endif 766 766 767 767 copyright_re := "s/^($$PREFIX)(Copyright \(C\) 20[0-9][0-9])(-20[0-9][0-9])?$\ 768 ( Edgewall Software )$$/\1\2-$(year)\4/g"768 ( Edgewall Software[\r]?)$$/\1\2-$(year)\4/g" 769 769 770 770 update-copyright: 771 771 ifeq "$(year)" ""
-
After the change is committed I'll update the copyright on 1.0-stable and 1.2-stable.
comment:30 by , 5 years ago
Updated copyright on 1.0-stable in r17305, on 1.2-stable in r17307.
Fixed lines containing CRLF not matched in r17306, merged in [17308:17310].
comment:31 by , 5 years ago
Replying to Ryan J Ollos:
comment:27 change committed to 1.4-stable in r17292, merged to trunk in r17293.
In [17293#file36] I accidentally reverted a change r17290. This was fixed in r17328.
Done, thanks. We should probably also update all source files.