~chaffra/+junk/trilinos

« back to all changes in this revision

Viewing changes to packages/moocho/config/string-replace.pl

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Prud'homme, Christophe Prud'homme, Johannes Ring
  • Date: 2009-12-13 12:53:22 UTC
  • mfrom: (5.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20091213125322-in0nrdjc55deqsw9
Tags: 10.0.3.dfsg-1
[Christophe Prud'homme]
* New upstream release

[Johannes Ring]
* debian/patches/libname.patch: Add prefix 'libtrilinos_' to all
  libraries. 
* debian/patches/soname.patch: Add soversion to libraries.
* debian/watch: Update download URL.
* debian/control:
  - Remove python-numeric from Build-Depends (virtual package).
  - Remove automake and autotools from Build-Depends and add cmake to
    reflect switch to CMake.
  - Add python-support to Build-Depends.
* debian/rules: 
  - Cleanup and updates for switch to CMake.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/perl -w
2
 
#
3
 
# This perl script replaces a string with another string.
4
 
# Here it is allowd for file_in and file_out to be the
5
 
# same file.
6
 
#
7
 
use strict;
8
 
#
9
 
my $g_use_msg =
10
 
  "Use: string-replace.pl find_string replacement_string file_in file_out\n";
11
 
if( scalar(@ARGV) < 4 ) {
12
 
  print STDERR $g_use_msg;
13
 
  exit(-1);
14
 
}
15
 
#
16
 
my $find_string        = shift;
17
 
my $replacement_string = shift;
18
 
my $file_in_name       = shift;
19
 
my $file_out_name      = shift;
20
 
#
21
 
#
22
 
if($file_in_name=~/CVS/) {
23
 
#  print "Do not replace in CVS\n";
24
 
  exit;
25
 
}
26
 
#
27
 
open FILE_IN, "<$file_in_name" || die "The file $file_in_name could not be opended for input\n";
28
 
my @file_in_array = <FILE_IN>;
29
 
close FILE_IN;
30
 
#
31
 
my @file_out_array;
32
 
my $did_replacement = 0;
33
 
foreach(@file_in_array) {
34
 
  #print $_;
35
 
  $did_replacement = 1 if $_=~s/$find_string/$replacement_string/g;
36
 
  #print $_;
37
 
  push @file_out_array, $_;
38
 
}
39
 
if($did_replacement || $file_out_name ne $file_in_name) {
40
 
  open FILE_OUT, ">$file_out_name" || die "The file $file_out_name could not be opended for output\n";
41
 
  print FILE_OUT @file_out_array;
42
 
  close FILE_OUT;
43
 
}