From 12a1c8c4530ddb9ab83fec1f9b5bf61a25764e6b Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Fri, 31 Aug 2012 08:00:07 -0500 Subject: better testing, more still to come --- sboupgrade | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'sboupgrade') diff --git a/sboupgrade b/sboupgrade index be2fc5a..cdc2ca2 100755 --- a/sboupgrade +++ b/sboupgrade @@ -101,20 +101,29 @@ sub grok_requirements ($$$) { my ($sbo, $location, $readme) = @_; my $requires = get_from_info (LOCATION => $location, GET => 'REQUIRES'); return unless $$requires[0]; + # do nothing if a req list contains %README% + return if '%README%' ~~ @$requires; + # do nothing if there's a circular requirement + FIRST: for my $req (@$requires) { + my $req_req = get_from_info (LOCATION => get_sbo_location $req, + GET => 'REQUIRES'); + return if $sbo ~~ @$req_req; + } + # else proceed for my $req (@$requires) { my $inst = get_installed_sbos; - my $inst_names= get_inst_names $inst;; + my $inst_names= get_inst_names $inst; unless ($req ~~ @$inst_names) { say $readme; say "$sbo has $req listed as a requirement."; print "Shall I attempt to install it first? [y] "; if ( =~ /^[Yy\n]/) { - my @cmd = ('/usr/sbin/sboupgrade', '-oN', $req); - system (@cmd) == 0 or die "$req failed to install.\n"; + system ('/usr/sbin/sboupgrade', '-oN', $req) == 0 or + die "$req failed to install.\n"; } } } - return 1; + return; } # look for any (user|group)add commands in the README -- cgit v1.2.3