From a5fb30d96daaac5e73f905cbf84236120cf16f03 Mon Sep 17 00:00:00 2001 From: Mason James Date: Wed, 27 Mar 2013 08:29:25 +1300 Subject: [PATCH] bug 8402 - a script to build ./install_misc/debian.packages from ./debian/control Content-Type: text/plain; charset="utf-8" to test 1/ delete existing ./install_misc/debian.packages file rm ./install_misc/debian.packages 2/ run script ./install_misc/build-pkg-file.pl -f 3/ view new ./install_misc/debian.packages file more ./install_misc/debian.packages --- install_misc/build-pkg-file.pl | 105 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 105 insertions(+), 0 deletions(-) create mode 100644 install_misc/build-pkg-file.pl diff --git a/install_misc/build-pkg-file.pl b/install_misc/build-pkg-file.pl new file mode 100644 index 0000000..38e4bcb --- /dev/null +++ b/install_misc/build-pkg-file.pl @@ -0,0 +1,105 @@ +#!/usr/bin/perl + +# Copyright (C) 2013 KohaAloha, NZ +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 3 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +=pod +a script to build the ./install_misc/debian.packages file from ./debian.control + +script must be run with --force arg, to execute + +=cut + +use Modern::Perl; +use Data::Printer; +use Data::Dumper; + +use Parse::Deb::Control; + +use Getopt::Long; +my $force,; +my $result = GetOptions( + 'f|force' => \$force, + +); + +if ( not $force ) { + print_usage(); + exit 0; +} + +my $parser = Parse::Deb::Control->new('./debian/control'); + +my $header = <get_keys('Package') ) { + my $r = ${ $entry->{'value'} }; + $para = $entry if $r =~ m/koha-common/; +} + +my $source; +foreach my $entry ( $parser->get_keys('Source') ) { + my $r = ${ $entry->{'value'} }; + $source = $entry if $r =~ m/koha/; +} + +my $dep = $para->{'para'}->{'Depends'}; +my $bdep = $source->{'para'}->{'Build-Depends'}; +my $deps = $dep . $bdep; + +my @deps2; +push @deps2, $header; + +foreach my $d ( split '\n', $deps ) { + next if $d =~ qr/\$/; + + $d =~ s/,//; + $d =~ s/.//; + $d =~ s/^[ \t]+|[ \t]+$//g; + $d =~ s/\s.*$//; + + $d =~ s/$/ install/; + $d .= "\n"; + + push @deps2, $d if $d !~ /\$/; +} + +my $file = './install_misc/debian.packages'; +open( my $fh, '>', $file ); + +print $fh (@deps2); +close $fh; + +sub print_usage { + print <<_USAGE_; +a script to build the ./install_misc/debian.packages file from ./debian.control + +script must be run with --force arg, to execute + +Parameters: + --force or -f run this script +_USAGE_ +} + +1; -- 1.7.2.5