« blib/lib/Alien/LibreSSL/Install/Files.pm
↑ Summary
blib/lib/auto/share/dist/Alien-LibreSSL/_alien/patch/libressl-2.6.2.pl »
| 1 | use strict; | ||
| 2 | use warnings; | ||
| 3 | use Data::Dumper qw( Dumper ); | ||
| 4 | use Path::Tiny qw( path ); | ||
| 5 | |||
| 6 | my $patch_filename = shift @ARGV; | ||
| 7 | die "need filename" unless defined $patch_filename; | ||
| 8 | |||
| 9 | my($pl_filename) = $patch_filename =~ /^(.*)\.diff$/; | ||
| 10 | die "unable to determine pl name" unless defined $pl_filename; | ||
| 11 | $pl_filename .= '.pl'; | ||
| 12 | |||
| 13 | my @lines = path($patch_filename)->lines; | ||
| 14 | |||
| 15 | my $filename; | ||
| 16 | my %p; | ||
| 17 | |||
| 18 | while(@lines) | ||
| 19 | { | ||
| 20 | my $line = shift @lines; | ||
| 21 | if($line =~ /^diff --git a\/(.*?)\s/) | ||
| 22 | { | ||
| 23 | $filename = $1; | ||
| 24 | shift @lines for (1..3); | ||
| 25 | } | ||
| 26 | else | ||
| 27 | { | ||
| 28 | $p{$filename} .= $line; | ||
| 29 | } | ||
| 30 | } | ||
| 31 | |||
| 32 | path($pl_filename)->spew( | ||
| 33 | "__DATA__\n my ", | ||
| 34 | Dumper(\%p), | ||
| 35 | ); | ||
| 36 |