Changeset 1813
- Timestamp:
- Apr 6, 2016 9:38:56 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SCRIPTS/document_changes
r1811 r1813 15 15 # PALM. If not, see <http://www.gnu.org/licenses/>. 16 16 # 17 # Copyright 1997-201 4Leibniz Universitaet Hannover17 # Copyright 1997-2016 Leibniz Universitaet Hannover 18 18 #------------------------------------------------------------------------------# 19 19 # 20 20 # Current revisions: 21 21 # ----------------- 22 # 22 # Added update of the copyright statements in the file headers. 23 23 # 24 24 # Former revisions: 25 25 # ----------------- 26 26 # $Id$ 27 # 27 # 28 28 # 1810 2016-04-05 20:25:29Z maronga 29 29 # document_changes now checks all subdirectories. Modified printing to screen. … … 58 58 comment_char=="!" #: comment character 59 59 count_changes=0 #: count the number of files with CR text 60 count_updates=0 #: count the number of files with copyright update 60 61 count_files=0 #: count the number of files 61 62 fn="" #: current file name to be scanned … … 73 74 list_delete="" #: contains the line no. that must be deleted from CR 74 75 timestamp="" #: the svn timestamp of the file 76 current_year=$(date +"%Y") 75 77 76 78 # … … 92 94 printf "\n *** Checking files in $input_dir and all recursive subdirectories...\n" 93 95 96 97 # 98 #-- scan all (sub-)directories for files. 94 99 IFS=$'\n'; 95 for fn in $(find $input_dir -not -name '*.pdf' -and -not -name '*.x' -and -not -name '*.eps' -and -not -name '*.png' -and -not -name '*.svn*'); do 96 97 # 98 #-- exclude backup and invisible files 100 for fn in $(find $input_dir -not -name '*.pdf' -and -not -name '*.x' \ 101 -and -not -name '*.eps' -and -not -name '*.png' \ 102 -and -not -name '*.svn*' -and -not -name '*~' \ 103 -and -not -name '*.tar'); do 104 105 # 106 #-- exclude invisible files 99 107 file_firstchar=${fn:0:1} 100 108 file_lastchar=`echo -n $fn| tail -c -1` 101 109 file_extension=${fn##*.} 102 if [[ "$file_firstchar" == "." || "$file_extension" == "x" || "$file_lastchar" == "~" || "$file_extension" == "tar"]]110 if [[ "$file_firstchar" == "." ]] 103 111 then 104 112 continue … … 115 123 116 124 # 117 #-- read one line at a time 125 #-- read one line at a time and move revision comments 118 126 while read line 119 127 do … … 176 184 done <"$fn" 177 185 186 187 188 # 189 #-- check for updates of the copyright statement 190 found_update_year=false 191 192 while read line 193 do 194 195 line_tmp="" 196 line_tmp2="" 197 line_tmp=${line:22:29} 198 line_tmp2=${line:2:15} 199 200 # echo "$line_tmp $line_tmp2" 201 202 if [[ "$line_tmp" == "Leibniz Universitaet Hannover" && "$line_tmp2" == "Copyright 1997-" ]] 203 then 204 205 year_in_file=${line:17:4} 206 if [[ "$year_in_file" != "$current_year" ]] 207 then 208 209 printf "\r%$(tput cols)s" " " 210 printf "\r \e[1;33m*** Copyright update required in $fn\e[0m\n" 211 212 comment_char=${line:0:1} 213 found_update_year=true 214 cp $fn $fn~ 215 216 fi 217 fi 218 219 done <"$fn" 220 178 221 printf "\r%$(tput cols)s" " " 179 printf "\r\e[1m *** Searched files: $count_files. Comments found: $count_changes \e[0m."222 printf "\r\e[1m *** Searched files: $count_files. Comments found: $count_changes. Copyright updates found: $count_updates\e[0m" 180 223 181 224 # … … 200 243 fi 201 244 245 # 246 #-- move comments from current revisions to former revisions 247 if [[ "$found_update_year" == true ]] 248 then 249 250 (( count_updates = count_updates + 1 )) 251 252 sed -i "s/$comment_char Copyright 1997-.*Leibniz Universitaet Hannover/$comment_char Copyright 1997-$current_year Leibniz Universitaet Hannover/" $fn 253 254 fi 255 202 256 done 203 257 … … 205 259 #-- inform the user about the changes 206 260 printf "\r%$(tput cols)s" " " 207 printf "\r\e[1m *** Searched files: $count_files. Comments found: $count_changes \e[0m. - \e[1;32mfinished.\e[0m\n\n"261 printf "\r\e[1m *** Searched files: $count_files. Comments found: $count_changes. Copyright updates found: $count_updates\e[0m. - \e[1;32mfinished.\e[0m\n\n" 208 262 209 263 if [[ $count_changes -gt 0 ]]
Note: See TracChangeset
for help on using the changeset viewer.