~ubuntu-branches/ubuntu/breezy/atool/breezy

« back to all changes in this revision

Viewing changes to debian/replace_autoconf_vars

  • Committer: Bazaar Package Importer
  • Author(s): Stephane Jourdois
  • Date: 2004-10-03 14:38:13 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20041003143813-p4iwzd0lrc6twk0l
Tags: 0.29.0-2
* Use rar as unpacker for rar archives by default (Closes: #273009).
* Remove Suggests: unrar, as atool supports unrar-nonfree and rar, but
  not unrar.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl -w
 
2
# This script reads configure.ac, and replaces all occurences of
 
3
# @.+@ in script and manpage with values.
 
4
# It returns 0 on success, 1 if it missed something.
 
5
#
 
6
# St�phane (kwisatz) Jourdois <kwisatz@rubis.org>
 
7
# Mon, 16 Aug 2004 15:22:24 +0200
 
8
 
 
9
use strict;
 
10
 
 
11
my %vars = (
 
12
        'PERL' => '/usr/bin/perl',
 
13
);
 
14
 
 
15
my ($from, $to) = @ARGV;
 
16
 
 
17
open AC, '<configure.ac' or die "Cannot read configure.ac: $!\n";
 
18
 
 
19
while (<AC>) {
 
20
        if (/^AC_INIT\((\w+), ([0-9.]+), .+\)/) {
 
21
                $vars{'PACKAGE_NAME'} = $1;
 
22
                $vars{'PACKAGE_VERSION'} = $2;
 
23
 
 
24
                # Remove this line if there is are
 
25
                # other interesting lines in configure.ac
 
26
                # For now there isn't.
 
27
                last;
 
28
        }
 
29
}
 
30
close AC;
 
31
 
 
32
open FROM, "<$from" or die "Cannot read $from: $!\n";
 
33
open TO, ">$to" or die "Cannot write $to: $!\n";
 
34
 
 
35
while (<FROM>) {
 
36
        for my $var (keys %vars) {
 
37
                s/\@$var\@/$vars{$var}/g;
 
38
        }
 
39
        print TO;
 
40
}
 
41
 
 
42
close FROM;
 
43
close TO;