diff options
-rw-r--r-- | lib/MDV/Distribconf.pm | 9 | ||||
-rw-r--r-- | t/01history.t | 8 |
2 files changed, 11 insertions, 6 deletions
diff --git a/lib/MDV/Distribconf.pm b/lib/MDV/Distribconf.pm index cc9d201..cd987b2 100644 --- a/lib/MDV/Distribconf.pm +++ b/lib/MDV/Distribconf.pm @@ -463,14 +463,15 @@ sub getvalue { /^os$/ and do { $default = 'linux'; last; }; /^gnu$/ and do { $default = 1; last; }; /^vendor$/ and do { $default = $distrib->{type}; last; }; - /^arch$/ and do { $default = `/bin/arch`; chomp($default); last; }; + /^arch$/ and do { $default = undef; last; }; /^platform$/ and do { - $default = sprintf('%s-%s-%s%s', - $distrib->getvalue($media, 'arch'), + my $arch = $distrib->getvalue($media, 'arch'); + $default = defined($arch) ? sprintf('%s-%s-%s%s', + $arch, $distrib->getvalue($media, 'vendor'), $distrib->getvalue($media, 'os'), $distrib->getvalue($media, 'gnu') ? '-gnu' : '', - ); + ) : undef; last; }; } diff --git a/t/01history.t b/t/01history.t index ef7e47a..f3db55c 100644 --- a/t/01history.t +++ b/t/01history.t @@ -17,6 +17,10 @@ foreach my $path (@testdpath) { ); ok($dconf->load(), "can load $path"); ok($dconf->listmedia(), "can list media"); - ok($dconf->getvalue(undef, "arch"), "can get arch"); - like($dconf->getvalue(undef, "platform"), '/^[^-]*-(mandriva|mandrake)-linux-gnu$/', "can get arch"); + SKIP: { + my $arch = $dconf->getvalue(undef, "arch"); + skip "undefined arch for in case", 2 unless(defined($arch)); + like($arch, '/.+/', "can get arch"); + like($dconf->getvalue(undef, "platform"), "/^$arch" . '-(mandriva|mandrake)-linux-gnu$/', "can get arch"); + } } |