Koha/debian/bd-to-depends
Jonathan Druart d269bef7eb Bug 4847: Remove the python dependency for package builds
The only place python is used is in the debian/bd-to-depends script.
This patch rewrite this script using perl.

Test plan:
The execution of
  debian/bd-to-depends
Should return the same output.

Signed-off-by: Robin Sheat <robin@catalyst.net.nz>
Checked output, built a package, all is happy. Yay for no python!

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-03-25 11:22:49 -03:00

31 lines
740 B
Perl
Executable file

#!/usr/bin/perl
use strict;
use warnings;
my @exclusions = (
'debhelper',
);
open my $control_fh, '<', 'debian/control' or die "Cannot open debian/control";
my @lines = <$control_fh>;
close $control_fh;
my @build_depends;
my $in_build_depends_block;
for my $line ( @lines ) {
chomp $line;
if ( $line =~ m|Build-Depends:| ) {
$in_build_depends_block = 1;
$line =~ s|Build-Depends:||;
}
next unless $in_build_depends_block;
if ( $line =~ m|^\s*$| ) {
last;
}
for my $dep ( split ',', $line ) {
$dep =~ s|^\s*||;
push @build_depends, $dep unless ( map { ( $dep =~ m|$_| ) ? 1 : () } @exclusions);
}
}
print 'koha:Depends=' . join ( ', ', @build_depends ) . "\n";