source: MondoRescue/branches/stable/tools/mkannounce.pl@ 1326

Last change on this file since 1326 was 659, checked in by bcornec, 18 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
Line 
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
10use strict;
11use Date::Manip;
12use File::Basename;
13use DBI;
14use English;
15
16
17# For date handling
18$ENV{LANG}="C";
19
20my $TOOLHOME;
21my $tmp = dirname($PROGRAM_NAME);
22print "$tmp\n";
23if ($tmp =~ /^\//) {
24 $TOOLHOME = $tmp;
25 }
26else {
27 $TOOLHOME = "$ENV{PWD}/$tmp";
28 }
29
30my $db="$TOOLHOME/../website/announces3.sql";
31
32my $dbh = DBI->connect("dbi:SQLite:dbname=$db","","",
33 { RaiseError => 1, AutoCommit => 1 })
34 || die "Unable to connect to $db";
35
36my $date = &UnixDate("today","%Y-%m-%d");
37
38# To read whole file
39local $/;
40open(ANNOUNCE,$ARGV[0]) || die "Unable to open $ARGV[0] (read)";
41my $announce = <ANNOUNCE>;
42#$announce =~ s/\"/\"\"/g;
43#$announce =~ s/!//g;
44close(ANNOUNCE);
45
46print "INSERT INTO announces VALUES (NULL, $date, $announce)\n";
47my $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')))
51#|| die "Unable to insert into $db";
52
53$dbh->disconnect;
Note: See TracBrowser for help on using the repository browser.