Skip to content

Commit

Permalink
upd. makesure
Browse files Browse the repository at this point in the history
  • Loading branch information
xonixx committed Dec 10, 2022
1 parent e3fb370 commit be58da5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
5 changes: 2 additions & 3 deletions Makesurefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@

# vim: syntax=bash
@options timing

@define TUSH_REPO='https://github.com/adolfopa/tush'
@define JSONTestSuite_REPO='https://github.com/nst/JSONTestSuite'
@define GOAWK_VERSION='1.13.0'
#@define GOAWK_VERSION='1.9.1'
@define GOAWK_VERSION='1.21.0'
@define GOAWK="goawk$GOAWK_VERSION"
@define AWK='awk'

Expand Down
16 changes: 9 additions & 7 deletions makesure
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
if command -v gawk >/dev/null;then makesure_awk='gawk -ltime -v Gawk=1';makesure_pre='';else makesure_awk=awk;makesure_pre='function gettimeofday(){}';fi
exec $makesure_awk -v "Version=0.9.18" -v "Prog=$0" "$makesure_pre"'
exec $makesure_awk -v "Version=0.9.19" -v "Prog=$0" "$makesure_pre"'
BEGIN {
Shell = "bash"
SupportedShells["bash"]
Expand All @@ -21,7 +21,7 @@ BEGIN {
function makesure() {
while (getline > 0) {
Lines[NR]=$0
if ($1 ~ /^@/ && "@define" != $1) reparseCli()
if ($1 ~ /^@/ && "@define" != $1 && "@reached_if" != $1) reparseCli()
if ("@options" == $1) handleOptions()
else if ("@define" == $1) handleDefine()
else if ("@shell" == $1) handleShell()
Expand Down Expand Up @@ -184,14 +184,14 @@ function calcGlob(goalName, pattern, script, file) {
GlobCnt = 0
GlobGoalName = goalName
split("",GlobFiles)
script = MyDirScript ";for f in " pattern ";do test -e \"$f\" && echo \"$f\";done"
script = MyDirScript ";for f in " pattern ";do test -e \"$f\"&&echo \"$f\"||:;done"
if ("sh" != Shell)
script = Shell " -c " quoteArg(script)
while ((script | getline file)>0) {
GlobCnt++
arrPush(GlobFiles,file)
}
close(script)
closeErr(script)
quicksort(GlobFiles,0,arrLen(GlobFiles)-1)
}
function parseGoalLine( priv) {
Expand Down Expand Up @@ -347,6 +347,7 @@ body,goalBody,goalBodies,resolvedGoals,exitCode, t0,t1,t2, goalTimed, list) {
emptyGoals[goalName] = length(body) == 0
goalBody[0] = ""
addLine(goalBody, preludeCode)
addLine(goalBody, CodePre[goalName])
if (goalName in GoalToLib)
addLine(goalBody, Lib[GoalToLib[goalName]])
addLine(goalBody, body)
Expand Down Expand Up @@ -449,8 +450,8 @@ function addCodeLine(line, goalName, name, i) {
Lib[name] = addL(Lib[name], line)
} else if ("goal_glob" == Mode) {
for (i=0; i < GlobCnt; i++){
if (!Code[goalName = globGoal(i)])
addCodeLineToGoal(goalName, makeGlobVarsCode(i))
if (!CodePre[goalName = globGoal(i)])
CodePre[goalName] = makeGlobVarsCode(i)
addCodeLineToGoal(goalName, line)
}
} else
Expand Down Expand Up @@ -545,9 +546,10 @@ function renderDuration(deltaMillis,\
}
function executeGetLine(script, res) {
script | getline res
close(script)
closeErr(script)
return res
}
function closeErr(script) { if (close(script)!=0) die("Error executing: " script) }
function dl(url, dest, verbose) {
verbose = "VERBOSE" in ENVIRON
if (commandExists("wget")) {
Expand Down

0 comments on commit be58da5

Please sign in to comment.