1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
#!/usr/bin/perl
# Processes hints files in the specified directory.
use strict;
use warnings;
my $dir=shift || die "need a hint directory\n";
my $fromsuite="etch-proposed-updates ";
my $tosuite="etch";
my $archive="/org/secure-testing.debian.net/";
my $heidicmd="heidi -a $tosuite";
sub getlines {
my $suite=shift;
my $package=shift;
my @ret;
my $pid;
die "Can’t fork: $!" unless defined($pid = open(KID, "-|"));
if ($pid) {
while (<KID>) {
chomp;
push @ret, $_;
}
close KID;
}
else {
exec "dak", "ls", "-s", $suite, "-f", "heidi", "-S", $package
or die "can't exec dak ls: $!";
}
return @ret;
}
my $run_dinstall=0;
print "dtsasync started at ".localtime(time)."\n\n";
foreach my $hint (glob "$dir/*") {
next if $hint =~/\/README$/;
if (! open (IN, $hint)) {
print "Cannot read $hint\n";
next;
}
print "Processing $hint\n";
while (<IN>) {
chomp;
s/#.*//;
s/^\s+//;
s/\s+$//;
next unless length;
if (/^sync\s+(.*)\/(.*)/) {
my $sync_package=$1;
my $sync_version=$2;
print "Syncing $sync_package/$sync_version\n";
print "Current status:\n";
system("dak", "ls", "-S", $sync_package);
my @fromlines=getlines($fromsuite, $sync_package);
if (! @fromlines) {
print "Not available in version $sync_version, doing nothing.\n";
next;
}
my @tolines=getlines($tosuite, $sync_package);
my @toheidi;
foreach my $line (@fromlines) {
next if grep { $_ eq $line } @tolines;
my ($pkg, $version, $arch)=split(' ', $line, 3);
next unless $version eq $sync_version;
push @toheidi, $line;
}
if (! @toheidi) {
print "In sync, doing nothing.\n";
next;
}
print "Syncing these:\n";
open(HEIDI, "| $heidicmd") || print "$heidicmd failed!\n";
foreach (@toheidi) {
print "$_\n";
print HEIDI "$_\n";
}
close HEIDI || print "$heidicmd exited nonzero!\n";
print "New status:\n";
system("dak", "ls", "-S", $sync_package);
$run_dinstall=1;
}
else {
print "$hint: parse failure on line $.\n";
}
}
close IN;
}
if ($run_dinstall) {
system("touch", "$archive/RUN-DINSTALL");
}
|