Message ID | 56C87280.2000509@mentor.com |
---|---|
State | New |
Headers | show |
On 20/02/16 15:04, Tom de Vries wrote: > Hi, > > this patch adds a script contrib/fix-ChangeLog.sh. > > It fixes whitespace issues, and shows ChangeLog lines that look suspicious. > > Using the script, I was able to find a stray changelog entry (removed in > rr233583, https://gcc.gnu.org/viewcvs?rev=233583&root=gcc&view=rev ). > > And I've [ slip of the keyboard ] cleaned up a few ChangeLogs using the script (r233584 - r233587): ChangeLog, gcc/ChangeLog, gcc/testsuite/ChangeLog, libgomp/ChangeLog. > > Any comments? > > Thanks, > - Tom > > 0001-Add-contrib-fix-ChangeLog.sh.patch > > > Add contrib/fix-ChangeLog.sh > > --- > contrib/fix-ChangeLog.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 42 insertions(+) > > diff --git a/contrib/fix-ChangeLog.sh b/contrib/fix-ChangeLog.sh > new file mode 100755 > index 0000000..b09ab83 > --- /dev/null > +++ b/contrib/fix-ChangeLog.sh > @@ -0,0 +1,42 @@ > +#!/bin/sh > + > +f="$1" > + > +# Make white-space-only lines empty > +sed -i 's/^[ \t]*$//' "$f" > + > +# Remove trailing whitespace > +sed -i 's/[ \t]*$//' "$f" > + > +# Replace 8/16 spaces at start of line with tab(s) > +sed -i 's/^ /\t/' "$f" > +sed -i 's/^ /\t\t/' "$f" > + > +# Replace 1-7 spaces followed by tab at start of line with tab > +sed -i 's/^ \t/\t/' "$f" > +sed -i 's/^ \t/\t/' "$f" > +sed -i 's/^ \t/\t/' "$f" > +sed -i 's/^ \t/\t/' "$f" > +sed -i 's/^ \t/\t/' "$f" > +sed -i 's/^ \t/\t/' "$f" > +sed -i 's/^ \t/\t/' "$f" > + > +# Replace 1-7 spaces at start of line with tab > +sed -i 's/^ /\t/' "$f" > +sed -i 's/^ /\t/' "$f" > +sed -i 's/^ /\t/' "$f" > +sed -i 's/^ /\t/' "$f" > +sed -i 's/^ /\t/' "$f" > +sed -i 's/^ /\t/' "$f" > +sed -i 's/^ /\t/' "$f" > + > +# Remove duplicate empty lines > +sed -i '/^$/N;/^\n$/D' "$f" > + > +# Detect lines that are not allowed. > +# Allowed are: > +# - '^$' : empty line > +# - '^<TAB>' : tab at start of line > +# - '^[a-zA-Z0-9]' : line starting with letter or number > +# - '^<^L>$' : form feed line > +egrep -H -C2 -v '^$|^ |^[a-zA-Z0-9]|^$' "$f" >
On 02/20/2016 07:12 AM, Tom de Vries wrote: > On 20/02/16 15:04, Tom de Vries wrote: >> Hi, >> >> this patch adds a script contrib/fix-ChangeLog.sh. >> >> It fixes whitespace issues, and shows ChangeLog lines that look >> suspicious. >> >> Using the script, I was able to find a stray changelog entry (removed in >> rr233583, https://gcc.gnu.org/viewcvs?rev=233583&root=gcc&view=rev ). >> >> And I've > > [ slip of the keyboard ] > > cleaned up a few ChangeLogs using the script (r233584 - r233587): > ChangeLog, gcc/ChangeLog, gcc/testsuite/ChangeLog, libgomp/ChangeLog. > >> >> Any comments? >> >> Thanks, >> - Tom >> >> 0001-Add-contrib-fix-ChangeLog.sh.patch Seems useful to me as long as we continue to produce ChangeLogs. I'd still rather extract that from the VCS, but we're not at that point yet. Your call whether or not to do checking/fixup on the author line. jeff
On Mon, Feb 22, 2016 at 11:05:49AM -0700, Jeff Law wrote: > On 02/20/2016 07:12 AM, Tom de Vries wrote: > >On 20/02/16 15:04, Tom de Vries wrote: > >>Hi, > >> > >>this patch adds a script contrib/fix-ChangeLog.sh. > >> > >>It fixes whitespace issues, and shows ChangeLog lines that look > >>suspicious. > >> > >>Using the script, I was able to find a stray changelog entry (removed in > >>rr233583, https://gcc.gnu.org/viewcvs?rev=233583&root=gcc&view=rev ). > >> > >>And I've > > > >[ slip of the keyboard ] > > > >cleaned up a few ChangeLogs using the script (r233584 - r233587): > >ChangeLog, gcc/ChangeLog, gcc/testsuite/ChangeLog, libgomp/ChangeLog. > > > >> > >>Any comments? > >> > >>Thanks, > >>- Tom > >> > >>0001-Add-contrib-fix-ChangeLog.sh.patch > Seems useful to me as long as we continue to produce ChangeLogs. I'd still > rather extract that from the VCS, but we're not at that point yet. It would be nice to only have one copy of the data if we need to have that, but having them in commit messages make git log much less pleasent than it could be. I think the only hard part of generating ChangeLogs from commit messages once we've switched to git is enforcing a particular format on the changeLog data in the commit message. I have a rather hacky script that I use to apply ChangeLogs from my own commits assuming the data is formatted the way mklog prints it, and it should be pretty easy to go from there to running the script when making tarballs. Trev > > Your call whether or not to do checking/fixup on the author line. > > jeff >
Add contrib/fix-ChangeLog.sh --- contrib/fix-ChangeLog.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/contrib/fix-ChangeLog.sh b/contrib/fix-ChangeLog.sh new file mode 100755 index 0000000..b09ab83 --- /dev/null +++ b/contrib/fix-ChangeLog.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +f="$1" + +# Make white-space-only lines empty +sed -i 's/^[ \t]*$//' "$f" + +# Remove trailing whitespace +sed -i 's/[ \t]*$//' "$f" + +# Replace 8/16 spaces at start of line with tab(s) +sed -i 's/^ /\t/' "$f" +sed -i 's/^ /\t\t/' "$f" + +# Replace 1-7 spaces followed by tab at start of line with tab +sed -i 's/^ \t/\t/' "$f" +sed -i 's/^ \t/\t/' "$f" +sed -i 's/^ \t/\t/' "$f" +sed -i 's/^ \t/\t/' "$f" +sed -i 's/^ \t/\t/' "$f" +sed -i 's/^ \t/\t/' "$f" +sed -i 's/^ \t/\t/' "$f" + +# Replace 1-7 spaces at start of line with tab +sed -i 's/^ /\t/' "$f" +sed -i 's/^ /\t/' "$f" +sed -i 's/^ /\t/' "$f" +sed -i 's/^ /\t/' "$f" +sed -i 's/^ /\t/' "$f" +sed -i 's/^ /\t/' "$f" +sed -i 's/^ /\t/' "$f" + +# Remove duplicate empty lines +sed -i '/^$/N;/^\n$/D' "$f" + +# Detect lines that are not allowed. +# Allowed are: +# - '^$' : empty line +# - '^<TAB>' : tab at start of line +# - '^[a-zA-Z0-9]' : line starting with letter or number +# - '^<^L>$' : form feed line +egrep -H -C2 -v '^$|^ |^[a-zA-Z0-9]|^$' "$f"