1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
# This file is part of the Mageia project
# Copyright (C) 2011 Damien Lallement <dams@mageia.org>
# (C) 2011 Romain D'Alverny <rda@mageia.org>
#
# 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 "<Log of check_idx>\n" if $verb;
print $log "<Log of check_idx>\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 "</Log of check_idx>\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 "</Log of check_idx>\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;
}
|