diff options
-rw-r--r-- | lib/MDV/Distribconf.pm | 12 | ||||
-rw-r--r-- | t/01distribconf.t | 3 |
2 files changed, 14 insertions, 1 deletions
diff --git a/lib/MDV/Distribconf.pm b/lib/MDV/Distribconf.pm index 560ae19..bab6a76 100644 --- a/lib/MDV/Distribconf.pm +++ b/lib/MDV/Distribconf.pm @@ -455,6 +455,18 @@ sub getvalue { and do { $default = $_; last }; /^(?:tag|branch)$/ and do { $default = ''; last }; /^(?:media|info)dir$/ and do { $default = $distrib->{$var}; last }; + /^os$/ and do { $default = 'linux'; last; }; + /^gnu$/ and do { $default = 1; last; }; + /^vendor$/ and do { $default = 'mandriva'; last; }; + /^platform$/ and do { + $default = sprintf('%s-%s-%s%s', + $distrib->getvalue($media, 'arch'), + $distrib->getvalue($media, 'vendor'), + $distrib->getvalue($media, 'os'), + $distrib->getvalue($media, 'gnu') ? '-gnu' : '', + ); + last; + }; } return $distrib->_expand($media, $distrib->{cfg}->val($media, $var, $default), $level); } diff --git a/t/01distribconf.t b/t/01distribconf.t index b494c6d..b411bea 100644 --- a/t/01distribconf.t +++ b/t/01distribconf.t @@ -12,7 +12,7 @@ my %testdpath = ( 'http://server/path/' => 'testdata/test/media/media_info/media.cfg', ); -plan tests => 14 + 21 * scalar(keys %testdpath); +plan tests => 14 + 22 * scalar(keys %testdpath); use_ok('MDV::Distribconf'); @@ -45,6 +45,7 @@ foreach my $path (keys %testdpath) { is($dconf->getvalue('main', 'version'), '2006.0', "Can get global value via media"); is($dconf->getvalue('main', 'name'), 'main', "Can get default name"); is($dconf->getvalue('contrib', 'name'), 'Contrib', "Can get media name"); + is($dconf->getvalue('contrib', 'platform'), 'i586-mandriva-linux-gnu', "Can get media platform"); is($dconf->getpath(undef, 'root'), $path, "Can get root path"); like($dconf->getpath(undef, 'media_info'), qr!^/*media/media_info/?$!, "Can get media_info path"); # vim color: */ |