Author: joeyh Date: 2005-08-27 19:11:31 +0000 (Sat, 27 Aug 2005) New Revision: 1678 Modified: bin/dtsasync Log: let''s try to make it actually work.. Modified: bin/dtsasync ==================================================================--- bin/dtsasync 2005-08-27 19:05:18 UTC (rev 1677) +++ bin/dtsasync 2005-08-27 19:11:31 UTC (rev 1678) @@ -22,8 +22,8 @@ } print "Processing $hint\n"; while (<IN>) { - s/#*//; chomp; + s/#.*//; s/^\s+//; s/\s+$//; next unless length; @@ -35,16 +35,30 @@ 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; + my $pid; + die "Can?t fork: $!" unless defined($pid = open(KID, "-?")); + if ($pid) { + while (<KID>) { + chomp; + my ($pkg, $version, $arch)=split('' '', 3); + next unless $version eq $sync_version; + push @toheidi, $_; + } + close KID || print "madison edited nonzero\n"; } + else { + exec "madison", "-s", $fromsuite, + "-f", "heidi", "-S", $sync_package + or die "can''t exec madison: $!"; + } + if (! @toheidi) { print "Already in sync, doing nothing.\n"; next; } + open(HEIDI, "| $heidicmd") || print "$heidicmd failed!\n"; foreach (@toheidi) { print HEIDI "$_\n";