Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 58 lines (43 sloc) 1.26 kB
12eb33b @jonjensen Add relocate.pl script for scripts/ -> bin/ conversion.
jonjensen authored
1 #!/usr/bin/perl -w
2
3 # relocate.pl
bf50418 @jonjensen Quell unneeded warnings about undef string concatenation.
jonjensen authored
4 # $Id: relocate.pl,v 2.2 2003-06-18 21:43:14 jon Exp $
12eb33b @jonjensen Add relocate.pl script for scripts/ -> bin/ conversion.
jonjensen authored
5 #
6 # Rewrite pathnames or other values that need to be hardcoded in
7 # files. Take a commented line, remove the leading hash character,
8 # substitute for the variable inside ~_~HERE~_~, and place the
9 # result on the line above the comment, like this:
10
11 =for example
12
13 use lib '/home/jon/interchange/lib';
14 #use lib '~_~INSTALLPRIVLIB~_~';
15
16 =cut
17
18 # A single output filename can be specified on the command line, and
19 # the input filename will be the same, with a .PL extension added.
20 # If no filename is given, just filter from stdin to stdout.
21
22 use strict;
23
24 use Config;
25
26 require 'scripts/initp.pl';
27
28 sub doit {
29 my ($key) = @_;
30 my $val;
31 if ($MV::Self->{RPMBUILDDIR} and $val = $MV::Self->{$key}) {
32 $val =~ s!^$MV::Self->{RPMBUILDDIR}/!/!;
33 return $val;
34 }
35 return $MV::Self->{$key} unless $key =~ /[a-z]/;
36 return $Config{$key};
37 }
38
bf50418 @jonjensen Quell unneeded warnings about undef string concatenation.
jonjensen authored
39 no warnings 'void';
40
12eb33b @jonjensen Add relocate.pl script for scripts/ -> bin/ conversion.
jonjensen authored
41 DOIT: {
42 my ($input, $output);
43 $output = $ARGV[0];
44 $input = "$output.PL" if $output;
45
46 local ($/);
47 @ARGV = ($input) if $input;
48 local ($_) = <>;
49
50 s{.*\n(#(.*)~_~(\w+)~_~(.*))}{$2 . doit($3) . "$4\n$1"}eg;
51
52 if ($output) {
53 open STDOUT, ">$output" or die "Error creating $output: $!\n";
54 }
55 print;
56 close STDOUT;
57 }
Something went wrong with that request. Please try again.