summaryrefslogtreecommitdiff
path: root/Porting
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2002-05-08 14:00:54 +0000
committerGurusamy Sarathy <gsar@cpan.org>2002-05-08 14:00:54 +0000
commit9b174a274a0c344c57b61e8f1e323c3e74fd6d6c (patch)
tree4d66fcb1f5eb53af7ea25d442075178d41b45cfc /Porting
parentd7e76ffd59da894806d7feb0cfdaaebe84ade370 (diff)
downloadperl-9b174a274a0c344c57b61e8f1e323c3e74fd6d6c.tar.gz
p4genpatch: produce unix-compatible patches on non-MacOS platforms;
don't unlink /dev/null p4raw-id: //depot/perl@16492
Diffstat (limited to 'Porting')
-rw-r--r--Porting/p4genpatch14
1 files changed, 12 insertions, 2 deletions
diff --git a/Porting/p4genpatch b/Porting/p4genpatch
index e2350b07ca..ccedff1087 100644
--- a/Porting/p4genpatch
+++ b/Porting/p4genpatch
@@ -51,9 +51,11 @@ while (<$p4>) {
close $p4;
my $tempdir;
+my @unlink;
print "Differences ...\n";
for my $a (@action) {
$tempdir ||= tempdir( "tmp-XXXX", CLEANUP => 1, TMPDIR => 1 );
+ @unlink = ();
my($action,$file,$prefix) = @$a;
my($path,$basename,$number) = $file =~ m|\Q$prefix\E/(.+/)?([^/]+)#(\d+)|;
@@ -69,7 +71,7 @@ for my $a (@action) {
# can't assume previous rev == $number-1 due to obliterated revisions
$prevfile = "$depotfile\@$prevchange";
if ($number == 1 or $action =~ /^(add|branch)$/) {
- $d1 = File::Spec->devnull;
+ $d1 = $^O eq 'MacOS' ? File::Spec->devnull : "/dev/null";
$t1 = $d1;
++$doadd;
} elsif ($action =~ /^(edit|integrate)$/) {
@@ -92,11 +94,13 @@ for my $a (@action) {
$t1 = File::Spec->catfile($tempdir, $d1);
rename $oldt1, $t1;
}
+ push @unlink, $t1;
} else {
die "Unknown action[$action]";
}
$d2 = File::Spec->catfile($path, $basename);
$t2 = File::Spec->catfile($tempdir, $d2);
+ push @unlink, $t2;
warn "==> $d2#$number <==\n" if $OPT{v};
my $system = qq[p4 @P4opt print -o "$t2" "$file"];
# warn "system[$system]";
@@ -113,6 +117,10 @@ for my $a (@action) {
unless ($type =~ /text/) {
next;
}
+ unless ($^O eq 'MacOS') {
+ $d1 =~ s,\\,/,g;
+ $d2 =~ s,\\,/,g;
+ }
print "Index: $d2\n";
correctmtime($prevfile,$prev,$t1) unless $doadd;
correctmtime($file,$number,$t2);
@@ -121,7 +129,9 @@ for my $a (@action) {
system($system); # no return check because diff doesn't always return 0
chdir $TOPDIR or warn "Could not chdir '$TOPDIR': $!";
}
- for ($t1, $t2) {
+}
+continue {
+ for (@unlink) {
unlink or warn "Could not unlink $_: $!" if -f;
}
}