3
# do-merge-quinn: merge current quinn-diff output into wanna-build
4
# database and make wanna-build statistics
5
# Copyright © 1998-2000 Roman Hodek <Roman.Hodek@informatik.uni-erlangen.de>
7
# This program is free software: you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License as published by
9
# the Free Software Foundation, either version 2 of the License, or
10
# (at your option) any later version.
12
# This program is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
# General Public License for more details.
17
# You should have received a copy of the GNU General Public License
18
# along with this program. If not, see
19
# <http://www.gnu.org/licenses/>.
21
#######################################################################
32
use vars qw($HOME $tmpdir $arch @dists $locked);
35
or die "HOME not defined in environment!\n";
36
@dists = qw(stable frozen unstable);
38
open( STDOUT, ">>$HOME/lib/merge.log" );
39
open( STDERR, ">&STDOUT" );
41
select(STDERR); $| = 1; select(STDOUT);
42
chomp( my $date = `date` );
43
print "-------------- merge-quinn $date --------------\n";
45
$tmpdir = "/tmp/merge-quinn.$$";
46
chomp( $arch = `dpkg --print-installation-architecture` );
48
mkdir( $tmpdir, 0755 ) or die "mkdir $tmpdir: $!\n";
49
chdir( $tmpdir ) or die "chdir $tmpdir: $!\n";
51
my $stats_only = 1 if @ARGV >= 1 && $ARGV[0] eq "--stat-only";
53
foreach (qw(HUP INT QUIT PIPE TERM __DIE__)) {
61
system "wanna-build", "--create-maintenance-lock"
62
and die "wanna-build --create-maintenance-lock error status $?\n";
65
foreach $dist (@dists) {
66
my $ofile = "quinn-$dist";
69
foreach $sect (@conf::sections) {
70
my $bf = ($conf::quinn_source_multi_section ?
71
$dist : "by_section-$arch.txt");
73
my $f = ($conf::quinn_source_multi_section ?
74
"$conf::quinn_source/$arch/$sect/$dist" :
75
"$conf::quinn_source/$dist/by_section-$arch.txt");
77
if (system "cat '$f' >>$ofile") {
78
warn "cat $f >>$ofile error status $?\n";
83
system "wget", "-q", $f and next;
84
if (system "cat '$bf' >>$ofile") {
85
warn "cat $bf >>$ofile error status $?\n";
95
next if ! -f "$conf::basedir/$conf::dbbase-$dist";
97
system "wanna-build", "--merge-quinn", "-v", "--dist=$dist", "$ofile"
98
and warn "wanna-build --merge-quinn error status $?\n";
102
system "wanna-build", "--remove-maintenance-lock";
107
foreach $dist (@dists) {
108
system "wanna-build-statistics --dist=$dist >>stats";
109
system "echo '' >>stats";
112
if (-s "stats" && defined($conf::stat_mail) && $conf::stat_mail) {
113
system "mail -s 'wanna-build statistics $date' $conf::stat_mail <stats"
114
and warn "mail for statistics error status: $?\n";
115
if ($conf::web_stats && -w $conf::web_stats) {
116
open( F, ">$conf::web_stats" )
117
or die "Cannot create $conf::web_stats: $!\n";
118
print F "wanna-build statistics $date\n";
119
print F "===================================================\n\n";
121
system "cat stats >>'$conf::web_stats'";
122
system "chmod", "644", $conf::web_stats;
126
chdir( "/" ) or die "chdir /: $!\n";
127
system "rm", "-rf", $tmpdir and die "rm -rf $tmpdir error status $?";
132
system "wanna-build", "--remove-maintenance-lock" if $locked;
133
system "rm -rf $tmpdir" if $tmpdir;