From 30b1aa84d602a648139ae78f00b94dc9ded666bf Mon Sep 17 00:00:00 2001 From: Andreas Guldstrand Date: Thu, 3 Mar 2016 14:53:18 +0100 Subject: sbo*: Add returns to subs missing them and check @_ better --- sbocheck | 4 +++- sboclean | 10 ++++++---- sboconfig | 7 ++++--- sbofind | 15 +++++++++------ sboinstall | 3 ++- sboremove | 5 ++++- sbosnap | 3 ++- sboupgrade | 3 ++- 8 files changed, 32 insertions(+), 18 deletions(-) diff --git a/sbocheck b/sbocheck index 30366bc..e0c6518 100755 --- a/sbocheck +++ b/sbocheck @@ -22,7 +22,7 @@ use Data::Dumper; my $self = basename($0); sub show_usage { - print < qw/ . .. /); @@ -86,6 +87,7 @@ sub clean_c32 { next FIRST unless $ls =~ /^package-.+-compat32$/; rm_full("$dir/$ls"); } + return 1; } remove_stuff($config{SBO_HOME} .'/distfiles') if $clean_dist; diff --git a/sboconfig b/sboconfig index 4d24256..2a90d46 100755 --- a/sboconfig +++ b/sboconfig @@ -23,7 +23,7 @@ use File::Temp qw(tempfile);; my $self = basename($0); sub show_usage { - print <') or return(); diff --git a/sbofind b/sbofind index 9025e3b..d3a613d 100755 --- a/sbofind +++ b/sbofind @@ -20,7 +20,7 @@ use Getopt::Long qw(:config bundling); my $self = basename($0); sub show_usage { - print <) { unless ($found) { + # TODO: fix this monstrosity $found++, next FIRST if $name = ($line =~ $name_regex)[0]; } else { if (my ($location) = ($line =~ $loc_regex)[0]) { @@ -104,9 +106,10 @@ sub perform_search { # pull the contents of a file into a variable and format it for output sub get_file_contents { - exists $_[0] or script_error 'get_file_contents requires an argument'; - -f $_[0] or return "$_[0] doesn't exist.\n"; - my ($fh, $exit) = open_read(shift); + @_ == 1 or script_error 'get_file_contents requires an argument'; + my $file = shift; + -f $file or return "$file doesn't exist.\n"; + my ($fh, $exit) = open_read($file); if ($exit) { warn $fh; return(); @@ -121,7 +124,7 @@ sub get_file_contents { # get build queue and return it as a single line. sub show_build_queue { - exists $_[0] or script_error('show_build_queue requires an argument.'); + @_ == 1 or script_error('show_build_queue requires an argument.'); my $queue = get_build_queue([shift], {}); return join(" ", reverse @$queue); } diff --git a/sboinstall b/sboinstall index aa0706c..7e15183 100755 --- a/sboinstall +++ b/sboinstall @@ -20,7 +20,7 @@ use File::Basename; my $self = basename($0); sub show_usage { - print <