commit 89f8746c079e471a07691ca3c18e49fcfbb8c32f
parent b5b6583a0b0f273ee3bea04b1ed0b8fccf7f0429
Author: Andreas Guldstrand <andreas.guldstrand@gmail.com>
Date: Mon, 7 Dec 2015 22:14:17 +0100
Bail out gracefully if a dependency can't be found
This fixes #16
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm
@@ -1007,7 +1007,7 @@ sub get_requires {
my $location = get_sbo_location(shift);
return() unless $location;
my $info = get_from_info(LOCATION => $location, GET => 'REQUIRES');
- return $$info[0] ne '' ? $info : undef;
+ return $info;
}
sub uniq {
@@ -1050,6 +1050,7 @@ sub merge_queues {
sub get_readme_contents {
exists $_[0] or script_error('get_readme_contents requires an argument.');
+ return undef, _ERR_OPENFH if not defined $_[0];
my ($fh, $exit) = open_read(shift .'/README');
return undef, $exit if $exit;
my $readme = do {local $/; <$fh>};
@@ -1141,6 +1142,7 @@ sub ask_opts {
sub user_prompt {
exists $_[1] or script_error('user_prompt requires two arguments.');
my ($sbo, $location) = @_;
+ if (not defined $location) { usage_error("Unable to locate $sbo in the SlackBuilds.org tree."); }
my ($readme, $exit) = get_readme_contents($location);
if (is_local($sbo)) { print "\nFound $sbo in local overrides.\n"; $exit = 0; }
return $readme, undef, $exit if $exit;