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
|
#!/usr/bin/perl
use strict;
foreach (@ARGV)
{
my $full_path = $_;
#my $tmpfile = $_."tmp_update-comment-header";
my @full_fn = split('/', $full_path);
my $filename = pop(@full_fn);
my $id_keyword = '$'.'Id'.'$';
$filename =~ s/\.sql\.tmpl\.h/_create_sql\.h/;
my $current = '2010';
my $new_header_main =
' MediaTomb - http://www.mediatomb.cc/
'.$filename.' - this file is part of MediaTomb.
Copyright (C) 2005 Gena Batyan <bgeradz@mediatomb.cc>,
Sergey \'Jin\' Bostandzhyan <jin@mediatomb.cc>
Copyright (C) 2006-'.$current.' Gena Batyan <bgeradz@mediatomb.cc>,
Sergey \'Jin\' Bostandzhyan <jin@mediatomb.cc>,
Leonhard Wimmer <leo@mediatomb.cc>
MediaTomb is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2
as published by the Free Software Foundation.
MediaTomb is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
version 2 along with MediaTomb; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
'.$id_keyword;
my $new_header_tombupnp =
' TombUPnP - a library for developing UPnP applications.
Copyright (C) 2006-'.$current.' Sergey \'Jin\' Bostandzhyan <jin@mediatomb.cc>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License version 2.1 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
'.$id_keyword;
my $new_header_free =
' MediaTomb - http://www.mediatomb.cc/
'.$filename.' - this file is part of MediaTomb.
Copyright (C) 2006-'.$current.' Gena Batyan <bgeradz@mediatomb.cc>,
Sergey \'Jin\' Bostandzhyan <jin@mediatomb.cc>,
Leonhard Wimmer <leo@mediatomb.cc>
This file is free software; the copyright owners give unlimited permission
to copy and/or redistribute it; with or without modifications, as long as
this notice is preserved.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
'.$id_keyword;
my $new_header_jan =
' MediaTomb - http://www.mediatomb.cc/
'.$filename.' - this file is part of MediaTomb.
Copyright (C) 2007-2008 Jan Habermann <jan.habermann@gmail.com>
MediaTomb is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2
as published by the Free Software Foundation.
MediaTomb is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
version 2 along with MediaTomb; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
'.$id_keyword;
my $new_header_c =
'/*MT*
'.$new_header_main.'
*/';
my $new_header_free_c =
'/*MT_F*
'.$new_header_free.'
*/';
my $new_header_sgml =
'<!--*MT*
'.$new_header_main.'
-->';
my @new_header_main_array = split("\n", $new_header_main);
my $new_header_main_number = join("\n#", @new_header_main_array);
my $new_header_number =
'#*MT*
#
#'.$new_header_main_number.'
#
#*MT*';
my $new_header_c_tombupnp =
'/*TU*
'.$new_header_tombupnp.'
*/';
my $new_header_jan_c =
'/*MT_J*
'.$new_header_jan.'
*/';
my $new_header_jan_sgml =
'<!--*MT_J*
'.$new_header_jan.'
-->';
print $full_path.": ";
open (FILE, '<', $full_path);
my $data = join('', <FILE>);
close FILE;
my $has_file = ($data =~ m|/// *\\file|);
my $add_file = ($filename =~ /\.(cc?|h)$/);
if (! $has_file && $add_file)
{
$new_header_c .= "\n\n/// \\file $filename";
}
my $nothing = 0;
if ($data =~ m|/\*MT\*|)
{
print "/*MT*...";
$data =~ s|/\*MT\*(.*?\*)??/|$new_header_c|s;
}
elsif ($data =~ /<!--\*MT\*/)
{
print "<!--*MT*...";
$data =~ s/<!--\*MT\*.*?->/$new_header_sgml/s;
}
elsif ($data =~ /#\*MT\*/)
{
print "#*MT*...";
$data =~ s/#\*MT\*.*?#\*MT\*/$new_header_number/s;
}
elsif ($data =~ m|/\*MT_F\*|)
{
print "/*MT_F*...";
$data =~ s|/\*MT_F\*(.*?\*)??/|$new_header_free_c|s;
}
elsif ($data =~ m|/\*MT_J\*|)
{
print "/*MT_J*...";
$data =~ s|/\*MT_J\*(.*?\*)??/|$new_header_jan_c|s;
}
elsif ($data =~ /<!--\*MT_J\*/)
{
print "<!--*MT_J*...";
$data =~ s/<!--\*MT_J\*.*?->/$new_header_jan_sgml/s;
}
# elsif ($data =~ m|/\*.*this file is part of MediaTomb\.|)
# {
# print "old header";
# $data =~ s|/\*.*this file is part of MediaTomb\..*?\*/|$new_header_c|s;
# }
elsif ($data =~ m|/\*TU\*|)
{
print "/*TU*...";
$data =~ s|/\*TU\*(.*?\*)??/|$new_header_c_tombupnp|s;
}
else
{
$nothing = 1;
print "nothing!";
}
if (! $nothing)
{
if ($has_file)
{
$data =~ s|/// *\\file +.*$|/// \\file $filename|m;
print " and had file";
}
open (FILE, '>', $full_path);
print FILE $data;
# print $data;
close FILE;
}
print "\n";
}
|