1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360
|
#!/bin/bash
###########################################################################
# addcopyright.sh
# ---------------------
# Date : May 2012
# Copyright : (C) 2012 by Juergen E. Fischer
# Email : jef at norbit dot de
###########################################################################
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
###########################################################################
# licensecheck -r src
export LC_TIME=C
set -e
if [ $# -gt 0 ]; then
FILES="$@"
elif [ -f files ]; then
FILES=$(<files)
else
echo no files
exit 1
fi
for i in $FILES; do
echo $i >&2
author=
authordate=
eval $(git log --reverse --pretty="export author='%an' authordate=\"\$(date --date='%ai' +'%%B %Y')\"" $i | head -1)
basename=$(basename $i)
authoryear=${authordate#* }
case $i in
# Override author if initial commit was by someone else
python/plugins/processing/*)
author=volayaf
;;
src/app/gps/qwtpolar-*|src/app/qtmain_android.cpp|src/core/gps/qextserialport/*|src/astyle/*|python/pyspatialite/*)
# Skip third party files
echo $f skipped
continue
;;
esac
case $author in
morb_au)
authorname="Brendan Morley"
authoremail="morb at ozemail dot com dot au"
;;
endmax)
authorname="Massimo Endrighi"
authoremail="massimo dot endrighi at geopartner dot it"
;;
rugginoso)
authorname="Lorenzo Masini"
authoremail="rugginoso at develer dot com"
;;
homann)
authorname="Magnus Homann"
authoremail="magnus at homann dot se"
;;
gsherman)
authorname="Gary Sherman"
authoremail="gsherman at geoapt dot com"
;;
kyngchaos)
authorname="William Kyngesburye"
authoremail="kyngchaos at kyngchaos dot com"
;;
volayaf)
authorname="Victor Olaya"
authoremail="volayaf at gmail dot com"
;;
jef|"Juergen E. Fischer")
authorname="Juergen E. Fischer"
authoremail="jef at norbit dot de"
;;
"Salvatore Larosa")
authorname="Salvatore Larosa"
authoremail="lrssvtml at gmail dot com"
;;
wonder|"Martin Dobias")
authorname="Martin Dobias"
authoremail="wonder dot sk at gmail dot com"
;;
"Marco Hugentobler"|mhugent)
authorname="Marco Hugentobler"
authoremail="marco dot hugentobler at sourcepole dot ch"
;;
"Pirmin Kalberer")
authorname="Pirmin Kalberer"
authoremail="pka at sourcepole dot ch"
;;
"Alexander Bruy")
authorname="Alexander Bruy"
authoremail="alexander dot bruy at gmail dot com"
;;
brushtyler|"Giuseppe Sucameli")
authorname="Giuseppe Sucameli"
authoremail="brush dot tyler at gmail dot com"
;;
pcav)
authorname="Paolo Cavallini"
authoremail="cavallini at faunalia dot it"
;;
"cfarmer")
authorname="Carson J. Q. Farmer"
authoremail="carson dot farmer at gmail dot com"
;;
rblazek|"Radim Blazek")
authorname="Radim Blazek"
authoremail="radim dot blazek at gmail dot com"
;;
marcopx)
authorname="Marco Pasetti"
authoremail="marco dot pasetti at alice dot it"
;;
timlinux|"Tim Sutton")
authorname="Tim Sutton"
authoremail="tim at linfiniti dot com"
;;
"Matthias Kuhn")
authorname="Matthias Kuhn"
authoremail="matthias at opengis dot ch"
;;
"Emilio Loi")
authorname="Emilio Loi"
authoremail="loi at faunalia dot it"
;;
"Nathan Woodrow"|Nathan)
authorname="Nathan Woodrow"
authoremail="woodrow dot nathan at gmail dot com"
;;
"Sandro Mani")
authorname="Sandro Mani"
authoremail="smani at sourcepole dot ch"
;;
"Chris Crook")
authorname="Chris Crook"
authoremail="ccrook at linz dot govt dot nz"
;;
"Hugo Mercier")
authorname="Hugo Mercier"
authoremail="hugo dot mercier at oslandia dot com"
;;
"Larry Shaffer")
authorname="Larry Shaffer"
authoremail="larrys at dakotacarto dot com"
;;
"Victor Olaya"|volaya)
authorname="Victor Olaya"
authoremail="volayaf at gmail dot com"
;;
elpaso)
authorname="Alessandro Pasotti"
authoremail="elpaso at itopen dot it"
;;
"Patrick Valsecchi")
authorname="Patrick Valsecchi"
authoremail="patrick dot valsecchi at camptocamp dot com"
;;
"Stéphane Brunner")
authorname="Stéphane Brunner"
authoremail="stephane dot brunner at camptocamp dot com"
;;
"ersts")
authorname="Peter Ersts"
authoremail="ersts at amnh dot org"
;;
"Etienne Tourigny")
authorname="Etienne Tourigny"
authoremail="etourigny dot dev at gmail dot com"
;;
"Nyall Dawson")
authorname="Nyall Dawson"
authoremail="nyall dot dawson at gmail dot com"
;;
*)
echo "Author $author not found."
exit 1
;;
esac
origsrc=$i
if [ -f "$i.nocopyright" ]; then
origsrc=$i.nocopyright
fi
src=$origsrc
dst=$src.new
shebang=$(head -1 $src)
case "$shebang" in
'#!'*)
shebang="$shebang
"
src="<(tail -n +2 $src)"
;;
*)
shebang=
;;
esac
case "$origsrc" in
*.sh)
eval cat - $src >$dst <<EOF
$shebang###########################################################################
# $basename
# ---------------------
# Date : $authordate
# Copyright : (C) $authoryear by $authorname
# Email : $authoremail
###########################################################################
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
###########################################################################
EOF
;;
*.py)
eval cat - $src >$dst <<EOF
$shebang# -*- coding: utf-8 -*-
"""
***************************************************************************
$basename
---------------------
Date : $authordate
Copyright : (C) $authoryear by $authorname
Email : $authoremail
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************
"""
__author__ = '$authorname'
__date__ = '$authordate'
__copyright__ = '(C) $authoryear, $authorname'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '\$Format:%H$'
EOF
;;
*.cpp|*.h)
cat - $src >$dst <<EOF
/***************************************************************************
$basename
---------------------
begin : $authordate
copyright : (C) $authoryear by $authorname
email : $authoremail
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
EOF
;;
*.pl)
eval cat - $src >$dst <<EOF
$shebang###########################################################################
# $basename
# ---------------------
# begin : $authordate
# copyright : (C) $authoryear by $authorname
# email : $authoremail
###########################################################################
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
###########################################################################
EOF
;;
*.bat|*.cmd)
cat - $src >$dst <<EOF
REM ***************************************************************************
REM $basename
REM ---------------------
REM begin : $authordate
REM copyright : (C) $authoryear by $authorname
REM email : $authoremail
REM ***************************************************************************
REM * *
REM * This program is free software; you can redistribute it and/or modify *
REM * it under the terms of the GNU General Public License as published by *
REM * the Free Software Foundation; either version 2 of the License, or *
REM * (at your option) any later version. *
REM * *
REM ***************************************************************************
EOF
;;
*)
echo "$i skipped"
continue
esac
[ -f $i.nocopyright ] || mv $i $i.nocopyright
cp $dst $origsrc
done
|