sbotools2

Maintenance fork of the original sbotools version 2
Log | Files | Refs | README

commit af1f5829a2b8181fc005acdafaa4cc52e5ae320b
parent ea914a834932b7f94379e5247d2788b4b1e47ceb
Author: Andreas Guldstrand <andreas.guldstrand@gmail.com>
Date:   Fri,  4 Dec 2015 01:35:04 +0100

Allow to override the version of slackware to grab from SBo

Diffstat:
MSBO-Lib/lib/SBO/Lib.pm | 2++
Mman1/sboconfig.1 | 5+++++
Mman5/sbotools.conf.5 | 5+++++
Msboconfig | 33++++++++++++++++++++-------------
4 files changed, 32 insertions(+), 13 deletions(-)

diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm @@ -144,6 +144,7 @@ our %config = ( PKG_DIR => 'FALSE', SBO_HOME => 'FALSE', LOCAL_OVERRIDES => 'FALSE', + SLACKWARE_VERSION => 'FALSE', ); # subroutine to suck in config in order to facilitate unit testing @@ -184,6 +185,7 @@ sub show_version { # 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 { + return $config{SLACKWARE_VERSION} unless $config{SLACKWARE_VERSION} eq 'FALSE'; my %supported = ( '14.0' => '14.0', '14.1' => '14.1', diff --git a/man1/sboconfig.1 b/man1/sboconfig.1 @@ -54,6 +54,11 @@ SBO_HOME: If set to a path, this is where the slackbuilds.org tree will live; by .RS LOCAL_OVERRIDES: If set to a path, any directory name under that path that matches a slackbuild name will be used instead of anything found on SBo. This will even work if it isn't on SBo at all. It still requires all the usual files present in an SBo directory such as README, name.info, and name.SlackBuild. .RE +.P +-V|--slackware-version (FALSE|#.#) +.RS +SLACKWARE_VERSION: If set to a version specification, use the SBo repository for that version instead of the one you can find in /etc/slackware-version. +.RE .SH EXIT CODES .P sboconfig can exit with the following codes: diff --git a/man5/sbotools.conf.5 b/man5/sbotools.conf.5 @@ -37,6 +37,11 @@ LOCAL_OVERRIDES=(FALSE|/path) .RS If set to a path, any directory name under that path that matches a slackbuild name will be used instead of anything found on SBo. This will even work if it isn't on SBo at all. It still requires all the usual files present in an SBo directory such as README, name.info, and name.SlackBuild. .RE +.P +SLACKWARE_VERSION=(FALSE|#.#) +.RS +If set to a version specification, use the SBo repository for that version instead of the one you can find in /etc/slackware-version. +.RE .SH SEE ALSO .P sbocheck(1), sboclean(1), sboconfig(1), sbofind(1), sboinstall(1), sboremove(1), sbosnap(1), sboupgrade(1) diff --git a/sboconfig b/sboconfig @@ -43,6 +43,8 @@ Config options (defaults shown): SBO_HOME: set the SBo directory. -l|--local-overrides FALSE: LOCAL_OVERRIDES: a directory containing local overrides. + -V|--slackware-version FALSE: + SLACKWARE_VERSION: use the SBo repository for this version. EOF } @@ -51,27 +53,29 @@ my %options; GetOptions(\%options, 'help|h', 'version|v', 'list|l', 'noclean|c=s', 'distclean|d=s', 'jobs|j=s', 'pkg-dir|p=s', 'sbo-home|s=s', - 'local-overrides|l=s'); + 'local-overrides|l=s', 'slackware-version|V=s'); show_usage() and exit 0 if exists $options{help}; show_version() and exit 0 if exists $options{version}; my %valid_confs = ( - noclean => 'NOCLEAN', - distclean => 'DISTCLEAN', - jobs => 'JOBS', - 'pkg-dir' => 'PKG_DIR', - 'sbo-home' => 'SBO_HOME', - 'local-overrides' => 'LOCAL_OVERRIDES', + noclean => 'NOCLEAN', + distclean => 'DISTCLEAN', + jobs => 'JOBS', + 'pkg-dir' => 'PKG_DIR', + 'sbo-home' => 'SBO_HOME', + 'local-overrides' => 'LOCAL_OVERRIDES', + 'slackware-version' => 'SLACKWARE_VERSION', ); my %params = ( - NOCLEAN => 'c|--noclean', - DISTCLEAN => 'd|--distclean', - JOBS => 'j|--jobs', - PKG_DIR => 'p|--pkg-dir', - SBO_HOME => 's|--sbo-home', - LOCAL_OVERRIDES => 'l|--local-overrides', + NOCLEAN => 'c|--noclean', + DISTCLEAN => 'd|--distclean', + JOBS => 'j|--jobs', + PKG_DIR => 'p|--pkg-dir', + SBO_HOME => 's|--sbo-home', + LOCAL_OVERRIDES => 'l|--local-overrides', + SLACKWARE_VERSION => 'V|--slackware-version', ); if (exists $options{list}) { @@ -109,6 +113,9 @@ if (exists $changes{SBO_HOME}) { if (exists $changes{LOCAL_OVERRIDES}) { usage_error("$warn -l") unless $changes{LOCAL_OVERRIDES} =~ qr#^(/|FALSE$)#; } +if (exists $changes{SLACKWARE_VERSION}) { + usage_error("$warn -V") unless $changes{SLACKWARE_VERSION} =~ m/^(\d+\.\d+|FALSE)$/; +} # 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