File: substitute.pl

package info (click to toggle)
octave-pkg-dev 1.4.4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 104 kB
  • ctags: 36
  • sloc: perl: 176; sh: 88; makefile: 7
file content (43 lines) | stat: -rwxr-xr-x 935 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/perl -w

use Parse::DebControl;
use Dpkg::Changelog;

my $parser = new Parse::DebControl;
my $data = $parser->parse_file ('./debian/control') -> [0];

for my $field ("Git", "Browser") {
    (my $tmp = $data -> {"Vcs-$field"}) =~ s/pkg-dev/\$name/;
    $data->{"Vcs-$field"} = $tmp;
}

open (FID, "< debian/compat");
$data->{Compat} = join ("", <FID>);
chomp $data->{Compat};
close FID;

open (FID, "< debian/changelog");
while (<FID>) {
    if (/\(([\d.]+)\)/) {
        $data->{Version} = $1;
        last;
    }
}

$base = "make-octave-forge-debpkg";
open (IN, "< $base.in");
open (OUT, "> $base");

while (<IN>) {
    for my $field ("Uploaders", "Standards-Version", "Maintainer",
                   "Vcs-Git", "Vcs-Browser", "Compat", "Version") {
        ## Escape @ signs in email addresses
        (my $value = $data->{$field}) =~ s/@/\\@/g;
        s{#$field#}{$value};
    }
    print OUT;
}

close IN;
close OUT;