aboutsummaryrefslogtreecommitdiffstats
path: root/t_install_iso/011_check_idx.t
diff options
context:
space:
mode:
Diffstat (limited to 't_install_iso/011_check_idx.t')
-rw-r--r--t_install_iso/011_check_idx.t78
1 files changed, 78 insertions, 0 deletions
diff --git a/t_install_iso/011_check_idx.t b/t_install_iso/011_check_idx.t
new file mode 100644
index 0000000..de9b8bb
--- /dev/null
+++ b/t_install_iso/011_check_idx.t
@@ -0,0 +1,78 @@
+# 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;
+}