aboutsummaryrefslogtreecommitdiff
path: root/SBO-Lib/lib/SBO/Lib.pm
diff options
context:
space:
mode:
authorAndreas Guldstrand <andreas.guldstrand@gmail.com>2015-12-07 22:14:17 +0100
committerAndreas Guldstrand <andreas.guldstrand@gmail.com>2015-12-07 22:14:17 +0100
commit89f8746c079e471a07691ca3c18e49fcfbb8c32f (patch)
treedb9675b1c1d4b5df01926877de8bbca03a17fbf5 /SBO-Lib/lib/SBO/Lib.pm
parentb5b6583a0b0f273ee3bea04b1ed0b8fccf7f0429 (diff)
downloadsbotools2-89f8746c079e471a07691ca3c18e49fcfbb8c32f.tar.xz
Bail out gracefully if a dependency can't be found
This fixes #16
Diffstat (limited to 'SBO-Lib/lib/SBO/Lib.pm')
-rw-r--r--SBO-Lib/lib/SBO/Lib.pm4
1 files changed, 3 insertions, 1 deletions
diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm
index de779e6..3b88810 100644
--- 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;