#!/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="sudo -u katie heidi -a $tosuite"; 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 () { s/#*//; chomp; s/^\s+//; s/\s+$//; next unless length; if (/^sync\s+(.*)\/(.*)/) { my $sync_package=$1; my $sync_version=$2; print "Syncing $sync_package/$sync_version"; print "Current status:\n"; system("madison", "-S", $sync_package); my @toheidi; foreach my $line (system("madison", "-s", $fromsuite, "-f", "heidi", "-S", $sync_package)) { my ($pkg, $version, $arch)=split(' ', 3); next unless $version eq $sync_version; push @toheidi, $line; } if (! @toheidi) { print "Already in sync, doing nothing.\n"; next; } open(HEIDI, "| $heidicmd") || print "$heidicmd failed!\n"; foreach (@toheidi) { print HEIDI "$_\n"; } close HEIDI || print "$heidicmd exited nonzero!\n"; $run_dinstall=1; } else { print "$hint: parse failure on line $.\n"; } } close IN; } if ($run_dinstall) { system("touch", "$archive/RUN-DINSTALL"); }