commit 57ae4ea1cd880398653c0a7b81a1964586c0f146
parent cc37e3a141030ff3dce74bc3fbf329ad0dd38972
Author: Andreas Guldstrand <andreas.guldstrand@gmail.com>
Date: Mon, 7 Dec 2015 03:34:15 +0100
Local overrides may have nonexistent fields
This fixes #14
Diffstat:
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm
@@ -407,12 +407,18 @@ sub get_from_info {
$store = {};
foreach my $line (split /\n/, $contents) {
my ($key, $val) = $last_key;
- if ($line =~ /^([^=\s]+)=(.*)$/) { $key = $1; $val = $2; }
+ if ($line =~ /^([^=\s]+)=(.*)$/) { $key = $1; $val = $2; }
elsif ($line =~ /^\s+([^\s].+)$/) { $val = $1; }
else { script_error("error when parsing $sbo.info file. Line: $line") }
push @{ $store->{$key} }, ($val ? split(' ', $val) : $val);
$last_key = $key;
}
+ # allow local overrides to get away with not having quite all the fields
+ if (is_local($sbo)) {
+ for my $key (qw/DOWNLOAD_x86_64 MD5SUM_x86_64 REQUIRES/) {
+ $store->{$key} //= ['']; # if they don't exist, treat them as empty
+ }
+ }
return $store->{$args{GET}};
}