File: octave-pkg-helper

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 (65 lines) | stat: -rwxr-xr-x 2,067 bytes parent folder | download
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/perl -w

# octave-pkg-dev.pl: Generate ${octave:Depends} variable and
#                    postinst/postrm scripts
# This file is part of the octave-pkg-dev Debian package

# Copyright (c) 2008, 2009, 2012, 2016  Rafael Laboissiere <rafael@laboissiere.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.


use strict;
use File::Find;
use Debian::Debhelper::Dh_Lib;
use MIME::Head;

init ();

my %depends = ();
my $desc = "";

my $octave_version = qx {/usr/bin/octave-config --print VERSION};
$octave_version =~ s/-rc/~rc/;

if (-f "DESCRIPTION") {

    my $fields = MIME::Head->new->from_file ("DESCRIPTION");

    my $deps = $fields->get ('depends');
    map {
	if (/([^ ]+) \((.*)\)/) {
	    $depends {"octave-$1"} = $2;
	} else {
	    $depends {"octave-$_"} = "";
	}
    } grep {not /^octave/i} split (", ", $deps);

    $desc = $fields->get ('description');
    $desc =~ s/\n */\n/g;
    chomp $desc;
    $desc =~ s/\n/\${Newline}/g;
}

foreach my $package (@{$dh{DOPACKAGES}}) {
    delsubstvar ($package, 'octave:Depends');
    addsubstvar ($package, 'octave:Depends', "octave (>= $octave_version)");
    for my $pkg (keys %depends) {
        # add dependencies from the DESCRIPTION file
        addsubstvar ($package, 'octave:Depends', $pkg, $depends {$pkg});
    }
    delsubstvar ($package, 'octave:Upstream-Description');
    addsubstvar ($package, 'octave:Upstream-Description', $desc);
}