3 function subst_defines(var,defs) {
4 while ((var ~ /%{.*}/) || (var ~ /%[A-Za-z0-9_]+/)) {
7 gsub("%{" j "}", defs[j], var)
8 gsub("%" j , defs[j], var)
11 if ( DEBUG ) for (i in defs) print i " == " defs[i]
18 function process_source(lurl,version) {
21 gsub("[^/]*$",":&",lurl)
26 if ( DEBUG ) print acc "://" host dir
29 while ( "lynx --dump " acc "://" host dir | getline result ) {
30 if ( result ~ "References" ) references=1
31 if ( result ~ "[0-9]+\. (ftp|http)://" ) {
40 function process_data(name,ver,rel,defs,src) {
42 if ( src[i] !~ /%{.*}/ && src[i] !~ /%[A-Za-z0-9_]/ ) {
43 if ( DEBUG ) print "Zrodlo: " src[i]
44 # process_source(src[i],defs["version"])
46 print FNAME ":" i ": niemozliwe podstawienie: " src[i]
52 # if U want to use DEBUG, run script with "-v DEBUG=1"
53 # or uncomment the line below
59 process_data(NAME,VER,REL,DEFS,SRC)
60 NAME="" ; VER="" ; REL=""
61 for (i in DEFS) delete DEFS[i]
62 for (i in SRC) delete SRC[i]
67 /^[Nn]ame:/&&(NAME=="") { NAME=subst_defines($2,DEFS) ; DEFS["name"]=NAME }
68 /^[Vv]ersion:/&&(VER=="") { VER=subst_defines($2,DEFS) ; DEFS["version"]=VER }
69 /^[Rr]elease:/&&(REL=="") { REL=subst_defines($2,DEFS) ; DEFS["release"]=REL }
70 /^[Ss]ource[0-9]*:/ { if (/(ftp|http):\/\//) SRC[FNR]=subst_defines($2,DEFS) }
71 /%define/ { DEFS[$2]=subst_defines($3,DEFS) }
74 process_data(NAME,VER,REL,DEFS,SRC)