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>
This commit is contained in:
Jonathan Druart 2015-03-24 13:23:53 +01:00 committed by Tomas Cohen Arazi
parent e044995d8a
commit d269bef7eb
3 changed files with 29 additions and 21 deletions

44
debian/bd-to-depends vendored
View file

@ -1,23 +1,31 @@
#!/usr/bin/python
#!/usr/bin/perl
import re
import debian.deb822
use strict;
use warnings;
exclusions = [
my @exclusions = (
'debhelper',
'python',
'python-debian',
]
);
exclusions = [re.compile(s) for s in exclusions]
open my $control_fh, '<', 'debian/control' or die "Cannot open debian/control";
my @lines = <$control_fh>;
close $control_fh;
depstring = debian.deb822.Deb822(file('debian/control')).get('Build-Depends')
deps = [s.strip() for s in depstring.split(',')]
result = []
for dep in deps:
for ex in exclusions:
if ex.match(dep):
break
else:
result.append(dep)
print 'koha:Depends=%s' % ', '.join(result)
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";

4
debian/control vendored
View file

@ -124,8 +124,8 @@ Build-Depends: libalgorithm-checkdigits-perl,
libyaml-perl,
libyaml-syck-perl,
perl,
perl-modules,
debhelper (>= 7.0.50), gettext, python, python-debian, xsltproc, docbook-xsl,
perl-modules,
debhelper (>= 7.0.50), gettext, xsltproc, docbook-xsl,
libxml2-utils, bash-completion, perl-modules (>= 5.14.2) | libtest-simple-perl (>= 0.98)
Package: koha-common

2
debian/control.in vendored
View file

@ -10,7 +10,7 @@ Standards-Version: 3.8.4
# See debian/rules, the override_dh_gencontrol rules.
# There are some exceptions.
Build-Depends:__AUTODEPENDS__,
debhelper (>= 7.0.50), gettext, python, python-debian, xsltproc, docbook-xsl,
debhelper (>= 7.0.50), gettext, xsltproc, docbook-xsl,
libxml2-utils, bash-completion, perl-modules (>= 5.14.2) | libtest-simple-perl (>= 0.98)
Package: koha-common