--- a/apt-mirror +++ a/apt-mirror @@ -477,8 +477,6 @@ my $size_output = format_bytes($need_bytes); print "$size_output will be downloaded into archive.\n"; -print STDERR "$size_output will be downloaded into archive.\n"; - download_urls("archive", sort keys %urls_to_download); @@ -509,6 +507,7 @@ sub collect_children { } if ( get_variable( "recreate_packages" ) eq 'yes' ) { + my $nthreads = get_variable("nthreads"); my @gzip_files = (); my @children = (); my $pid; @@ -535,9 +534,13 @@ if ( get_variable( "recreate_packages" ) eq 'yes' ) { if ( $pid == 0 ) { chdir get_variable("mirror_path")."/$path"; - exec "apt-ftparchive $filetype $source > $packages\n"; + exec "exec apt-ftparchive $filetype $source > $packages\n"; } push @children, $pid; + if ( scalar @children >= $nthreads ) { + my $dead = wait(); + @childrens = grep { $_ != $dead } @childrens; + } } collect_children( @children ); @@ -552,9 +555,13 @@ if ( get_variable( "recreate_packages" ) eq 'yes' ) { if ( $pid == 0 ) { chdir get_variable("mirror_path")."/$path"; - exec "gzip < $packages > $packages.gz\n"; + exec "exec gzip < $packages > $packages.gz\n"; } push @children, $pid; + if ( scalar @children >= $nthreads ) { + my $dead = wait(); + @childrens = grep { $_ != $dead } @childrens; + } } collect_children( @children ); } else {