/[secure-testing]/bin/dtsasync
ViewVC logotype

Contents of /bin/dtsasync

Parent Directory Parent Directory | Revision Log Revision Log


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

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.5