Last change
on this file since 644 was 644, checked in by bcornec, 18 years ago |
printf causes problem with % => print in tools/mkchangelog.pl
|
-
Property svn:executable
set to
*
|
File size:
1.7 KB
|
Rev | Line | |
---|
[636] | 1 | #!/usr/bin/perl -w
|
---|
| 2 | #
|
---|
| 3 | # Creates changelog for packages from Changelog files in the apps
|
---|
| 4 | #
|
---|
| 5 | # $Id$
|
---|
| 6 | #
|
---|
| 7 | # Syntax : mkchangelog dtype package-name output-file
|
---|
| 8 | #
|
---|
| 9 |
|
---|
| 10 | use strict;
|
---|
| 11 | use Date::Manip;
|
---|
| 12 |
|
---|
| 13 | my $log = "";
|
---|
| 14 | my $dtype = $ARGV[0];
|
---|
| 15 | my $pkg = $ARGV[1];
|
---|
| 16 | my $pkg2;
|
---|
| 17 | my $outfile = $ARGV[2];
|
---|
| 18 | my $TOOLHOME = $ENV{TOOLHOME};
|
---|
| 19 | my $chglog = "";
|
---|
| 20 | my $ndate = "";
|
---|
| 21 | my $tmp = "";
|
---|
| 22 | my $ver = "";
|
---|
| 23 | my $date = "";
|
---|
| 24 |
|
---|
| 25 | # For date handling
|
---|
| 26 | $ENV{LANG}="C";
|
---|
| 27 |
|
---|
| 28 | die "Syntax : mkchangelog dtype package-name output-file"
|
---|
| 29 | if ((not (defined $dtype)) || ($dtype eq "") ||
|
---|
| 30 | (not (defined $pkg)) || ($pkg eq "") ||
|
---|
| 31 | (not (defined $outfile)) || ($outfile eq ""));
|
---|
| 32 |
|
---|
| 33 | if (-f "$TOOLHOME/../$pkg/ChangeLog") {
|
---|
| 34 | $chglog = "$TOOLHOME/../$pkg/ChangeLog";
|
---|
| 35 | }
|
---|
| 36 | else {
|
---|
| 37 | $pkg2 = $pkg;
|
---|
| 38 | $pkg2 =~ s/-..*//;
|
---|
| 39 | if (-f "$TOOLHOME/../$pkg2/ChangeLog") {
|
---|
| 40 | $chglog = "$TOOLHOME/../$pkg2/ChangeLog";
|
---|
| 41 | }
|
---|
| 42 | else {
|
---|
| 43 | die "Unable to find a ChangeLog file for $pkg\n";
|
---|
| 44 | }
|
---|
| 45 | }
|
---|
| 46 | print "Using $chglog as input ChangeLog file for $pkg\n";
|
---|
| 47 |
|
---|
| 48 | open(INPUT,"$chglog") || die "Unable to open $chglog (read)";
|
---|
| 49 | open(OUTPUT,"> $outfile") || die "Unable to open $outfile (write)";
|
---|
| 50 | # Skip first 4 lines
|
---|
| 51 | $tmp = <INPUT>;
|
---|
| 52 | $tmp = <INPUT>;
|
---|
| 53 | $tmp = <INPUT>;
|
---|
| 54 | $tmp = <INPUT>;
|
---|
| 55 |
|
---|
| 56 | # Handle each block separated by newline
|
---|
| 57 | while (<INPUT>) {
|
---|
| 58 | ($ver, $date) = split(/ /);
|
---|
| 59 | chomp($date);
|
---|
| 60 | $date =~ s/\(([0-9-]+)\)/$1/;
|
---|
[642] | 61 | #print "**$date**\n";
|
---|
[636] | 62 | $ndate = UnixDate($date,"%a", "%b", "%d", "%Y");
|
---|
[642] | 63 | #print "**$ndate**\n";
|
---|
[636] | 64 | if ($dtype eq "rpm") {
|
---|
[644] | 65 | print OUTPUT "* $ndate Bruno Cornec <bruno\@mondorescue.org> $ver\n";
|
---|
| 66 | print OUTPUT "- Updated to $ver\n";
|
---|
[636] | 67 |
|
---|
| 68 | $tmp = <INPUT>;
|
---|
| 69 | while ($tmp !~ /^$/) {
|
---|
[644] | 70 | print OUTPUT $tmp;
|
---|
[636] | 71 | $tmp = <INPUT>;
|
---|
| 72 | }
|
---|
[644] | 73 | print OUTPUT "\n";
|
---|
[636] | 74 | }
|
---|
| 75 | }
|
---|
| 76 | close(OUTPUT);
|
---|
| 77 | close(INPUT);
|
---|
Note:
See
TracBrowser
for help on using the repository browser.