Skip to content

Commit cccfd90

Browse files
authored
Merge pull request #168 from xonixx/0.9.23
0.9.23
2 parents ca2bf5f + 6bf6b56 commit cccfd90

File tree

5 files changed

+21
-14
lines changed

5 files changed

+21
-14
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## v0.9.23
2+
3+
- Allow glob to be interpolated string to facilitate reuse [#165](https://github.com/xonixx/makesure/issues/165)
4+
- Minor improvements and fixes.
5+
16
## v0.9.22
27
- Main theme of this release is allowing glob goals to be parameterized [#155](https://github.com/xonixx/makesure/issues/155)
38
- Support interpolation including parameterized goal params [#153](https://github.com/xonixx/makesure/issues/153)

Makesurefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# vim: syntax=bash
22
@options timing
33

4-
@define NEXT_VERSION '0.9.22'
4+
@define NEXT_VERSION '0.9.23'
55
@define GOAWK_VERSION '1.25.0'
66
@define JUST_VERSION '1.3.0'
77
@define FHTAGN_VERSION 'v0.1.1'

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ By default, all scripts inside goals are executed with `bash`. If you want to us
5454

5555
```
5656
$ ./makesure -h
57-
makesure ver. 0.9.22
57+
makesure ver. 0.9.23
5858
Usage: makesure [options...] [-f buildfile] [goals...]
5959
-f,--file buildfile
6060
set buildfile to use (default Makesurefile)

makesure

+12-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22
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
3-
exec $makesure_awk -v "Version=0.9.22" -v "Prog=$0" "$makesure_pre"'
3+
exec $makesure_awk -v "Version=0.9.23" -v "Prog=$0" "$makesure_pre"'
44
BEGIN {
55
Shell="bash"
66
SupportedShells["bash"]
@@ -103,7 +103,7 @@ function handleDefine(){
103103
if(NF!=3){
104104
addError("Invalid @define syntax, should be @define VAR_NAME '\''value'\''")
105105
return}
106-
if($2 !~ /^[A-Za-z_][A-Za-z0-9_]*$/){
106+
if($2!~/^[A-Za-z_][A-Za-z0-9_]*$/){
107107
addError("Wrong variable name: '\''"$2"'\''")
108108
return}
109109
if(!($2 in DefineOverrides))
@@ -143,7 +143,7 @@ function handleGoal(i,goalName){
143143
GoalParams[goalName,GoalParamsCnt[goalName]++]=validateParamName($i)
144144
}else if(NF>2)addError("nothing allowed after goal name")}
145145
function validateParamName(p){
146-
if(p !~ /^[A-Z_][A-Z0-9_]*$/)addError("@param name should match /^[A-Z_][A-Z0-9_]*$/: '\''"p"'\''")
146+
if(p!~/^[A-Z_][A-Z0-9_]*$/)addError("@param name should match /^[A-Z_][A-Z0-9_]*$/: '\''"p"'\''")
147147
return p}
148148
function registerGoal(priv,goalName){
149149
if(""==goalName||"@params"==goalName)
@@ -180,7 +180,7 @@ function handleGoalGlob(goalName,globAllGoal,globSingle,priv,i,pattern,nfMax,gi,
180180
}else
181181
pattern=$(nfMax=4)
182182
if(NF>nfMax&&"@params"!=$(nfMax+1))
183-
addError("nothing or @params allowed after glob pattern")
183+
addError("nothing or @params allowed after glob pattern")
184184
else if(pattern=="")
185185
addError("absent glob pattern")
186186
else {
@@ -389,7 +389,7 @@ function shellExec(script,comment,res){
389389
function getMyDir(makesurefilePath){
390390
return executeGetLine("cd \"$(dirname "quoteArg(makesurefilePath)")\";pwd")}
391391
function handleCodeLine(line){
392-
if(!isCodeAllowed()&&line !~ /^[ \t]*#/&&trim(line)!=""){
392+
if(!isCodeAllowed()&&line!~/^[ \t]*#/&&trim(line)!=""){
393393
if(!ShellInPreludeErrorShown++)
394394
addError("Shell code is not allowed outside goals/libs")
395395
}else
@@ -454,7 +454,7 @@ function instantiate(goal,args,newArgs,i,j,depArg,depArgType,dep,goalNameInstant
454454
copyKey(goal,goalNameInstantiated,ReachedIf)
455455
copyKey(goal,goalNameInstantiated,GoalToLib)
456456
for(i in args)
457-
argsCode=addL(argsCode,i"="quoteArg(args[i]))
457+
argsCode=addL(argsCode,i"="quoteArg(args[i])";export "i)
458458
CodePre[goalNameInstantiated]=addL(CodePre[goalNameInstantiated],argsCode)
459459
if(goalNameInstantiated in ReachedIf)
460460
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
601601
return"unterminated argument"
602602
if(!inDef&&":"==c&&"-"==substr(line,pos+1,1)){
603603
inDef=1
604-
c=substr(line,pos += 2,1)}
604+
c=substr(line,pos+=2,1)}
605605
if(inDef){
606606
if("}"==c)
607607
break
@@ -613,7 +613,7 @@ function parseCli_2(line,vars,vars2,res,pos,c,c1,isDoll,q,var,inDef,defVal,val,w
613613
}else
614614
for(;(c=substr(line,pos+1,1))~/[_A-Za-z0-9]/;pos++)
615615
var=var c
616-
if(var !~ /^[_A-Za-z][_A-Za-z0-9]*$/)
616+
if(var!~/^[_A-Za-z][_A-Za-z0-9]*$/)
617617
return"wrong var: '\''"var"'\''"
618618
w=(w)((val=var in vars?vars[var]:var in vars2?vars2[var]:ENVIRON[var])!=""?val:defVal)
619619
continue}
@@ -626,7 +626,7 @@ function parseCli_2(line,vars,vars2,res,pos,c,c1,isDoll,q,var,inDef,defVal,val,w
626626
w=c
627627
while((c=substr(line,++pos,1))!=""&&c!=" "&&c!="\t"){
628628
w=w c}
629-
if(w !~ /^[_A-Za-z0-9@.]+$/)
629+
if(w!~/^[-_A-Za-z0-9@.]+$/)
630630
return"wrong unquoted: '\''"w"'\''"
631631
res[i=+res[-7]++,"quote"]="u"
632632
res[i]=w}}}}
@@ -639,7 +639,9 @@ function reparseCli(res,i,err){
639639
for(i=NF=0;i in res;i++)
640640
$(++NF)=res[i]
641641
for(i=2;i<=NF;i++)
642-
if("\""==res[i-1,"quote"]&&!("@define"==$1&&3==i||"@depends_on"==$1&&"@args"==$3&&i>3)){
642+
if("\""==res[i-1,"quote"]&&!("@define"==$1&&3==i||
643+
"@depends_on"==$1&&"@args"==$3&&i>3||
644+
"@goal"==$1&&"@glob"==$(i-1))){
643645
addError("Wrong quoting: "$i)
644646
return 0}
645647
return 1}

makesure_candidate

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22
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
3-
exec $makesure_awk -v "Version=0.9.22" -v "Prog=$0" "$makesure_pre"'
3+
exec $makesure_awk -v "Version=0.9.23" -v "Prog=$0" "$makesure_pre"'
44
BEGIN {
55
Shell="bash"
66
SupportedShells["bash"]
@@ -626,7 +626,7 @@ function parseCli_2(line,vars,vars2,res,pos,c,c1,isDoll,q,var,inDef,defVal,val,w
626626
w=c
627627
while((c=substr(line,++pos,1))!=""&&c!=" "&&c!="\t"){
628628
w=w c}
629-
if(w!~/^[_A-Za-z0-9@.]+$/)
629+
if(w!~/^[-_A-Za-z0-9@.]+$/)
630630
return"wrong unquoted: '\''"w"'\''"
631631
res[i=+res[-7]++,"quote"]="u"
632632
res[i]=w}}}}

0 commit comments

Comments
 (0)