From f4f8a83f5f23b509c924f87348bf55fa00dd7eef 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..a1f955b --- /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 -f/--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 $ss = ${ $entry->{'value'} }; + $para = $entry if $ss =~ m/koha-common/; +} + +my $source; +foreach my $entry ( $parser->get_keys('Source') ) { + my $ss = ${ $entry->{'value'} }; + $source = $entry if $ss =~ m/koha/; +} + +my $dep = $para->{'para'}->{'Depends'}; +my $bdep = $source->{'para'}->{'Build-Depends'}; +my $a = $dep . $bdep; + +my @moo; +push @moo, $header; + +foreach my $aa ( split '\n', $a ) { + next if $aa =~ qr/\$/; + + $aa =~ s/,//; + $aa =~ s/.//; + $aa =~ s/^[ \t]+|[ \t]+$//g; + $aa =~ s/\s.*$//; + + $aa =~ s/$/ install/; + $aa .= "\n"; + + push @moo, $aa if $aa !~ /\$/; +} + +my $file = './install_misc/debian.packages'; +open( my $fh, '>', $file ); + +print $fh (@moo); +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 -f/--force arg, to execute + +Parameters: + --force or -f run this script +_USAGE_ +} + +1; -- 1.7.2.5