mirror of
https://github.com/duncs/clusterssh.git
synced 2025-07-03 18:03:23 +00:00

Prevent the same files being generated mutliple times when using 'make -j 4'. OpenSUSE bug: https://bugzilla.opensuse.org/show_bug.cgi?id=1083835 SourceForge support ticket 55
46 lines
1 KiB
Perl
Executable file
46 lines
1 KiB
Perl
Executable file
#!/usr/bin/env perl
|
|
|
|
use strict;
|
|
use warnings;
|
|
|
|
use FindBin qw($Bin $Script);
|
|
use File::Basename;
|
|
|
|
my $bindir="bin";
|
|
|
|
if(! -d $bindir) {
|
|
mkdir $bindir || die "Could not mkdir $bindir: $!";
|
|
}
|
|
|
|
print "Using perl binary: $^X",$/;
|
|
print "Using perl version $^V",$/;
|
|
|
|
for my $dest (@ARGV) {
|
|
my $source=$Bin.'/'.basename($dest);
|
|
|
|
next if($source =~ m/$Script/);
|
|
next if($source =~ m/\.x$/);
|
|
|
|
print "Generating: $source",$/;
|
|
|
|
if(-f $dest) {
|
|
chmod(0777, $dest) || die "Could not chmod $dest for removing: $!";
|
|
}
|
|
|
|
open(my $sfh, '<', $source) || die "Could not open $source for reading: $!";
|
|
open(my $dfh, '>', $dest ) || die "Could not open $dest for writing: $!";
|
|
print $dfh $_ while(<$sfh>);
|
|
close($sfh);
|
|
|
|
if($source !~ m/clusterssh_bash_completion.dist/) {
|
|
print $dfh "\n\n__END__\n\n";
|
|
|
|
my $pod= qx{ $^X $source --generate-pod };
|
|
die "Failed to generate pod" if($?);
|
|
print $dfh $pod;
|
|
}
|
|
|
|
close($dfh);
|
|
|
|
chmod(0555, $dest) || die "Could not chmod $dest: $!";
|
|
}
|