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

Last change on this file since 651 was 651, checked in by bcornec, 18 years ago

Lots of bug fixes on delivery process
Addition of mkannounce to generate announces of new versions automatically

  • Property svn:executable set to *
File size: 962 bytes
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/announces.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;
43close(ANNOUNCE);
44
45print "INSERT INTO announces VALUES (NULL, $date, $announce)\n";
46#$dbh->do("INSERT INTO announces VALUES (NULL, $date, $announce)")
47#|| die "Unable to insert into $db";
48$dbh->disconnect;
Note: See TracBrowser for help on using the repository browser.