]>
Commit | Line | Data |
---|---|---|
a66bc250 | 1 | #!/bin/awk -f |
2 | # $Revision$, $Date$ | |
ad1c417a | 3 | # |
d3a5feb3 | 4 | # Copyright (C) 2000-2009 PLD-Team <feedback@pld-linux.org> |
ad1c417a ER |
5 | # Authors: |
6 | # Sebastian Zagrodzki <zagrodzki@pld-linux.org> | |
7 | # Jacek Konieczny <jajcus@pld-linux.org> | |
8 | # Andrzej Krzysztofowicz <ankry@pld-linux.org> | |
9 | # Jakub Bogusz <qboosh@pld-linux.org> | |
10 | # Elan Ruusamäe <glen@pld-linux.org> | |
11 | # | |
12 | # See cvs log pldnotify.awk for list of contributors | |
13 | # | |
14 | # TODO: | |
15 | # - "SourceXDownload" support (use given URLs if present instead of cut-down SourceX URLs) | |
16 | # - "SourceXActiveFTP" support | |
daab043a | 17 | |
a66bc250 | 18 | function fixedsub(s1,s2,t, ind) { |
19 | # substitutes fixed strings (not regexps) | |
20 | if (ind = index(t,s1)) { | |
21 | t = substr(t, 1, ind-1) s2 substr(t, ind+length(s1)) | |
22 | } | |
23 | return t | |
24 | } | |
25 | ||
0904cdde JB |
26 | function ispre(s) { |
27 | if ((s~"pre")||(s~"PRE")||(s~"beta")||(s~"BETA")||(s~"alpha")||(s~"ALPHA")||(s~"rc")||(s~"RC")) { | |
28 | if (DEBUG) print "pre-version" | |
29 | return 1 | |
30 | } else { | |
31 | return 0 | |
32 | } | |
33 | } | |
daab043a | 34 | |
a66bc250 | 35 | function compare_ver(v1,v2) { |
36 | # compares version numbers | |
37 | while (match(v1,/[a-zA-Z][0-9]|[0-9][a-zA-Z]/)) | |
38 | v1=(substr(v1,1,RSTART) "." substr(v1,RSTART+RLENGTH-1)) | |
39 | while (match(v2,/[a-zA-Z][0-9]|[0-9][a-zA-Z]/)) | |
40 | v2=(substr(v2,1,RSTART) "." substr(v2,RSTART+RLENGTH-1)) | |
41 | sub("^0*","",v1) | |
42 | sub("^0*","",v2) | |
0014f176 JB |
43 | gsub("\.0*",".",v1) |
44 | gsub("\.0*",".",v2) | |
a66bc250 | 45 | if (DEBUG) print "v1 == " v1 |
46 | if (DEBUG) print "v2 == " v2 | |
47 | count=split(v1,v1a,"\.") | |
48 | count2=split(v2,v2a,"\.") | |
daab043a ER |
49 | |
50 | if (count<count2) mincount=count | |
a66bc250 | 51 | else mincount=count2 |
daab043a | 52 | |
a66bc250 | 53 | for (i=1; i<=mincount; i++) { |
54 | if (v1a[i]=="") v1a[i]=0 | |
55 | if (v2a[i]=="") v2a[i]=0 | |
56 | if (DEBUG) print "i == " i | |
57 | if (DEBUG) print "v1[i] == " v1a[i] | |
58 | if (DEBUG) print "v2[i] == " v2a[i] | |
59 | if ((v1a[i]~/[0-9]/)&&(v2a[i]~/[0-9]/)) { | |
60 | if (length(v2a[i])>length(v1a[i])) | |
61 | return 1 | |
62 | else if (v2a[i]>v1a[i]) | |
63 | return 1 | |
64 | else if (length(v1a[i])>length(v2a[i])) | |
65 | return 0 | |
66 | else if (v1a[i]>v2a[i]) | |
67 | return 0 | |
68 | } else if ((v1a[i]~/[A-Za-z]/)&&(v2a[i]~/[A-Za-z]/)) { | |
69 | if (v2a[i]>v1a[i]) | |
70 | return 1 | |
71 | else if (v1a[i]>v2a[i]) | |
72 | return 0 | |
0904cdde | 73 | } else if (ispre(v1a[i]) == 1) |
a66bc250 | 74 | return 1 |
75 | else | |
76 | return 0 | |
77 | } | |
78 | if ((count2==mincount)&&(count!=count2)) { | |
79 | for (i=count2+1; i<=count; i++) | |
0904cdde | 80 | if (ispre(v1a[i]) == 1) |
a66bc250 | 81 | return 1 |
82 | return 0 | |
83 | } else if (count!=count2) { | |
84 | for (i=count+1; i<=count2; i++) | |
0904cdde | 85 | if (ispre(v2a[i]) == 1) |
a66bc250 | 86 | return 0 |
87 | return 1 | |
88 | } | |
89 | return 0 | |
90 | } | |
91 | ||
0014f176 JB |
92 | function compare_ver_dec(v1,v2) { |
93 | # compares version numbers as decimal floats | |
94 | while (match(v1,/[0-9][a-zA-Z]/)) | |
95 | v1=(substr(v1,1,RSTART) "." substr(v1,RSTART+RLENGTH-1)) | |
96 | while (match(v2,/[0-9][a-zA-Z]/)) | |
97 | v2=(substr(v2,1,RSTART) "." substr(v2,RSTART+RLENGTH-1)) | |
98 | sub("^0*","",v1) | |
99 | sub("^0*","",v2) | |
100 | if (DEBUG) print "v1 == " v1 | |
101 | if (DEBUG) print "v2 == " v2 | |
102 | count=split(v1,v1a,"\.") | |
103 | count2=split(v2,v2a,"\.") | |
daab043a ER |
104 | |
105 | if (count<count2) mincount=count | |
0014f176 | 106 | else mincount=count2 |
daab043a | 107 | |
0014f176 JB |
108 | for (i=1; i<=mincount; i++) { |
109 | if (v1a[i]=="") v1a[i]=0 | |
110 | if (v2a[i]=="") v2a[i]=0 | |
111 | if (DEBUG) print "i == " i | |
112 | if (DEBUG) print "v1[i] == " v1a[i] | |
113 | if (DEBUG) print "v2[i] == " v2a[i] | |
114 | if ((v1a[i]~/[0-9]/)&&(v2a[i]~/[0-9]/)) { | |
115 | if (i==2) { | |
116 | if (0+("." v2a[i])>0+("." v1a[i])) | |
117 | return 1 | |
118 | else if (0+("." v1a[i])>0+("." v2a[i])) | |
119 | return 0 | |
120 | } else { | |
121 | if (length(v2a[i])>length(v1a[i])) | |
122 | return 1 | |
123 | else if (v2a[i]>v1a[i]) | |
124 | return 1 | |
125 | else if (length(v1a[i])>length(v2a[i])) | |
126 | return 0 | |
127 | else if (v1a[i]>v2a[i]) | |
128 | return 0 | |
129 | } | |
130 | } else if ((v1a[i]~/[A-Za-z]/)&&(v2a[i]~/[A-Za-z]/)) { | |
131 | if (v2a[i]>v1a[i]) | |
132 | return 1 | |
133 | else if (v1a[i]>v2a[i]) | |
134 | return 0 | |
0904cdde | 135 | } else if (ispre(v1a[i]) == 1) |
0014f176 JB |
136 | return 1 |
137 | else | |
138 | return 0 | |
139 | } | |
140 | if ((count2==mincount)&&(count!=count2)) { | |
141 | for (i=count2+1; i<=count; i++) | |
0904cdde | 142 | if (ispre(v1a[i]) == 1) |
0014f176 JB |
143 | return 1 |
144 | return 0 | |
145 | } else if (count!=count2) { | |
146 | for (i=count+1; i<=count2; i++) | |
0904cdde | 147 | if (ispre(v2a[i]) == 1) |
0014f176 JB |
148 | return 0 |
149 | return 1 | |
150 | } | |
151 | return 0 | |
152 | } | |
153 | ||
ad1c417a ER |
154 | function link_seen(link) { |
155 | for (seenlink in frameseen) { | |
156 | if (seenlink == link) { | |
157 | if (DEBUG) print "Link: [" link "] seen already, skipping..." | |
158 | return 1 | |
159 | } | |
160 | } | |
161 | frameseen[link]=1 | |
162 | return 0 | |
163 | } | |
164 | ||
165 | function mktemp( _cmd, _tmpfile) { | |
166 | _cmd = "mktemp /tmp/XXXXXX" | |
167 | _cmd | getline _tmpfile | |
168 | close(_cmd) | |
169 | return _tmpfile | |
170 | } | |
171 | ||
a66bc250 | 172 | # get all <A HREF=..> tags from specified URL |
ad1c417a ER |
173 | function get_links(url,filename, errno,link,oneline,retval,odp,wholeodp,lowerodp,tmpfile,cmd) { |
174 | ||
175 | wholeerr="" | |
176 | ||
177 | tmpfile = mktemp() | |
178 | tmpfileerr = mktemp() | |
daab043a ER |
179 | |
180 | if (url ~ /^http:\/\/(download|dl).(sf|sourceforge).net\//) { | |
181 | gsub("^http://(download|dl).(sf|sourceforge).net/", "", url) | |
87a659b0 | 182 | gsub("/.*", "", url) |
183 | url = "http://sourceforge.net/projects/" url "/files/" | |
daab043a ER |
184 | if (DEBUG) print "sf url, mungled url to: " url |
185 | } | |
186 | ||
ad1c417a ER |
187 | if (url ~ /^http:\/\/(.*)\.googlecode\.com\/files\//) { |
188 | gsub("^http://", "", url) | |
189 | gsub("\..*", "", url) | |
190 | url = "http://code.google.com/p/" url "/downloads/list" | |
191 | if (DEBUG) print "googlecode url, mungled url to: " url | |
192 | } | |
193 | ||
194 | if (url ~ /^http:\/\/pecl.php.net\/get\//) { | |
195 | gsub("-.*", "", filename) | |
196 | url = "http://pecl.php.net/package/" filename | |
197 | if (DEBUG) print "pecl.php.net url, mungled url to: " url | |
198 | } | |
199 | ||
200 | if (url ~ /^(http|ftp):\/\/mysql.*\/Downloads\/MySQL-5.1\//) { | |
201 | url = "http://dev.mysql.com/downloads/mysql/5.1.html#source" | |
202 | if (DEBUG) print "mysql 5.1 url, mungled url to: " url | |
203 | } | |
204 | ||
87a659b0 | 205 | if (url ~/^(http|https):\/\/launchpad\.net\/(.*)\//) { |
206 | gsub("^(http|https):\/\/launchpad\.net\/", "", url) | |
207 | gsub("\/.*/", "", url) | |
208 | url = "https://code.launchpad.net/" url "/+download" | |
209 | if (DEBUG) print "main launchpad url, mungled url to: " url | |
210 | } | |
211 | ||
212 | if (url ~/^(http|https):\/\/edge\.launchpad\.net\/(.*)\//) { | |
213 | gsub("^(http|https):\/\/edge\.launchpad\.net\/", "", url) | |
214 | gsub("\/.*/", "", url) | |
215 | url = "https://edge.launchpad.net/" url "/+download" | |
216 | if (DEBUG) print "edge launchpad url, mungled url to: " url | |
217 | } | |
218 | ||
ad1c417a | 219 | |
a66bc250 | 220 | if (DEBUG) print "Retrieving: " url |
87a659b0 | 221 | cmd = "wget --user-agent \"Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2) Gecko/20100129 PLD/3.0 (Th) Iceweasel/3.6\" -nv -O - \"" url "\" -t 2 -T 45 --passive-ftp --no-check-certificate > " tmpfile " 2> " tmpfileerr |
ad1c417a ER |
222 | if (DEBUG) print "Execute: " cmd |
223 | errno = system(cmd) | |
daab043a | 224 | |
a66bc250 | 225 | if (errno==0) { |
226 | while (getline oneline < tmpfile) | |
daab043a ER |
227 | wholeodp=(wholeodp " " oneline) |
228 | if ( DEBUG ) print "Response: " wholeodp | |
ad1c417a ER |
229 | } else { |
230 | wholeerr = "" | |
231 | while (getline oneline < tmpfileerr) | |
232 | wholeerr=(wholeerr " " oneline) | |
233 | if ( DEBUG ) print "Error Response: " wholeerr | |
a66bc250 | 234 | } |
daab043a | 235 | |
a66bc250 | 236 | system("rm -f " tmpfile) |
ad1c417a ER |
237 | system("rm -f " tmpfileerr) |
238 | ||
0014f176 JB |
239 | urldir=url; |
240 | sub(/[^\/]+$/,"",urldir) | |
daab043a | 241 | |
a66bc250 | 242 | if ( errno==0) { |
daab043a ER |
243 | while (match(wholeodp, /<([aA]|[fF][rR][aA][mM][eE])[ \t][^>]*>/) > 0) { |
244 | odp=substr(wholeodp,RSTART,RLENGTH); | |
245 | wholeodp=substr(wholeodp,RSTART+RLENGTH); | |
246 | ||
247 | lowerodp=tolower(odp); | |
248 | if (lowerodp ~ /<frame[ \t]/) { | |
249 | sub(/[sS][rR][cC]=[ \t]*/,"src=",odp); | |
250 | match(odp,/src="[^"]+"/) | |
251 | newurl=substr(odp,RSTART+5,RLENGTH-6) | |
252 | if (DEBUG) print "Frame: " newurl | |
0014f176 JB |
253 | if (newurl !~ /\//) { |
254 | newurl=(urldir newurl) | |
daab043a | 255 | if (DEBUG) print "Frame->: " newurl |
0014f176 | 256 | } |
ad1c417a ER |
257 | |
258 | if (link_seen(newurl)) { | |
259 | newurl="" | |
260 | continue | |
261 | } | |
262 | ||
a66bc250 | 263 | retval=(retval " " get_links(newurl)) |
daab043a ER |
264 | } else if (lowerodp ~ /href=[ \t]*"[^"]*"/) { |
265 | sub(/[hH][rR][eE][fF]=[ \t]*"/,"href=\"",odp) | |
266 | match(odp,/href="[^"]*"/) | |
267 | link=substr(odp,RSTART,RLENGTH) | |
268 | odp=substr(odp,1,RSTART) substr(odp,RSTART+RLENGTH) | |
269 | link=substr(link,7,length(link)-7) | |
ad1c417a ER |
270 | |
271 | if (link_seen(link)) { | |
272 | link="" | |
273 | continue | |
274 | } | |
275 | ||
daab043a ER |
276 | retval=(retval " " link) |
277 | if (DEBUG) print "href(\"\"): " link | |
278 | } else if (lowerodp ~ /href=[ \t]*'[^']*'/) { | |
279 | sub(/[hH][rR][eE][fF]=[ \t]*'/,"href='",odp) | |
280 | match(odp,/href='[^']*'/) | |
a66bc250 | 281 | link=substr(odp,RSTART,RLENGTH) |
daab043a | 282 | odp=substr(odp,1,RSTART) substr(odp,RSTART+RLENGTH) |
a66bc250 | 283 | link=substr(link,7,length(link)-7) |
ad1c417a ER |
284 | |
285 | if (link_seen(link)) { | |
286 | link="" | |
287 | continue | |
288 | } | |
289 | ||
a66bc250 | 290 | retval=(retval " " link) |
daab043a ER |
291 | if (DEBUG) print "href(''): " link |
292 | } else if (lowerodp ~ /href=[ \t]*[^ \t>]*/) { | |
293 | sub(/[hH][rR][eE][fF]=[ \t]*/,"href=",odp) | |
294 | match(odp,/href=[^ \t>]*/) | |
a66bc250 | 295 | link=substr(odp,RSTART,RLENGTH) |
daab043a | 296 | odp=substr(odp,1,RSTART) substr(odp,RSTART+RLENGTH) |
a66bc250 | 297 | link=substr(link,6,length(link)-5) |
ad1c417a ER |
298 | |
299 | if (link_seen(link)) { | |
300 | link="" | |
301 | continue | |
302 | } | |
303 | ||
a66bc250 | 304 | retval=(retval " " link) |
daab043a | 305 | if (DEBUG) print "href(): " link |
0014f176 | 306 | } else { |
daab043a ER |
307 | # <a ...> but not href - skip |
308 | if (DEBUG) print "skipping <a > without href: " odp | |
a66bc250 | 309 | } |
310 | } | |
311 | } else { | |
ad1c417a | 312 | retval=("WGET ERROR: " errno ": " wholeerr) |
a66bc250 | 313 | } |
daab043a ER |
314 | |
315 | ||
316 | if (DEBUG) print "Returning: " retval | |
a66bc250 | 317 | return retval |
318 | } | |
319 | ||
320 | function subst_defines(var,defs) { | |
321 | # substitute all possible RPM macros | |
322 | while ((var ~ /%{.*}/) || (var ~ /%[A-Za-z0-9_]+/)) { | |
323 | oldvar=var | |
324 | for (j in defs) { | |
325 | gsub("%{" j "}", defs[j], var) | |
326 | gsub("%" j , defs[j], var) | |
327 | } | |
328 | if (var==oldvar) { | |
329 | if ( DEBUG ) for (i in defs) print i " == " defs[i] | |
330 | return var | |
331 | } | |
332 | } | |
333 | return var | |
334 | } | |
335 | ||
336 | function find_mirror(url) { | |
337 | ||
338 | while (succ = (getline line < "mirrors")) { | |
339 | if (succ==-1) { return url } | |
340 | nf=split(line,fields,"|") | |
341 | if (nf>1){ | |
342 | origin=fields[1] | |
343 | mirror=fields[2] | |
344 | mname=fields[3] | |
345 | prefix=substr(url,1,length(origin)) | |
346 | if (prefix==origin){ | |
daab043a | 347 | if ( DEBUG ) print "Mirror fount at " mname |
a66bc250 | 348 | close("mirrors") |
daab043a | 349 | return mirror substr(url,length(origin)+1) |
a66bc250 | 350 | } |
351 | } | |
352 | } | |
353 | ||
354 | return url | |
355 | } | |
356 | ||
357 | function process_source(number,lurl,name,version) { | |
358 | # fetches file list, and compares version numbers | |
daab043a | 359 | if ( DEBUG ) print "Processing " lurl |
a66bc250 | 360 | |
361 | if ( index(lurl,version)==0 ) { | |
daab043a | 362 | if (DEBUG) print "There is no version number." |
a66bc250 | 363 | return 0 |
364 | } | |
365 | ||
366 | sub("://",":",lurl) | |
367 | sub("/",":/",lurl) | |
368 | gsub("[^/]*$",":&",lurl) | |
369 | split(lurl,url,":") | |
370 | acc=url[1] | |
371 | host=url[2] | |
372 | dir=url[3] | |
373 | filename=url[4] | |
374 | ||
375 | if (index(dir,version)) { | |
376 | dir=substr(dir,1,index(dir,version)-1) | |
377 | sub("[^/]*$","",dir) | |
378 | sub("(\.tar\.(bz|bz2|gz)|zip)$","",filename) | |
daab043a ER |
379 | if ( DEBUG ) print "Will check a directory: " dir |
380 | if ( DEBUG ) print "and a file: " filename | |
a66bc250 | 381 | } |
382 | ||
383 | filenameexp=filename | |
384 | gsub("\+","\\+",filenameexp) | |
0904cdde JB |
385 | sub(version,"[A-Za-z0-9.]+",filenameexp) |
386 | gsub("\.","\\.",filenameexp) | |
daab043a | 387 | if ( DEBUG ) print "Expression: " filenameexp |
a66bc250 | 388 | match(filename,version) |
389 | prever=substr(filename,1,RSTART-1) | |
390 | postver=substr(filename,RSTART+RLENGTH) | |
daab043a ER |
391 | if ( DEBUG ) print "Before number: " prever |
392 | if ( DEBUG ) print "and after: " postver | |
393 | newurl=find_mirror(acc "://" host dir) | |
a66bc250 | 394 | #print acc "://" host dir |
395 | #newurl=url[1]"://"url[2]url[3]url[4] | |
396 | #newurl=acc "://" host dir filename | |
daab043a ER |
397 | if ( DEBUG ) print "Looking at " newurl |
398 | ||
a66bc250 | 399 | references=0 |
400 | finished=0 | |
401 | oldversion=version | |
ad1c417a | 402 | odp=get_links(newurl,filename) |
a66bc250 | 403 | if( odp ~ "ERROR: ") { |
404 | print name "(" number ") " odp | |
405 | } else { | |
daab043a | 406 | if (DEBUG) print "WebPage downloaded" |
a66bc250 | 407 | c=split(odp,linki) |
408 | for (nr=1; nr<=c; nr++) { | |
409 | addr=linki[nr] | |
daab043a | 410 | if (DEBUG) print "Found link: " addr |
bfa53c5b | 411 | if ((addr ~ filenameexp) && !(addr ~ "[-_.0-9A-Za-z~]" filenameexp)) { |
a66bc250 | 412 | match(addr,filenameexp) |
413 | newfilename=substr(addr,RSTART,RLENGTH) | |
daab043a | 414 | if (DEBUG) print "Hypothetical new: " newfilename |
a66bc250 | 415 | newfilename=fixedsub(prever,"",newfilename) |
416 | newfilename=fixedsub(postver,"",newfilename) | |
daab043a | 417 | if (DEBUG) print "Version: " newfilename |
87a659b0 | 418 | if (newfilename ~ /\.(asc|sig|pkg|bin|binary|built)$/) continue |
0014f176 JB |
419 | if (NUMERIC) { |
420 | if ( compare_ver_dec(version, newfilename)==1 ) { | |
daab043a | 421 | if (DEBUG) print "Yes, there is new one" |
0014f176 JB |
422 | version=newfilename |
423 | finished=1 | |
424 | } | |
425 | } else if ( compare_ver(version, newfilename)==1 ) { | |
daab043a | 426 | if (DEBUG) print "Yes, there is new one" |
a66bc250 | 427 | version=newfilename |
428 | finished=1 | |
429 | } | |
430 | } | |
431 | } | |
432 | if (finished==0) | |
433 | print name "(" number ") seems ok: " oldversion | |
434 | else | |
435 | print name "(" number ") [OLD] " oldversion " [NEW] " version | |
436 | } | |
437 | } | |
daab043a ER |
438 | |
439 | # upgrade check for pear package using PEAR CLI | |
440 | function pear_upgrade(name, ver) { | |
441 | pname = name; | |
442 | sub(/^php-pear-/, "", pname); | |
443 | ||
444 | pearcmd = "pear remote-info " pname " | awk '/^Latest/{print $NF}'" | |
445 | if (DEBUG) { | |
446 | print "pearcmd: " pearcmd | |
447 | } | |
448 | pearcmd | getline nver | |
449 | close(pearcmd) | |
450 | ||
451 | if (compare_ver(ver, nver)) { | |
452 | print name " [OLD] " ver " [NEW] " nver | |
453 | } else { | |
454 | print name " seems ok: " ver | |
455 | } | |
456 | ||
457 | return | |
458 | } | |
459 | ||
a66bc250 | 460 | function process_data(name,ver,rel,src) { |
daab043a ER |
461 | if (name ~ /^php-pear-/) { |
462 | return pear_upgrade(name, ver); | |
463 | } | |
464 | ||
a66bc250 | 465 | # this function checks if substitutions were valid, and if true: |
466 | # processes each URL and tries to get current file list | |
467 | for (i in src) { | |
ad1c417a ER |
468 | if ( src[i] ~ /%{nil}/ ) { |
469 | gsub(/\%\{nil\}/, "", src[i]) | |
470 | } | |
a66bc250 | 471 | if ( src[i] !~ /%{.*}/ && src[i] !~ /%[A-Za-z0-9_]/ ) { |
daab043a | 472 | if ( DEBUG ) print "Source: " src[i] |
a66bc250 | 473 | process_source(i,src[i],name,ver) |
474 | } else { | |
daab043a | 475 | print FNAME ":" i ": impossible substitution: " src[i] |
a66bc250 | 476 | } |
477 | } | |
478 | } | |
479 | ||
480 | BEGIN { | |
481 | # if U want to use DEBUG, run script with "-v DEBUG=1" | |
482 | # or uncomment the line below | |
483 | # DEBUG = 1 | |
484 | ||
485 | errno=system("wget --help > /dev/null 2>&1") | |
486 | if (errno) { | |
487 | print "No wget installed!" | |
488 | exit 1 | |
489 | } | |
0014f176 JB |
490 | if (ARGC>=3 && ARGV[2]=="-n") { |
491 | NUMERIC=1 | |
daab043a | 492 | for (i=3; i<ARGC; i++) ARGV[i-1]=ARGV[i] |
0014f176 JB |
493 | ARGC=ARGC-1 |
494 | } | |
a66bc250 | 495 | } |
496 | ||
497 | FNR==1 { | |
498 | if ( ARGIND != 1 ) { | |
ad1c417a ER |
499 | # clean frameseen for each ARG |
500 | for (i in frameseen) { | |
501 | delete frameseen[i] | |
502 | } | |
503 | frameseen[0] = 1 | |
504 | ||
a66bc250 | 505 | process_data(NAME,VER,REL,SRC) |
506 | NAME="" ; VER="" ; REL="" | |
507 | for (i in DEFS) delete DEFS[i] | |
508 | for (i in SRC) delete SRC[i] | |
509 | } | |
510 | FNAME=FILENAME | |
ad1c417a ER |
511 | DEFS["_alt_kernel"]="" |
512 | DEFS["20"]="\\ " | |
a66bc250 | 513 | } |
514 | ||
515 | /^[Uu][Rr][Ll]:/&&(URL=="") { URL=subst_defines($2,DEFS) ; DEFS["url"]=URL } | |
516 | /^[Nn]ame:/&&(NAME=="") { NAME=subst_defines($2,DEFS) ; DEFS["name"]=NAME } | |
517 | /^[Vv]ersion:/&&(VER=="") { VER=subst_defines($2,DEFS) ; DEFS["version"]=VER } | |
518 | /^[Rr]elease:/&&(REL=="") { REL=subst_defines($2,DEFS) ; DEFS["release"]=REL } | |
ad1c417a | 519 | /^[Ss]ource[0-9]*:/ { if (/(ftp|http|https):\/\//) SRC[FNR]=subst_defines($2,DEFS) } |
a66bc250 | 520 | /%define/ { DEFS[$2]=subst_defines($3,DEFS) } |
521 | ||
522 | END { | |
523 | process_data(NAME,VER,REL,SRC) | |
524 | } |