aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Guldstrand <andreas.guldstrand@gmail.com>2015-12-07 03:34:15 +0100
committerAndreas Guldstrand <andreas.guldstrand@gmail.com>2015-12-07 03:34:15 +0100
commit57ae4ea1cd880398653c0a7b81a1964586c0f146 (patch)
treec23d00f391f2fc52a3ff81ee97582450c7dd936d
parentcc37e3a141030ff3dce74bc3fbf329ad0dd38972 (diff)
downloadsbotools2-57ae4ea1cd880398653c0a7b81a1964586c0f146.tar.xz
Local overrides may have nonexistent fields
This fixes #14
-rw-r--r--SBO-Lib/lib/SBO/Lib.pm8
1 files changed, 7 insertions, 1 deletions
diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm
index 0f75eaa..de779e6 100644
--- 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}};
}