From 2c6017d9464f2e10834d9316e381bdb5c351e15e Mon Sep 17 00:00:00 2001 From: Olivier Thauvin Date: Thu, 19 Jul 2007 17:06:05 +0000 Subject: - add getdpath and getfulldpath function --- lib/MDV/Distribconf.pm | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'lib') diff --git a/lib/MDV/Distribconf.pm b/lib/MDV/Distribconf.pm index 8695c55..7f432b1 100644 --- a/lib/MDV/Distribconf.pm +++ b/lib/MDV/Distribconf.pm @@ -474,6 +474,10 @@ sub getvalue { ) : undef; last; }; + /^rpmsrate$/ and do { $default = 'rpmsrate'; last; }; + /^description$/ and do { $default = 'description'; last; }; + /^provide$/ and do { $default = 'description'; last; }; + /^depslist.ordered$/ and do { $default = 'description'; last; }; } return $distrib->_expand($media, $distrib->{cfg}->val($media, $var, $default), $level); } @@ -552,6 +556,44 @@ sub getfullmediapath { return $distrib->getpath(undef, 'root') . '/' . $path; } +=head2 $distrib->getdpath($media, $var) + +Does the same thing than getpath(), but the return always return the best for +file having twice location (index). + +You may want to use this function to ensure you allways the good value. + +=cut + +sub getdpath { + my ($distrib, $media, $var) = @_; + + if ($var =~ /^(hdlist|synthesis|pubkey|MD5SUM)$/) { + if ($distrib->{type} eq 'mandriva') { + return $distrib->getmediapath($media, $var); + } else { + return $distrib->getpath($media, $var); + } + } else { + return $distrib->getpath($media, $var); + } +} + +=head2 $distrib->getfulldpath($media, $var) + +Does the same thing than getfullpath(), but the return always return the best +for file having twice location (index). + +You may want to use this function to ensure you allways the good value. + +=cut + +sub getfulldpath { + my $distrib = shift; + my $path = $distrib->getdpath(@_) or return; + return $distrib->getpath(undef, 'root') . '/' . $path; +} + 1; -- cgit v1.2.1