From 7d0f163c8587d3bb145e7f0bf8fd314594c069b9 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 24 Mar 2015 13:23:53 +0100 Subject: [PATCH] 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. --- debian/bd-to-depends | 44 ++++++++++++++++++++++++++------------------ debian/control | 4 ++-- debian/control.in | 2 +- 3 files changed, 29 insertions(+), 21 deletions(-) diff --git a/debian/bd-to-depends b/debian/bd-to-depends index ce8809b..cff8b24 100755 --- a/debian/bd-to-depends +++ b/debian/bd-to-depends @@ -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"; diff --git a/debian/control b/debian/control index 96a6650..0d923b7 100644 --- a/debian/control +++ b/debian/control @@ -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 diff --git a/debian/control.in b/debian/control.in index 66ebc4c..9f404d6 100644 --- a/debian/control.in +++ b/debian/control.in @@ -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 -- 2.1.0