-
Laszlo Ersek authored
We've been advised to state Red Hat's Copyright as Copyright Red Hat In order to collect our current copyright notices, I've used the following "loose options" for git-grep (bash syntax): loose_options=(-i -e copyright --and -e 'red.?hat') Namely, the command git grep -h "${loose_options[@]}" produces 464 matches (lines) in libnbd @ d169661119f6, and 861 matches (lines) in nbdkit @ e36cfb6f. Lest we replace strings too broadly, define the "strict pattern" as follows (note that we assume LC_ALL=en_US.UTF-8): year='20[0-2][0-9]' year_range="$year(-$year)?" year_range_list="$year_range(, $year_range)*" year_range_list_opt="( $year_range_list)?" c_sym='(\(C\)|©)' company='Red Hat,? Inc\.' strict_pattern="[Cc]opyright $c_sym$year_range_list_opt $company" The command git grep -h "${loose_options[@]}" \ | grep -E -v -- "$strict_pattern" produces zero lines in each of nbdkit and libnbd, meaning that the "strict pattern" covers all matches from the "loose options". Assuming that our filenames do not contain newline characters, replace the copyright notices with the following command: git grep -l "${loose_options[@]}" \ | sponge \ | tr '\n' '\0' \ | xargs -0 -r -- sed -i -E -e "s/$strict_pattern/Copyright Red Hat/" -- The resultant diffstat in each project shows that all notices have been replaced (note that some files contain multiple notices, therefore the number of files modified is less than the number of lines modified). Signed-off-by: Laszlo Ersek <lersek@redhat.com>
712fe24c
Loading