From 178521d057638c8b04422fb8c832e002f0dddcfe Mon Sep 17 00:00:00 2001 From: Olivier Thauvin Date: Wed, 16 Jan 2008 23:04:43 +0000 Subject: - handle new xml files --- lib/MDV/Distribconf.pm | 43 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 9 deletions(-) (limited to 'lib/MDV') diff --git a/lib/MDV/Distribconf.pm b/lib/MDV/Distribconf.pm index d8be727..a06bc3b 100644 --- a/lib/MDV/Distribconf.pm +++ b/lib/MDV/Distribconf.pm @@ -76,6 +76,18 @@ A human-readable name for the media. By default this is the media path (that is, the section name), where slashes have been replaced by underscores. +=item B + +The xml file containing rpm informations. + +=item B + +The xml file containing rpm changelogs. + +=item B + +The xml file containing rpm files list. + =back =item global specific values: @@ -437,7 +449,11 @@ sub getvalue { my $default = ""; for ($var) { - /^synthesis$/ and $default = 'synthesis.' . lc($distrib->getvalue($media, 'hdlist', $level)); + /^path$/ and return $media; + /^root$/ and return $distrib->{root}; + /^(info|files|changelog)$/ and + return "$var." . lc($distrib->getvalue($media, 'name', $level)) . '.xml.lzma'; + /^synthesis$/ and $default = 'synthesis.' . lc($distrib->getvalue($media, 'hdlist', $level)); /^hdlist$/ and $default = 'hdlist_' . lc($distrib->getvalue($media, 'name', $level)) . '.cz'; /^pubkey$/ and $default = 'pubkey_' . lc($distrib->getvalue($media, 'name', $level)); /^(pubkey|hdlist|synthesis)$/ and do { @@ -452,8 +468,6 @@ sub getvalue { return join(',', map { "$_=" . ($distrib->getvalue(undef, $_) || '') } qw(vendor distribution type version branch release arch product)); }; - /^path$/ and return $media; - /^root$/ and return $distrib->{root}; /^mediacfg_version$/ and return $distrib->{cfg}->val('media_info', 'mediacfg_version') || 1; /^VERSION$/ and do { $default = 'VERSION'; last }; @@ -497,6 +511,10 @@ sub getpath { my ($distrib, $media, $var) = @_; $distrib->mediaexists($media) or return; $var ||= ""; # Avoid undef value + if ($var =~ /^(info|files|changelog)$/) { + $distrib->getvalue($media, 'xml-info') or return; + $distrib->getvalue($media, 'cdmode') or return; + } my $val = $distrib->getvalue($media, $var); $var =~ /^(?:root|VERSION|product\.id|(?:media|info)dir)$/ and return $val; my $thispath = $var eq 'path' ? $distrib->{mediadir} : $distrib->{infodir}; @@ -519,13 +537,20 @@ to the media for files having doble location (index for example). sub getmediapath { my ($distrib, $media, $var) = @_; my %files = ( - pubkey => 'pubkey', - hdlist => 'hdlist.cz', - synthesis => 'synthesis.hdlist.cz', - MD5SUM => 'MD5SUM', - infodir => '', + pubkey => 'pubkey', + hdlist => 'hdlist.cz', + synthesis => 'synthesis.hdlist.cz', + MD5SUM => 'MD5SUM', + infodir => '', + info => 'info.xml.lzma', + files => 'files.xml.lzma', + changelog => 'changelog.xml.lzma', ); $var eq 'path' and return $distrib->getpath($media, 'path'); + if ($var =~ /^(info|files|changelog)$/) { + $distrib->getvalue($media, 'xml-info') or return; + $distrib->getvalue($media, 'cdmode') and return; + } return $distrib->getpath($media, 'path') . $distrib->{mediainfodir} . "/$files{$var}"; } @@ -570,7 +595,7 @@ You may want to use this function to ensure you allways the good value. sub getdpath { my ($distrib, $media, $var) = @_; - if ($var =~ /^(hdlist|synthesis|pubkey|MD5SUM)$/) { + if ($var =~ /^(hdlist|synthesis|pubkey|MD5SUM|info|files|changelog)$/) { if ($distrib->getvalue($media, 'cdmode') || $distrib->{type} eq 'mandrake') { return $distrib->getpath($media, $var); -- cgit v1.2.1