source: subversion/applications/utils/packaging/svn_log2debian_changelog.pl @ 14989

Last change on this file since 14989 was 14989, checked in by joerg, 10 years ago

Rename directory to suite for all packaging related stuff

  • Property svn:executable set to *
File size: 5.8 KB
RevLine 
[14361]1#!/usr/bin/perl
2
3use strict;
4use warnings;
5use IO::File;
6use Getopt::Long;
7use Pod::Usage;
8
9my $project_name="";
10
11my $append=0;
12my $prefix="";
13my $debug = 0;
14
15$ENV{'LANGUAGE'}="en_US";
16$ENV{'LANG'}="en_US";
17
18
19GetOptions (
20    'project_name:s'    => \$project_name,
21    'prefix:s'          => \$prefix,
22    'append'            => \$append,
23    'debug'             => \$debug,
24    ) or pod2usage(1);
25
26unless ( $project_name ) {
27    pod2usage(2);
28    die "No Projectname defined";
29}
30
31
32my $fi = IO::File->new("svn log . |");
33
34my $fo;
35if ( $append )  {
36    $fo = IO::File->new(">>debian/changelog");
37} else {
38    $fo = IO::File->new(">debian/changelog");
39}
40my ($rev,$user,$date,$lines) = ('','','','');
41my ($date_dummy,$date_time,$date_offset,$date_date) = ('','','','');
42my $t='@';
43my $user2full_name={
44    root        => "the Maintainer",
45    amillar     => "Alan Millar",
46    andystreet  => "",
47    artem       => "Artem Pavlenko",
48    ben         => "Ben Robinson",
49    bobkare     => "Knut Arne Bjørndal",
50    breki       => "Igor Brejic",
51    brent       => "",
52    bretth      => "Brett Henderson",
53    christofd   => "Christof Dallermassl",
54    damians     => "",
55    danmoore    => "Dan Moore",
56    david       => "David Earl <david${t}frankieandshadow.com>",
57    deelkar     => "Dirk-Lüder Kreie",
58    dennis_de   => "dennis_de",
59    dirkl       => "Dirk-Lüder Kreie now deelkar",
60    dotbaz      => "Barry Crabtree",
61    dshpak      => "Darryl Shpak",
62    enxrah      => "",
63    etienne     => "Etienne Cherdlu",
64    frederik    => "Frederik Ramm",
65    frsantos    => "Francisco R. Santos <frsantos${t}gmail.com> ",
66    gabriel     => "Gabriel Ebner",
67    gslater     => "Grant Slater",
68    guenther    => "Guenter Maier",
69    hakan       => "Hakan Tandogan",
70    harrywood   => "Harry Wood",
71    imi         => "Immanuel Scholz",
72    isortega    => "Iván Sánchez Ortega",
73    jdschmidt   => "J. D. 'Dutch' Schmidt",
74    jeroen      => "Jeroen Ticheler",
75    jochen      => "Jochen Topf",
76    joerg       => "Joerg Ostertag (Debian Packages) <debian${t}ostertag.name>",
77    jonas       => "",
78    jonb        => "Jon Burgess",
79    jrreid      => "Jason Reid",
80    ksharp      => "Keith Sharp",
81    lorenz      => "Lorenz Kiefner",
82    marc        => "",
83    martinvoosterhout   => "Martijn van Oosterhout",
84    matt_gnu    => "",
85    matthewnc   => "",
86    mstrecke    => "Michael Strecke <MStrecke${t}gmx.de>",
87    nick        => "",
88    nickb       => "Nick Black",
89    nickburch   => "Nick Burch",
90    ojw         => "Almién Oliver White <ojwlists${t}googlemail.com>",
91    pere        => "Petter Reinholdtsen",
92    richard     => "Richard Fairhurst",
93    spaetz      => "Sebastian Spaeth",
94    stefanb     => "Stefan B (Ljubljana, Slovenia)",
95    steve       => "Steve Coast",
96    t2000       => "",
97    tabacha     => "Sven Anders",
98    texamus     => "Artem Dudarev",
99    tim         => "",
100    tomhughes   => "Tom Hughes",
101    twalraet    => "Thomas Walraet",
102    tweety      => "Joerg Ostertag (Debian Packages) <debian${t}ostertag.name>",
103    ulf         => "Ulf Lamping",
104    charles     => "Charles Curley <charlescurley${t}charlescurley.com>",
105    cjastram    => "Christopher Jastram",
106    commiter    => "",
107    dse         => "Guenther Meyer <d.s.e${t}sordidmusic.com>",
108    ganter      => "Fritz Ganter",
109    gladiac     => "Andreas Schneider",
110    hamish      => "Hamish <hamish_b${t}yahoo.com>",
111    loom        => "Christoph Metz <loom${t}mopper.de>",
112    pollardd    => "\"David Pollard\" <david.pollard${t}optusnet.com.au>",
113    robstewart  => "Rob Stewart",
114};
115
116my %unknown_users=();
117sub print_user_line($$){
118    my $user = shift;
119    my $date = shift;
120
121    if ( $user ) {
122        my $full_name= $user2full_name->{$user};
123        if ( ! $full_name ) {
124            $unknown_users{$user}++;
125            $full_name = $user;
126        }
127        $full_name =~ s/^\((.*)\)$/$1/; #  (no author) --> no author
128        if ( $full_name =~ m/\@/ ) {
129            $full_name =~ s/\@/ via the domain /;
130            $full_name =~ s/</(/;
131            $full_name =~ s/>/)/;
132        }
133        if ( $full_name !~ m/\@/ ) {
134            #my $fake_e_mail=$full_name;
135            #$fake_e_mail=~ s/ /_/g;
136            #$full_name = "$full_name <$fake_e_mail-fake-tmf\@gpsdrive.de>";
[14989]137            if ( $project_name =~ m/gpsdrive/ ) {
[14361]138                $full_name = "$full_name via GPSdrive discussion list <gpsdrive\@lists.gpsdrivers.org>";
139            } else {
140                $full_name = "$full_name via osm-dev List <dev\@openstreetmap.org>";
141            }
142        }
143        print $fo "\n -- $full_name  $date_date $date_time $date_offset\n\n";
144    }
145}
146
147my $commitmessage_seen=0;
148my $entry_no=0;
149while ( my $line = $fi->getline()) {
150    if ( $line =~ m/^-+$/) {
151        if ( $entry_no && ! $commitmessage_seen ) {
152            print $fo "   * no Commit Message\n";
153            print $fo "\n"
154        }
155        $entry_no++;
156        $commitmessage_seen=0;
157        next;
158    } elsif ( $line =~ m/^r\d+.*\|.*\|.*line/ ) {
159        print_user_line($user,$date);
160        ($rev,$user,$date,$lines) = split(m/\s*\|\s*/,$line);
161        ($date_dummy,$date_time,$date_offset,$date_date) = split(m/\s+/,$date,4);
162        $date_date =~ s/[\(\)]//g;
163        $rev =~ s/^r//;
164
165        print $fo "$project_name (${prefix}$rev) unstable; urgency=low\n\n";
166    } elsif ( $line=~ m/^\s*$/ ) {
167#       print $fo "\n";
168    } else {
169        print $fo "   * $line";
170        $commitmessage_seen++;
171    }
172};
173print_user_line($user,$date);
174
175$fi->close();
176$fo->close();
177
178if ( $debug ) {
179    if ( keys %unknown_users ) {
180        warn "Unknown Users:\n\t".
181            join("\n\t",sort keys %unknown_users).
182            "\n";
183    }
184};
185
186exit 0;
187
188__END__
189=head1 NAME
190
191svn_log2debian_changelog.pl - convert svn log to a debian/changelog
192
193=head1 SYNOPSIS
194
195svn_log2debian_changelog.pl tries to fetch the current svn changelog and
196convert it into a valid debian changelog.
197
198
199svn_log2debian_changelog.pl --project_name="openstreetmap-utils" --prefix="2.10svn" --append
200
201    --prefix=<prefix>
202      Prefix is added as a prefix in front of each svn-revision to
203      get the debian revision number.
204
205    --append
206         Append to an existing File
207
208    --debug
209         also printout which users could not be inserted with there full name
210
211
212
213=head1 RESULT
214
215 #############################################
216 # Example of the result:
217
218 openstreetmap-utils (7572) unstable; urgency=low
219
220  * Initial Version
221 
222 -- Joerg Ostertag (Debian Packages) via GPSdrive discussion list <gpsdrive\@lists.gpsdrivers.org>  Fri, 1 Jan 2007 07:05:36 +0100
223
Note: See TracBrowser for help on using the repository browser.