# This file is part of the Mageia project # Copyright (C) 2011 Damien Lallement # (C) 2011 Romain D'Alverny # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library 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 # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with this library; see the file COPYING.LIB. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, # Boston, MA 02110-1301, USA. # # TODO # # use Test::Most; bail_on_fail; SKIP: { skip "TODO", 1 unless 0; } done_testing(); # get the product to verify in idxlist sub check_idx { my ($log, $distro, $image, $verbo) = @_; my $idx; my $valid = 1; my $col; $col = 0 if member($distro, qw(Free FREE)); $col = 2 if member($distro, qw(PWP Powerpack)); $col = 3 if member($distro, qw(One ONE one)); $col = 1 if -r "/media/iso_check/i586/" && -r "/media/iso_check/x86_64/"; if ($col == 3) { substr($image, -3 , 3) = ''; $idx = $image . "lst"; $valid &= check_idx_list($idx, $log, $col, $verbo) if -r $idx && -r "idxlist"; } else { substr($image, -3 , 3) = ''; $idx = $image . "idx"; $valid &= check_idx_list($idx, $log, $col, $verbo) if -r $idx && -r "idxlist"; } return $valid; } # Verification of the presence of the packages on the iso sub check_idx_list { my ($idx, $log, $col, $verb) = @_; my $pkg; my $valid = 1; my $file; my @media; print "\n" if $verb; print $log "\n"; open(my $list, 'idxlist') or fail('check_idx_list'); while ($pkg = <$list>) { if (substr($pkg, 0, 1) ne '#') { chomp($pkg); @media = split(/ /, $pkg); if ($media[$col] == 1) { $file = `cat $idx | cut -d ' ' -f 2 | grep $media[4]` if $col != 3; $file = `cat $idx | grep $media[4]` if $col == 3; if ($file eq '') { print $log "$media[4] NOT FOUND in $idx\n"; print "$media[4] NOT FOUND in $idx\n" if $verb; $valid = 0; } else { print $file if $verb; #print $log $file; } } } } print $log "\n"; print $log "Comparison between idxlist and .idx OK\n" if $valid != 0; print $log "Comparison between idxlist and .idx NOT OK\n" if $valid == 0; print "\n" if $verb; print "Comparison between idxlist and .idx: OK\n" if $valid != 0 && $verb; print "Comparison between idxlist and .idx: NOT OK\n" if $valid == 0 && $verb; return $valid; }