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
|
#! /usr/bin/perl
-x 'inplace/bin/ghc-pkg' or die "inplace ghc-pkg not executable or present";
open PKG, 'inplace/bin/ghc-pkg list --simple-output |'
or die "ghc-pkg list failed: $!";
my @ignored = ('ghc', 'mtl', 'utf8-string', 'rts', 'stm', 'parallel');
my %ignored;
$ignored{$_}++ for @ignored;
my @no_conflict = ('cabal');
my %no_conflict;
$no_conflict{$_}++ for @no_conflict;
my @pkgs;
while (<PKG>) {
y/A-Z/a-z/;
my $pkgstring = $_;
LOOP: while ($pkgstring =~ m,([^ ]*?)-\d.*? ?,g) {
my $pkg = $1;
next if exists $ignored{$pkg};
push @pkgs, $1;
}
}
close PKG;
my $buf;
open DEV, '>debian/ghc.substvars';
$buf = "provided-devs=";
foreach (sort @pkgs) {$buf .= "libghc-$_-dev, ";}
$buf =~ s#(.*), #$1#;
print DEV $buf."\n";
$buf = "conflicting-devs=";
foreach (sort @pkgs) {
next if $no_conflict{$_};
$buf .= "libghc-$_-dev, ";
}
$buf =~ s#(.*), #$1#;
print DEV $buf."\n";
close DEV;
open PROF, '>debian/ghc-prof.substvars';
print PROF 'provided-profs=';
$buf = "";
foreach (@pkgs) {$buf .= "libghc-$_-prof, ";}
$buf =~ s#(.*), #$1#;
print PROF $buf."\n";
close PROF;
open DOC, '>debian/ghc-doc.substvars';
print DOC 'provided-docs=';
$buf = "";
foreach (@pkgs) {$buf .= "libghc-$_-doc, ";}
$buf =~ s#(.*), #$1#;
print DOC $buf."\n";
close DOC;
|