forked from perkeep/perkeep
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcamfix.pl
More file actions
executable file
·23 lines (17 loc) · 665 Bytes
/
camfix.pl
File metadata and controls
executable file
·23 lines (17 loc) · 665 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/perl
my $file = shift;
die "$file doesn't exist" unless -e $file;
open(my $fh, $file) or die "failed: $!\n";
my $c = do { local $/; <$fh> };
close($fh);
my $changes = 0;
$changes = 1 if $c =~ s!^(\s+)\"camli/(.+)\"!$1\"camlistore.org/pkg/$2\"!mg;
$changes = 1 if $c =~ s!^(\s+)\"camlistore/(.+)\"!$1\"camlistore.org/$2\"!mg;
$changes = 1 if $c =~ s!^(\s+_ )\"camlistore/(.+)\"!$1\"camlistore.org/$2\"!mg;
$changes = 1 if $c =~ s!/pkg/pkg/!/pkg/!g;
$changes = 1 if $c =~ s!camlistore.org/pkg/third_party/!camlistore.org/third_party/!g;
exit 0 unless $changes;
open(my $fh, ">$file") or die;
print $fh $c;
close($fh);
print STDERR "rewrote $file\n";