1
0
mirror of synced 2026-01-12 00:42:56 +00:00

Some polish on the new loadup scripts - dribble files and lock overrides (#2157)

Three changes to loadup scripts:

1) dribble files are now copied from the workdir into loadups if loadup completes successfully, 

2) if the lock preventing simultaneous runs is already set when loadup starts, it now asks the user if they want to override the lock or to exit (previously it just exited), 

3) there is now a --override flag that will automatically override the lock without asking the user.  

Man page updated accordingly.
This commit is contained in:
Frank Halasz 2025-05-19 09:48:39 -07:00 committed by GitHub
parent 2499b3546e
commit 330c5a01a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 84 additions and 21 deletions

View File

@ -103,14 +103,16 @@ The target files are copied from this work directory to the loadups
directory if the loadup is successful.
Each stage of the loadup also creates a dribble file containing the
terminal output from within the Medley environment.
These dribble files are not copied to the loadups directory, but remain
available in the work directory after the loadup completes.
These dribble files are also copied to the loadups directory, but also
remain available in the work directory after the loadup completes.
.PP
Only one instance (per <MEDLEIDIR>) of loadup can be run at a time.
(The lock file is in the work directory and is named
\f[B]\f[BI]lock\f[B]\f[R].
It can be removed in case of an uncontrolled failure of the loadup
procedure.)
There is lock file to prevent simultaneous loadups in the work directory
(named \f[B]\f[BI]lock\f[B]\f[R]) that can be manually removed.
The lock can also be automatically overridden (see the \[en]override
flag below).
Alternatively, if a lock is encountered at run time, the user will be
asked to choose whether to override or simply exit the loadup.
.PP
Note: \f[B]MEDLEYDIR\f[R] is an environment variable set by the loadup
script.
@ -253,6 +255,12 @@ Synonym for \[lq]\[en]target apps\[rq]
\f[B]-a-, --apps-, -apps-, -5-\f[R]
Synonym for \[lq]\[en]target apps\[rq]
.TP
\f[B]-ov, --override, -override\f[R]
Automatically override the lock that prevents two loadups from running
simultaneously.
If this flag is not set and an active lock is encountered, the user will
be asked to choose whether to override or exit.
.TP
\f[B]-nc, --nocopy, -nocopy\f[R]
Run the specified loadups, but do not copy results into loadups
directory.

View File

@ -48,10 +48,10 @@ The two independent stages that can be run if the first 4 sequential stages comp
>+ **DB:**: creates the *fuller.database* file. Fuller.database is a Mastercope database created by analyzing all of the source code included in full.sysout. (Stage 4) Fuller.database is copied into the loadups directory.
Loadup does all of its work in a work directory (\<MEDLEYDIR>loadups/build). The target files are copied from this work directory to the loadups directory if the loadup is successful. Each stage of the loadup also creates a dribble file containing the terminal output from within the Medley environment. These dribble files are not copied to the loadups directory, but remain available in the work directory after the loadup completes.
Loadup does all of its work in a work directory (\<MEDLEYDIR>loadups/build). The target files are copied from this work directory to the loadups directory if the loadup is successful. Each stage of the loadup also creates a dribble file containing the terminal output from within the Medley environment. These dribble files are also copied to the loadups directory, but also remain available in the work directory after the loadup completes.
Only one instance (per \<MEDLEIDIR>) of loadup can be run at a time. (The lock file is in the work directory and is named ***lock***. It can be removed in case of an uncontrolled failure of the loadup procedure.)
Only one instance (per \<MEDLEIDIR>) of loadup can be run at a time. There is lock file to prevent simultaneous loadups in the work directory (named ***lock***) that can be manually removed. The lock can also be automatically overridden (see the --override flag below). Alternatively, if a lock is encountered at run time, the user will be asked to choose whether to override or simply exit the loadup.
Note: **MEDLEYDIR** is an environment variable set by the loadup script. It is set to the top level directory of the Medley installation that contains the specific loadup script that
is invoked after all symbolic links are resolved. In the standard global installation this will
@ -120,6 +120,9 @@ OPTIONS
**-a-, \-\-apps-, -apps-, -5-**
: Synonym for "--target apps"
**-ov, \-\-override, -override**
: Automatically override the lock that prevents two loadups from running simultaneously. If this flag is not set and an active lock is encountered, the user will be asked to choose whether to override or exit.
**-nc, \-\-nocopy, -nocopy**
: Run the specified loadups, but do not copy results into loadups directory.

View File

@ -77,12 +77,15 @@ into the loadups directory.</p></li>
work directory to the loadups directory if the loadup is successful.
Each stage of the loadup also creates a dribble file containing the
terminal output from within the Medley environment. These dribble files
are not copied to the loadups directory, but remain available in the
work directory after the loadup completes.</p>
are also copied to the loadups directory, but also remain available in
the work directory after the loadup completes.</p>
<p>Only one instance (per &lt;MEDLEIDIR&gt;) of loadup can be run at a
time. (The lock file is in the work directory and is named
<strong><em>lock</em></strong>. It can be removed in case of an
uncontrolled failure of the loadup procedure.)</p>
time. There is lock file to prevent simultaneous loadups in the work
directory (named <strong><em>lock</em></strong>) that can be manually
removed. The lock can also be automatically overridden (see the
override flag below). Alternatively, if a lock is encountered at run
time, the user will be asked to choose whether to override or simply
exit the loadup.</p>
<p>Note: <strong>MEDLEYDIR</strong> is an environment variable set by
the loadup script. It is set to the top level directory of the Medley
installation that contains the specific loadup script that is invoked
@ -194,6 +197,13 @@ loadups.</p>
<dd>
<p>Synonym for “target apps”</p>
</dd>
<dt><strong>-ov, --override, -override</strong></dt>
<dd>
<p>Automatically override the lock that prevents two loadups from
running simultaneously. If this flag is not set and an active lock is
encountered, the user will be asked to choose whether to override or
exit.</p>
</dd>
<dt><strong>-nc, --nocopy, -nocopy</strong></dt>
<dd>
<p>Run the specified loadups, but do not copy results into loadups

View File

@ -17,6 +17,7 @@ main() {
nocopy=false
thinw=false
thinl=false
override_lock=false
while [ "$#" -ne 0 ];
do
case "$1" in
@ -144,6 +145,9 @@ main() {
export MAIKODIR="${maikodir}"
shift
;;
-ov | -override | --override)
override_lock=true
;;
--noendmsg)
noendmsg=true
;;
@ -251,7 +255,7 @@ main() {
# check and set the run_lock
check_run_lock
check_run_lock "${override_lock}"
# if requested, thin the loadups and workdirs by eliminating all versioned (*.~[0-9]*~) files
# from these directories
@ -348,18 +352,24 @@ main() {
then
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/lisp.sysout "${LOADUP_OUTDIR}" \
| sed -e "s#${MEDLEYDIR}/##g"
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/lisp.dribble "${LOADUP_OUTDIR}" \
| sed -e "s#${MEDLEYDIR}/##g"
fi
if [ $start -le 3 ] && [ $end -ge 4 ]
then
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/full.sysout "${LOADUP_OUTDIR}" \
| sed -e "s#${MEDLEYDIR}/##g"
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/full.dribble "${LOADUP_OUTDIR}" \
| sed -e "s#${MEDLEYDIR}/##g"
fi
if [ $start -le 4 ] && [ $end -ge 5 ]
then
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/apps.sysout "${LOADUP_OUTDIR}" \
| sed -e "s#${MEDLEYDIR}/##g"
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/apps.dribble "${LOADUP_OUTDIR}" \
| sed -e "s#${MEDLEYDIR}/##g"
fi
if [ "${aux}" = true ]
@ -368,12 +378,18 @@ main() {
| sed -e "s#${MEDLEYDIR}/##g"
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/exports.all "${LOADUP_OUTDIR}" \
| sed -e "s#${MEDLEYDIR}/##g"
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/whereis.dribble "${LOADUP_OUTDIR}" \
| sed -e "s#${MEDLEYDIR}/##g"
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/exports.dribble "${LOADUP_OUTDIR}" \
| sed -e "s#${MEDLEYDIR}/##g"
fi
if [ "${db}" = true ]
then
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/fuller.database "${LOADUP_OUTDIR}" \
| sed -e "s#${MEDLEYDIR}/##g"
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/fuller.dribble "${LOADUP_OUTDIR}" \
| sed -e "s#${MEDLEYDIR}/##g"
fi
fi

View File

@ -249,13 +249,39 @@ process_maikodir() {
export LOADUP_LOCKFILE="${LOADUP_WORKDIR}"/lock
check_run_lock() {
if [ -e "${LOADUP_LOCKFILE}" ]
then
output_error_msg "Error: Another loadup is already running with PID $(cat "${LOADUP_LOCKFILE}")${EOL}Exiting."
exit 1
fi
echo "$$" > "${LOADUP_LOCKFILE}"
LOADUP_LOCK="$$"
set +x
if [ -e "${LOADUP_LOCKFILE}" ]
then
output_warn_msg "Warning: Another loadup is already running with PID $(cat "${LOADUP_LOCKFILE}")"
if [ "${override_lock}" = true ]
then
output_warn_msg "Overriding lock preventing simultaneous loadups due to command line argument --override${EOL}Continuing."
else
loop_done=false
while [ "${loop_done}" = "false" ]
do
output_warn_msg "Do you want to override the lock guarding against simultaneous loadups?"
output_warn_msg "Answer [y, Y, n or N, default n] followed by RETURN"
read resp
if [ -z "${resp}" ]; then resp=n; fi
case "${resp}" in
n* | N* )
output_error_msg "Ok. Exiting"
exit 5
;;
y* | Y* )
output_warn_msg "Ok. Overriding lock and continuing"
loop_done=true
;;
* )
output_warn_msg "Answer not one of Y, y, N, or n. Retry."
;;
esac
done
fi
fi
echo "$$" > "${LOADUP_LOCKFILE}"
LOADUP_LOCK="$$"
}
remove_run_lock() {