diff options
author | Erich Eckner <git@eckner.net> | 2015-07-22 10:23:37 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2015-07-22 10:23:37 +0200 |
commit | 45f858310064390226db71676706b0004667bee9 (patch) | |
tree | d91667d138a625718371dffdbf0e994fa6e7bdb3 /Make.lpr | |
parent | 27e82200895cdfd716f6a6e692af3209b22cceec (diff) | |
download | Make-45f858310064390226db71676706b0004667bee9.tar.xz |
Bug aus Lokalitaetspruefung entfernt
Diffstat (limited to 'Make.lpr')
-rw-r--r-- | Make.lpr | 76 |
1 files changed, 51 insertions, 25 deletions
@@ -108,24 +108,31 @@ begin until s<>''; end; -procedure sammleDateien(wo: string; rekursiv: boolean; var dats: TDateienMitDaten); -var sr: TSearchRec; - err: integer; +procedure sammleDateien(wo: string; rekursiv: boolean; ignoriere: array of tRegExpr; var dats: TDateienMitDaten); +var + sr: TSearchRec; + err,i: integer; + weglassen: boolean; begin err:=FindFirst(wo,faReadOnly or faHidden or faSysFile or (byte(rekursiv)*faDirectory),sr); while err=0 do begin - if sr.Attr and faDirectory <> 0 then begin - if rekursiv and - (sr.Name<>'.') and - (sr.Name<>'..') then - sammleDateien(extractfilepath(wo)+sr.Name+'/'+extractfilename(wo),rekursiv,dats); - end - else begin - setlength(dats,length(dats)+1); - getmem(dats[length(dats)-1],sizeof(TDateiMitDatum)); - fillchar(dats[length(dats)-1]^,sizeof(TDateiMitDatum),0); - dats[length(dats)-1]^.Name:=extractfilepath(wo)+sr.name; - dats[length(dats)-1]^.Datum:=FileDateTodateTime(FileAge(dats[length(dats)-1]^.Name)); + weglassen:=false; + for i:=0 to length(ignoriere)-1 do + weglassen:=weglassen or ignoriere[i].Exec(extractfilepath(wo)+sr.name); + if not weglassen then begin + if sr.Attr and faDirectory <> 0 then begin + if rekursiv and + (sr.Name<>'.') and + (sr.Name<>'..') then + sammleDateien(extractfilepath(wo)+sr.Name+'/'+extractfilename(wo),rekursiv,ignoriere,dats); + end + else begin + setlength(dats,length(dats)+1); + getmem(dats[length(dats)-1],sizeof(TDateiMitDatum)); + fillchar(dats[length(dats)-1]^,sizeof(TDateiMitDatum),0); + dats[length(dats)-1]^.Name:=extractfilepath(wo)+sr.name; + dats[length(dats)-1]^.Datum:=FileDateTodateTime(FileAge(dats[length(dats)-1]^.Name)); + end; end; err:=FindNext(sr); end; @@ -136,14 +143,16 @@ function liesMakeFile(datNam: string; out Abh: TAbhaengigkeiten; out dats: TDate var f: textfile; s,t: string; NA: TAbhaengigkeit; + ignoriere: array of tRegExpr; beg,fin,rek: boolean; - wo,num: integer; + wo,num,i: integer; begin result:=false; NA:=TAbhaengigkeit.create; setlength(dats,0); setlength(Abh,0); + setlength(ignoriere,0); wo:=0; num:=0; assignfile(f,datNam); @@ -151,17 +160,31 @@ begin while liesZeile(f,s) do begin if wo=0 then begin if notQuotedPos(':',s)=0 then begin - while (length(s)>0) and (s[1] in [' ',#9]) do delete(s,1,1); + s:=trim(s); if length(s)=0 then continue; - s:=s+' '; - rek:=pos('-r',s)=1; - if rek then delete(s,1,pos(' ',s)); - while pos(' ',s)>0 do begin - sammleDateien(copy(s,1,pos(' ',s)-1),rek,dats); - delete(s,1,pos(' ',s)); + if pos('!',s)=1 then begin + delete(s,1,1); + s:=trim(s); + setlength(ignoriere,length(ignoriere)+1); + ignoriere[length(ignoriere)-1]:=tRegExpr.create; + ignoriere[length(ignoriere)-1].Expression:=s; + end + else begin + s:=s+' '; + rek:=pos('-r',s)=1; + if rek then delete(s,1,pos(' ',s)); + while pos(' ',s)>0 do begin + sammleDateien(copy(s,1,pos(' ',s)-1),rek,ignoriere,dats); + delete(s,1,pos(' ',s)); + end; end; end - else wo:=1; + else begin + for i:=0 to length(ignoriere)-1 do + ignoriere[i].free; + setlength(ignoriere,0); + wo:=1; + end; end; if wo=1 then begin fin:=s[length(s)]=';'; @@ -219,6 +242,9 @@ begin end; closefile(f); NA.free; + for i:=0 to length(ignoriere)-1 do + ignoriere[i].free; + setlength(ignoriere,0); result:=true; end; @@ -662,7 +688,7 @@ begin if geaenderteDateien.count>0 then Befehle.Add('echo -ne "Sha512summen erneuern ..."'); for i:=0 to geaenderteDateien.count-1 do - Befehle.Add('/usr/bin/sha512sum '+geaenderteDateien[i]+' >> '+Summendatei); + Befehle.Add('/usr/bin/sha512sum "'+geaenderteDateien[i]+'" >> '+Summendatei); if geaenderteDateien.count>0 then Befehle.Add('echo " fertig"'); if not nurAnzeigen then begin |