[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: TeX packages - side topic make and sleep



.TH SHMAKE 1 "06 Jul 2011" "\fBshmake\fR 1.0" "User Commands"
.SH NAME
shmake \- easily template for dependancy situations, runs commands accordingly
.SH SYNOPSIS
\fBshmake\fR  [options] File [label]
.SH DESCRIPTION
Runs each left command in File when all files on it's right are ready (touched).
.LP
This program provides any commands with a quick and simplest to use automatic dependancy resolver. It has a as few features deemed needed and is end-point alterable for spot needs / plain text.
.LP
For ordering and pausing commands which beget dependant needs. For programs who's flow needs to be plain to see, easily modifiable, and automatically resolved.
.LP
File   File is simple lr format.  See examples of the simple LR File below.
.LP
.TP
\fB-h\fR
-\fB-help\fR
.TP
\fB-n\fR
show what commands would launch next but don't launch
.TP
\fB-q\fR
quiet
.TP
\fB-s\fR
stop if any dep is unmet
.TP
\fB-w\fR
seconds to wait between scans label show if label is ready. if it's an aside and is, launch it (for item readiness check or asides)
.LP
Default is to scan File until goal completion (it pauses between scans). If there is no set goal it continually checks up on / runs commands if needs be.
.LP
File is a 2 column list of steps toward a goal (see examples further below).
.IP
left    a command label which is invoked when right is met
.IP
right   a list dependent commands / labels to wait for
.IP
goal    if on left, right determines success and quit
.LP
Detours.  One of these 'fakes' can be pre-pended to any label:
.IP
%       inv,     makes prepended item 'invisible'
.IP
-       false,   always missing and never runs
.IP
^       nodate,  no updating / ignore date
.IP
@       aside,   launches only as aside (left only, see below)
.IP
#       comment on rest of line
.SH MANUAL
The LR list is read in order, launching each left who's right is ready.
If there is no complete "goal" it scanning starts again from top.
.LP
Goals.  A left label "goal" is special.  When it's conditions are met
\fBshmake\fR quits with success.  "goal" can appear multiple times
and have differing depends.
.LP
\fBshmake\fR(1) prints progress while running that is verbosely self explanitory.
.LP
Command. If label.sh exists it will be invoked as command. If not, 'File.sh' is invoked with parameter "label". That's File from '\fBshmake\fR File'.
.LP
Dependancies. After any command 'label' runs it will (should) 'touch label' to
indicate success. These label files are used to determine what is finished. That is how "right becomes met" / ready.
.LP
Auto Updating.  If any dependant of a command is \fBnewer\fR(1) than command
command then command is invoked [to update].  This solves another
difficult dependancy problem of which needs / don't need reworking.
.LP
Stopping.  If scanning needs to stop \fBtouch\fR(1) file "stop" and it will stop
normally when the current label finishes.  Ctrl-C if you must.
.LP
Format.  Any labels at the start of line are left and all labels until the next left are a right.
.LP
Other possible 'detour' modifies do not really add convenience because
they are better achieved with simpler L-R notation.  If I missed something
make has this needs let me know !
.LP
Re-Scan.  If File changed while \fBshmake\fR(1) is running \fBshmake\fR uses it.  This is
for allowing changes that shouldn't want quitting out.  Just keep in mind
if saving and editing while it's running please.
.LP
The aside.  seeing shdeps \fB--help\fR, 'shdeps file fun' will show if fun is
is ready and quit.  But if it's an aside, @fun, then shdeps first launches
it (asides never launch otherwise).  see example above.  @ used on the
right are ignored.
.LP
\fBmake\fR(1) uses first left as goal and can't change goals.
.SH EXAMPLES
COMMANDS    FILES / DEPENDENCIES
.LP
spool       pages.spurious
.LP
chap        spool summary.pg
.LP
doit        printready chap
.LP
---------------------
.LP
fun1   collect_sounds
.LP
fun2   collect_sights
.LP
fun3   fun2 find_map
.LP
fun4   fun3 fun1 request
.LP
goal   fun4 visited
.LP
.SH USES
As a precaution and convenince for developing anything with steps that may change or be partially replaced. For preventing static dummy checks from creeping into worker steps (ruinous if design alters). For programs wishing to utilize dependency solving without need of redesigning it.
.LP
\fBshmake\fR is useful when
.TP
\fB-o\fR
when there are many steps which may not be complete and redoing done steps is avoided (ex. printing chapters of a book with a distiller script)
.TP
\fB-o\fR
there is no order commands except to work with current status
.SH FILES
example.deplist.\fBshmake\fR
example.sh.\fBshmake\fR
.SH BUGS
please mail any bugs you find I'd like \fBshmake\fR to be simple for everyone
.SH LICENSE
pre-release; not yet licensed
.SH VERSION
Version 0.01
.SH AUTHOR
John D. Hendrickson, debguy@sourceforge.net
.SH SEE ALSO
\fBmake\fR(1)
Samuel Thibault wrote:
John D. Hendrickson and Sara Darnell, le Thu 07 Jul 2011 13:16:18 -0400, a écrit :
Jan Hauke Rahm wrote:
On Thu, Jul 07, 2011 at 01:26:29PM +0100, Jon Dowland wrote:
On Thu, Jul 07, 2011 at 11:53:17AM +0300, Andrew O. Shadoura wrote:
Is it possible to run mktexlsr and updmap-sys (and, possibly, other
TeX things) just once when installing or removing packages which need
to run them in postinst/postrm? I've been trying to remove some
not-really-needed latex-cjk-* packages to minimize my old
laptop's system installed size, and the removal process appeared to run
for ages...
I think these processes could be moved over to dpkg triggers, it just takes
someone to do the work.
I think, whatever can be covered by triggers, already is. tex-common has
trigger support for some time now.
I'm not a maintainer.  I don't see the validity of this response (which I responded to).

It's completely valid. He believes it's already implemented fully (and I
believe too, actually).

RE: the request was reduce triggering and the answer suggested only how to
add triggering (while not saying how the tail end would be detected)

How to add *dpkg* triggering, which is management for triggers, to
factorize them.

Samuel



I call this a "sleeping make" because it is mostly make except it waits instead of immediately exiting.


########################
#!/bin/sh
# ---------------------------------
# test sh .v make .sh deps cntrl
# see README for problem params
# ---------------------------------
# read options from shell if any
if [ c"$1" = c"--help" ] ; then help=1 ; fi ; n=0 ; w=3
if [ ! $help ] ; then while getopts "hnqsw:" Option ; do
	case $Option in
	h     ) help=1 ;;
	n     ) n=1 ;;
	q     ) q=1 ; export q ;;
	s     ) s=1 ;;
	w     ) w="$OPTARG" ;;
	esac
done ; shift `expr $OPTIND - 1` ; fi
if [ $help ] ; then cat << EOF
USAGE: `basename $0` [options] File [label]
DESCR: easily template for dependancy situations, runs commands accordingly
 File     edit File installer.exmpl, the format is simple
   -h     --help
   -n     show what commands would launch next but don't launch
   -q     quiet
   -s     stop if any dep is unmet
   -w     seconds to wait between scans
label     show if label is ready.  if it's an aside and is, launch it
          (for item readiness check or asides)
NOTES:
    * default is to scan File until goal completion (pauses between scans)
    * "flow" easy to see all of / modifiable, removes wild code re-structuring
    * see also: make(1)
Version 0.01
EOF
exit 0 ; fi
if [ "$#" -lt 1 ] ; then echo "need template filename, see -h" ; exit 1 ; fi
# ---------------------------------
file="$1" ; shift 1
if [ "$1" ] ; then label="$1" ; fi
scr=':lbl;/^[[:space:]+]/{H;n;x;s/[[:cntrl:]+]/ /g;x;b lbl};x;/^./p'
print () { if [ ! $q ] ; then echo "$1" ; fi }
setcmd () { cmd="" ; if [ -x "${left}.sh" ] ; then cmd="${left}.sh" ; else cmd="${file}.sh $left" ; fi }
echo "" > ".$file.tmp" ; print "~ begin ~" ; unset goal
while [ 1 ] ; do IFS=$'\n'
for x in `cat $file | sed -e 's/#.*$//' | sed -ne $scr` ; do
	IFS=$' \t' ; unset left update ok ; rmiss=0 ; lmiss=0
	for y in $x ; do
		z="$y" ; z="${z#%}" ; z="${z#-}" ; z="${z#^}" ; z="${z#@}"
		if [ ! $left ] ; then left="$z" ; if [ $label ] ; then
			if [ "$left" != "$label" ] ; then continue 2 ; fi
			case "$y" in @*) ;; *) n=1 ;; esac ; fi ; continue ; fi
		case "$y" in %*) ;; -*) rmissing=1 ; break ;;
		^*)	if [ ! -f "$z" ] ; then rmiss=1 ; break ; fi ;;
		 *)	if [ ! -f "$z" ] ; then rmiss=1 ; break ; fi
			if ! newer "$left" "$z" ; then update=1 ; fi ;;
		esac ; done
	if [ $label ] && [ "$left" != "$label" ] ; then continue ; fi
	print " checking $left..."
	if [ ! -f "$left" ] || [ $update ] ; then lmiss=1 ; fi
	case "$rmiss $lmiss $n" in
	"0 0 0" | "0 0 1") ok=1 ; print "  $left : still complete" ;;
	"0 1 0") setcmd
		if [ $update ] ; then print "  ${left} : updating" ; fi
		case "$left" in %*) ;; -*) false ;;
			@*) if [ $label ] ; then $cmd ; exit ; fi ;;
			*) $cmd ;; esac
		if [ $? -eq 0 ] ; then
			print "  ${left} : success" ; ok=1
		else    print "  ${left} : stopped" ; fi ;;
	"0 1 1")
		if [ $n ] ; then print "  $left : would launch" ; fi ;;
	*)	print "  ${left} : waiting on $z"
		if [ $s ] ; then exit 1 ; fi ;;
	esac
	if [ -e stop ] || [ $label ] ; then exit ; fi
	if newer "$file" ".${file}.tmp" ; then break ; fi
	if [ "$left" == "goal" ] && [ $ok ] ; then break ; fi
done
	if [ $label ] ; then exit ; fi
	if [ "$left" == "goal" ] && [ $ok ] ; then break ; fi
	echo "" > ".$file.tmp" ; cnt="$(($cnt + 1))"
	print "$cnt scans : sleeping $w seconds..." ; sleep $w
done
print "goal : $x : success" ; print "~ finish ~"
rm .$file.tmp
exit 0


########################

.TH SHMAKE 1 "06 Jul 2011" "\fBshmake\fR 1.0" "User Commands"
.SH NAME
shmake \- easily template for dependancy situations, runs commands accordingly
.SH SYNOPSIS
\fBshmake\fR  [options] File [label]
.SH DESCRIPTION
Runs each left command in File when all files on it's right are ready (touched).
.LP
This program provides any commands with a quick and simplest to use automatic dependancy resolver. It has a as few features deemed needed and is end-point alterable for spot needs / plain text.
.LP
For ordering and pausing commands which beget dependant needs. For programs who's flow needs to be plain to see, easily modifiable, and automatically resolved.
.LP
File   File is simple lr format.  See examples of the simple LR File below.
.LP
.TP
\fB-h\fR
-\fB-help\fR
.TP
\fB-n\fR
show what commands would launch next but don't launch
.TP
\fB-q\fR
quiet
.TP
\fB-s\fR
stop if any dep is unmet
.TP
\fB-w\fR
seconds to wait between scans label show if label is ready. if it's an aside and is, launch it (for item readiness check or asides)
.LP
Default is to scan File until goal completion (it pauses between scans). If there is no set goal it continually checks up on / runs commands if needs be.
.LP
File is a 2 column list of steps toward a goal (see examples further below).
.IP
left    a command label which is invoked when right is met
.IP
right   a list dependent commands / labels to wait for
.IP
goal    if on left, right determines success and quit
.LP
Detours.  One of these 'fakes' can be pre-pended to any label:
.IP
%       inv,     makes prepended item 'invisible'
.IP
-       false,   always missing and never runs
.IP
^       nodate,  no updating / ignore date
.IP
@       aside,   launches only as aside (left only, see below)
.IP
#       comment on rest of line
.SH MANUAL
The LR list is read in order, launching each left who's right is ready.
If there is no complete "goal" it scanning starts again from top.
.LP
Goals.  A left label "goal" is special.  When it's conditions are met
\fBshmake\fR quits with success.  "goal" can appear multiple times
and have differing depends.
.LP
\fBshmake\fR(1) prints progress while running that is verbosely self explanitory.
.LP
Command. If label.sh exists it will be invoked as command. If not, 'File.sh' is invoked with parameter "label". That's File from '\fBshmake\fR File'.
.LP
Dependancies. After any command 'label' runs it will (should) 'touch label' to
indicate success. These label files are used to determine what is finished. That is how "right becomes met" / ready.
.LP
Auto Updating.  If any dependant of a command is \fBnewer\fR(1) than command
command then command is invoked [to update].  This solves another
difficult dependancy problem of which needs / don't need reworking.
.LP
Stopping.  If scanning needs to stop \fBtouch\fR(1) file "stop" and it will stop
normally when the current label finishes.  Ctrl-C if you must.
.LP
Format.  Any labels at the start of line are left and all labels until the next left are a right.
.LP
Other possible 'detour' modifies do not really add convenience because
they are better achieved with simpler L-R notation.  If I missed something
make has this needs let me know !
.LP
Re-Scan.  If File changed while \fBshmake\fR(1) is running \fBshmake\fR uses it.  This is
for allowing changes that shouldn't want quitting out.  Just keep in mind
if saving and editing while it's running please.
.LP
The aside.  seeing shdeps \fB--help\fR, 'shdeps file fun' will show if fun is
is ready and quit.  But if it's an aside, @fun, then shdeps first launches
it (asides never launch otherwise).  see example above.  @ used on the
right are ignored.
.LP
\fBmake\fR(1) uses first left as goal and can't change goals.
.SH EXAMPLES
COMMANDS    FILES / DEPENDENCIES
.LP
spool       pages.spurious
.LP
chap        spool summary.pg
.LP
doit        printready chap
.LP
---------------------
.LP
fun1   collect_sounds
.LP
fun2   collect_sights
.LP
fun3   fun2 find_map
.LP
fun4   fun3 fun1 request
.LP
goal   fun4 visited
.LP
.SH USES
As a precaution and convenince for developing anything with steps that may change or be partially replaced. For preventing static dummy checks from creeping into worker steps (ruinous if design alters). For programs wishing to utilize dependency solving without need of redesigning it.
.LP
\fBshmake\fR is useful when
.TP
\fB-o\fR
when there are many steps which may not be complete and redoing done steps is avoided (ex. printing chapters of a book with a distiller script)
.TP
\fB-o\fR
there is no order commands except to work with current status
.SH FILES
example.deplist.\fBshmake\fR
example.sh.\fBshmake\fR
.SH BUGS
please mail any bugs you find I'd like \fBshmake\fR to be simple for everyone
.SH LICENSE
pre-release; not yet licensed
.SH VERSION
Version 0.01
.SH AUTHOR
John D. Hendrickson, debguy@sourceforge.net
.SH SEE ALSO
\fBmake\fR(1)


Reply to: