From 9cedd9938ed1afaf9469ff817db9fa78e6de3302 Mon Sep 17 00:00:00 2001 From: Olivier Thauvin Date: Thu, 17 Jan 2008 17:50:50 +0000 Subject: - perform basic check on new xml files --- lib/MDV/Distribconf/Checks.pm | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'lib/MDV') diff --git a/lib/MDV/Distribconf/Checks.pm b/lib/MDV/Distribconf/Checks.pm index 078cda9..ac0b643 100644 --- a/lib/MDV/Distribconf/Checks.pm +++ b/lib/MDV/Distribconf/Checks.pm @@ -217,6 +217,16 @@ sub check_media_coherency { $media ); } + if ($distrib->getvalue($media, 'xml-info')) { + foreach (qw/info files changelog/) { + -f $distrib->getfulldpath($media, $_) or $error += _report_err( + $fhout, + 'MISSING_INDEX', "$_ %s doesn't exist for media `%s'", + $distrib->getfulldpath($media, $_), + $media + ); + } + } foreach (qw/pubkey/) { -f $distrib->getfullpath($media, $_) or $error += _report_err( $fhout, @@ -277,9 +287,14 @@ Return 1 if no error were found. sub check_media_md5 { my ($self, $media) = @_; + my @indexes = map { $self->getfullmediapath($media, $_) } (qw(hdlist synthesis)); + if ($self->getvalue($media, 'xml-info') && !$self->getvalue($media, 'cdmode')) { + push(@indexes, map { $self->getfullmediapath($media, $_) } + (qw(info files changelog))); + } my ($unsync) = MDV::Distribconf::Utils::checkmd5( $self->getfullmediapath($media, 'MD5SUM'), - map { $self->getfullmediapath($media, $_) } (qw(hdlist synthesis)) + @indexes ); if (@{$unsync || []}) { return 0; @@ -292,8 +307,18 @@ sub check_global_md5 { my ($self) = @_; my @indexes; foreach my $media ($self->listmedia()) { - push(@indexes, map { $self->getfullpath($media, $_) } (qw(hdlist synthesis))); + push( + @indexes, + map { $self->getfulldpath($media, $_) } (qw(hdlist synthesis)) + ); + if ($self->getvalue($media, 'xml-info') && $self->getvalue($media, 'cdmode')) { + push( + @indexes, + map { $self->getfulldpath($media, $_) } (qw(info files changelog)) + ); + } } + my ($unsync) = MDV::Distribconf::Utils::checkmd5( $self->getfullpath(undef, 'MD5SUM'), @indexes, -- cgit v1.2.1