Updated 2015-05-20 17:26:06 by Stu

SPITE - Simple Packager and Installer for Tcl Extensions

Directions to find it at Stu

Stu 2015-05-20 Version 0.3.

Release notes
Spring 2015 - Version 0.3

Updated license to ISC.
New command [->] is an alias for [addfile]
New command [license] to specify license type (default ISC)
Added ability to install files as Tcl Modules
Added ability to create links
Files can be added but not installed. Specify dir "".

New mask types:
  "" defaults to "data"
  "none" won't chmod the file when installing

New file types:
  "tclmodule" the file may be installed as a Tcl module
  "pkgindex" the file won't be installed if installing Tcl modules


Winter 2012 - Version 0.2
Added command line option -f to specify spite.conf file

README
SPITE - Simple Packager and Installer for Tcl Extensions
 2004-2015 Stuart Cassoff <[email protected]>

SPITE is a utility to package Tcl scripts and other
files for easy distribution and installation.
SPITE is designed mainly for unix systems.
SPITE takes a list of files and puts them
and the installer code into a shell script.
This shell script may then be used to install the files.
The idea behind SPITE is to provide a simple way to distribute
mostly non-binary Tcl extensions consisting of a handful of text files.
Textual input files must terminate with a newline or SPITE will break.
When installing files of type 'tclscript', the installer will pass
the file through sed with one or both of the following regexps:
"1,5s/exec .*tclsh[^ ]*/exec ${TCLSH}/g"
"1,5s/exec .*wish[^ ]*/exec ${WISH}/g"
This requires sed and mktemp on the target system.
Checksumming may be disabled during install with --sum ""

Requires Tcl 8.5+

Usage:
  spite [-f configfile]

Will write to stdout a .spite installer file based
on the configuration in configfile.


BUGS
  For directories, ownership is changed only for the last dir in a path.

Fully documented config file (spite.conf)
# SPITE config file
#
# 2004-2015 Stuart Cassoff
#
# This config is very simple.
# This file is [sourced] by spite.
# Errors should show up quickly.
#


# This will appear at the top of the spite file
# default is ""
comment "SPITE - Simple Packager and Installer for Tcl Extensions"


# Destination dir tail
# Probably the name of the program
# Almost always needed
# default is ""
appdir spite


# Version info
# default is ""
version 0.3


# Author info
# default is ""
author "Stuart Cassoff"


# License info
# default is "ISC"
#license BSD


# Homepage url
# default is ""
homepage http://www3.bell.net/stwo/software/


# Distribution file url
# default is ""
distfile http://www3.bell.net/stwo/software/spite-0.3.spite.gz


# Base dir for source files
# default is "."
#srcdir /home/stu/tcl/netutil


# Install prefix
# default is "/usr/local"
#prefix /opt


# Bin dir
# Installed as $prefix/$bindir
# default is 'bin'
#bindir mybindir/bin


# Lib dir
# Installed as $prefix/$libdir
# default is "lib"
#libdir mylibdir


# Script dir
# If "" - this will become $libdir/$appdir
# default is ""
#scriptdir myscriptdir


# Man dir
# Installed as $prefix/$mandir
# default is "man"
#mandir mymandir


# Doc dir
# Installed as $prefix/$docdir
# default is "share/doc"
#docdir mydocdir


# Example dir
# Installed as $prefix/$docdir
# default is "share/examples"
#exampledir myexampledir


# Configuration dir
# If "" - this will become $libdir/$appdir
# default is ""
#confdir  myconfdir


# Mask for datafiles
# default is "0444"
#datamask 0644


# Mask for script files
# default is "0555"
#scriptmask 0755


# Name of program to checksum files.
# set to "" will turn off checksumming
# default is "md5"
#sum sha256
#sum ""


# How to encode binary files
# default is "uuencode -p"
#encode "base64 -e"


# How to decode binary files
# default is "uudecode"
#decode "base64 -d"


# Files to install
#
# Use [addfile] or [->] to specify files to install
#
# addfile sname dir ?mask? ?type? ?iname?
# ->      sname dir ?mask? ?type? ?iname?
#
# "sname" is where file is located now (source name)
# relative to "srcdir"
#
# "iname" is the name the file should have when installed
#
# destdir for file is "prefix" + "dir"
# if dir is one of appdir, bindir, libdir,
# scriptdir, mandir, docdir or exdir
# then the named dir will be used
#
# "mask" is "" or numerical mask or name
# "mask" "data" or "" will use "datamask"
# "mask" "script" will use "scriptmask"
# "mask" "none" won't set the file's mode when installing
#
# "type" can be "", "text", "binary", "tclscript",
# "tclmodule", "pkgindex", "readme", "license" or "link"
#
# if "type" is "" or "text" then normal processing will occur
# if "type" is "binary" then the file will be uuencoded/decoded
#
# if "type" is "tclmodule" it will be treated the same
# as "text" except that it will be installed in the --tclmoddir
# with a Tcl module style name
#
# if "type" is "pkgindex" it will be treated the same
# as "text" except that it won't be installed if --tclmodule
# is set when installing
#
# if "type" is "tclscript" it will be treated the same
# as "text" except that tclsh/wish path resolution will
# be performed during install
#
# if "type" is "readme" it will be treated the same
# as "text" except that it will enable a command line
# option allowing the user to view the readme before installing
#
# if "type" is "license" it will be treated the same
# as "text" except that it will enable a command line
# option allowing the user to view the readme before installing
#
# if "type" is "link" then its iname will be symlinked
# to whatever sname ends up as
#

#       sname           destdir         mask    type            iname
#--------------------------------------------------------------------
->      LICENSE         docdir          data    license
->      README          docdir          ""      readme
->      spite.tcl       bindir          data    tclscript       spite
->      spite.conf      exdir

#->     README          docdir          ""      link            LISEZMOI

#       sname                           destdir         mask    type    iname
#----------------------------------------------------------------------------
->      examples/bwidget-spite.conf     exdir
addfile examples/tkcon-spite.conf       exdir


# EOF

Example usage
$ gzcat spite-0.2.spite.gz | sh -s -- --help
SPITE 0.3 Installer for  * SPITE - Simple Packager and Installer for Tcl Extensions *
Usage: sh --install [option value ...]
Install options:
--install            Perform installation
--appdir      dir    Usually the name of the app [spite]
--prefix      dir    Install prefix [/usr/local]
--bindir      dir    Executable files dir [$prefix/bin]
--libdir      dir    Library files dir [$prefix/lib]
--tclmoddir   dir    Tcl modules dir [$prefix/lib/tcl8/8.5]
--scriptdir   dir    Script files dir [$prefix/lib/spite]
--mandir      dir    Man files dir  [$prefix/man]
--docdir      dir    Documentation files dir [$prefix/share/doc/$appdir]
--exdir       dir    Example files dir [$prefix/share/examples/$appdir]
--confdir     dir    Configuration files dir [$prefix/lib/spite]
--tmp         dir    Dir used during installation for temporary files [/tmp]
--user        user   Install files as user:group  User and group must
--group       group  both be specified if "chown" is to be performed
--datamask    mask   Mask for data files [0444]
--scriptmask  mask   Mask for executable files [0555]
--tclsh       file   Path to tclsh []
--wish        file   Path to wish []
--sed         file   Sed program [sed]
--sum         file   Checksum program ("" will disable checksumming) [md5]
--destdir     dir    Super-prefix installation dir, does not affect --tmp []
--tclmodule          Install as a Tcl module
--quiet              Do not display installation messages
--fake               Show messages, do not perform actions
--info               Display program info
--readme             Display readme
--license            Display license
--help               This information

$ gunzip < spite-0.3.spite.gz | sh -s -- --info
COMMENT  : SPITE - Simple Packager and Installer for Tcl Extensions
AUTHOR   : Stuart Cassoff
VERSION  : 0.3
LICENSE  : ISC
HOMEPAGE : http://www3.bell.net/stwo/software/
DISTFILE : http://www3.bell.net/stwo/software/spite-0.3.spite.gz

$ mkdir /tmp/test
$ gunzip < spite-0.3.spite.gz | sh -s -- --destdir /tmp/test --install
Installing LICENSE as /tmp/test/usr/local/share/doc/spite/LICENSE : sum ok
Installing README as /tmp/test/usr/local/share/doc/spite/README : sum ok
Installing spite as /tmp/test/usr/local/bin/spite : sum ok
Installing spite.conf as /tmp/test/usr/local/share/examples/spite/spite.conf : sum ok
Installing bwidget-spite.conf as /tmp/test/usr/local/share/examples/spite/bwidget-spite.conf : sum ok
Installing tkcon-spite.conf as /tmp/test/usr/local/share/examples/spite/tkcon-spite.conf : sum ok

It's also possible to install over the 'net using http or [wget]
$ echo 'package require http; set r [http::geturl http://www.mysite.net/mydir/spite-0.3.spite.gz -binary 1]; fconfigure stdout -translation binary; puts -nonewline stdout [http::data $r]' | tclsh | gunzip | sh -s -- --install

$ wget -q -O - http://www.mysite.net/mydir/spite-0.3.spite.gz | gunzip | sh -s -- --install