diff --git a/Makesurefile b/Makesurefile index 6c1490e..92c6d16 100644 --- a/Makesurefile +++ b/Makesurefile @@ -1,7 +1,7 @@ # vim: syntax=bash @options timing -@define NEXT_VERSION '0.9.22' +@define NEXT_VERSION '0.9.23' @define GOAWK_VERSION '1.25.0' @define JUST_VERSION '1.3.0' @define FHTAGN_VERSION 'v0.1.1' diff --git a/README.md b/README.md index 0e300e3..9ec442b 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ By default, all scripts inside goals are executed with `bash`. If you want to us ``` $ ./makesure -h -makesure ver. 0.9.22 +makesure ver. 0.9.23 Usage: makesure [options...] [-f buildfile] [goals...] -f,--file buildfile set buildfile to use (default Makesurefile) diff --git a/makesure b/makesure index 66648c5..e2bb572 100755 --- a/makesure +++ b/makesure @@ -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.22" -v "Prog=$0" "$makesure_pre"' +exec $makesure_awk -v "Version=0.9.23" -v "Prog=$0" "$makesure_pre"' BEGIN { Shell="bash" SupportedShells["bash"] @@ -103,7 +103,7 @@ function handleDefine(){ if(NF!=3){ addError("Invalid @define syntax, should be @define VAR_NAME '\''value'\''") return} - if($2 !~ /^[A-Za-z_][A-Za-z0-9_]*$/){ + if($2!~/^[A-Za-z_][A-Za-z0-9_]*$/){ addError("Wrong variable name: '\''"$2"'\''") return} if(!($2 in DefineOverrides)) @@ -143,7 +143,7 @@ function handleGoal(i,goalName){ GoalParams[goalName,GoalParamsCnt[goalName]++]=validateParamName($i) }else if(NF>2)addError("nothing allowed after goal name")} function validateParamName(p){ - if(p !~ /^[A-Z_][A-Z0-9_]*$/)addError("@param name should match /^[A-Z_][A-Z0-9_]*$/: '\''"p"'\''") + if(p!~/^[A-Z_][A-Z0-9_]*$/)addError("@param name should match /^[A-Z_][A-Z0-9_]*$/: '\''"p"'\''") return p} function registerGoal(priv,goalName){ if(""==goalName||"@params"==goalName) @@ -180,7 +180,7 @@ function handleGoalGlob(goalName,globAllGoal,globSingle,priv,i,pattern,nfMax,gi, }else pattern=$(nfMax=4) if(NF>nfMax&&"@params"!=$(nfMax+1)) - addError("nothing or @params allowed after glob pattern") + addError("nothing or @params allowed after glob pattern") else if(pattern=="") addError("absent glob pattern") else { @@ -389,7 +389,7 @@ function shellExec(script,comment,res){ function getMyDir(makesurefilePath){ return executeGetLine("cd \"$(dirname "quoteArg(makesurefilePath)")\";pwd")} function handleCodeLine(line){ - if(!isCodeAllowed()&&line !~ /^[ \t]*#/&&trim(line)!=""){ + if(!isCodeAllowed()&&line!~/^[ \t]*#/&&trim(line)!=""){ if(!ShellInPreludeErrorShown++) addError("Shell code is not allowed outside goals/libs") }else @@ -454,7 +454,7 @@ function instantiate(goal,args,newArgs,i,j,depArg,depArgType,dep,goalNameInstant copyKey(goal,goalNameInstantiated,ReachedIf) copyKey(goal,goalNameInstantiated,GoalToLib) for(i in args) - argsCode=addL(argsCode,i"="quoteArg(args[i])) + argsCode=addL(argsCode,i"="quoteArg(args[i])";export "i) CodePre[goalNameInstantiated]=addL(CodePre[goalNameInstantiated],argsCode) if(goalNameInstantiated in ReachedIf) ReachedIf[goalNameInstantiated]=argsCode"\n"ReachedIf[goalNameInstantiated]} @@ -601,7 +601,7 @@ function parseCli_2(line,vars,vars2,res,pos,c,c1,isDoll,q,var,inDef,defVal,val,w return"unterminated argument" if(!inDef&&":"==c&&"-"==substr(line,pos+1,1)){ inDef=1 - c=substr(line,pos += 2,1)} + c=substr(line,pos+=2,1)} if(inDef){ if("}"==c) break @@ -613,7 +613,7 @@ function parseCli_2(line,vars,vars2,res,pos,c,c1,isDoll,q,var,inDef,defVal,val,w }else for(;(c=substr(line,pos+1,1))~/[_A-Za-z0-9]/;pos++) var=var c - if(var !~ /^[_A-Za-z][_A-Za-z0-9]*$/) + if(var!~/^[_A-Za-z][_A-Za-z0-9]*$/) return"wrong var: '\''"var"'\''" w=(w)((val=var in vars?vars[var]:var in vars2?vars2[var]:ENVIRON[var])!=""?val:defVal) continue} @@ -626,7 +626,7 @@ function parseCli_2(line,vars,vars2,res,pos,c,c1,isDoll,q,var,inDef,defVal,val,w w=c while((c=substr(line,++pos,1))!=""&&c!=" "&&c!="\t"){ w=w c} - if(w !~ /^[_A-Za-z0-9@.]+$/) + if(w!~/^[-_A-Za-z0-9@.]+$/) return"wrong unquoted: '\''"w"'\''" res[i=+res[-7]++,"quote"]="u" res[i]=w}}}} @@ -639,7 +639,9 @@ function reparseCli(res,i,err){ for(i=NF=0;i in res;i++) $(++NF)=res[i] for(i=2;i<=NF;i++) - if("\""==res[i-1,"quote"]&&!("@define"==$1&&3==i||"@depends_on"==$1&&"@args"==$3&&i>3)){ + if("\""==res[i-1,"quote"]&&!("@define"==$1&&3==i|| +"@depends_on"==$1&&"@args"==$3&&i>3|| +"@goal"==$1&&"@glob"==$(i-1))){ addError("Wrong quoting: "$i) return 0} return 1} diff --git a/makesure_candidate b/makesure_candidate index 5813d2f..e2bb572 100755 --- a/makesure_candidate +++ b/makesure_candidate @@ -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.22" -v "Prog=$0" "$makesure_pre"' +exec $makesure_awk -v "Version=0.9.23" -v "Prog=$0" "$makesure_pre"' BEGIN { Shell="bash" SupportedShells["bash"] @@ -626,7 +626,7 @@ function parseCli_2(line,vars,vars2,res,pos,c,c1,isDoll,q,var,inDef,defVal,val,w w=c while((c=substr(line,++pos,1))!=""&&c!=" "&&c!="\t"){ w=w c} - if(w!~/^[_A-Za-z0-9@.]+$/) + if(w!~/^[-_A-Za-z0-9@.]+$/) return"wrong unquoted: '\''"w"'\''" res[i=+res[-7]++,"quote"]="u" res[i]=w}}}}