From 38488004c207508834543e02e991e6129669bc8c Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Thu, 30 Aug 2012 07:20:32 -0500 Subject: changes for REQUIRES in SBos for 14, and many cleanups, fixes, enhancements --- sboupgrade | 323 +++++++++++++++++++++++++++---------------------------------- 1 file changed, 144 insertions(+), 179 deletions(-) (limited to 'sboupgrade') diff --git a/sboupgrade b/sboupgrade index 2daedb9..cf4468a 100755 --- a/sboupgrade +++ b/sboupgrade @@ -9,6 +9,7 @@ # date: Boomtime, the 39th day of Discord in the YOLD 3178 # license: WTFPL +use 5.16.0; use SBO::Lib; use File::Basename; use Getopt::Std; @@ -19,7 +20,7 @@ use warnings FATAL => 'all'; my %config = %SBO::Lib::config; my $self = basename ($0); -sub show_usage { +sub show_usage () { print < =~ /^[Yy\n]/) { - my @args = ("/usr/sbin/sboupgrade", '-oN'); - # populate args so that they carry over correctly - push @args, "-c" if exists $options{c}; - push @args, "-d" if exists $options{d}; - push @args, "-j $options{j}" if exists $options{j}; - push @args, "-p" if $compat32 eq 'TRUE'; - push @args, $need; - system (@args) == 0 or - die "Requirement failure, unable to proceed.\n"; +# for a ref to an array of hashes of installed packages, return an array ref +# consisting of just their names +sub get_inst_names ($) { + exists $_[0] or script_error 'get_inst_names requires an argument.'; + my $inst = shift; + my $installed; + push @$installed, $$_{name} for @$inst; + return $installed; +} + +# pull list of requirements, offer to install them +sub grok_requirements ($$$) { + exists $_[1] or script_error 'grok_requirements requires an argument.'; + my ($sbo, $location, $readme) = @_; + my $requires = get_from_info (LOCATION => $location, GET => 'REQUIRES'); + return unless $$requires[0]; + for my $req (@$requires) { + my $inst = get_installed_sbos; + 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"; + } } } - return; + return 1; } # look for any (user|group)add commands in the README -sub grok_user_group { - exists $_[0] or script_error ('grok_user_group requires an argument'); +sub grok_user_group ($) { + exists $_[0] or script_error 'grok_user_group requires an argument'; my $readme = shift; - my @readme_array = split /\n/, $readme; - my @cmds; + my $readme_array = [split /\n/, $readme]; my $cmd_regex = qr/^\s*#\s+((user|group)add.*)/; - push @cmds, ($_ =~ $cmd_regex)[0] for @readme_array; + my @cmds; + push @cmds, ($_ =~ $cmd_regex)[0] for @$readme_array; return unless exists $cmds[0]; - print "\n". $readme ."\n";; + say "\n". $readme; print "\nIt looks like this slackbuild requires the following command(s)"; - print " to be run first:\n"; - print " # $_\n" for @cmds; + say " to be run first:"; + say " # $_" for @cmds; print "Shall I run it/them now? [y] "; if ( =~ /^[Yy\n]/) { for my $cmd (@cmds) { @@ -170,73 +139,81 @@ sub grok_user_group { } # see if the README mentions any options -sub grok_options { - exists $_[0] or script_error ('grok_options requires an argument'); +sub grok_options ($) { + exists $_[0] or script_error 'grok_options requires an argument'; my $readme = shift; - return 7 unless $readme =~ /[A-Z]+=[^\s]/; - my @readme_array = split /\n/, $readme; - print "\n". $readme; + return unless $readme =~ /[A-Z]+=[^\s]/; + say "\n". $readme; print "\nIt looks this slackbuilds has options; would you like to set any"; print " when the slackbuild is run? [n] "; if ( =~ /^[Yy]/) { - my $ask = sub { + my $ask = sub () { print "\nPlease supply any options here, or enter to skip: "; chomp (my $opts = ); - return 7 if $opts =~ /^$/; - return $opts; }; + return if $opts =~ /^$/; + return $opts; + }; my $kv_regex = qr/[A-Z]+=[^\s]+(|\s([A-Z]+=[^\s]+){0,})/; - my $opts = &$ask (); + my $opts = &$ask; FIRST: while ($opts !~ $kv_regex) { warn "Invalid input received.\n"; - $opts = &$ask (); - return 7 if $opts eq "7"; + $opts = &$ask; } return $opts; } - return 7; + return; } -# prompt for the readme, and grok the readme at this time also. -sub readme_prompt { - exists $_[0] or script_error ('readme_prompt requires an argument.'); - my $sbo = shift; - my $fh = open_read (get_readme_path ($sbo) ); +# prompt for the readme +sub readme_prompt ($$) { + exists $_[0] or script_error 'readme_prompt requires an argument.'; + my ($sbo, $location) = @_; + my $fh = open_read (get_readme_path $sbo); my $readme = do {local $/; <$fh>}; close $fh; - grok_requirements ($sbo, $readme); - grok_user_group ($readme); - my $opts = grok_options ($readme); - print "\n". $readme if ($opts eq "7" || ! $opts); - my $name = $compat32 eq 'TRUE' ? "$sbo-compat32" : $sbo; + # check for requirements, useradd/groupadd, options + grok_requirements $sbo, $location, $readme; + grok_user_group $readme; + my $opts = grok_options $readme; + print "\n". $readme unless $opts; + # present the name as -compat32 if appropriate + my $name = $compat32 ? "$sbo-compat32" : $sbo; print "\nProceed with $name? [y]: "; exit 0 unless =~ /^[Yy\n]/; - return $opts if defined $opts; - return 1; + return $opts; } # do the things with the provided sbos - whether upgrades or new installs. sub process_sbos { - exists $_[0] or script_error ('process_sbos requires an argument.'); - my @todo = @_; + exists $_[0] or script_error 'process_sbos requires an argument.'; + my $todo = shift; my @failures; - FIRST: for my $sbo (@todo) { + FIRST: for my $sbo (keys %$todo) { my $opts = 0; - $opts = readme_prompt ($sbo) unless $no_readme eq 'TRUE'; - $opts = 'FALSE' if ($opts =~ /\d+/ || ! $opts); + $opts = readme_prompt $sbo, $$todo{$sbo} unless $no_readme; # switch compat32 on if upgrading a -compat32 - $compat32 = 'TRUE' if $sbo =~ /-compat32$/; + $compat32 = 1 if $sbo =~ /-compat32$/; my ($version, $pkg, $src); - my @sb_args = ($opts, $jobs, $sbo, $locations{$sbo}, $compat32); - eval { ($version, $pkg, $src) = do_slackbuild (@sb_args); }; + eval { ($version, $pkg, $src) = do_slackbuild ( + OPTS => $opts, + JOBS => $jobs, + LOCATION => $locations{$sbo}, + COMPAT32 => $compat32, + ); }; if ($@) { push @failures, $sbo; } else { unless ($distclean eq 'TRUE') { - make_clean ($sbo, $src, $version) if $noclean eq 'FALSE'; + make_clean $sbo, $src, $version unless $noclean eq 'TRUE'; } else { - make_distclean ($sbo, $src, $version, $locations{$sbo}); + make_distclean ( + SBO => $sbo, + SRC => $src, + VERSION => $version, + LOCATION => $locations{$sbo}, + ); } - do_upgradepkg ($pkg) unless $no_install eq 'TRUE'; + 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}; @@ -244,7 +221,7 @@ sub process_sbos { mkdir ($dir) or warn "Unable to create $dir\n"; } if (-d $dir) { - move ($pkg, $dir), print "$pkg stored in $dir\n"; + move ($pkg, $dir), say "$pkg stored in $dir"; } else { warn "$pkg left in /tmp\n"; } @@ -256,80 +233,68 @@ sub process_sbos { return @failures; } -my @failed; - -sub print_failures { - if (exists $failed[0]) { - print "Failures:\n"; - print " $_\n" for @failed; +sub print_failures (;@) { + if (exists $_[0]) { + say "Failures:"; + say " $_" for @_; exit 1; } } # deal with any updates prior to any new installs. # no reason to bother if only_new is specified, ie running from sboinstall. -unless ($only_new eq 'TRUE') { - # doesn't matter what's updatable and what's not if force is specified - my @updates unless $force eq 'TRUE'; - unless ($force eq 'TRUE') { - my @updates_array = get_available_updates (); - push @updates, $updates_array[$_]{name} for keys @updates_array; +goto INSTALL_NEW if $only_new; + +# doesn't matter what's updatable and what's not if force is specified +my @updates unless $force; +unless ($force) { + my $updates = get_available_updates; + push @updates, $$_{name} for @$updates; +} +my $todo_upgrade; +# but without force, we only want to update what there are updates for +unless ($force) { + for my $sbo (@ARGV) { + $$todo_upgrade{$sbo} = $locations{$sbo} if $sbo ~~ @updates; } - my @todo_upgrade; - # but without force, we only want to update what there are updates for - unless ($force eq 'TRUE') { - for my $sbo (@ARGV) { - push @todo_upgrade, $sbo if $sbo ~~ @updates; - } - } else { - my @inst = get_installed_sbos (); - FIRST: for my $sbo (@ARGV) { - SECOND: for my $key (keys @inst) { - if ($sbo eq $inst[$key]{name}) { - push @todo_upgrade, $sbo; - last SECOND; - } - } +} else { + my $inst = get_installed_sbos; + my $inst_names= get_inst_names $inst;; + FIRST: for my $sbo (@ARGV) { + if ($sbo ~~ @$inst_names) { + $$todo_upgrade{$sbo} = $locations{$sbo}; } } - @failed = process_sbos (@todo_upgrade) if exists $todo_upgrade[0]; - print_failures () unless $install_new eq 'TRUE'; } +my @failures = process_sbos $todo_upgrade if keys %$todo_upgrade > 0; +print_failures @failures; -if ($install_new eq 'TRUE') { - my @todo_install; - FIRST: for my $sbo (@ARGV) { - my $has = 'FALSE'; - my $name = $compat32 eq 'TRUE' ? "$sbo-compat32" : $sbo; - my @inst = get_installed_sbos (); - SECOND: for my $key (keys @inst) { - $has = 'TRUE', last SECOND if $name eq $inst[$key]{name}; - } - # if compat32 is TRUE, we need to see if the non-compat version exists. - if ($compat32 eq 'TRUE') { - my $has64 = 'FALSE'; - my @inst = get_installed_sbos (); - THIRD: for my $key (keys @inst) { - $has64 = 'TRUE', last THIRD if $sbo eq $inst[$key]{name}; - } - unless ($has64 eq 'TRUE') { - print "\nYou are attempting to install $sbo-compat32, however,"; - print " $sbo is not yet installed. Shall I install it first?"; - print " [y] "; - if ( =~ /^[Yy\n]/) { - my @args = ('/usr/sbin/sboupgrade', '-oN', $sbo); - system (@args) == 0 or exit 1; - } else { - print "Please install $sbo\n" and exit 0; - } +INSTALL_NEW: +exit 0 unless $install_new; +my $todo_install; +FIRST: for my $sbo (@ARGV) { + my $name = $compat32 ? "$sbo-compat32" : $sbo; + my $inst = get_installed_sbos; + my $inst_names = get_inst_names $inst;; + warn "$name already installed\n", next FIRST if $name ~~ @$inst_names; + # if compat32 is TRUE, we need to see if the non-compat version exists. + if ($compat32) { + my $inst = get_installed_sbos; + my $inst_names = get_inst_names $inst; + unless ($sbo ~~ @$inst_names) { + print "\nYou are attempting to install $name, however, $sbo is not"; + print " yet installed. Shall I install it first? [y] "; + if ( =~ /^[Yy\n]/) { + my @args = ('/usr/sbin/sboupgrade', '-oN', $sbo); + system (@args) == 0 or exit 1; + } else { + warn "Please install $sbo\n" and exit 0; } } - $has eq 'TRUE' ? warn "$name already installed.\n" : - push @todo_install, $sbo; } - @failed = process_sbos (@todo_install) if exists $todo_install[0]; - print_failures (); + $$todo_install{$sbo} = $locations{$sbo}; } +@failures = process_sbos $todo_install if keys %$todo_install > 0; +print_failures @failures; -exit 1 if exists $failed[0]; exit 0; -- cgit v1.2.3 From dd031840dcb5d295b26b15ad7aac694b1d300072 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Thu, 30 Aug 2012 10:18:47 -0500 Subject: more enhancements and cleanups --- sboupgrade | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'sboupgrade') diff --git a/sboupgrade b/sboupgrade index cf4468a..b5208e9 100755 --- a/sboupgrade +++ b/sboupgrade @@ -89,9 +89,7 @@ sub get_readme_path ($) { sub get_inst_names ($) { exists $_[0] or script_error 'get_inst_names requires an argument.'; my $inst = shift; - my $installed; - push @$installed, $$_{name} for @$inst; - return $installed; + return [$$_{name} for @$inst]; } # pull list of requirements, offer to install them @@ -184,13 +182,13 @@ sub readme_prompt ($$) { } # do the things with the provided sbos - whether upgrades or new installs. -sub process_sbos { +sub process_sbos ($) { exists $_[0] or script_error 'process_sbos requires an argument.'; my $todo = shift; my @failures; - FIRST: for my $sbo (keys %$todo) { + FIRST: for my $sbo (@$todo) { my $opts = 0; - $opts = readme_prompt $sbo, $$todo{$sbo} unless $no_readme; + $opts = readme_prompt $sbo, $locations{$sbo} unless $no_readme; # switch compat32 on if upgrading a -compat32 $compat32 = 1 if $sbo =~ /-compat32$/; my ($version, $pkg, $src); @@ -226,7 +224,7 @@ sub process_sbos { warn "$pkg left in /tmp\n"; } } elsif ($distclean eq 'TRUE') { - unlink ($pkg); + unlink $pkg; } } } @@ -255,18 +253,16 @@ my $todo_upgrade; # but without force, we only want to update what there are updates for unless ($force) { for my $sbo (@ARGV) { - $$todo_upgrade{$sbo} = $locations{$sbo} if $sbo ~~ @updates; + push $$todo_upgrades, $sbo if $sbo ~~ @updates; } } else { my $inst = get_installed_sbos; - my $inst_names= get_inst_names $inst;; + my $inst_names= get_inst_names $inst; FIRST: for my $sbo (@ARGV) { - if ($sbo ~~ @$inst_names) { - $$todo_upgrade{$sbo} = $locations{$sbo}; - } + push $todo_upgrade, $sbo if $sbo ~~ @$inst_names; } } -my @failures = process_sbos $todo_upgrade if keys %$todo_upgrade > 0; +my @failures = process_sbos $todo_upgrade if exists $todo_upgrade[0]; print_failures @failures; INSTALL_NEW: @@ -292,9 +288,9 @@ FIRST: for my $sbo (@ARGV) { } } } - $$todo_install{$sbo} = $locations{$sbo}; + push $todo_install, $sbo; } -@failures = process_sbos $todo_install if keys %$todo_install > 0; +@failures = process_sbos $todo_install if exists $todo_install[0]; print_failures @failures; exit 0; -- cgit v1.2.3 From 5ca399e0e9ab12063f15c4ab14443ba762877634 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Thu, 30 Aug 2012 14:03:49 -0500 Subject: bugfixes++ --- sboupgrade | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sboupgrade') diff --git a/sboupgrade b/sboupgrade index b5208e9..be2fc5a 100755 --- a/sboupgrade +++ b/sboupgrade @@ -63,6 +63,7 @@ if (exists $options{j}) { ($options{j} =~ /^\d+$/ || $options{j} eq 'FALSE'); } my $jobs = exists $options{j} ? $options{j} : $config{JOBS}; +$jobs = 0 if $jobs eq 'FALSE'; show_usage and exit 1 unless exists $ARGV[0]; @@ -89,7 +90,9 @@ sub get_readme_path ($) { sub get_inst_names ($) { exists $_[0] or script_error 'get_inst_names requires an argument.'; my $inst = shift; - return [$$_{name} for @$inst]; + my @installed; + push @installed, $$_{name} for @$inst; + return \@installed; } # pull list of requirements, offer to install them -- cgit v1.2.3 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 From d55dbdf17977ed9b1dfd91c98a4a569960b851cd Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Fri, 31 Aug 2012 15:53:21 -0500 Subject: epic changes and fixes and much further testing --- sboupgrade | 87 ++++++++++++++++++++++++++++++++++++++------------------------ 1 file changed, 54 insertions(+), 33 deletions(-) (limited to 'sboupgrade') diff --git a/sboupgrade b/sboupgrade index cdc2ca2..6633834 100755 --- a/sboupgrade +++ b/sboupgrade @@ -95,10 +95,10 @@ sub get_inst_names ($) { return \@installed; } -# pull list of requirements, offer to install them -sub grok_requirements ($$$) { - exists $_[1] or script_error 'grok_requirements requires an argument.'; - my ($sbo, $location, $readme) = @_; +# pull list of requirements +sub get_requires ($$) { + exists $_[1] or script_error 'get_requires requires an argument.'; + my ($sbo, $location) = @_; my $requires = get_from_info (LOCATION => $location, GET => 'REQUIRES'); return unless $$requires[0]; # do nothing if a req list contains %README% @@ -109,7 +109,13 @@ sub grok_requirements ($$$) { GET => 'REQUIRES'); return if $sbo ~~ @$req_req; } - # else proceed + return $requires; +} + +# ask to install any requirements found +sub ask_requires ($$$) { + exists $_[2] or script_error 'ask_requires requires three arguments.'; + my ($requires, $readme, $sbo) = shift; for my $req (@$requires) { my $inst = get_installed_sbos; my $inst_names= get_inst_names $inst; @@ -123,36 +129,43 @@ sub grok_requirements ($$$) { } } } - return; } # look for any (user|group)add commands in the README -sub grok_user_group ($) { +sub get_user_group ($) { exists $_[0] or script_error 'grok_user_group requires an argument'; my $readme = shift; - my $readme_array = [split /\n/, $readme]; - my $cmd_regex = qr/^\s*#\s+((user|group)add.*)/; - my @cmds; - push @cmds, ($_ =~ $cmd_regex)[0] for @$readme_array; - return unless exists $cmds[0]; + my @cmds = $readme =~ /^\s*#*\s*(useradd.*|groupadd.*)/mg; + return @cmds; +} + +# 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; say "\n". $readme; - print "\nIt looks like this slackbuild requires the following command(s)"; - say " to be run first:"; - say " # $_" for @cmds; + print "\nIt looks like this slackbuild requires the following"; + say " command(s) to be run first:"; + say " # $_" for @$cmds; print "Shall I run it/them now? [y] "; if ( =~ /^[Yy\n]/) { - for my $cmd (@cmds) { - system ($cmd == 0) or warn "\"$cmd\" exited non-zero\n"; + for my $cmd (@$cmds) { + system ($cmd) == 0 or warn "\"$cmd\" exited non-zero\n"; } } - return 1; } # see if the README mentions any options -sub grok_options ($) { +sub get_opts ($) { exists $_[0] or script_error 'grok_options requires an argument'; my $readme = shift; - return unless $readme =~ /[A-Z]+=[^\s]/; + return $readme =~ /[A-Z]+=[^\s]/ ? 1 : undef; +} + +# provide an opportunity to set options +sub ask_opts ($) { + exists $_[0] or script_error 'ask_opts requires an argument'; + my $readme = shift; say "\n". $readme; print "\nIt looks this slackbuilds has options; would you like to set any"; print " when the slackbuild is run? [n] "; @@ -181,10 +194,15 @@ sub readme_prompt ($$) { my $fh = open_read (get_readme_path $sbo); my $readme = do {local $/; <$fh>}; close $fh; - # check for requirements, useradd/groupadd, options - grok_requirements $sbo, $location, $readme; - grok_user_group $readme; - my $opts = grok_options $readme; + # check for requirements, offer to install any found + my $requires = get_requires $sbo, $location; + ask_requires $requires, $readme, $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'; + # check for options mentioned in the README + my $opts; + $opts = ask_opts $readme if get_opts $readme; print "\n". $readme unless $opts; # present the name as -compat32 if appropriate my $name = $compat32 ? "$sbo-compat32" : $sbo; @@ -197,7 +215,7 @@ sub readme_prompt ($$) { sub process_sbos ($) { exists $_[0] or script_error 'process_sbos requires an argument.'; my $todo = shift; - my @failures; + my %failures; FIRST: for my $sbo (@$todo) { my $opts = 0; $opts = readme_prompt $sbo, $locations{$sbo} unless $no_readme; @@ -211,7 +229,7 @@ sub process_sbos ($) { COMPAT32 => $compat32, ); }; if ($@) { - push @failures, $sbo; + $failures{$sbo} = $@; } else { unless ($distclean eq 'TRUE') { make_clean $sbo, $src, $version unless $noclean eq 'TRUE'; @@ -240,13 +258,16 @@ sub process_sbos ($) { } } } - return @failures; + return %failures; } -sub print_failures (;@) { +sub print_failures (;%) { if (exists $_[0]) { + my %failures = @_; say "Failures:"; - say " $_" for @_; + while (my ($key, $val) = each %failures) { + say " $key: $val"; + } exit 1; } } @@ -274,8 +295,8 @@ unless ($force) { push $todo_upgrade, $sbo if $sbo ~~ @$inst_names; } } -my @failures = process_sbos $todo_upgrade if exists $todo_upgrade[0]; -print_failures @failures; +my %failures = process_sbos $todo_upgrade if exists $todo_upgrade[0]; +print_failures %failures; INSTALL_NEW: exit 0 unless $install_new; @@ -302,7 +323,7 @@ FIRST: for my $sbo (@ARGV) { } push $todo_install, $sbo; } -@failures = process_sbos $todo_install if exists $todo_install[0]; -print_failures @failures; +%failures = process_sbos $todo_install if exists $todo_install[0]; +print_failures %failures; exit 0; -- cgit v1.2.3 From 6be3ef603fefc5d04b506b17cbad140790698042 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Sat, 1 Sep 2012 02:14:32 -0500 Subject: more cleanups and fixes and such --- sboupgrade | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sboupgrade') diff --git a/sboupgrade b/sboupgrade index 6633834..0403712 100755 --- a/sboupgrade +++ b/sboupgrade @@ -10,14 +10,14 @@ # license: WTFPL use 5.16.0; +use strict; +use warnings FATAL => 'all'; use SBO::Lib; use File::Basename; use Getopt::Std; use File::Copy; -use strict; -use warnings FATAL => 'all'; -my %config = %SBO::Lib::config; +#my %config = %SBO::Lib::config; my $self = basename ($0); sub show_usage () { -- cgit v1.2.3 From 22e595ded4d1bc5bf6b8987ffcdd0f522d1a1bd0 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Sat, 1 Sep 2012 03:29:58 -0500 Subject: more cleanups --- sboupgrade | 1 - 1 file changed, 1 deletion(-) (limited to 'sboupgrade') diff --git a/sboupgrade b/sboupgrade index 0403712..842e833 100755 --- a/sboupgrade +++ b/sboupgrade @@ -17,7 +17,6 @@ use File::Basename; use Getopt::Std; use File::Copy; -#my %config = %SBO::Lib::config; my $self = basename ($0); sub show_usage () { -- cgit v1.2.3 From 8b08c603ae79c145bc3b344f6dca4f0a95ed6201 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Sat, 1 Sep 2012 04:52:02 -0500 Subject: more and more cleanups and fixes --- sboupgrade | 55 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 24 deletions(-) (limited to 'sboupgrade') diff --git a/sboupgrade b/sboupgrade index 842e833..2835a60 100755 --- a/sboupgrade +++ b/sboupgrade @@ -67,7 +67,7 @@ $jobs = 0 if $jobs eq 'FALSE'; show_usage and exit 1 unless exists $ARGV[0]; # if we can't find SLACKBUILDS.TXT in $config{HOME}, prompt to fetch the tree -slackbuilds_or_fetch; +slackbuilds_or_fetch; # build a hash of locations for each item provided on command line, at the same # time verifying each item is a valid slackbuild @@ -96,7 +96,8 @@ sub get_inst_names ($) { # pull list of requirements sub get_requires ($$) { - exists $_[1] or script_error 'get_requires requires an argument.'; + return if $no_reqs; + exists $_[1] or script_error 'get_requires requires two arguments.'; my ($sbo, $location) = @_; my $requires = get_from_info (LOCATION => $location, GET => 'REQUIRES'); return unless $$requires[0]; @@ -115,27 +116,33 @@ sub get_requires ($$) { sub ask_requires ($$$) { exists $_[2] or script_error 'ask_requires requires three arguments.'; my ($requires, $readme, $sbo) = shift; - for my $req (@$requires) { + FIRST: for my $req (@$requires) { + my $name = $compat32 ? "$req-compat32" : $req; my $inst = get_installed_sbos; - 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]/) { - system ('/usr/sbin/sboupgrade', '-oN', $req) == 0 or - die "$req failed to install.\n"; + my $inst_names = get_inst_names $inst; + next FIRST if $name ~~ @$inst_names; + say $readme; + say "$sbo has $name listed as a requirement."; + print "Shall I attempt to install it first? [y] "; + if ( =~ /^[Yy\n]/) { + my @args = ('/usr/sbin/sboupgrade', '-oN'); + # populate args so that they carry over correctly + for my $arg (qw(c d p)) { + push @args, "-$arg" if exists $options{$arg}; } + push @args, "-j $options{j}" if exists $options{j}; + system (@args, $req) == 0 or die "$name failed to install.\n"; } } + return; } # look for any (user|group)add commands in the README sub get_user_group ($) { - exists $_[0] or script_error 'grok_user_group requires an argument'; + exists $_[0] or script_error 'get_user_group requires an argument'; my $readme = shift; my @cmds = $readme =~ /^\s*#*\s*(useradd.*|groupadd.*)/mg; - return @cmds; + return \@cmds; } # offer to run any user/group add commands @@ -156,7 +163,7 @@ sub ask_user_group ($$) { # see if the README mentions any options sub get_opts ($) { - exists $_[0] or script_error 'grok_options requires an argument'; + exists $_[0] or script_error 'get_opts requires an argument'; my $readme = shift; return $readme =~ /[A-Z]+=[^\s]/ ? 1 : undef; } @@ -278,23 +285,23 @@ goto INSTALL_NEW if $only_new; # doesn't matter what's updatable and what's not if force is specified my @updates unless $force; unless ($force) { - my $updates = get_available_updates; + my $updates = get_available_updates; push @updates, $$_{name} for @$updates; } my $todo_upgrade; # but without force, we only want to update what there are updates for unless ($force) { for my $sbo (@ARGV) { - push $$todo_upgrades, $sbo if $sbo ~~ @updates; + push @$todo_upgrade, $sbo if $sbo ~~ @updates; } } else { - my $inst = get_installed_sbos; - my $inst_names= get_inst_names $inst; + my $inst = get_installed_sbos; + my $inst_names = get_inst_names $inst; FIRST: for my $sbo (@ARGV) { - push $todo_upgrade, $sbo if $sbo ~~ @$inst_names; + push @$todo_upgrade, $sbo if $sbo ~~ @$inst_names; } } -my %failures = process_sbos $todo_upgrade if exists $todo_upgrade[0]; +my %failures = process_sbos $todo_upgrade if exists $$todo_upgrade[0]; print_failures %failures; INSTALL_NEW: @@ -302,12 +309,12 @@ exit 0 unless $install_new; my $todo_install; FIRST: for my $sbo (@ARGV) { my $name = $compat32 ? "$sbo-compat32" : $sbo; - my $inst = get_installed_sbos; + my $inst = get_installed_sbos; my $inst_names = get_inst_names $inst;; warn "$name already installed\n", next FIRST if $name ~~ @$inst_names; # if compat32 is TRUE, we need to see if the non-compat version exists. if ($compat32) { - my $inst = get_installed_sbos; + my $inst = get_installed_sbos; my $inst_names = get_inst_names $inst; unless ($sbo ~~ @$inst_names) { print "\nYou are attempting to install $name, however, $sbo is not"; @@ -320,9 +327,9 @@ FIRST: for my $sbo (@ARGV) { } } } - push $todo_install, $sbo; + push @$todo_install, $sbo; } -%failures = process_sbos $todo_install if exists $todo_install[0]; +%failures = process_sbos $todo_install if exists $$todo_install[0]; print_failures %failures; exit 0; -- cgit v1.2.3 From b182d3c89554828478d8d24fd31a87ba629e75fc Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Sat, 1 Sep 2012 07:56:24 -0500 Subject: more of the same... --- sboupgrade | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'sboupgrade') diff --git a/sboupgrade b/sboupgrade index 2835a60..1ec26d7 100755 --- a/sboupgrade +++ b/sboupgrade @@ -113,25 +113,32 @@ sub get_requires ($$) { } # ask to install any requirements found -sub ask_requires ($$$) { - exists $_[2] or script_error 'ask_requires requires three arguments.'; - my ($requires, $readme, $sbo) = shift; - FIRST: for my $req (@$requires) { +sub ask_requires (%) { + my %args = ( + REQUIRES => '', + README => '', + SBO => '', + @_ + ); + unless ($args{REQUIRES} && $args{README} && $args{SBO}) { + script_error 'ask_requires requires three arguments.'; + } + FIRST: for my $req (@{$args{REQUIRES}}) { my $name = $compat32 ? "$req-compat32" : $req; my $inst = get_installed_sbos; my $inst_names = get_inst_names $inst; next FIRST if $name ~~ @$inst_names; - say $readme; - say "$sbo has $name listed as a requirement."; + say $args{README}; + say "$args{SBO} has $name listed as a requirement."; print "Shall I attempt to install it first? [y] "; if ( =~ /^[Yy\n]/) { - my @args = ('/usr/sbin/sboupgrade', '-oN'); + my @cmd_args = ('/usr/sbin/sboupgrade', '-oN'); # populate args so that they carry over correctly for my $arg (qw(c d p)) { - push @args, "-$arg" if exists $options{$arg}; + push @cmd_args, "-$arg" if exists $options{$arg}; } - push @args, "-j $options{j}" if exists $options{j}; - system (@args, $req) == 0 or die "$name failed to install.\n"; + push @cmd_args, "-j $options{j}" if exists $options{j}; + system (@cmd_args, $req) == 0 or die "$name failed to install.\n"; } } return; @@ -321,7 +328,12 @@ FIRST: for my $sbo (@ARGV) { print " yet installed. Shall I install it first? [y] "; if ( =~ /^[Yy\n]/) { my @args = ('/usr/sbin/sboupgrade', '-oN', $sbo); - system (@args) == 0 or exit 1; + # populate args so that they carry over correctly + for my $arg (qw(c d)) { + push @args, "-$arg" if exists $options{$arg}; + } + push @args, "-j $options{j}" if exists $options{j}; + system (@args) == 0 or die "$sbo failed to install.\n"; } else { warn "Please install $sbo\n" and exit 0; } -- cgit v1.2.3 From eb394521aabc27b9918c84a2fc6eb7571f577510 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Sat, 1 Sep 2012 12:06:19 -0500 Subject: almost there. --- sboupgrade | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'sboupgrade') diff --git a/sboupgrade b/sboupgrade index 1ec26d7..403fed3 100755 --- a/sboupgrade +++ b/sboupgrade @@ -155,7 +155,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:"; @@ -209,10 +209,11 @@ sub readme_prompt ($$) { close $fh; # check for requirements, offer to install any found my $requires = get_requires $sbo, $location; - 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; @@ -244,8 +245,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, @@ -254,7 +257,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}; -- cgit v1.2.3 From 1a0e9da0d21f2682be30fc58d6fc694b7b927c74 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Fri, 21 Sep 2012 07:01:43 -0500 Subject: sboupgrade converted to long options and fixes added from 0.8 --- sboupgrade | 173 +++++++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 116 insertions(+), 57 deletions(-) (limited to 'sboupgrade') diff --git a/sboupgrade b/sboupgrade index 403fed3..fa0c570 100755 --- a/sboupgrade +++ b/sboupgrade @@ -14,7 +14,7 @@ use strict; use warnings FATAL => 'all'; use SBO::Lib; use File::Basename; -use Getopt::Std; +use Getopt::Long qw(:config bundling); use File::Copy; my $self = basename ($0); @@ -23,48 +23,74 @@ sub show_usage () { print < \$help, + 'version|v' => \$vers, + 'noclean|c=s' => \$noclean, + 'distclean|d=s' => \$distclean, + 'force|f' => \$force, + 'noinstall|i' => \$no_install, + 'jobs|j=s' => \$jobs, + 'installnew|N' => \$install_new, + 'nointeractive|r' => \$non_int, + 'norequirements|R' => \$no_reqs, + 'force-reqs|z' => \$force_reqs, + 'only-new|o' => \$only_new, + 'compat32|p' => \$compat32, +); -if (exists $options{j}) { +show_usage && exit 0 if $help; +show_version && exit 0 if $vers; + +$noclean = $noclean eq 'TRUE' ? 1 : 0; +$distclean = $distclean eq 'TRUE' ? 1 : 0; + +if ($jobs) { die "You have provided an invalid parameter for -j\n" unless - ($options{j} =~ /^\d+$/ || $options{j} eq 'FALSE'); + ($jobs =~ /^\d+$/ || $jobs eq 'FALSE'); } -my $jobs = exists $options{j} ? $options{j} : $config{JOBS}; $jobs = 0 if $jobs eq 'FALSE'; show_usage and exit 1 unless exists $ARGV[0]; +if ($compat32) { + die "compat32 only works on x86_64.\n" unless get_arch eq 'x86_64'; +} # if we can't find SLACKBUILDS.TXT in $config{HOME}, prompt to fetch the tree slackbuilds_or_fetch; @@ -112,6 +138,20 @@ sub get_requires ($$) { return $requires; } +# remove any installed requirements from req list +sub clean_reqs ($) { + exists $_[0] or script_error 'clean_reqs requires an argument.'; + my $reqs = shift; + my $inst = get_installed_sbos; + my $inst_names = get_inst_names $inst; + my @new_reqs; + for my $req (@$reqs) { + $req = $compat32 ? "$req-compat32" : $req; + push @new_reqs, $req unless $req ~~ @$inst_names; + } + return \@new_reqs; +} + # ask to install any requirements found sub ask_requires (%) { my %args = ( @@ -123,21 +163,23 @@ sub ask_requires (%) { unless ($args{REQUIRES} && $args{README} && $args{SBO}) { script_error 'ask_requires requires three arguments.'; } - FIRST: for my $req (@{$args{REQUIRES}}) { + my $reqs = $args{REQUIRES}; + $reqs = clean_reqs $reqs unless ($force && $force_reqs); + FIRST: for my $req (@$reqs) { my $name = $compat32 ? "$req-compat32" : $req; - my $inst = get_installed_sbos; - my $inst_names = get_inst_names $inst; - next FIRST if $name ~~ @$inst_names; say $args{README}; say "$args{SBO} has $name listed as a requirement."; - print "Shall I attempt to install it first? [y] "; + print 'Shall I attempt to install it first? [y] '; if ( =~ /^[Yy\n]/) { - my @cmd_args = ('/usr/sbin/sboupgrade', '-oN'); + my @cmd_args = ('/usr/sbin/sboupgrade'); + push @cmd_args, $force_reqs ? '-N' : '-oN'; # populate args so that they carry over correctly - for my $arg (qw(c d p)) { - push @cmd_args, "-$arg" if exists $options{$arg}; - } - push @cmd_args, "-j $options{j}" if exists $options{j}; + push @cmd_args, $noclean ? '-cTRUE' : '-cFALSE'; + push @cmd_args, $distclean ? '-dTRUE' : '-dFALSE'; + push @cmd_args, '-p' if $compat32; + push @cmd_args, '-f' if $force; + push @cmd_args, '-r' if $force_reqs; + push @cmd_args, "-j$jobs" if $jobs; system (@cmd_args, $req) == 0 or die "$name failed to install.\n"; } } @@ -172,7 +214,7 @@ sub ask_user_group ($$) { sub get_opts ($) { exists $_[0] or script_error 'get_opts requires an argument'; my $readme = shift; - return $readme =~ /[A-Z]+=[^\s]/ ? 1 : undef; + return $readme =~ /[A-Z0-9]+=[^\s]/ ? 1 : undef; } # provide an opportunity to set options @@ -186,11 +228,12 @@ sub ask_opts ($) { my $ask = sub () { print "\nPlease supply any options here, or enter to skip: "; chomp (my $opts = ); - return if $opts =~ /^$/; + return if $opts =~ /^\n/; return $opts; }; - my $kv_regex = qr/[A-Z]+=[^\s]+(|\s([A-Z]+=[^\s]+){0,})/; + my $kv_regex = qr/[A-Z0-9]+=[^\s]+(|\s([A-Z]+=[^\s]+){0,})/; my $opts = &$ask; + return unless $opts; FIRST: while ($opts !~ $kv_regex) { warn "Invalid input received.\n"; $opts = &$ask; @@ -232,7 +275,7 @@ sub process_sbos ($) { my %failures; FIRST: for my $sbo (@$todo) { my $opts = 0; - $opts = readme_prompt $sbo, $locations{$sbo} unless $no_readme; + $opts = readme_prompt $sbo, $locations{$sbo} unless $non_int; # switch compat32 on if upgrading a -compat32 $compat32 = 1 if $sbo =~ /-compat32$/; my ($version, $pkg, $src); @@ -246,9 +289,9 @@ sub process_sbos ($) { $failures{$sbo} = $@; } else { do_upgradepkg $pkg unless $no_install; - unless ($distclean eq 'TRUE') { + unless ($distclean) { make_clean (SBO => $sbo, SRC => $src, VERSION => $version) - unless $noclean eq 'TRUE'; + unless $noclean; } else { make_distclean ( SBO => $sbo, @@ -268,7 +311,7 @@ sub process_sbos ($) { } else { warn "$pkg left in /tmp\n"; } - } elsif ($distclean eq 'TRUE') { + } elsif ($distclean) { unlink $pkg; } } @@ -299,15 +342,32 @@ unless ($force) { } my $todo_upgrade; # but without force, we only want to update what there are updates for +my @remove; unless ($force) { - for my $sbo (@ARGV) { - push @$todo_upgrade, $sbo if $sbo ~~ @updates; + for my $key (keys @ARGV) { + if ($ARGV[$key] ~~ @updates) { + push @$todo_upgrade, $ARGV[$key]; + push @remove, $key; + } + } + # don't pass upgradable stuff to the install code + for my $rem (@remove) { + splice @ARGV, $rem, 1; + $_-- for @remove; } } else { my $inst = get_installed_sbos; my $inst_names = get_inst_names $inst; - FIRST: for my $sbo (@ARGV) { - push @$todo_upgrade, $sbo if $sbo ~~ @$inst_names; + for my $key (keys @ARGV) { + if ($ARGV[$key] ~~ @$inst_names) { + push @$todo_upgrade, $ARGV[$key]; + push @remove, $key; + } + } + # don't pass upgradable stuff to the install code + for my $rem (@remove) { + splice @ARGV, $rem, 1; + $_-- for @remove; } } my %failures = process_sbos $todo_upgrade if exists $$todo_upgrade[0]; @@ -319,8 +379,8 @@ my $todo_install; FIRST: for my $sbo (@ARGV) { my $name = $compat32 ? "$sbo-compat32" : $sbo; my $inst = get_installed_sbos; - my $inst_names = get_inst_names $inst;; - warn "$name already installed\n", next FIRST if $name ~~ @$inst_names; + my $inst_names = get_inst_names $inst; + warn "$name already installed.\n" and next FIRST if $name ~~ @$inst_names; # if compat32 is TRUE, we need to see if the non-compat version exists. if ($compat32) { my $inst = get_installed_sbos; @@ -331,11 +391,10 @@ FIRST: for my $sbo (@ARGV) { if ( =~ /^[Yy\n]/) { my @args = ('/usr/sbin/sboupgrade', '-oN', $sbo); # populate args so that they carry over correctly - for my $arg (qw(c d)) { - push @args, "-$arg" if exists $options{$arg}; - } - push @args, "-j $options{j}" if exists $options{j}; - system (@args) == 0 or die "$sbo failed to install.\n"; + push @args, $noclean ? '-cTRUE' : '-cFALSE'; + push @args, $distclean ? '-dTRUE' : '-dFALSE'; + push @args, "-j$jobs" if $jobs; + system (@args, $sbo) == 0 or die "$sbo failed to install.\n"; } else { warn "Please install $sbo\n" and exit 0; } -- cgit v1.2.3 From 1354c09e1b93567ef309ffe0f966cd0de00cf95f Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Sat, 22 Sep 2012 03:22:46 -0500 Subject: fix bug where installing a compat32 where its 64-bit version is already installed results in the 64-bit version building and installing twice --- sboupgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sboupgrade') diff --git a/sboupgrade b/sboupgrade index fa0c570..544ae92 100755 --- a/sboupgrade +++ b/sboupgrade @@ -389,7 +389,7 @@ FIRST: for my $sbo (@ARGV) { print "\nYou are attempting to install $name, however, $sbo is not"; print " yet installed. Shall I install it first? [y] "; if ( =~ /^[Yy\n]/) { - my @args = ('/usr/sbin/sboupgrade', '-oN', $sbo); + my @args = ('/usr/sbin/sboupgrade', '-oN'); # populate args so that they carry over correctly push @args, $noclean ? '-cTRUE' : '-cFALSE'; push @args, $distclean ? '-dTRUE' : '-dFALSE'; -- cgit v1.2.3 From 0af02e57b6fbfd559a48ba0061245e6148d12814 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Wed, 3 Oct 2012 03:55:38 -0500 Subject: when circular reqs are found, advise the user of the situation and ask whether or not proceed, default no --- sboupgrade | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'sboupgrade') diff --git a/sboupgrade b/sboupgrade index 544ae92..406ac4a 100755 --- a/sboupgrade +++ b/sboupgrade @@ -133,7 +133,12 @@ sub get_requires ($$) { FIRST: for my $req (@$requires) { my $req_req = get_from_info (LOCATION => get_sbo_location $req, GET => 'REQUIRES'); - return if $sbo ~~ @$req_req; + if ($sbo ~~ @$req_req) { + say "I am seeing circular requirements between $sbo and $req."; + say "Therefore, I am not going to handle requirements for $sbo."; + print 'Do you still wish to proceed? [n] '; + ~ /^[Yy\n]/ ? return : exit 0; + } } return $requires; } -- cgit v1.2.3 From fbf71b740fbd3e249a5fd780543f018dd1c77c7b Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Wed, 3 Oct 2012 04:13:05 -0500 Subject: ... --- sboupgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sboupgrade') diff --git a/sboupgrade b/sboupgrade index 406ac4a..ae6ad74 100755 --- a/sboupgrade +++ b/sboupgrade @@ -237,7 +237,7 @@ sub ask_opts ($) { return $opts; }; my $kv_regex = qr/[A-Z0-9]+=[^\s]+(|\s([A-Z]+=[^\s]+){0,})/; - my $opts = &$ask; + my $opts = &$ask; return unless $opts; FIRST: while ($opts !~ $kv_regex) { warn "Invalid input received.\n"; -- cgit v1.2.3 From cfa0795650606f5e629a65b3e243e8c2ccc000ef Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Wed, 3 Oct 2012 06:10:18 -0500 Subject: bug fix to previous change --- sboupgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sboupgrade') diff --git a/sboupgrade b/sboupgrade index ae6ad74..0ef528a 100755 --- a/sboupgrade +++ b/sboupgrade @@ -137,7 +137,7 @@ sub get_requires ($$) { say "I am seeing circular requirements between $sbo and $req."; say "Therefore, I am not going to handle requirements for $sbo."; print 'Do you still wish to proceed? [n] '; - ~ /^[Yy\n]/ ? return : exit 0; + =~ /^[Yy\n]/ ? return : exit 0; } } return $requires; -- cgit v1.2.3 From 8afc555e23623c6ab4d36aeff48269baf2c8eea4 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Wed, 3 Oct 2012 12:13:14 -0500 Subject: fix bug where sboupgrade -fz passed -r flag on recursion instead of -z --- sboupgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sboupgrade') diff --git a/sboupgrade b/sboupgrade index 0ef528a..64650d7 100755 --- a/sboupgrade +++ b/sboupgrade @@ -183,7 +183,7 @@ sub ask_requires (%) { push @cmd_args, $distclean ? '-dTRUE' : '-dFALSE'; push @cmd_args, '-p' if $compat32; push @cmd_args, '-f' if $force; - push @cmd_args, '-r' if $force_reqs; + push @cmd_args, '-z' if $force_reqs; push @cmd_args, "-j$jobs" if $jobs; system (@cmd_args, $req) == 0 or die "$name failed to install.\n"; } -- cgit v1.2.3 From 62405748ab1470aac11811167c001ce7cbeb040a Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Thu, 4 Oct 2012 05:05:52 -0500 Subject: removed 'date:' line from comments, cleanups for quote consistency, etc --- sboupgrade | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'sboupgrade') diff --git a/sboupgrade b/sboupgrade index 64650d7..04d9732 100755 --- a/sboupgrade +++ b/sboupgrade @@ -6,7 +6,6 @@ # script to update an installed SlackBuild. # # author: Jacob Pipkin -# date: Boomtime, the 39th day of Discord in the YOLD 3178 # license: WTFPL use 5.16.0; @@ -47,9 +46,6 @@ Options (defaults shown first where applicable): -z|--force-reqs: when used with -f, will force rebuilding an SBo's requirements as well. -Example: - $self -d libsexy - EOF } @@ -75,8 +71,8 @@ GetOptions ( 'compat32|p' => \$compat32, ); -show_usage && exit 0 if $help; -show_version && exit 0 if $vers; +show_usage and exit 0 if $help; +show_version and exit 0 if $vers; $noclean = $noclean eq 'TRUE' ? 1 : 0; $distclean = $distclean eq 'TRUE' ? 1 : 0; @@ -205,9 +201,9 @@ sub ask_user_group ($$) { my ($cmds, $readme) = @_; say "\n". $readme; print "\nIt looks like this slackbuild requires the following"; - say " command(s) to be run first:"; + say ' command(s) to be run first:'; say " # $_" for @$cmds; - print "Shall I run it/them now? [y] "; + print 'Shall I run it/them now? [y] '; if ( =~ /^[Yy\n]/) { for my $cmd (@$cmds) { system ($cmd) == 0 or warn "\"$cmd\" exited non-zero\n"; @@ -228,7 +224,7 @@ sub ask_opts ($) { my $readme = shift; say "\n". $readme; print "\nIt looks this slackbuilds has options; would you like to set any"; - print " when the slackbuild is run? [n] "; + print ' when the slackbuild is run? [n] '; if ( =~ /^[Yy]/) { my $ask = sub () { print "\nPlease supply any options here, or enter to skip: "; @@ -327,7 +323,7 @@ sub process_sbos ($) { sub print_failures (;%) { if (exists $_[0]) { my %failures = @_; - say "Failures:"; + say 'Failures:'; while (my ($key, $val) = each %failures) { say " $key: $val"; } @@ -392,7 +388,7 @@ FIRST: for my $sbo (@ARGV) { my $inst_names = get_inst_names $inst; unless ($sbo ~~ @$inst_names) { print "\nYou are attempting to install $name, however, $sbo is not"; - print " yet installed. Shall I install it first? [y] "; + print ' yet installed. Shall I install it first? [y] '; if ( =~ /^[Yy\n]/) { my @args = ('/usr/sbin/sboupgrade', '-oN'); # populate args so that they carry over correctly -- cgit v1.2.3 From b9036db1e5e965dc395d978397e8151ca9ab59fd Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Sat, 6 Oct 2012 08:42:41 -0500 Subject: fix bug where, when circular requirements are found, the default chocie is claimed to be no, but is actually yes --- sboupgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sboupgrade') diff --git a/sboupgrade b/sboupgrade index 04d9732..c4c8e2f 100755 --- a/sboupgrade +++ b/sboupgrade @@ -133,7 +133,7 @@ sub get_requires ($$) { say "I am seeing circular requirements between $sbo and $req."; say "Therefore, I am not going to handle requirements for $sbo."; print 'Do you still wish to proceed? [n] '; - =~ /^[Yy\n]/ ? return : exit 0; + =~ /^[Yy]/ ? return : exit 0; } } return $requires; -- cgit v1.2.3