Last change
on this file since 2618 was 659, checked in by bcornec, 19 years ago |
changelog are now generated from mindi's and mondo's main ChangeLog files
new tool to create automatically announces for new version-tag
news.shtml and latest-news.html are now generated from a DB of announce (SQLite)
announce DB added (SQLite v3)
Build process improved for Debian
|
-
Property svn:executable
set to
*
|
File size:
1.1 KB
|
Rev | Line | |
---|
[651] | 1 | #!/usr/bin/perl -w
|
---|
| 2 | #
|
---|
| 3 | # Creates announces for new mondorescue version/tag
|
---|
| 4 | #
|
---|
| 5 | # $Id$
|
---|
| 6 | #
|
---|
| 7 | # Syntax : mkannounce announce-file
|
---|
| 8 | #
|
---|
| 9 |
|
---|
| 10 | use strict;
|
---|
| 11 | use Date::Manip;
|
---|
| 12 | use File::Basename;
|
---|
| 13 | use DBI;
|
---|
| 14 | use English;
|
---|
| 15 |
|
---|
| 16 |
|
---|
| 17 | # For date handling
|
---|
| 18 | $ENV{LANG}="C";
|
---|
| 19 |
|
---|
| 20 | my $TOOLHOME;
|
---|
| 21 | my $tmp = dirname($PROGRAM_NAME);
|
---|
| 22 | print "$tmp\n";
|
---|
| 23 | if ($tmp =~ /^\//) {
|
---|
| 24 | $TOOLHOME = $tmp;
|
---|
| 25 | }
|
---|
| 26 | else {
|
---|
| 27 | $TOOLHOME = "$ENV{PWD}/$tmp";
|
---|
| 28 | }
|
---|
| 29 |
|
---|
[659] | 30 | my $db="$TOOLHOME/../website/announces3.sql";
|
---|
[651] | 31 |
|
---|
| 32 | my $dbh = DBI->connect("dbi:SQLite:dbname=$db","","",
|
---|
| 33 | { RaiseError => 1, AutoCommit => 1 })
|
---|
| 34 | || die "Unable to connect to $db";
|
---|
| 35 |
|
---|
| 36 | my $date = &UnixDate("today","%Y-%m-%d");
|
---|
| 37 |
|
---|
| 38 | # To read whole file
|
---|
| 39 | local $/;
|
---|
| 40 | open(ANNOUNCE,$ARGV[0]) || die "Unable to open $ARGV[0] (read)";
|
---|
| 41 | my $announce = <ANNOUNCE>;
|
---|
[659] | 42 | #$announce =~ s/\"/\"\"/g;
|
---|
| 43 | #$announce =~ s/!//g;
|
---|
[651] | 44 | close(ANNOUNCE);
|
---|
| 45 |
|
---|
| 46 | print "INSERT INTO announces VALUES (NULL, $date, $announce)\n";
|
---|
[659] | 47 | my $sth = $dbh->prepare(qq{INSERT INTO announces VALUES (NULL,?,?)})
|
---|
| 48 | || die "Unable to insert into $db";
|
---|
| 49 | $sth->execute($date, $announce);
|
---|
| 50 | #$dbh->do(qq(INSERT INTO announces VALUES (NULL, '$date', '$announce')))
|
---|
[651] | 51 | #|| die "Unable to insert into $db";
|
---|
[659] | 52 |
|
---|
[651] | 53 | $dbh->disconnect;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.