diff options
author | Albert Cheng <acheng@hdfgroup.org> | 2005-11-01 16:59:59 (GMT) |
---|---|---|
committer | Albert Cheng <acheng@hdfgroup.org> | 2005-11-01 16:59:59 (GMT) |
commit | ea9707ccdf1b77d9444c1317a5240219a44b6c65 (patch) | |
tree | 1462e4bda16761eda0a67853b956c5c3fa88e1a1 /bin | |
parent | c931d254998f283b4bbc4f0484569c0053a24a1c (diff) | |
download | hdf5-ea9707ccdf1b77d9444c1317a5240219a44b6c65.zip hdf5-ea9707ccdf1b77d9444c1317a5240219a44b6c65.tar.gz hdf5-ea9707ccdf1b77d9444c1317a5240219a44b6c65.tar.bz2 |
[svn-r11652] Purpose:
Improvement
Description:
The copyright notice of some files may contain some white spaces such
as tabs, trailing blanks and \r (common in Windows files). Diff will
flag them as not matching. Could not just use -b or -w of diff because
it will ignore embedded spaces and could not handle \r anyway.
Solution:
Added a RINSE function will remove all \r and trailing spaces and
expand tabs to proper number of spaces. Now, diff can compare without
worry of cosmetic white spaces.
Platforms tested:
heping, applying on a Windows/copy_hdf.bat file.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/chkcopyright | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/bin/chkcopyright b/bin/chkcopyright index aa4098f..ccd3fe2 100755 --- a/bin/chkcopyright +++ b/bin/chkcopyright @@ -257,6 +257,19 @@ PARSE_OPTION() } +# Rinse the file by, +# removing all \r which is often present in Windows files; +# replace tabs with equivalent spaces; +# removing all trailing spaces. +# $1 is the file to be rinsed. +RINSE() +{ + rf=$1 + cp $rf $tmpfile + dos2unix < $tmpfile | expand | sed -e 's/ *$//' > $rf +} + + # Match Copyright notice. # $1 file which contains the expected copyright notice. # $2 file in which to look for the copyright notice. @@ -277,6 +290,7 @@ MATCH_COPYRIGHT() nlines=`wc -l < ${COPYRIGHTFILE}| tr -d ' '` head -$NUMBEGINLINES < $f | sed -n -e "/${COPYRIGHTSTR}/"',$p' | \ head -${nlines} > ${EXTRACTEDFILE} + RINSE ${EXTRACTEDFILE} $DIFF ${EXTRACTEDFILE} ${COPYRIGHTFILE} >/dev/null 2>&1 if test $? -eq 0; then echo PASSED @@ -331,7 +345,8 @@ HTML_FILE() COPYRIGHTFILE=$HTM_COPYRIGHT # Must use stdin for wc to prevent filename from popping up. nlines=`wc -l < ${COPYRIGHTFILE}| tr -d ' '` - sed -n -e '/^<!--$/,/^ -->$/p' < $f | head -${nlines} > ${EXTRACTEDFILE} + sed -n -e '/^<!--/,/^ -->/p' < $f | head -${nlines} > ${EXTRACTEDFILE} + RINSE ${EXTRACTEDFILE} $DIFF ${EXTRACTEDFILE} ${COPYRIGHTFILE} >/dev/null 2>&1 if test $? -ne 0; then # show the differences @@ -501,8 +516,8 @@ while read file; do # Ignore binary data files continue ;; - *.zip | *.dsp | *.dsw) - # Ignore Windows binary files + *.zip | *.dsp | *.dsw | *.js) + # Ignore Windows binary or special files. continue ;; *CVS/* ) |