diff options
author | Jacob Pipkin <j@dawnrazor.net> | 2012-09-01 12:05:47 -0500 |
---|---|---|
committer | Jacob Pipkin <j@dawnrazor.net> | 2012-09-01 12:05:47 -0500 |
commit | 72afb8322ace13da8b3598ac9e5a543382b207d6 (patch) | |
tree | c3bbd858329fae3d658e1b37fe0ca4f527a392c0 | |
parent | 33407165134a76e34c763898ef461ee6fd979f97 (diff) | |
download | sbotools2-72afb8322ace13da8b3598ac9e5a543382b207d6.tar.xz |
almost there.
-rw-r--r-- | SBO-Lib/lib/SBO/Lib.pm | 3 | ||||
-rwxr-xr-x | sbofind | 8 | ||||
-rwxr-xr-x | sboupgrade | 13 |
3 files changed, 15 insertions, 9 deletions
diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index e76fa8d..6d2916e 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -51,6 +51,7 @@ use File::Path qw(make_path remove_tree); use Fcntl; use File::Temp qw(tempdir tempfile); use Fcntl qw(F_SETFD F_GETFD); +use feature 'say'; our $tempdir = tempdir (CLEANUP => 1); @@ -660,7 +661,7 @@ sub make_clean (%) { unless ($args{SBO} && $args{SRC} && $args{VERSION}) { script_error 'make_clean requires three arguments.'; } - say "Cleaning for $args{SBO}-$args{VERSION}..."; + say "Cleaning for $args{SBO}-$args{VERSION}...\n"; my $tmpsbo = "/tmp/SBo"; remove_tree ("$tmpsbo/$args{SRC}") if -d "$tmpsbo/$args{SRC}"; remove_tree ("$tmpsbo/package-$args{SBO}") if @@ -77,12 +77,14 @@ sub get_file_contents ($) { -f $_[0] or return "$_[0] doesn't exist.\n"; my $fh = open_read shift; my $contents = do {local $/; <$fh>}; - $contents =~ s/\n/\n /g; - $contents =~ s/ $//g; + for ($contents) { + s/\n/\n /g; + s/ $//g; + } return $contents; } -perform_search $search; +my $findings = perform_search $search; # pretty formatting if (exists $$findings[0]) { @@ -133,6 +133,7 @@ sub get_requires ($$) { $_-- for @remove; } return \@deps; +} # ask to install any requirements found sub ask_requires (%) { @@ -177,7 +178,7 @@ sub get_user_group ($) { # offer to run any user/group add commands sub ask_user_group ($$) { exists $_[1] or script_error 'ask_user_group requires two arguments'; - my ($cmds, $readme) = shift; + my ($cmds, $readme) = @_; say "\n". $readme; print "\nIt looks like this slackbuild requires the following"; say " command(s) to be run first:"; @@ -231,10 +232,11 @@ sub readme_prompt ($) { close $fh; # check for requirements, offer to install any found my $requires = get_requires $sbo, $readme; - ask_requires $requires, $readme, $sbo if ref $requires eq 'ARRAY'; + ask_requires (REQUIRES => $requires, README => $readme, SBO => $sbo) if + ref $requires eq 'ARRAY'; # check for user/group add commands, offer to run any found my $user_group = get_user_group $readme; - ask_user_group $user_group, $readme if ref $user_group eq 'ARRAY'; + ask_user_group $user_group, $readme if $$user_group[0]; # check for options mentioned in the README my $opts; $opts = ask_opts $readme if get_opts $readme; @@ -266,8 +268,10 @@ sub process_sbos ($) { if ($@) { $failures{$sbo} = $@; } else { + do_upgradepkg $pkg unless $no_install; unless ($distclean eq 'TRUE') { - make_clean $sbo, $src, $version unless $noclean eq 'TRUE'; + make_clean (SBO => $sbo, SRC => $src, VERSION => $version) + unless $noclean eq 'TRUE'; } else { make_distclean ( SBO => $sbo, @@ -276,7 +280,6 @@ sub process_sbos ($) { LOCATION => $locations{$sbo}, ); } - do_upgradepkg $pkg unless $no_install; # move package to $config{PKG_DIR} if defined unless ($config{PKG_DIR} eq 'FALSE') { my $dir = $config{PKG_DIR}; |