Lines 1-23
Link Here
|
1 |
#!/usr/bin/python |
1 |
#!/usr/bin/perl |
2 |
|
2 |
|
3 |
import re |
3 |
use strict; |
4 |
import debian.deb822 |
4 |
use warnings; |
5 |
|
5 |
|
6 |
exclusions = [ |
6 |
my @exclusions = ( |
7 |
'debhelper', |
7 |
'debhelper', |
8 |
'python', |
8 |
); |
9 |
'python-debian', |
|
|
10 |
] |
11 |
|
9 |
|
12 |
exclusions = [re.compile(s) for s in exclusions] |
10 |
open my $control_fh, '<', 'debian/control' or die "Cannot open debian/control"; |
|
|
11 |
my @lines = <$control_fh>; |
12 |
close $control_fh; |
13 |
|
13 |
|
14 |
depstring = debian.deb822.Deb822(file('debian/control')).get('Build-Depends') |
14 |
my @build_depends; |
15 |
deps = [s.strip() for s in depstring.split(',')] |
15 |
my $in_build_depends_block; |
16 |
result = [] |
16 |
for my $line ( @lines ) { |
17 |
for dep in deps: |
17 |
chomp $line; |
18 |
for ex in exclusions: |
18 |
if ( $line =~ m|Build-Depends:| ) { |
19 |
if ex.match(dep): |
19 |
$in_build_depends_block = 1; |
20 |
break |
20 |
$line =~ s|Build-Depends:||; |
21 |
else: |
21 |
} |
22 |
result.append(dep) |
22 |
next unless $in_build_depends_block; |
23 |
print 'koha:Depends=%s' % ', '.join(result) |
23 |
if ( $line =~ m|^\s*$| ) { |
|
|
24 |
last; |
25 |
} |
26 |
for my $dep ( split ',', $line ) { |
27 |
$dep =~ s|^\s*||; |
28 |
push @build_depends, $dep unless ( map { ( $dep =~ m|$_| ) ? 1 : () } @exclusions); |
29 |
} |
30 |
} |
31 |
print 'koha:Depends=' . join ( ', ', @build_depends ) . "\n"; |