Last change
on this file since 2750 was 672, checked in by bcornec, 18 years ago |
merge -r651:671 $SVN_M/branches/stable
|
-
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 |
|
---|
[672] | 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>;
|
---|
[672] | 42 | #$announce =~ s/\"/\"\"/g;
|
---|
| 43 | #$announce =~ s/!//g;
|
---|
[651] | 44 | close(ANNOUNCE);
|
---|
| 45 |
|
---|
| 46 | print "INSERT INTO announces VALUES (NULL, $date, $announce)\n";
|
---|
[672] | 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";
|
---|
[672] | 52 |
|
---|
[651] | 53 | $dbh->disconnect;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.