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

Contents of /bin/dtsasync

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1678 - (hide annotations) (download)
Sat Aug 27 19:11:31 2005 UTC (7 years, 8 months ago) by joeyh
File size: 1702 byte(s)
let's try to make it actually work..
1 joeyh 1676 #!/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="sudo -u katie heidi -a $tosuite";
12    
13     my $run_dinstall=0;
14    
15     print "dtsasync started at ".localtime(time)."\n\n";
16    
17 joeyh 1677 foreach my $hint (glob "$dir/*") {
18 joeyh 1676 next if $hint =~/\/README$/;
19     if (! open (IN, $hint)) {
20     print "Cannot read $hint\n";
21     next;
22     }
23     print "Processing $hint\n";
24     while (<IN>) {
25     chomp;
26 joeyh 1678 s/#.*//;
27 joeyh 1676 s/^\s+//;
28     s/\s+$//;
29     next unless length;
30    
31     if (/^sync\s+(.*)\/(.*)/) {
32     my $sync_package=$1;
33     my $sync_version=$2;
34    
35     print "Syncing $sync_package/$sync_version";
36     print "Current status:\n";
37     system("madison", "-S", $sync_package);
38 joeyh 1678
39 joeyh 1676 my @toheidi;
40 joeyh 1678 my $pid;
41     die "Can’t fork: $!" unless defined($pid = open(KID, "-│"));
42     if ($pid) {
43     while (<KID>) {
44     chomp;
45     my ($pkg, $version, $arch)=split(' ', 3);
46     next unless $version eq $sync_version;
47     push @toheidi, $_;
48     }
49     close KID || print "madison edited nonzero\n";
50 joeyh 1676 }
51 joeyh 1678 else {
52     exec "madison", "-s", $fromsuite,
53     "-f", "heidi", "-S", $sync_package
54     or die "can't exec madison: $!";
55     }
56    
57 joeyh 1676 if (! @toheidi) {
58     print "Already in sync, doing nothing.\n";
59     next;
60     }
61 joeyh 1678
62 joeyh 1676 open(HEIDI, "| $heidicmd") || print "$heidicmd failed!\n";
63     foreach (@toheidi) {
64     print HEIDI "$_\n";
65     }
66     close HEIDI || print "$heidicmd exited nonzero!\n";
67     $run_dinstall=1;
68     }
69     else {
70     print "$hint: parse failure on line $.\n";
71     }
72     }
73     close IN;
74     }
75    
76     if ($run_dinstall) {
77     system("touch", "$archive/RUN-DINSTALL");
78     }

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.5