diff options
Diffstat (limited to 'lib/MDV/Distribconf/Build.pm')
-rw-r--r-- | lib/MDV/Distribconf/Build.pm | 81 |
1 files changed, 2 insertions, 79 deletions
diff --git a/lib/MDV/Distribconf/Build.pm b/lib/MDV/Distribconf/Build.pm index 129c467..44a1ecb 100644 --- a/lib/MDV/Distribconf/Build.pm +++ b/lib/MDV/Distribconf/Build.pm @@ -1,23 +1,3 @@ -##- Nanar <nanardon@mandriva.org> -##- (c) 2005 Olivier Thauvin -##- (c) 2005 Mandriva Linux -##- -##- This program 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 2, or (at your option) -##- any later version. -##- -##- This program 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 this program; if not, write to the Free Software -##- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# $Id$ - package MDV::Distribconf::Build; =head1 NAME @@ -34,8 +14,8 @@ use strict; use warnings; use MDV::Distribconf; -our @ISA = qw(MDV::Distribconf); -our $VERSION = $MDV::Distribconf::VERSION; +use base qw(MDV::Distribconf MDV::Distribconf::Checks); +our $VERSION = (qq$Revision$ =~ /(\d+)/)[0]; =item MDV::Distribconf::Build->new($root_of_distrib) @@ -168,63 +148,6 @@ sub write_version { } -=item $distrib->check($fhout) - -Performs basic checks on the distribution and prints to $fhout (STDERR by -default) warnings and errors found. Returns the number of errors reported. - -=cut - -sub check { - my ($distrib, $fhout) = @_; - $fhout ||= \*STDERR; - - my $error = 0; - - my $report_err = sub { - my ($l, $f, @msg) = @_; - $l eq 'E' and $error++; - printf $fhout "$l: $f\n", @msg; - }; - - $distrib->listmedia or $report_err->('W', "No media found in this config"); - - # Checking no overlap - foreach my $var (qw/hdlist synthesis path/) { - my %e; - foreach ($distrib->listmedia) { - my $v = $distrib->getpath($_, $var); - push @{$e{$v}}, $_; - } - - foreach my $key (keys %e) { - if (@{$e{$key}} > 1) { - $report_err->('E', "media %s have same %s (%s)", - join (", ", @{$e{$key}}), - $var, - $key - ); - } - } - } - - foreach my $media ($distrib->listmedia) { - -d $distrib->getfullpath($media, 'path') or $report_err->( - 'E', "dir %s does't exist for media '%s'", - $distrib->getpath($media, 'path'), - $media - ); - foreach (qw/hdlist synthesis pubkey/) { - -f $distrib->getfullpath($media, $_) or $report_err->( - 'E', "$_ %s doesn't exist for media '%s'", - $distrib->getpath($media, $_), - $media - ); - } - } - return $error; -} - 1; __END__ |