diff options
author | J Pipkin <j@dawnrazor.net> | 2012-12-22 18:33:44 -0600 |
---|---|---|
committer | J Pipkin <j@dawnrazor.net> | 2012-12-22 18:33:44 -0600 |
commit | 09d1feb09c1b50726f0d37222456d9bf174bbe0e (patch) | |
tree | d9086b7cbd9c7581c0a880da84a288825f7d83a2 | |
parent | 22b55d4409588ba9661e7fb869a67a7e2d5f59df (diff) | |
parent | b9036db1e5e965dc395d978397e8151ca9ab59fd (diff) | |
download | sbotools2-09d1feb09c1b50726f0d37222456d9bf174bbe0e.tar.xz |
merged slack14 back to master branch
-rw-r--r-- | SBO-Lib/lib/SBO/Lib.pm | 14 | ||||
-rw-r--r-- | man1/sbocheck.1 | 2 | ||||
-rw-r--r-- | man1/sboclean.1 | 4 | ||||
-rw-r--r-- | man1/sboconfig.1 | 2 | ||||
-rw-r--r-- | man1/sbofind.1 | 2 | ||||
-rw-r--r-- | man1/sboinstall.1 | 8 | ||||
-rw-r--r-- | man1/sbosnap.1 | 2 | ||||
-rw-r--r-- | man1/sboupgrade.1 | 13 | ||||
-rw-r--r-- | man5/sbotools.conf.5 | 2 | ||||
-rwxr-xr-x | sbocheck | 2 | ||||
-rwxr-xr-x | sboclean | 2 | ||||
-rwxr-xr-x | sboconfig | 5 | ||||
-rwxr-xr-x | sbofind | 6 | ||||
-rwxr-xr-x | sboinstall | 2 | ||||
-rwxr-xr-x | sbosnap | 2 | ||||
-rwxr-xr-x | sboupgrade | 76 | ||||
-rwxr-xr-x | t/prep.pl | 4 | ||||
-rwxr-xr-x | t/test.t | 203 |
18 files changed, 193 insertions, 158 deletions
diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index 1fb5ffc..92f22b5 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -9,12 +9,12 @@ # date: Setting Orange, the 37th day of Discord in the YOLD 3178 # license: WTFPL <http://sam.zoy.org/wtfpl/COPYING> -use 5.12.3; +use 5.16.0; use strict; use warnings FATAL => 'all'; -package SBO::Lib 0.10; -my $version = '0.10'; +package SBO::Lib 1.1; +my $version = '1.1'; require Exporter; our @ISA = qw(Exporter); @@ -52,7 +52,6 @@ use File::Path qw(make_path remove_tree); use File::Temp qw(tempdir tempfile); use File::Find; use Fcntl qw(F_SETFD F_GETFD); -use feature 'say'; our $tempdir = tempdir (CLEANUP => 1); @@ -118,8 +117,10 @@ sub show_version () { } # %supported maps what's in /etc/slackware-version to what's at SBo +# which is now not needed since this version drops support < 14.0 +# but it's already future-proofed, so leave it. sub get_slack_version () { - my %supported = ('13.37.0' => '13.37'); + my %supported = ('14.0' => '14.0'); my $fh = open_read '/etc/slackware-version'; chomp (my $line = <$fh>); close $fh; @@ -349,7 +350,7 @@ sub get_filename_from_link ($) { my $fn = shift; my $regex = qr#/([^/]+)$#; my $filename = $fn =~ $regex ? $distfiles .'/'. ($fn =~ $regex)[0] : undef; - $filename = s/%2B/+/g; + $filename =~ s/%2B/+/g; return $filename; } @@ -496,7 +497,6 @@ sub create_symlinks ($%) { my @symlinks; for my $link (keys %downloads) { my $filename = get_filename_from_link $link; - my $symlink = get_symlink_from_filename $filename, $location; push @symlinks, $symlink; symlink $filename, $symlink; diff --git a/man1/sbocheck.1 b/man1/sbocheck.1 index 35cf529..59c2560 100644 --- a/man1/sbocheck.1 +++ b/man1/sbocheck.1 @@ -1,4 +1,4 @@ -.TH sbocheck 1 "Boomtime, Bureaucracy 58, 3178 YOLD" "sbotools 0.10 fnord" dawnrazor.net +.TH sbocheck 1 "Boomtime, Bureaucracy 58, 3178 YOLD" "sbotools 1.1 fnord" dawnrazor.net .SH NAME .P sbocheck - update a local slackbuilds.org tree and check for updates. diff --git a/man1/sboclean.1 b/man1/sboclean.1 index aa2f1d5..1bed44b 100644 --- a/man1/sboclean.1 +++ b/man1/sboclean.1 @@ -1,4 +1,4 @@ -.TH sboclean 1 "Boomtime, Bureaucracy 58, 3178 YOLD" "sbotools 0.10 fnord" dawnrazor.net +.TH sboclean 1 "Boomtime, Bureaucracy 58, 3178 YOLD" "sbotools 1.1 fnord" dawnrazor.net .SH NAME .P sboclean - clean files left around by sbotools. @@ -32,7 +32,7 @@ Clean working directories, located under /tmp/SBo. .P -i|--interactive .RS -Be interactive; sboclean will ask for confirmation for each item which it think should be removed. +Be interactive; sboclean will ask for confirmation for each item which it thinks should be removed. .SH BUGS .P None known, but there may be some. Please report any found to j@dawnrazor.net; patches are always welcome. diff --git a/man1/sboconfig.1 b/man1/sboconfig.1 index 9ed8bfd..9d3a5ac 100644 --- a/man1/sboconfig.1 +++ b/man1/sboconfig.1 @@ -1,4 +1,4 @@ -.TH sboconfig 1 "Boomtime, Bureaucracy 58, 3178 YOLD" "sbotools 0.10 fnord" dawnrazor.net +.TH sboconfig 1 "Boomtime, Bureaucracy 58, 3178 YOLD" "sbotools 1.1 fnord" dawnrazor.net .SH NAME .P sboconfig - set sbotools configuration options. diff --git a/man1/sbofind.1 b/man1/sbofind.1 index 6b4d8e6..f9973e4 100644 --- a/man1/sbofind.1 +++ b/man1/sbofind.1 @@ -1,4 +1,4 @@ -.TH sbofind 1 "Boomtime, Bureaucracy 58, 3178 YOLD" "sbotools 0.10 fnord" dawnrazor.net +.TH sbofind 1 "Boomtime, Bureaucracy 58, 3178 YOLD" "sbotools 1.1 fnord" dawnrazor.net .SH NAME .P sbofind - search slackbuilds.org tree for a given name diff --git a/man1/sboinstall.1 b/man1/sboinstall.1 index d269f20..3f8fa91 100644 --- a/man1/sboinstall.1 +++ b/man1/sboinstall.1 @@ -1,4 +1,4 @@ -.TH sboinstall 1 "Boomtime, Bureaucracy 58, 3178 YOLD" "sbotools 0.10 fnord" dawnrazor.net +.TH sboinstall 1 "Boomtime, Bureaucracy 58, 3178 YOLD" "sbotools 1.1 fnord" dawnrazor.net .SH NAME .P sboinstall - install slackbuilds @@ -7,7 +7,7 @@ sboinstall - install slackbuilds sboinstall [-h|-v] [-d TRUE|FALSE] [-j #|FALSE] [-c TRUE|FALSE] [-NrRip] sbo_name (sbo_name) .SH DESCRIPTION .P -sboinstall is equivalent to sboupgrade -N, but is faster since it only installs new slackbuilds, so is preferred for installs. If the -r flag is NOT specified, sboinstall will attempt to grok a list of requirements in the README for a given slackbuild. If such a list exists, sboinstall will look to see whether or not those requirements are already installed, and if not, it will ask whether or not it should attempt to install them first. This is recursive, so that ordering happens correctly. Note that this method is FAR from foolproof, which is why this does not happen if the README is bypassed. sboinstall will also note groupadd and useradd commands in README files and offer to run those first. If the README documents options of the KEY=value form, sboinstall will offer the opportunity to set options. +sboinstall is equivalent to sboupgrade -N, but is faster since it only installs new slackbuilds, so is preferred for installs. If the -r flag is NOT specified, sboinstall will pull the list of requirements from the .info file for any specified slackbuild. If such a list exists, sboinstall will look to see whether or not those requirements are already installed, and if not, it will ask whether or not it should attempt to install them first. This is recursive, so that ordering happens correctly. sboinstall will refuse to handle circular requirements. sboinstall will also note groupadd and useradd commands in README files and offer to run those first. If the README documents options of the KEY=value form, sboinstall will offer the opportunity to set options. .SH OPTIONS .P -h|--help @@ -52,11 +52,11 @@ Skip viewing of the README and the yes or no question which accompanies it. Anyt .P -R|--norequirements .RS -This option causes sboinstall to skip requirement parsing, but still show the README and prompt the user to proceed. +This option causes sboinstall to skip requirement handling, but still show the README and prompt the user to proceed. .RE .SH BUGS .P -Requirement parsing is not foolproof; there are corner cases where it does not function as expected. +None known, but there may be some. Please report any found to j@dawnrazor.net; patches are always welcome. .SH SEE ALSO .P sbocheck(1), sboclean(1), sboconfig(1), sbofind(1), sbosnap(1), sboupgrade(1), sbotools.conf(5) diff --git a/man1/sbosnap.1 b/man1/sbosnap.1 index f88a134..dba3d0c 100644 --- a/man1/sbosnap.1 +++ b/man1/sbosnap.1 @@ -1,4 +1,4 @@ -.TH sbosnap 1 "Boomtime, Bureaucracy 58, 3178 YOLD" "sbotools 0.10 fnord" dawnrazor.net +.TH sbosnap 1 "Boomtime, Bureaucracy 58, 3178 YOLD" "sbotools 1.1 fnord" dawnrazor.net .SH NAME .P sbosnap - slackbuilds.org tree fetch and update command. diff --git a/man1/sboupgrade.1 b/man1/sboupgrade.1 index 5db83dc..7e7c7ab 100644 --- a/man1/sboupgrade.1 +++ b/man1/sboupgrade.1 @@ -1,4 +1,4 @@ -.TH sboupgrade 1 "Boomtime, Bureaucracy 58, 3178 YOLD" "sbotools 0.10 fnord" dawnrazor.net +.TH sboupgrade 1 "Boomtime, Bureaucracy 58, 3178 YOLD" "sbotools 1.1 fnord" dawnrazor.net .SH NAME .P sboupgrade - install or upgrade slackbuilds @@ -7,7 +7,7 @@ sboupgrade - install or upgrade slackbuilds sboupgrade [-h|-v] [-c TRUE|FALSE] [-d TRUE|FALSE] [-j #|FALSE] [-fNrRiz] sbo_name (sbo_name) .SH DESCRIPTION .P -sboupgrade is used to upgrade packages installed from slackbuilds. If the -r flag is NOT specified, sboupgrade will attempt to grok a list of requirements in the README for a given slackbuild. If such a list exists, sboupgrade will look to see whether or not those requirements are already installed, and if not, it will ask whether or not it should attempt to install them first. This is recursive, so that ordering happens correctly. Note that this method is FAR from foolproof, which is part of the reason this does not happen if the README is bypassed. sboupgrade will also note groupadd and useradd commands in README files and offer to run those first. If the README documents options of the KEY=value form, sboupgrade will offer the opportunity to set such options. +sboupgrade is used to upgrade packages installed from slackbuilds. If the -r flag is NOT specified, sboupgrade will pull the list of requirements from the .info file for any specified slackbuild. If such a list exists, sboupgrade will look to see whether or not those requirements are already installed, and if not, it will ask whether or not it should attempt to install them first. This is recursive, so that ordering happens correctly. sboupgrade will refuse to handle circular requirements. sboupgrade will also note groupadd and useradd commands in README files and offer to run those first. If the README documents options of the KEY=value form, sboupgrade will offer the opportunity to set options. .SH OPTIONS .P -h|--help @@ -57,7 +57,12 @@ Skip viewing of the README and the yes or no question which accompanies it. Anyt .P -R|--norequirements .RS -This option causes sboupgrade to skip requirement parsing, but still show the README and prompt the user to proceed. +This option causes sboupgrade to skip requirement handling, but still show the README and prompt the user to proceed. +.RE +.P +-z|--force-reqs +.RS +When used in combination with the -f option, to force an update even if it would not constitute an update, this will cause sboupgrade to also rebuild all of that slackbuild's requirements. Normally with -f, only the slackbuild(s) specified, and any requirements not already installed, will be rebuilt. This allows for recursive upgrades, among other things. .RE .P -z|--force-reqs @@ -66,7 +71,7 @@ When used in combination with the -f option, to force an update even if it would .RE .SH BUGS .P -Requirement parsing is not foolproof; there are corner cases where it does not function as expected. +None known, but there may be some. Please report any found to j@dawnrazor.net; patches are always welcome. .SH SEE ALSO .P sbocheck(1), sboclean(1), sboconfig(1), sbofind(1), sboinstall(1), sbosnap(1), sbotools.conf(5) diff --git a/man5/sbotools.conf.5 b/man5/sbotools.conf.5 index f384835..ff5786b 100644 --- a/man5/sbotools.conf.5 +++ b/man5/sbotools.conf.5 @@ -1,4 +1,4 @@ -.TH sbotools.conf 5 "Boomtime, Bureaucracy 58, 3178 YOLD" "sbotools 0.10 fnord" dawnrazor.net +.TH sbotools.conf 5 "Boomtime, Bureaucracy 58, 3178 YOLD" "sbotools 1.1 fnord" dawnrazor.net .SH NAME .P sbotools.conf - configuration file for sbotools commands. @@ -8,7 +8,7 @@ # author: Jacob Pipkin <j@dawnrazor.net> # license: WTFPL <http://sam.zoy.org/wtfpl/COPYING> -use 5.12.3; +use 5.16.0; use strict; use warnings FATAL => 'all'; use SBO::Lib; @@ -8,7 +8,7 @@ # author: Jacob Pipkin <j@dawnrazor.net> # license: WTFPL <http://sam.zoy.org/wtfpl/COPYING> -use 5.12.3; +use 5.16.0; use strict; use warnings FATAL => 'all'; use SBO::Lib; @@ -8,7 +8,7 @@ # author: Jacob Pipkin <j@dawnrazor.net> # license: WTFPL <http://sam.zoy.org/wtfpl/COPYING> -use 5.12.3; +use 5.16.0; use strict; use warnings FATAL => 'all'; use SBO::Lib; @@ -102,6 +102,9 @@ if (exists $changes{SBO_HOME}) { # safely modify our conf file; write its contents to a temp file, modify the # temp file, write the contents of the temp file back to the conf file +# TODO: if multiple options are provided to this script, this sub should write +# them all at once, instead of only a single one and having to call it once for +# each option specified to the script. sub config_write ($$) { exists $_[1] or script_error 'config_write requires two arguments.'; my ($key, $val) = @_; @@ -8,7 +8,7 @@ # author: Jacob Pipkin <j@dawnrazor.net> # license: WTFPL <http://sam.zoy.org/wtfpl/COPYING> -use 5.12.3; +use 5.16.0; use strict; use warnings FATAL => 'all'; use SBO::Lib; @@ -99,8 +99,8 @@ if (exists $$findings[0]) { while (my ($key, $val) = each %$hash) { say "SBo: $key"; say "Path: $val"; - say "info: ". get_file_contents "$val/$key.info"; - say "README: ". get_file_contents "$val/README"; + say "info: ". get_file_contents "$val/$key.info" if $show_info; + say "README: ". get_file_contents "$val/README" if $show_readme; say ''; } } @@ -8,7 +8,7 @@ # author: Jacob Pipkin <j@dawnrazor.net> # license: WTFPL <http://sam.zoy.org/wtfpl/COPYING> -use 5.12.3; +use 5.16.0; use strict; use warnings FATAL => 'all'; use SBO::Lib; @@ -8,7 +8,7 @@ # author: Jacob Pipkin <j@dawnrazor.net> # license: WTFPL <http://sam.zoy.org/wtfpl/COPYING> -use 5.12.3; +use 5.16.0; use strict; use warnings FATAL => 'all'; use SBO::Lib; @@ -8,7 +8,7 @@ # author: Jacob Pipkin <j@dawnrazor.net> # license: WTFPL <http://sam.zoy.org/wtfpl/COPYING> -use 5.12.3; +use 5.16.0; use strict; use warnings FATAL => 'all'; use SBO::Lib; @@ -42,7 +42,7 @@ Options (defaults shown first where applicable): -r|--nointeractive: non-interactive; skips README and all prompts. -R|--norequirements: - view the README but do not parse requirements, commands, or options. + view the README but do not handle requirements, commands, or options. -z|--force-reqs: when used with -f, will force rebuilding an SBo's requirements as well. @@ -116,47 +116,27 @@ sub get_inst_names ($) { return \@installed; } -# this subroutine may be getting a little out of hand. +# pull list of requirements sub get_requires ($$) { - exists $_[1] or script_error 'get_requires requires two arguments.'; return if $no_reqs; - my ($sbo, $readme) = @_; - my $readme_orig = $readme; - for ($readme) { - # deal with and at end of line - s/and/and /g; - # work around missing period at end of list of requirements (given 2 - # \ns), or no period at end of whole thing. - s/$/./; - # yet another nasty hack. yanh! - s/[Oo]ptional/./g; - # yanh. - s/not\s+require//g; - s/\n\n/./g; - s/\n//g; - } - return unless my $string = - ($readme =~ /([Tt]his|\Q$sbo\E|)\s*[Rr]equire(s|)(|:)\s+([^\.]+)/)[3]; - for ($string) { - # remove anything in brackets or parens - s/(\s)*\[[^\]]+\](\s)*//g; - s/(\s)*\([^\)]+\)(\s)*//g; - # convert and to comma - s/(\s+|,)and\s+/,/g; - s/,\s+/,/g; - } - my @deps = split /,/, $string; - # if anything has a space, we didn't parse correctly, so remove it, also - # remove anything that's blank or has an equal sign in - my @remove; - for my $key (keys @deps) { - push @remove, $key if ($deps[$key] =~ /[\s=]/ || $deps[$key] =~ /^$/); - } - for my $rem (@remove) { - splice @deps, $rem, 1; - $_-- for @remove; + 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]; + # 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'); + 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] '; + <STDIN> =~ /^[Yy]/ ? return : exit 0; + } } - return \@deps; + return $requires; } # remove any installed requirements from req list @@ -189,8 +169,8 @@ sub ask_requires (%) { FIRST: for my $req (@$reqs) { my $name = $compat32 ? "$req-compat32" : $req; say $args{README}; - print "It looks like $args{SBO} requires $name; shall I"; - print ' attempt to install it first? [y] '; + say "$args{SBO} has $name listed as a requirement."; + print 'Shall I attempt to install it first? [y] '; if (<STDIN> =~ /^[Yy\n]/) { my @cmd_args = ('/usr/sbin/sboupgrade'); push @cmd_args, $force_reqs ? '-N' : '-oN'; @@ -257,22 +237,22 @@ sub ask_opts ($) { return unless $opts; FIRST: while ($opts !~ $kv_regex) { warn "Invalid input received.\n"; - $opts = &$ask; + $opts = &$ask; } return $opts; } return; } -# prompt for the readme, and grok the readme at this time also. -sub readme_prompt ($) { +# prompt for the readme +sub readme_prompt ($$) { exists $_[0] or script_error 'readme_prompt requires an argument.'; - my $sbo = shift; + my ($sbo, $location) = @_; my $fh = open_read (get_readme_path $sbo); my $readme = do {local $/; <$fh>}; close $fh; # check for requirements, offer to install any found - my $requires = get_requires $sbo, $readme; + my $requires = get_requires $sbo, $location; ask_requires (REQUIRES => $requires, README => $readme, SBO => $sbo) if ref $requires eq 'ARRAY'; # check for user/group add commands, offer to run any found @@ -296,7 +276,7 @@ sub process_sbos ($) { my %failures; FIRST: for my $sbo (@$todo) { my $opts = 0; - $opts = readme_prompt $sbo unless $non_int; + $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); @@ -1,6 +1,6 @@ #!/usr/bin/perl -use 5.12.3; +use 5.16.0; use strict; use warnings FATAL => 'all'; use File::Copy; @@ -8,7 +8,7 @@ use Tie::File; chomp (my $pwd = `pwd`); mkdir "$pwd/SBO" unless -d "$pwd/SBO"; -copy ('/home/d4wnr4z0r/sbotwo/sbotools/SBO-Lib/lib/SBO/Lib.pm', "$pwd/SBO"); +copy ('/home/d4wnr4z0r/projects/slack14/sbotools/SBO-Lib/lib/SBO/Lib.pm', "$pwd/SBO"); open my $write, '>>', "$pwd/SBO/Lib.pm"; @@ -1,16 +1,16 @@ #!/usr/bin/env perl -use 5.12.3; +use 5.16.0; use strict; use warnings FATAL => 'all'; use File::Temp qw(tempdir tempfile); -use Test::More tests => 87; +use Test::More tests => 90; use File::Copy; use Text::Diff; use lib "."; use SBO::Lib; -my $sbo_home = '/usr/sbo'; +my $sbo_home = '/home/d4wnr4z0r/sbo.git/slackbuilds'; # 1, open_read, open_fh tests my $fh = open_read ('./test.t'); @@ -20,21 +20,22 @@ close $fh; # 2-7, config settings tests; ok (defined $SBO::Lib::tempdir, '$tempdir is defined'); is ($SBO::Lib::config{DISTCLEAN}, 'FALSE', 'config{DISTCLEAN} is good'); -is ($SBO::Lib::config{JOBS}, 'FALSE', 'config{JOBS} is good'); +is ($SBO::Lib::config{JOBS}, 2, 'config{JOBS} is good'); is ($SBO::Lib::config{NOCLEAN}, 'FALSE', 'config{NOCLEAN} is good'); -is ($SBO::Lib::config{PKG_DIR}, '/usr/sbo/packages', 'config{PKG_DIR} is good'); +is ($SBO::Lib::config{PKG_DIR}, 'FALSE', 'config{PKG_DIR} is good'); is ($SBO::Lib::config{SBO_HOME}, "$sbo_home", 'config{SBO_HOME} is good'); # 8, show_version test is (show_version, 1, 'show_version is good'); # 9, get_slack_version test -is (get_slack_version, '13.37', 'get_slack_version is good'); +is (get_slack_version, '14.0', 'get_slack_version is good'); # 10-11, chk_slackbuilds_txt tests is (chk_slackbuilds_txt, 1, 'chk_slackbuilds_txt is good'); -move ("$sbo_home/SLACKBUILDS.TXT", "$sbo_home/SLACKBUILDS.TXT.moved") or say "Unable to move SLACKBUILDS.TXT: $!"; -is (chk_slackbuilds_txt, undef, 'chk_slackbuilds_txt returns false with no SLACKBUILDS.TXT'); +move ("$sbo_home/SLACKBUILDS.TXT", "$sbo_home/SLACKBUILDS.TXT.moved"); +is (chk_slackbuilds_txt, undef, + 'chk_slackbuilds_txt returns false with no SLACKBUILDS.TXT'); move ("$sbo_home/SLACKBUILDS.TXT.moved", "$sbo_home/SLACKBUILDS.TXT"); #ok (rsync_sbo_tree == 1, 'rsync_sbo_tree is good'); @@ -47,74 +48,103 @@ is (slackbuilds_or_fetch, 1, 'slackbuilds_or_fetch is good'); print "pseudo-random sampling of get_installed_sbos output...\n"; my $installed = get_installed_sbos; for my $key (keys @$installed) { - is ($$installed[$key]{version}, '1.1.21') if $$installed[$key]{name} eq 'perlprimer'; - is ($$installed[$key]{version}, '1.1.0') if $$installed[$key]{name} eq 'matplotlib'; - is ($$installed[$key]{version}, '0.4.16') if $$installed[$key]{name} eq 'orc'; - is ($$installed[$key]{version}, '1.6.1') if $$installed[$key]{name} eq 'numpy'; - is ($$installed[$key]{version}, '3.12.4') if $$installed[$key]{name} eq 'mozilla-nss'; - is ($$installed[$key]{version}, '4.0.0.8') if $$installed[$key]{name} eq 'skype'; + is ($$installed[$key]{version}, '1.13') if $$installed[$key]{name} eq + 'OpenAL'; + is ($$installed[$key]{version}, '9.5.1_enu') if $$installed[$key]{name} eq + 'adobe-reader'; + is ($$installed[$key]{version}, '4.1.3') if $$installed[$key]{name} eq + 'libdvdnav'; + is ($$installed[$key]{version}, '0.8.8.4') if $$installed[$key]{name} eq + 'libmodplug'; + is ($$installed[$key]{version}, '3.12.4') if $$installed[$key]{name} eq + 'mozilla-nss'; + is ($$installed[$key]{version}, '2.5.0') if $$installed[$key]{name} eq + 'zdoom'; } print "completed pseudo-random testing of get_installed_sbos \n"; # 19-20, get_sbo_location tests -is (get_sbo_location 'nginx', "$sbo_home/network/nginx", 'get_sbo_location is good'); -is (get_sbo_location 'omgwtfbbq', undef, 'get_sbo_location returns false with not-an-sbo input'); +is (get_sbo_location 'nginx', "$sbo_home/network/nginx", + 'get_sbo_location is good'); +is (get_sbo_location 'omgwtfbbq', undef, + 'get_sbo_location returns false with not-an-sbo input'); # 21-22, get_available_updates tests my $updates = get_available_updates; for my $key (keys @$updates) { - is ($$updates[$key]{installed}, '18.0.1025.142', '$$updates[$key]{installed} good for chromium') if $$updates[$key]{name} eq 'chromium'; - is ($$updates[$key]{update}, '20.0.1132.57', '$$updates[$key]{update} good for chromium') if $$updates[$key]{name} eq 'chromium'; + is ($$updates[$key]{installed}, '1.15', + '$$updates[$key]{installed} good for mutagen') if $$updates[$key]{name} + eq 'mutagen'; + is ($$updates[$key]{update}, '1.20', + '$$updates[$key]{update} good for mutagen') if $$updates[$key]{name} eq + 'mutagen'; } # 23, get_arch test -is (get_arch, 'i686', 'get_arch is good'); +is (get_arch, 'x86_64', 'get_arch is good'); # 24-25, get_download_info tests my %dl_info = get_download_info (LOCATION => "$sbo_home/system/wine", X64 => 0); my $link = 'http://downloads.sf.net/wine/source/1.4/wine-1.4.1.tar.bz2'; -is ($dl_info{$link}, '0c28702ed478df7a1c097f3a9c4cabd6', 'get_download_info test 01 good.'); +is ($dl_info{$link}, '0c28702ed478df7a1c097f3a9c4cabd6', + 'get_download_info test 01 good.'); $link = 'http://www.unrealize.co.uk/source/dibeng-max-2010-11-12.zip'; -is ($dl_info{$link}, '97159d77631da13952fe87e846cf1f3b', 'get_download_info test 02 good.'); +is ($dl_info{$link}, '97159d77631da13952fe87e846cf1f3b', + 'get_download_info test 02 good.'); # 26-28, get_sbo_downloads tests %dl_info = get_sbo_downloads (LOCATION => "$sbo_home/system/wine"); $link = 'http://downloads.sf.net/wine/source/1.4/wine-1.4.1.tar.bz2'; -is ($dl_info{$link}, '0c28702ed478df7a1c097f3a9c4cabd6', 'get_sbo_downloads test 01 good.'); +is ($dl_info{$link}, '0c28702ed478df7a1c097f3a9c4cabd6', + 'get_sbo_downloads test 01 good.'); $link = 'http://www.unrealize.co.uk/source/dibeng-max-2010-11-12.zip'; -is ($dl_info{$link}, '97159d77631da13952fe87e846cf1f3b', 'get_sbo_downloads test 02 good.'); +is ($dl_info{$link}, '97159d77631da13952fe87e846cf1f3b', + 'get_sbo_downloads test 02 good.'); my %downloads = get_sbo_downloads (LOCATION => "$sbo_home/system/ifuse"); $link = 'http://www.libimobiledevice.org/downloads/ifuse-1.1.1.tar.bz2'; -is ($downloads{$link}, '8d528a79de024b91f12f8ac67965c37c', 'get_sbo_downloads test 03 good.'); +is ($downloads{$link}, '8d528a79de024b91f12f8ac67965c37c', + 'get_sbo_downloads test 03 good.'); # 29, get_filename_from_link test -is (get_filename_from_link 'http://www.libimobiledevice.org/downloads/ifuse-1.1.1.tar.bz2', "$sbo_home/distfiles/ifuse-1.1.1.tar.bz2", 'get_file_from_link good'); -is (get_filename_from_link 'adf;lkajsdfaksjdfalsdjfalsdkfjdsfj', undef, 'get_filename_from_link good with invalid input'); +is (get_filename_from_link + 'http://www.libimobiledevice.org/downloads/ifuse-1.1.1.tar.bz2', + "$sbo_home/distfiles/ifuse-1.1.1.tar.bz2", 'get_file_from_link good'); +is (get_filename_from_link 'adf;lkajsdfaksjdfalsdjfalsdkfjdsfj', undef, + 'get_filename_from_link good with invalid input'); # 31, compute_md5sum test -is (compute_md5sum "$sbo_home/distfiles/laptop-mode-tools_1.61.tar.gz", '6685af5dbb34c3d51ca27933b58f484e', 'compute_md5sum good'); +is (compute_md5sum "$sbo_home/distfiles/laptop-mode-tools_1.61.tar.gz", + '6685af5dbb34c3d51ca27933b58f484e', 'compute_md5sum good'); # 32, verify_distfile test -is ((verify_distfile "$sbo_home/distfiles/laptop-mode-tools_1.61.tar.gz", '6685af5dbb34c3d51ca27933b58f484e'), 1, 'verify_distfile good'); +is ((verify_distfile "$sbo_home/distfiles/laptop-mode-tools_1.61.tar.gz", + '6685af5dbb34c3d51ca27933b58f484e'), 1, 'verify_distfile good'); # 33, get_sbo_version test is (get_sbo_version "$sbo_home/system/wine", '1.4.1', 'get_sbo_version good'); # 34, get_symlink_from_filename test -is ((get_symlink_from_filename "$sbo_home/distfiles/laptop-mode-tools_1.61.tar.gz", "$sbo_home/system/laptop-mode-tools"), "$sbo_home/system/laptop-mode-tools/laptop-mode-tools_1.61.tar.gz", 'get_symlink_from_filename good'); +is ((get_symlink_from_filename + "$sbo_home/distfiles/laptop-mode-tools_1.61.tar.gz", + "$sbo_home/system/laptop-mode-tools"), + "$sbo_home/system/laptop-mode-tools/laptop-mode-tools_1.61.tar.gz", + 'get_symlink_from_filename good'); # 35-36, check_x32 tests ok (check_x32 "$sbo_home/system/wine", 'check_x32 true for 32-bit only wine'); -ok (!(check_x32 "$sbo_home/system/ifuse"), 'check_x32 false for not-32-bit-only ifuse'); +ok (!(check_x32 "$sbo_home/system/ifuse"), + 'check_x32 false for not-32-bit-only ifuse'); # 37, check_multilib tests -#ok (check_multilib, 'check_multilib good'); +ok (check_multilib, 'check_multilib good'); # 38-39, create_symlinks tests %downloads = get_sbo_downloads (LOCATION => "$sbo_home/system/wine", 32 => 1); my @symlinks = create_symlinks "$sbo_home/system/wine", %downloads; -is ($symlinks[0], "$sbo_home/system/wine/wine-1.4.1.tar.bz2", '$symlinks[0] good for create_symlinks'); -is ($symlinks[1], "$sbo_home/system/wine/dibeng-max-2010-11-12.zip", '$symlinks[1] good for create_symlinks'); +is ($symlinks[0], "$sbo_home/system/wine/wine-1.4.1.tar.bz2", + '$symlinks[0] good for create_symlinks'); +is ($symlinks[1], "$sbo_home/system/wine/dibeng-max-2010-11-12.zip", + '$symlinks[1] good for create_symlinks'); # 40-41, grok_temp_file, get_src_dir/get_pkg_name tests my $tempdir = tempdir (CLEANUP => 1); @@ -133,27 +163,35 @@ close $tempfh; is ((check_distfiles %downloads), 1, 'check_distfiles good'); # 43-45, check_home tests -system ('sudo /usr/sbin/sboconfig -s /home/d4wnr4z0r/opt_sbo') == 0 or die "unable to set sboconfig -s\n"; +system ('sudo /usr/sbin/sboconfig -s /home/d4wnr4z0r/opt_sbo') == 0 or die + "unable to set sboconfig -s\n"; read_config; ok (check_home, 'check_home returns true with new non-existent directory'); ok (-d '/home/d4wnr4z0r/opt_sbo', 'check_home creates $config{SBO_HOME}'); ok (check_home, 'check_home returns true with new existent empty directory'); -system ("sudo /usr/sbin/sboconfig -s $sbo_home") == 0 or die "unable to reset sboconfig -s\n"; +system ("sudo /usr/sbin/sboconfig -s $sbo_home") == 0 or die + "unable to reset sboconfig -s\n"; read_config; rmdir "/home/d4wnr4z0r/opt_sbo"; # 46-47 get_sbo_from_loc tests -is (get_sbo_from_loc '/home/d4wnr4z0r/sbo.git/system/ifuse', 'ifuse', 'get_sbo_from_loc returns correctly with valid input'); -ok (! get_sbo_from_loc 'omg_wtf_bbq', 'get_sbo_from_loc returns false with invalid input'); +is (get_sbo_from_loc '/home/d4wnr4z0r/sbo.git/system/ifuse', 'ifuse', + 'get_sbo_from_loc returns correctly with valid input'); +ok (! get_sbo_from_loc 'omg_wtf_bbq', + 'get_sbo_from_loc returns false with invalid input'); # 48-49, compare_md5s tests -is (compare_md5s ('omgwtf123456789', 'omgwtf123456789'), 1, 'compare_md5s returns true for matching parameters'); -is (compare_md5s ('omgwtf123456788', 'somethingelsebbq'), undef, 'compare_md5s returns false for not-matching parameters'); +is (compare_md5s ('omgwtf123456789', 'omgwtf123456789'), 1, + 'compare_md5s returns true for matching parameters'); +is (compare_md5s ('omgwtf123456788', 'somethingelsebbq'), undef, + 'compare_md5s returns false for not-matching parameters'); # 50, get_distfile tests my $distfile = "$sbo_home/distfiles/Sort-Versions-1.5.tar.gz"; unlink $distfile if -f $distfile; -is (get_distfile ('http://search.cpan.org/CPAN/authors/id/E/ED/EDAVIS/Sort-Versions-1.5.tar.gz', '5434f948fdea6406851c77bebbd0ed19'), 1, 'get_distfile is good'); +is (get_distfile + ('http://search.cpan.org/CPAN/authors/id/E/ED/EDAVIS/Sort-Versions-1.5.tar.gz', + '5434f948fdea6406851c77bebbd0ed19'), 1, 'get_distfile is good'); unlink $distfile; # 51-58, rewrite_slackbuilds/revert_slackbuild tests @@ -162,8 +200,9 @@ copy ("$sbo_home/system/ifuse/ifuse.SlackBuild", $rewrite_dir); my $slackbuild = "$rewrite_dir/ifuse.SlackBuild"; $tempfh = tempfile (DIR => $rewrite_dir); my $tempfn = get_tmp_extfn $tempfh; -my %changes; -is (rewrite_slackbuild (SLACKBUILD => $slackbuild,TEMPFN => $tempfn,CHANGES => \%changes), 1, 'rewrite_slackbuild with no %changes good'); +my %changes = (); +is (rewrite_slackbuild (SLACKBUILD => $slackbuild, TEMPFN => $tempfn, + CHANGES => \%changes), 1, 'rewrite_slackbuild with no %changes good'); ok (-f "$slackbuild.orig", 'rewrite_slackbuild backing up original is good.'); my $expected_out = "67c67 < tar xvf \$CWD/\$PRGNAM-\$VERSION.tar.bz2 @@ -174,12 +213,14 @@ my $expected_out = "67c67 --- > /sbin/makepkg -l y -c n \$OUTPUT/\$PRGNAM-\$VERSION-\$ARCH-\$BUILD\$TAG.\${PKGTYPE:-tgz} | tee -a $tempfn "; -is (diff ("$slackbuild.orig", $slackbuild, {STYLE => 'OldStyle'}), $expected_out, 'tar line rewritten correctly'); +is (diff ("$slackbuild.orig", $slackbuild, {STYLE => 'OldStyle'}), + $expected_out, 'tar line rewritten correctly'); is (revert_slackbuild $slackbuild, 1, 'revert_slackbuild is good'); $changes{libdirsuffix} = ''; $changes{make} = '-j 5'; $changes{arch_out} = 'i486'; -is (rewrite_slackbuild (SLACKBUILD => $slackbuild,TEMPFN => $tempfn,CHANGES => \%changes), 1, 'rewrite_slackbuild with all %changes good'); +is (rewrite_slackbuild (SLACKBUILD => $slackbuild, TEMPFN => $tempfn, + CHANGES => \%changes), 1, 'rewrite_slackbuild with all %changes good'); ok (-f "$slackbuild.orig", 'rewrite_slackbuild backing up original is good.'); $expected_out = "55c55 < LIBDIRSUFFIX=\"64\" @@ -198,7 +239,8 @@ $expected_out = "55c55 --- > /sbin/makepkg -l y -c n \$OUTPUT/\$PRGNAM-\$VERSION-i486-\$BUILD\$TAG.\${PKGTYPE:-tgz} | tee -a $tempfn "; -is (diff ("$slackbuild.orig", $slackbuild, {STYLE => 'OldStyle'}), $expected_out, 'all changed lines rewritten correctly'); +is (diff ("$slackbuild.orig", $slackbuild, {STYLE => 'OldStyle'}), + $expected_out, 'all changed lines rewritten correctly'); is (revert_slackbuild $slackbuild, 1, 'revert_slackbuild is good again'); # 59-61, get_from_info tests @@ -207,7 +249,8 @@ my %params = (LOCATION => $test_loc); my $info = get_from_info (%params, GET => 'VERSION'); is ($$info[0], '1.1.1', 'get_from_info GET => VERSION is good'); $info = get_from_info (%params, GET => 'HOMEPAGE'); -is ($$info[0], 'http://www.libimobiledevice.org', 'get_from_info GET => HOMEPAGE is good'); +is ($$info[0], 'http://www.libimobiledevice.org', + 'get_from_info GET => HOMEPAGE is good'); $info = get_from_info (%params, GET => 'DOWNLOAD_x86_64'); is ($$info[0], "", 'get_from_info GET => DOWNLOAD_x86_64 is good'); @@ -215,16 +258,20 @@ is ($$info[0], "", 'get_from_info GET => DOWNLOAD_x86_64 is good'); my $listing = get_update_list; s/\s//g for @$listing; for my $item (@$listing) { - is ($item, 'zdoom-2.5.0<needsupdating(SBohas2.6.0)', 'get_update_list output good for zdoom') if $item =~ /^zdoom/; - is ($item, 'ffmpeg-0.8.7<needsupdating(SBohas0.11.1)', 'get_update_list output good for ffmpeg') if $item =~ /^ffmpeg/; - is ($item, 'atkmm-2.22.4<needsupdating(SBohas2.22.6)', 'get_update_list output good for atkmm') if $item =~ /^atkmm/; + is ($item, 'zdoom-2.5.0<needsupdating(SBohas2.6.0)', + 'get_update_list output good for zdoom') if $item =~ /^zdoom/; + is ($item, 'ffmpeg-0.8.7<needsupdating(SBohas0.11.1)', + 'get_update_list output good for ffmpeg') if $item =~ /^ffmpeg/; + is ($item, 'atkmm-2.22.4<needsupdating(SBohas2.22.6)', + 'get_update_list output good for atkmm') if $item =~ /^atkmm/; } # 65, remove_stuff test - can only really test for invalid input is (remove_stuff '/omg/wtf/bbq', 1, 'remove_stuff good for invalid input'); # 66, config_write test -is (config_write ('OMG', 'WTF'), undef, 'config_write returned undef correctly'); +is (config_write ('OMG', 'WTF'), undef, + 'config_write returned undef correctly'); # 67-74, perform_search tests my $findings = perform_search 'desktop'; @@ -242,65 +289,65 @@ for my $found (@$findings) { } elsif ($key eq 'gsettings-desktop-schemas') { $section = 'system'; } - is ($$found{$key}, "$sbo_home/$section/$key", 'perform_search good for $search eq desktop'); + is ($$found{$key}, "$sbo_home/$section/$key", + 'perform_search good for $search eq desktop'); } } # 75, get_inst_names test $installed = get_installed_sbos; my $inst_names = get_inst_names $installed; -ok ('skype' ~~ @$inst_names, 'get_inst_names is good'); +ok ('zdoom' ~~ @$inst_names, 'get_inst_names is good'); # 76-81, get_reqs tests $SBO::Lib::no_reqs = 0; -#ok (! (get_requires 'stops', "$sbo_home/audio/stops"), 'get_requires good for circular requirements'); -#ok (! (get_requires 'smc', "$sbo_home/games/smc"), 'get_requires good for REQUIRES="%README%"'); -ok (! (get_requires 'krb5', "$sbo_home/network/krb5"), 'get_requires good for REQUIRES=""'); -open $fh, '<', "$sbo_home/desktop/matchbox-desktop/README"; -my $readme = do {local $/; <$fh>}; -close $fh; -my $reqs = get_requires 'matchbox-desktop', $readme; +ok (! (get_requires 'zarafa', "$sbo_home/network/zarafa"), + 'get_requires good for circular requirements'); +ok (! (get_requires 'smc', "$sbo_home/games/smc"), + 'get_requires good for REQUIRES="%README%"'); +ok (! (get_requires 'krb5', "$sbo_home/network/krb5"), + 'get_requires good for REQUIRES=""'); +my $reqs = get_requires 'matchbox-desktop', + "$sbo_home/audio/gmpc"; my $say = 'get_requires good for normal req list'; -is ($$reqs[0], 'libmatchbox', $say); -is ($$reqs[1], 'matchbox-window-manager', $say); -is ($$reqs[2], 'matchbox-common', $say); +is ($$reqs[0], 'gob2', $say); +is ($$reqs[1], 'libmpd', $say); +is ($$reqs[2], 'vala', $say); # 82-85, get_user_group tests $fh = open_read "$sbo_home/network/nagios/README"; -$readme = do {local $/; <$fh>}; +my $readme = do {local $/; <$fh>}; close $fh; my $cmds = get_user_group $readme; is ($$cmds[0], 'groupadd -g 213 nagios', 'get_user_group good for # groupadd'); -is ($$cmds[1], 'useradd -u 213 -d /dev/null -s /bin/false -g nagios nagios', 'get_user_group for # useradd'); +is ($$cmds[1], 'useradd -u 213 -d /dev/null -s /bin/false -g nagios nagios', + 'get_user_group for # useradd'); $fh = open_read "$sbo_home/network/havp/README"; $readme = do {local $/; <$fh>}; close $fh; $cmds = get_user_group $readme; is ($$cmds[0], 'groupadd -g 210 clamav', 'get_user_group good for groupadd'); -is ($$cmds[1], 'useradd -u 256 -d /dev/null -s /bin/false -g clamav havp', 'get_user_group good for useradd'); +is ($$cmds[1], 'useradd -u 256 -d /dev/null -s /bin/false -g clamav havp', + 'get_user_group good for useradd'); # 86-87, get_opts test $fh = open_read "$sbo_home/games/vbam/README"; $readme = do {local $/; <$fh>}; close $fh; ok (get_opts $readme, 'get_opts good where README defines opts'); -$fh = open_read "$sbo_home/libraries/libmatchbox/README"; +$fh = open_read "$sbo_home/audio/gmpc/README"; $readme = do {local $/; <$fh>}; close $fh; ok (! (get_opts $readme), 'get_opts good where README does not define opts'); # 88-90, clean_reqs tests +#$reqs = get_requires "wine", "$sbo_home/system/wine"; +#$reqs = clean_reqs $reqs; +#print $_,"\n" for @$reqs; +#ok (! $$reqs[0], 'clean_reqs good for already installed reqs'); $SBO::Lib::compat32 = 0; -$fh = open_read "$sbo_home/system/wine/README"; -$readme = do {local $/; <$fh>}; -close $fh; -$reqs = get_requires 'wine', $readme; +$reqs = get_requires 'gmpc', "$sbo_home/audio/gmpc"; $reqs = clean_reqs $reqs; -ok (! $$reqs[0], 'clean_reqs good for already installed reqs'); -$fh = open_read "$sbo_home/games/pingus/README"; -$readme = do {local $/; <$fh>}; -close $fh; -$reqs = get_requires 'pingus', $readme; -$reqs = clean_reqs $reqs; -ok ($$reqs[0] eq 'scons', 'clean_reqs good for un/installed reqs.'); -ok ($$reqs[1] eq 'physfs', 'clean_reqs good for un/installed reqs.'); +ok ($$reqs[0] eq 'gob2', 'clean_reqs good for un/installed reqs.'); +ok ($$reqs[1] eq 'libmpd', 'clean_reqs good for un/installed reqs.'); + |