2012-05-18 19:35:43 +02:00
|
|
|
#!/bin/bash
|
2012-10-04 19:33:47 +02:00
|
|
|
###########################################################################
|
|
|
|
# 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. #
|
|
|
|
# #
|
|
|
|
###########################################################################
|
|
|
|
|
2012-05-18 19:35:43 +02:00
|
|
|
# licensecheck -r src
|
|
|
|
|
2012-10-04 19:33:47 +02:00
|
|
|
set -e
|
|
|
|
|
2012-05-18 19:35:43 +02:00
|
|
|
for i in $(<files); do
|
2012-10-04 19:33:47 +02:00
|
|
|
echo $i >&2
|
2012-05-18 19:35:43 +02:00
|
|
|
author=
|
|
|
|
authordate=
|
|
|
|
eval $(git log --reverse --pretty="export author='%an' authordate=\"\$(date --date='%ai' +'%%B %Y')\"" $i | head -1)
|
|
|
|
basename=$(basename $i)
|
|
|
|
authoryear=${authordate#* }
|
2012-10-04 19:33:47 +02:00
|
|
|
|
|
|
|
case $i in
|
|
|
|
# Override author if initial commit was by someone else
|
|
|
|
python/plugins/sextante/*)
|
|
|
|
author=volayaf
|
|
|
|
;;
|
|
|
|
|
|
|
|
src/app/gps/qwtpolar-*|src/app/qtmain_android.cpp|src/core/spatialite/*|src/core/spatialindex/src/*|src/core/gps/qextserialport/*|src/plugins/grass/qtermwidget/*|src/astyle/*|python/pyspatialite/*|src/providers/sqlanywhere/sqlanyconnection/*)
|
|
|
|
# Skip third party files
|
|
|
|
echo $f skipped
|
|
|
|
continue
|
|
|
|
;;
|
|
|
|
|
|
|
|
esac
|
|
|
|
|
2012-05-18 19:35:43 +02:00
|
|
|
case $author in
|
2012-10-04 19:33:47 +02:00
|
|
|
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"
|
|
|
|
;;
|
|
|
|
|
2012-05-18 19:35:43 +02:00
|
|
|
wonder|"Martin Dobias")
|
|
|
|
authorname="Martin Dobias"
|
2012-10-08 00:29:13 +02:00
|
|
|
authoremail="wonder dot sk at gmail dot com"
|
2012-05-18 19:35:43 +02:00
|
|
|
;;
|
|
|
|
|
|
|
|
"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"
|
|
|
|
;;
|
|
|
|
|
2012-10-04 19:33:47 +02:00
|
|
|
"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"
|
|
|
|
;;
|
|
|
|
|
2012-10-06 13:10:25 +02:00
|
|
|
pcav)
|
|
|
|
authorname="Paolo Cavallini"
|
2012-10-07 00:06:19 +02:00
|
|
|
authoremail="cavallini at faunalia dot it"
|
2012-10-06 13:10:25 +02:00
|
|
|
;;
|
|
|
|
|
2012-10-04 19:33:47 +02:00
|
|
|
"cfarmer")
|
|
|
|
authorname="Carson J. Q. Farmer"
|
|
|
|
authoremail="carson dot farmer at gmail dot com"
|
|
|
|
;;
|
|
|
|
|
|
|
|
rblazek|"Radim Blazek")
|
2012-05-18 19:35:43 +02:00
|
|
|
authorname="Radim Blazek"
|
|
|
|
authoremail="radim dot blazek at gmail dot com"
|
|
|
|
;;
|
|
|
|
|
2012-10-06 13:10:25 +02:00
|
|
|
marcopx)
|
|
|
|
authorname="Marco Pasetti"
|
2012-10-08 00:29:13 +02:00
|
|
|
authoremail="marco dot pasetti at alice dot it"
|
2012-10-06 13:10:25 +02:00
|
|
|
;;
|
|
|
|
|
2012-10-04 19:33:47 +02:00
|
|
|
timlinux|"Tim Sutton")
|
2012-05-18 19:35:43 +02:00
|
|
|
authorname="Tim Sutton"
|
2012-10-07 00:06:19 +02:00
|
|
|
authoremail="tim at linfiniti dot com"
|
2012-05-18 19:35:43 +02:00
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
echo "Author $author not found."
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2012-10-04 19:33:47 +02:00
|
|
|
origsrc=$i
|
2012-05-18 19:35:43 +02:00
|
|
|
if [ -f "$i.nocopyright" ]; then
|
2012-10-04 19:33:47 +02:00
|
|
|
origsrc=$i.nocopyright
|
2012-05-18 19:35:43 +02:00
|
|
|
fi
|
|
|
|
|
2012-10-04 19:33:47 +02:00
|
|
|
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)
|
2012-10-05 23:28:47 +02:00
|
|
|
eval cat - $src >$dst <<EOF
|
2012-10-04 19:33:47 +02:00
|
|
|
$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
|
2012-05-18 19:35:43 +02:00
|
|
|
/***************************************************************************
|
|
|
|
$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. *
|
|
|
|
* *
|
|
|
|
***************************************************************************/
|
2012-10-06 13:10:25 +02:00
|
|
|
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 ***************************************************************************
|
2012-05-18 19:35:43 +02:00
|
|
|
EOF
|
2012-10-04 19:33:47 +02:00
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
echo "$i skipped"
|
|
|
|
continue
|
|
|
|
esac
|
|
|
|
|
2012-05-18 19:35:43 +02:00
|
|
|
[ -f $i.nocopyright ] || mv $i $i.nocopyright
|
2012-10-04 19:33:47 +02:00
|
|
|
cp $dst $origsrc
|
2012-05-18 19:35:43 +02:00
|
|
|
done
|