sbotools2

Maintenance fork of the original sbotools version 2
git clone git://git.server.ky/slackcoder/sbotools2
Log | Files | Refs | README

15-usage.t (5990B)


      1 #!/usr/bin/env perl
      2 
      3 use 5.16.0;
      4 use strict;
      5 use warnings FATAL => 'all';
      6 use Test::More;
      7 use Capture::Tiny qw/ capture_merged /;
      8 use FindBin '$RealBin';
      9 use lib $RealBin;
     10 use Test::Sbotools qw/ make_slackbuilds_txt sbocheck sboclean sboconfig sbofind sboinstall sboremove sbosnap sboupgrade /;
     11 
     12 plan tests => 14;
     13 
     14 make_slackbuilds_txt();
     15 
     16 # 1-8: test -h output of sbo* scripts
     17 
     18 ## sbocheck
     19 sbocheck '-h', { expected => <<'SBOCHECK' };
     20 Usage: sbocheck
     21 
     22 Options:
     23   -h|--help:
     24     this screen.
     25   -v|--version:
     26     version information.
     27 
     28 SBOCHECK
     29 
     30 ## sboclean
     31 sboclean '-h', { expected => <<'SBOCLEAN' };
     32 Usage: sboclean (options) [package]
     33 
     34 Options:
     35   -h|--help:
     36     this screen.
     37   -v|--version:
     38     version information.
     39   -d|--dist:
     40     clean distfiles.
     41   -w|--work:
     42     clean working directories.
     43   -i|--interactive:
     44     be interactive.
     45 
     46 SBOCLEAN
     47 
     48 ## sboconfig
     49 my $sboconfig = <<'SBOCONFIG';
     50 Usage: sboconfig [options] [arguments]
     51 
     52 Options:
     53   -h|--help:
     54     this screen.
     55   -v|--version:
     56     version information.
     57   -l|--list:
     58     show current options.
     59 
     60 Config options (defaults shown):
     61   -c|--clean FALSE:
     62       NOCLEAN: if TRUE, do NOT clean up after building by default.
     63   -d|--distclean FALSE:
     64       DISTCLEAN: if TRUE, DO clean distfiles by default after building.
     65   -f|--fallback-archive ftp://slackware.uk/sbosrcarch:
     66       FALLBACK_ARCHIVE: Fallback URL to download package source's.  FALSE to disable.
     67   -j|--jobs FALSE:
     68       JOBS: numeric -j setting to feed to make for multicore systems.
     69   -g|--gpg-key D3076BC3E783EE747F09B8B70368EF579C7BA3B6:
     70       GPG_KEY GPG key ID for verification.
     71   -p|--pkg-dir FALSE:
     72       PKG_DIR: set a directory to store packages in.
     73   -s|--sbo-home /usr/sbo:
     74       SBO_HOME: set the SBo directory.
     75   -o|--local-overrides FALSE:
     76       LOCAL_OVERRIDES: a directory containing local overrides.
     77   -V|--slackware-version FALSE:
     78       SLACKWARE_VERSION: use the SBo repository for this version.
     79   -r|--repo FALSE:
     80       REPO: use a repository other than SBo.
     81 
     82 SBOCONFIG
     83 sboconfig '-h', { expected => $sboconfig };
     84 sboconfig { expected => $sboconfig };
     85 
     86 ## sbofind
     87 my $sbofind = <<'SBOFIND';
     88 Usage: sbofind (search_term)
     89 
     90 Options:
     91   -h|--help:
     92     this screen.
     93   -v|--verison:
     94     version information.
     95   -e|--exact:
     96     only exact matching.
     97   -t|--no-tags:
     98     exclude tags from search.
     99   -i|--info:
    100     show the .info for each found item.
    101   -r|--readme:
    102     show the README for each found item.
    103   -q|--queue:
    104     show the build queue for each found item.
    105 
    106 Example:
    107   sbofind libsexy
    108 
    109 SBOFIND
    110 sbofind '-h', { expected => $sbofind };
    111 sbofind { expected => $sbofind, exit => 1 };
    112 
    113 ## sboinstall
    114 my $sboinstall = <<'SBOINSTALL';
    115 Usage: sboinstall [options] sbo
    116        sboinstall --use-template file
    117 
    118 Options (defaults shown first where applicable):
    119   -h|--help:
    120     this screen.
    121   -v|--version:
    122     version information.
    123   -c|--noclean (FALSE|TRUE):
    124     set whether or not to clean working files/directories after the build.
    125   -d|--distclean (TRUE|FALSE):
    126    set whether or not to clean distfiles afterward.
    127   -i|--noinstall:
    128     do not run installpkg at the end of the build process.
    129   -j|--jobs (FALSE|#):
    130     specify "-j" setting to make, for multicore systems; overrides conf file.
    131   -p|--compat32:
    132     install an SBo as a -compat32 pkg on a multilib x86_64 system.
    133   -r|--nointeractive:
    134     non-interactive; skips README and all prompts.
    135   -R|--norequirements:
    136     view the README but do not parse requirements, commands, or options.
    137   --reinstall:
    138     Ask to reinstall any already-installed packages in the requirement list.
    139   --create-template (FILE):
    140     create a template with specified requirements, commands, and options.
    141   --use-template (FILE):
    142     use a template created by --create-template to install requirements with
    143     specified commands and options. This also enables the --nointeractive flag.
    144 
    145 SBOINSTALL
    146 sboinstall '-h', { expected => $sboinstall };
    147 sboinstall { expected => $sboinstall, exit => 1 };
    148 
    149 ## sboremove
    150 my $sboremove = <<'SBOREMOVE';
    151 Usage: sboremove [options] sbo
    152 
    153 Options (defaults shown first where applicable):
    154   -h|--help:
    155     this screen.
    156   -v|--version:
    157     version information.
    158   -a|--alwaysask:
    159     always ask to remove, even if required by other packages on system.
    160 
    161 Note: optional dependencies need to be removed separately.
    162 
    163 SBOREMOVE
    164 sboremove '-h', { expected => $sboremove };
    165 sboremove { expected => $sboremove, exit => 1 };
    166 
    167 ## sbosnap
    168 my $sbosnap = <<'SBOSNAP';
    169 Usage: sbosnap [options|command]
    170 
    171 Options:
    172   -h|--help:
    173     this screen.
    174   -v|--version:
    175     version information.
    176 
    177 Commands:
    178   fetch: initialize a local copy of the slackbuilds.org tree.
    179   import-key [path or url]: import GPG for verifying the slackbuilds.org tree. Defaults to the key shipped with sbotools2.
    180   update: update an existing local copy of the slackbuilds.org tree.
    181           (generally, you may prefer "sbocheck" over "sbosnap update")
    182 
    183 SBOSNAP
    184 sbosnap '-h', { expected => $sbosnap };
    185 sbosnap { expected => $sbosnap, exit => 1 };
    186 
    187 ## sboupgrade
    188 my $sboupgrade = <<'SBOUPGRADE';
    189 Usage: sboupgrade (options) [package]
    190 
    191 Options (defaults shown first where applicable):
    192   -h|--help:
    193     this screen.
    194   -v|--version:
    195     version information.
    196   -c|--noclean (FALSE|TRUE):
    197     set whether or not to clean working directories after building.
    198   -d|--distclean (TRUE|FALSE):
    199     set whether or not to clean distfiles afterward.
    200   -f|--force:
    201     force an update, even if the "upgrade" version is the same or lower.
    202   -i|--noinstall:
    203     do not run installpkg at the end of the build process.
    204   -j|--jobs (FALSE|#):
    205     specify "-j" setting to make, for multicore systems; overrides conf file.
    206   -r|--nointeractive:
    207     non-interactive; skips README and all prompts.
    208   -z|--force-reqs:
    209     when used with -f, will force rebuilding an SBo's requirements as well.
    210   --all
    211     this flag will upgrade everything reported by sbocheck(1).
    212 
    213 SBOUPGRADE
    214 sboupgrade '-h', { expected => $sboupgrade };
    215 sboupgrade { expected => $sboupgrade, exit => 1 };
    216