Ignore:
Timestamp:
Mar 31, 2020 6:55:54 PM (5 years ago)
Author:
maronga
Message:

Bugfix for copyright updates in document_changes; copyright update applied to all files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SCRIPTS/document_changes

    r4370 r4481  
    2525# -----------------
    2626# $Id$
     27# Bugfix for copyright updates
     28#
     29# 4370 2020-01-10 14:00:44Z raasch
    2730# script made bash compatible
    2831#
     
    204207       done <"$fn"
    205208
    206        
    207        
     209
    208210#
    209211#--    check for updates of the copyright statement
    210        found_update_year=false
    211 
    212212       while read line
    213213       do
     
    216216          line_tmp2=""     
    217217          line_tmp=${line:22:29}
    218           line_tmp2=${line:2:15}
    219          
    220 #           echo "$line_tmp $line_tmp2"
    221          
    222           if  [[ "$line_tmp" == "Leibniz Universitaet Hannover" && "$line_tmp2" == "Copyright 1997-" ]]
    223           then
    224          
    225              year_in_file=${line:17:4}
    226              if  [[ "$year_in_file" != "$current_year" ]]
     218          line_tmp2=${line:2:10}
     219
     220          if  [[ "$line_tmp2" == "Copyright " ]]
     221          then
     222             year_in_file1=${line:12:4}
     223             year_in_file2=${line:17:4}
     224             institution=${line:22}
     225
     226             if  [[ "$year_in_file2" != "$current_year" ]]
    227227             then
    228      
    229228                printf "\r%$(tput cols)s" " "   
    230229                printf "\r  \e[1;33m*** Copyright update required in $fn\e[0m\n"
    231230
    232231                comment_char=${line:0:1}
    233                 found_update_year=true             
    234232                cp $fn $fn~
    235                
     233
     234                (( count_updates = count_updates + 1 ))
     235                sed -i "s/$comment_char Copyright .*$institution/$comment_char Copyright $year_in_file1-$current_year $institution/" $fn
     236
    236237             fi
    237238          fi
    238        
     239
    239240       done <"$fn"
    240          
     241
    241242       printf "\r%$(tput cols)s" " "   
    242243       printf "\r\e[1m  *** Searched files: $count_files. Comments found: $count_changes. Copyright updates found: $count_updates\e[0m"
    243        
     244
    244245#
    245246#--    move comments from current revisions to former revisions
     
    252253#--       remove leading \n characters in string
    253254          comments=${comments:2}
    254  
    255  
    256          
     255
    257256#
    258257#--       fix old time stamp
     
    267266          (( line_stop = line_stop + 2 ))
    268267          sed -i "${line_stop}i$comments" $fn
    269          
     268
    270269
    271270
     
    279278       fi
    280279
    281 #
    282 #--    move comments from current revisions to former revisions
    283        if [[ "$found_update_year" == true ]]
    284        then
    285 
    286           (( count_updates = count_updates + 1 )) 
    287          
    288            sed -i "s/$comment_char Copyright 1997-.*Leibniz Universitaet Hannover/$comment_char Copyright 1997-$current_year Leibniz Universitaet Hannover/" $fn
    289      
    290        fi
    291        
    292280    done
    293281
Note: See TracChangeset for help on using the changeset viewer.