Bug 25184: (RM follow-up) Make DB update idempotent
[koha.git] / debian / bd-to-depends
blob5bc755b987042d9a3fd544f764a0e335cd010f3b
1 #!/usr/bin/perl
3 use Modern::Perl;
5 my @exclusions = (
6 'debhelper',
7 );
9 open my $control_fh, '<', 'debian/control' or die "Cannot open debian/control";
10 my @lines = <$control_fh>;
11 close $control_fh;
13 my @build_depends;
14 my $in_build_depends_block;
15 for my $line ( @lines ) {
16 chomp $line;
17 if ( $line =~ m|Build-Depends:| ) {
18 $in_build_depends_block = 1;
19 $line =~ s|Build-Depends:||;
21 next unless $in_build_depends_block;
22 if ( $line =~ m|^\s*$| ) {
23 last;
25 for my $dep ( split ',', $line ) {
26 $dep =~ s|^\s*||;
27 push @build_depends, $dep unless ( map { ( $dep =~ m|$_| ) ? 1 : () } @exclusions);
30 print 'koha:Depends=' . join ( ', ', @build_depends ) . "\n";