]> git.pld-linux.org Git - packages/rpm-build-tools.git/blob - adapter.awk
- remove cvs leftover: $id in at line 1
[packages/rpm-build-tools.git] / adapter.awk
1 #!/usr/bin/gawk -f
2 #
3 # Adapter adapts .spec files for PLD Linux.
4 #
5 # Copyright (C) 1999-2012 PLD-Team <feedback@pld-linux.org>
6 # Authors:
7 #       Michał Kuratczyk <kura@pld.org.pl>
8 #       Sebastian Zagrodzki <s.zagrodzki@mimuw.edu.pl>
9 #       Tomasz Kłoczko <kloczek@rudy.mif.pg.gda.pl>
10 #       Artur Frysiak <wiget@pld-linux.org>
11 #       Michal Kochanowicz <mkochano@pld.org.pl>
12 #       Jakub Bogusz <qboosh@pld-linux.org>
13 #       Elan Ruusamäe <glen@pld-linux.org>
14 #
15 # See cvs log adapter{,.awk} for list of contributors
16 #
17 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
18
19 # TODO
20 # - really long sourceX make preamble sorting totally fcked up (try snake.spec r1.1)
21 # - parse ../PLD-doc/BuildRequires.txt and setup proper BR epoches?
22 # - add "-nc" option to skip CVS interaction
23 # - sort Summary(XX)
24 # - sort Requires, BuildRequires
25 # - check if %description (lang=C) contains 8bit
26 # - desc wrapping is totally fucked up on global.spec,1.25, dosemu.spec,1.115-
27 # - it should change: /%source([0-9]+)/i to %{SOURCE\1}
28 # - extra quote on LDFLAGS line: https://bugs.launchpad.net/pld-linux/+bug/385836
29 # - %{with_foo:%attr()...} gets converted to %attr() %{with_foo:...} [vlc.spec]
30 # - 'R: foo ' (with traliling space) gets coverted to "R: foo\nR: " [vlc.spec @ 1.199 ]
31
32 BEGIN {
33         RPM_SECTIONS = "package|build|changelog|clean|description|install|post|posttrans|postun|pre|prep|pretrans|preun|triggerin|triggerpostun|triggerun|verifyscript|check"
34         SECTIONS = "^%(" RPM_SECTIONS ")"
35
36         rev = "1.514"
37         VERSION = "0.36/" rev
38
39         PREAMBLE_TAGS = "(R|BR|Summary|Name|Version|Release|Epoch|License|Group|URL|BuildArch|BuildRoot|Obsoletes|Conflicts|Provides|ExclusiveArch|ExcludeArch|Pre[Rr]eq|(Build)?Requires|Suggests|Auto(Req|Prov))"
40
41         usedigest = 0   # Enable to switch to rpm 4.4.6+ md5 digests
42
43         preamble = 1    # Is it part of preamble? Default - yes
44         boc = 4                 # Beginning of %changelog
45         bod = 0                 # Beginning of %description
46         tw = 70                 # Descriptions width
47
48         b_idx = 0               # index of BR/R arrays
49         BR_count = 0    # number of additional BuildRequires
50
51         # If variable removed, then 1 (for removing it from export)
52         removed["LDFLAGS"] = 0
53         removed["CFLAGS"] = 0
54         removed["CXXFLAGS"] = 0
55
56         # If 1, we are inside of comment block (started with /^#%/)
57         comment_block = 0
58
59         import_rpm_macros()
60
61         packages_dir = topdir
62         groups_file = packages_dir "/rpm.groups"
63
64         system("cd "packages_dir"; [ -f rpm.groups ] || cvs up rpm.groups > /dev/null")
65         system("[ -d ../PLD-doc ] && cd ../PLD-doc && ([ -f BuildRequires.txt ] || cvs up BuildRequires.txt >/dev/null)");
66
67         # Temporary file for changelog section
68         changelog_file = mktemp("adapter.changelogXXXXXX")
69 }
70
71 # If the latest line matched /%files/
72 defattr == 1 {
73         if (ENVIRON["SKIP_DEFATTR"] != 1) {
74                 if ($0 !~ /defattr/) {  # If no %defattr
75                         print "%defattr(644,root,root,755)"     # Add it
76                 } else {
77                         $0 = "%defattr(644,root,root,755)"      # Correct mistakes (if any)
78                 }
79         }
80         defattr = 0
81 }
82
83 # call mktemp(1) and return the value
84 function mktemp(template, tmp) {
85    "mktemp " template | getline tmp
86    return tmp
87 }
88
89 function b_makekey(a, b,        s) {
90         s = a "" b;
91         # kill bcond
92         gsub(/[#%]+{[!?]+[_a-zA-Z0-9]+:/, "", s);
93
94         # kill commented out items
95         gsub(/^#[ \t]*/, "", s);
96
97         # force order
98         gsub(/^Summary\(/, "11Summary(", s);
99         gsub(/^Summary/, "10Summary", s);
100
101         gsub(/^Name/, "2Name", s);
102         gsub(/^Version/, "3Version", s);
103         gsub(/^Release/, "4Release", s);
104         gsub(/^Epoch/, "5Epoch", s);
105         gsub(/^License/, "5License", s);
106         gsub(/^Group/, "6Group", s);
107         gsub(/^URL/, "7URL", s);
108
109         gsub(/^BuildRequires/, "B1BuildRequires", s);
110         gsub(/^BuildConflicts/, "B2BuildConflicts", s);
111
112         gsub(/^Suggests/, "X1Suggests", s);
113         gsub(/^Provides/, "X2Provides", s);
114         gsub(/^Obsoletes/, "X3Obsoletes", s);
115         gsub(/^Conflicts/, "X4Conflicts", s);
116         gsub(/^BuildArch/, "X5BuildArch", s);
117         gsub(/^ExclusiveArch/, "X6ExclusiveArch", s);
118         gsub(/^ExcludeArch/, "X7ExcludeArch", s);
119         gsub(/^BuildRoot/, "X9BuildRoot", s);
120
121         gsub(/^AutoProv/, "Xx1AutoProv", s);
122         gsub(/^AutoReq/, "Xx2AutoReq", s);
123
124 #       printf("%s -> %s\n", a""b, s);
125         return s;
126 }
127
128 # Comments
129 /^#/ && (description == 0) {
130         if (/This file does not like to be adapterized!/) {
131                 print                   # print this message
132                 while (getline)         # print the rest of spec as it is
133                         print
134                 do_not_touch_anything = 1 # do not touch anything in END()
135                 exit(rc = 0)
136         }
137
138         # Generally, comments are printed without touching
139         sub(/[ \t]+$/, "")
140
141         if (/#[ \t]*Source.*md5/) {
142                 if (usedigest == 1) {
143                         sub(/^#[ \t]*Source/, "BuildRequires:\tdigest(%SOURCE", $0)
144                         sub(/-md5[ \t]*:[ \t]*/, ") = ", $0)
145                 }
146                 print $0
147                 next
148         }
149 }
150
151 /^%define/ {
152         # Remove defining _applnkdir (this macro has been included in rpm-3.0.4)
153         if ($2 == "_applnkdir") {
154                 next
155         }
156         if ($2 == "date") {
157                 date = 1
158                 if (did_files == 0) {
159                         print "%files"
160                         print ""
161                         did_files = 1
162                 }
163         }
164
165         # Do not add %define of _prefix if it already is.
166         if ($2 ~ /^_prefix/) {
167                 sub("^"prefix, $3, bindir)
168                 sub("^"prefix, $3, sbindir)
169                 sub("^"prefix, $3, libdir)
170                 sub("^"prefix, $3, datadir)
171                 sub("^"prefix, $3, includedir)
172                 prefix = $3
173         }
174
175         if ($2 ~ /_bindir/ && !/_sbindir/)
176                 bindir = $3
177         if ($2 ~ /_sbindir/)
178                 sbindir = $3
179         if ($2 ~ /_libdir/) {
180                 if ($3 ~ /^%\(/) {
181                         # TODO: should escape for latter checks like: ($c ~ sysconfdir "/{?cron.")
182                         libdir = "%%%%%%%%%%%%%%"
183                 } else {
184                         libdir = $3
185                 }
186         }
187         if ($2 ~ /_sysconfdir/) {
188                 if ($3 ~ /^%\(/) {
189                         # TODO: should escape for latter checks like: ($c ~ sysconfdir "/{?cron.")
190                         sysconfdir = "%%%%%%%%%%%%%%"
191                 } else {
192                         sysconfdir = $3
193                 }
194         }
195         if ($2 ~ /_datadir/) {
196                 if ($3 ~ /^%\(/) {
197                         # TODO: should escape for latter checks like: ($c ~ sysconfdir "/{?cron.")
198                         datadir = "%%%%%%%%%%%%%%"
199                 } else {
200                         datadir = $3
201                 }
202         }
203         if ($2 ~ /_includedir/)
204                 includedir = $3
205         if ($2 ~ /_mandir/)
206                 mandir = $3
207         if ($2 ~ /_infodir/)
208                 infodir = $3
209         if ($2 ~ /_docdir/)
210                 docdir = $3
211
212         # version related macros
213         if ($2 ~ /^_beta$/)
214                 _beta = $3
215         if ($2 ~ /^_rc$/)
216                 _rc = $3
217         if ($2 ~ /^_pre$/)
218                 _pre = $3
219         if ($2 ~ /^_snap$/)
220                 _snap = $3
221         if ($2 ~ /^subver$/)
222                 subver = $3
223
224         # these are used usually when adapterizing external spec
225         if ($2 ~ /^name$/)
226                 name = $3
227         if ($2 ~ /^version$/)
228                 version = $3
229         if ($2 ~ /^release$/)
230                 release = $3
231
232         if ($2 ~ /^mod_name$/)
233                 mod_name = $3
234         if ($2 ~ /^_?pearname$/)
235                 pearname = $3
236         if ($2 ~ /^_class$/)
237                 pear_class = $3
238         if ($2 ~ /^_subclass$/)
239                 pear_subclass = $3
240
241         # kill the _class and _subclass pear macros
242         if ($2 == "_pearname" || $2 == "pearname") {
243                 if (pear_class) {
244                         gsub("%{_class}", pear_class, $3);
245                 }
246                 if (pear_subclass) {
247                         gsub("%{_subclass}", pear_subclass, $3);
248                 }
249         }
250
251         sub(/[ \t]+$/, "");
252         # do nothing further, otherwise adapter thinks we're at preamble
253         print
254         next
255 }
256
257 # Obsolete
258 /^%include.*\/usr\/lib\/rpm\/macros\.python$/ {
259         next
260 }
261
262 ################
263 # %description #
264 ################
265 /^%description/, (!/^%description/ && $0 ~ SECTIONS) {
266         preamble = 0
267
268         if (/^%description/) {
269                 bod++
270                 format_line = ""
271                 format_indent = -1
272         }
273
274         # Format description
275         if (ENVIRON["SKIP_DESC"] != 1 && description == 1 && !/^%[a-z]+/ && !/^%description/) {
276                 if (/^[ \t]*$/) {
277                         format_flush(format_line, format_indent)
278                         print ""
279                         format_line = ""
280                         format_indent = -1
281                 } else if (/^[ \t]*[-\*][ \t]*/) {
282                         format_flush(format_line, format_indent)
283                         match($0, /^[ \t]*/)
284                         format_indent = RLENGTH
285                         match($0, /^[ \t]*[-\*][ \t]/)
286                         format_line = substr($0, RLENGTH)
287                 } else
288                         format_line = format_line " " $0
289                 next
290         }
291
292         if (/^%[a-z]+/ && (!/^%description/ || bod == 2)) {
293                 if (NF > 3 && $2 == "-l") {
294                         ll = $1
295                         for (i = 4; i <= NF; i++)
296                                 ll = ll " " $i
297                         $0 = ll " -l " $3
298                 }
299                 format_flush(format_line, format_indent)
300                 if (bod == 2) {
301                         bod = 1
302                         description = 1
303                 } else {
304                         bod = 0
305                         description = 0
306                 }
307         } else
308                 description = 1
309 }
310
311 #########
312 # %prep #
313 #########
314 /^%prep/, (!/^%prep/ && $0 ~ SECTIONS) {
315         preamble = 0
316         did_prep = 1
317
318         use_macros()
319
320         # Add '-q' to %setup
321         if (/^%setup/ && !/-q/) {
322                 sub(/^%setup/, "%setup -q")
323         }
324
325         if (/^%setup/ && name != "setup") {
326                 $0 = fixedsub(name, "%{name}", $0);
327                 $0 = fixedsub(version, "%{version}", $0);
328                 if (_beta) {
329                         $0 = fixedsub(_beta, "%{_beta}", $0);
330                 }
331                 if (_rc) {
332                         $0 = fixedsub(_rc, "%{_rc}", $0);
333                 }
334                 if (_pre) {
335                         $0 = fixedsub(_pre, "%{_pre}", $0);
336                 }
337                 if (_snap) {
338                         $0 = fixedsub(_snap, "%{_snap}", $0);
339                 }
340                 if (subver) {
341                         $0 = fixedsub(subver, "%{subver}", $0);
342                 }
343         }
344
345         if (/^%setup/ && /-n %{name}-%{version}( |$)/) {
346                 $0 = fixedsub(" -n %{name}-%{version}", "", $0)
347         }
348         sub("^%patch ", "%patch0 ");
349
350         # fedora extras
351         if (/^%apply/) {
352                 sub("^%apply -n", "%patch");
353         }
354
355         # invalid in %prep
356         sub("^rm -rf \$RPM_BUILD_ROOT.*", "");
357 }
358
359 ##########
360 # %build #
361 ##########
362 /^%build/, (!/^%build/ && $0 ~ SECTIONS) {
363         preamble = 0
364
365         if (did_prep == 0) {
366                 print "%prep"
367                 print ""
368                 did_prep = 1
369         }
370
371         use_macros()
372         use_tabs()
373
374         if (/^automake$/)
375                 sub(/$/, " -a -c")
376
377         if (/LDFLAGS/) {
378                 if (/LDFLAGS="-s"/) {
379                         removed["LDFLAGS"] = 1
380                         next
381                 } else {
382                         split($0, tmp, "LDFLAGS=")
383                         count = split(tmp[2], flags, "\"")
384                         if (flags[1] != "" && flags[1] !~ "!?debug") {
385                                 sub(/-s[" ]?/, "%{rpmldflags} ", flags[1])
386                                 $0 = tmp[1] line[1] "LDFLAGS=" flags[1] "\""
387                                 for (i = 2; i < count; i++)
388                                         $0 = $0 flags[i] "\""
389                         }
390                 }
391         }
392
393         if (/CFLAGS=/)
394                 if (cflags("CFLAGS") == 0)
395                         next
396
397         if (/CXXFLAGS=/)
398                 if (cflags("CXXFLAGS") == 0)
399                         next
400
401         if (/^export /) {
402                 if (removed["LDFLAGS"])
403                         sub(" LDFLAGS", "")
404                 if (removed["CFLAGS"])
405                         sub(" CFLAGS", "")
406                 if (removed["CXXFLAGS"])
407                         sub(" CXXFLAGS", "")
408                 # Is there still something?
409                 if (/^export[ ]*$/)
410                         next
411         }
412
413         # quote CC
414         if (/CC=%{__cc} /) {
415                 sub("CC=%{__cc}", "CC=\"%{__cc}\"")
416         }
417         
418         # use PLD Linux macros
419         $0 = fixedsub("glib-gettextize --copy --force","%{__glib_gettextize}", $0);
420         $0 = fixedsub("intltoolize --copy --force", "%{__intltoolize}", $0);
421         $0 = fixedsub("automake --add-missing --copy", "%{__automake}", $0);
422         $0 = fixedsub("automake -a --foreign --copy", "%{__automake}", $0);
423         $0 = fixedsub("automake -a -c --foreign", "%{__automake}", $0);
424         $0 = fixedsub("automake -a -c", "%{__automake}", $0);
425         $0 = fixedsub("libtoolize --force --automake --copy", "%{__libtoolize}", $0);
426         $0 = fixedsub("libtoolize -c -f --automake", "%{__libtoolize}", $0);
427
428         sub(/^aclocal$/, "%{__aclocal}");
429         sub(/^autoheader$/, "%{__autoheader}");
430         sub(/^autoconf$/, "%{__autoconf}");
431         sub(/^automake$/, "%{__automake}");
432         sub(/^libtoolize$/, "%{__libtoolize}");
433
434         # atrpms
435         $0 = fixedsub("%perl_configure", "%{__perl} Makefile.PL \\\n\tINSTALLDIRS=vendor", $0);
436         $0 = fixedsub("%perl_makecheck", "%{?with_tests:%{__make} test}", $0);
437
438         # alt linux
439         $0 = fixedsub("%make_build", "%{__make}", $0);
440 }
441
442 ##########
443 # %clean #
444 ##########
445 /^%clean/, (!/^%clean/ && $0 ~ SECTIONS) {
446         did_clean = 1
447
448         use_macros()
449 }
450
451 ############
452 # %install #
453 ############
454 /^%install/, (!/^%install/ && $0 ~ SECTIONS) {
455
456         preamble = 0
457
458         # foreign rpms
459         sub("^%{__rm} -rf %{buildroot}", "rm -rf $RPM_BUILD_ROOT")
460         sub("%buildroot", "$RPM_BUILD_ROOT");
461         sub("%{buildroot}", "$RPM_BUILD_ROOT");
462
463         if (/^[ \t]*rm([ \t]+-[rf]+)*[ \t]+(\${?RPM_BUILD_ROOT}?|%{?buildroot}?)/ && did_rmroot==0) {
464                 did_rmroot=1
465                 print "rm -rf $RPM_BUILD_ROOT"
466                 next
467         }
468
469         if (!/^(#?[ \t]*)$/ && !/^%install/ && did_rmroot==0) {
470                 print "rm -rf $RPM_BUILD_ROOT"
471                 did_rmroot=1
472         }
473
474         if (tmpdir) {
475                 buildroot = tmpdir "/" name "-" version "-root-" ENVIRON["USER"]
476                 gsub(buildroot, "$RPM_BUILD_ROOT")
477         }
478
479         if (!/%{_lib}/) {
480                 sub("\$RPM_BUILD_ROOT/%", "$RPM_BUILD_ROOT%")
481         }
482
483         use_macros()
484
485         # 'install -d' instead 'mkdir -p'
486         if (/mkdir -p/)
487                 sub(/mkdir -p/, "install -d")
488
489         # cp -a already implies cp -r
490         sub(/^cp -ar/, "cp -a")
491
492         # No '-u root' or '-g root' for 'install'
493         if (/^install/ && /-[ug][ \t]*root/)
494                 gsub(/-[ug][ \t]*root /, "")
495
496         if (/^install/ && /-m[ \t]*[0-9]+/)
497                 gsub(/-m[ \t]*[0-9]+ /, "")
498
499         # No lines contain 'chown' or 'chgrp' if owner/group is 'root'
500         if (($1 ~ /chown/ && $2 ~ /root\.root/) || ($1 ~ /chgrp/ && $2 ~ /root/))
501                 next
502
503         # No lines contain 'chmod' if it sets the modes to '644'
504         if ($1 ~ /chmod/ && $2 ~ /644/)
505                 next
506
507         # atrpms
508         $0 = fixedsub("%perl_makeinstall", "%{__make} pure_install \\\n\tDESTDIR=$RPM_BUILD_ROOT", $0);
509
510         # alt linux
511         $0 = fixedsub("%make_install DESTDIR=$RPM_BUILD_ROOT install", "%{__make} install \\\n\tDESTDIR=$RPM_BUILD_ROOT", $0);
512 }
513
514 ##########
515 # %files #
516 ##########
517 /^%files/, (!/^%files/ && $0 ~ SECTIONS) {
518         preamble = 0
519         did_files = 1
520
521         if ($0 ~ /^%files/)
522                 defattr = 1
523
524         if (!use_files_macros()) {
525                 next
526         }
527 }
528
529 ##############
530 # %changelog #
531 ##############
532 /^%changelog/, (!/^%changelog/ && $0 ~ SECTIONS) {
533         preamble = 0
534         has_changelog = 1
535         skip = 0
536         # There should be some CVS keywords on the first line of %changelog.
537         if (boc == 3) {
538                 if ($0 !~ _cvsmailfeedback) {
539                         print "* %{date} " _cvsmailfeedback > changelog_file
540                 } else {
541                         skip = 1
542                 }
543                 boc = 2
544         }
545         if (boc == 2 && !skip) {
546                 if (!/All persons listed below/) {
547                         printf "All persons listed below can be reached at " > changelog_file
548                         print "<cvs_login>" _cvsmaildomain "\n" > changelog_file
549                 } else {
550                         skip = 1
551                 }
552                 boc = 1
553         }
554         if (boc == 1 && !skip) {
555                 if (!/^$/) {
556                         if (!/\$.*Log:.*\$/) {
557                                 print "$" "Log:$" > changelog_file
558                         }
559                         boc = 0
560                 }
561         }
562         # Define date macro.
563         if (boc == 4) {
564                 if (date == 0) {
565                         printf "%%define date\t%%(echo `LC_ALL=\"C\"" > changelog_file
566                         print " date +\"%a %b %d %Y\"`)" > changelog_file
567                         date = 1
568                 }
569                 boc = 3
570         }
571
572         sub(/[ \t]+$/, "");
573         if (!/^%[a-z]+$/ || /changelog/) {
574                 # stop changelog if "real" changelog starts
575                 if (boc == 0 && /^\* /) {
576                         boc = -1
577                 }
578                 if (boc == -1) {
579                         next;
580                 }
581                 print > changelog_file
582         } else {
583                 print
584         }
585         next
586 }
587
588 ###########
589 # SCRIPTS #
590 ###########
591 /^%pre/, (!/^%pre/ && $0 ~ SECTIONS) {
592         preamble = 0
593
594         if (gsub("/usr/sbin/useradd", "%useradd")) {
595                 sub(" 2> /dev/null \|\| :", "");
596                 sub(" >/dev/null 2>&1 \|\|:", "");
597         }
598
599         # fedora extras macros
600         if (/%__fe_useradd/) {
601                 sub("%__fe_useradd", "%useradd -u ");
602                 sub(" 2> /dev/null \|\| :", "");
603                 sub(" >/dev/null 2>&1 \|\|:", "");
604                 sub(" &>/dev/null \\|\\| :", "");
605         }
606
607         if (/%__fe_groupadd/) {
608                 sub("%__fe_groupadd", "%groupadd -g ");
609                 sub(" &>/dev/null \\|\\| :", "");
610         }
611
612         # %useradd and %groupadd may not be wrapped
613         if (/%(useradd|groupadd).*\\$/) {
614                 a = $0; getline;
615                 sub(/^[\s\t]*/, "");
616                 $0 = substr(a, 1, length(a) - 1) $0;
617         }
618         use_script_macros()
619 }
620
621 /^%post/, (!/^%post/ && $0 ~ SECTIONS) {
622         preamble = 0
623
624         # fedora extras macros
625         sub("%__chkconfig", "/sbin/chkconfig");
626
627         sub("update-desktop-database &> /dev/null \\|\\| :", "%update_desktop_database");
628         sub("touch --no-create %{_datadir}/icons/hicolor", "%update_icon_cache_post hicolor");
629         sub("if \\[ -x %{_bindir}/gtk-update-icon-cache \\]; then\n\t%{_bindir}/gtk-update-icon-cache -q %{_datadir}/icons/hicolor \|\| :\nfi", "");
630
631         sub("export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`", "")
632         if (/gconftool-2 --makefile-install-rule/) {
633                 sub("gconftool-2 --makefile-install-rule %{_sysconfdir}/gconf/schemas/", "%gconf_schema_install ")
634                 sub("> /dev/null", "");
635         }
636
637         use_macros()
638 }
639 /^%preun/, (!/^%preun/ && $0 ~ SECTIONS) {
640         preamble = 0
641         use_macros()
642 }
643 /^%postun/, (!/^%postun/ && $0 ~ SECTIONS) {
644         preamble = 0
645
646         # fedora extras macros
647         if (/%__fe_userdel|%__fe_groupdel/) {
648                 sub("%__fe_groupdel", "%groupremove");
649                 sub("%__fe_userdel", "%userremove");
650                 sub(" &>/dev/null \\|\\| :", "");
651         }
652
653         use_script_macros()
654 }
655 /^%triggerin/, (!/^%triggerin/ && $0 ~ SECTIONS) {
656         preamble = 0
657         use_script_macros()
658 }
659 /^%triggerun/, (!/^%triggerun/ && $0 ~ SECTIONS) {
660         preamble = 0
661         use_script_macros()
662 }
663 /^%triggerpostun/, (!/^%triggerpostun/ && $0 ~ SECTIONS) {
664         preamble = 0
665         use_script_macros()
666 }
667 /^%pretrans/, (!/^%pretrans/ && $0 ~ SECTIONS) {
668         preamble = 0
669         use_script_macros()
670 }
671 /^%posttrans/, (!/^%posttrans/ && $0 ~ SECTIONS) {
672         preamble = 0
673         use_script_macros()
674 }
675 /^%verifyscript/, (!/^%verifyscript/ && $0 ~ SECTIONS) {
676         preamble = 0
677         use_script_macros()
678 }
679 /^%check/, (!/^%check/ && $0 ~ SECTIONS) {
680         preamble = 0
681         use_script_macros()
682 }
683
684 #############
685 # PREAMBLES #
686 #############
687 preamble == 1 {
688         # There should not be a space after the name of field
689         # and before the colon.
690         sub(/[ \t]*:/, ":")
691
692         if (/^%perl_module_wo_prefix/) {
693                 name = $2
694                 version = $3
695                 release = "0." fixedsub(".%{disttag}.at", "", $4)
696         }
697
698         field = tolower($1)
699         if (field ~ /summary:/ && !/etc\.$/ && !/Inc\.$/) {
700                 sub(/\.$/, "", $0);
701         }
702         if (field ~ /group(\([^)]+\)):/)
703                 next
704         if (field ~ /group:/) {
705                 format_preamble()
706                 group = $0;
707                 sub(/^[^ \t]*[ \t]*/, "", group);
708                 group = replace_groupnames(group);
709                 $0 = "Group:\t\t" group
710
711                 if (group ~ /^X11/ && x11 == 0) # Is it X11 application?
712                         x11 = 1
713
714                 byl_plik_z_groupmi = 0
715                 byl_opis_grupy = 0
716                 while ((getline linia_grup < groups_file) > 0) {
717                         byl_plik_z_groupmi = 1
718                         if (linia_grup == group) {
719                                 byl_opis_grupy = 1
720                                 break
721                         }
722                 }
723
724                 if (!byl_plik_z_groupmi)
725                         print "######\t\t" groups_file ": no such file"
726                 else if (!byl_opis_grupy)
727                         print "######\t\t" "Unknown group!"
728
729                 close(groups_file)
730                 did_groups = 1
731         }
732
733         if (field ~ /prereq:/) {
734                 sub(/Pre[Rr]eq:/, "Requires:", $1);
735         }
736
737         # split (build)requires, obsoletes on commas
738         if (field ~ /(obsoletes|requires|provides|conflicts|suggests):/ && NF > 2) {
739                 value = substr($0, index($0, $2));
740                 $0 = format_requires($1, value);
741         }
742
743         # BR: tar (and others) is to common (rpm-build requires it)
744         if (field ~ /^buildrequires:/) {
745                 l = substr($0, index($0, $2));
746                 if (l == "awk" ||
747                         l == "binutils" ||
748                         l == "bzip2" ||
749                         l == "cpio" ||
750                         l == "diffutils" ||
751                         l == "elfutils" ||
752                         l == "fileutils" ||
753                         l == "findutils" ||
754                         l == "glibc-devel" ||
755                         l == "grep" ||
756                         l == "gzip" ||
757                         l == "make" ||
758                         l == "patch" ||
759                         l == "sed" ||
760                         l == "sh-utils" ||
761                         l == "tar" ||
762                         l == "textutils") {
763                         next
764                 }
765
766                 replace_requires();
767         }
768
769         if (field ~ /^requires:/ || field ~ /^requires\(/) {
770                 replace_requires();
771         }
772
773
774         # obsolete/unwanted tags
775         if (field ~ /vendor:|packager:|distribution:|docdir:|prefix:|icon:|author:|author-email:|metadata-version:/) {
776                 next
777         }
778
779         if (field ~ /buildroot:/) {
780                 $0 = $1 "%{tmpdir}/%{name}-%{version}-root-%(id -u -n)"
781                 did_build_root = 1
782         }
783
784         # Use "License" instead of "Copyright" if it is (L)GPL or BSD
785         if (field ~ /copyright:/ && $2 ~ /GPL|BSD/) {
786                 $1 = "License:"
787         }
788
789         # ease updating from debian .dsc
790         if (field ~ /homepage:/) {
791                 $1 = "URL:"
792         }
793
794         # suse
795         if (field ~ /recommends:/) {
796                 $1 = "Suggests:"
797         }
798
799         if ($3 == "==" && $1 !~ /%/) {
800                 $3 = "="
801         }
802
803         if (field ~ /license:/) {
804                 l = substr($0, index($0, $2));
805                 if (l == "Python Software Foundation License") {
806                         l = "PSF"
807                 }
808                 if (l == "Apache License 2.0" || l == "Apache 2.0" || l == "Apache License Version 2.0" || l == "Apache License, Version 2.0" || l == "Apache Software License v2") {
809                         l = "Apache v2.0"
810                 }
811                 if (l == "Apache Group License" || l == "Apache Software License" || l == "Apache License") {
812                         l = "Apache"
813                 }
814                 if (l == "Apache-style License" || l == "Apache-style Software License") {
815                         l = "Apache-like"
816                 }
817                 if (l == "Apache Software License 1.1" || l == "Apache 1.1") {
818                         l = "Apache v1.1"
819                 }
820                 if (l == "GPLv2") {
821                         l = "GPL v2"
822                 }
823                 if (l == "GPLv2+") {
824                         l = "GPL v2+"
825                 }
826                 if (l == "GPL v2 or later") {
827                         l = "GPL v2+"
828                 }
829                 if (l == "LGPL v2.0 only") {
830                         l = "LGPL v2"
831                 }
832                 if (l == "LGPLv2+") {
833                         l = "LGPL v2+"
834                 }
835                 if (l == "GPLv3") {
836                         l = "GPL v3"
837                 }
838                 if (l == "GPLv3+") {
839                         l = "GPL v3+"
840                 }
841                 if (l == "MPLv1.1") {
842                         l = "MPL v1.1"
843                 }
844                 $0 = "License:\t" l;
845         }
846
847
848         if (field ~ /name:/) {
849                 if ($2 == "%{name}" && name) {
850                         $2 = name
851                 }
852                 name = $2
853                 name_seen = 1;
854         }
855
856         if (field ~ /version:/) {
857                 if ($2 == "%{version}" && version) {
858                         $2 = version
859                 }
860                 version = $2
861                 version_seen = 1;
862         }
863
864         if (field ~ /release:/) {
865                 if ($2 == "%{release}" && release) {
866                         $2 = release
867                 }
868                 sub(/%atrelease /, "0.", $0)
869                 release = $2
870                 release_seen = 1;
871         }
872
873
874         if (field ~ /serial:/)
875                 $1 = "Epoch:"
876
877         if (field ~ /home-page:/)
878                 $1 = "URL:"
879
880         # proper caps
881         if (field ~ /^url:$/)
882                 $1 = "URL:"
883
884         if (field ~ /^patch/)
885                 $1 = "Patch" substr(field, 6);
886
887         if (field ~ /^description:$/)
888                 $1 = "\n%description\n"
889
890         # Use %{name} and %{version} in the filenames in "Source:"
891         if (field ~ /^source/ || field ~ /patch/) {
892                 n = split($2, url, /\//)
893                 if (url[n] ~ /\.gz$/) {
894                         url[n+1] = ".gz" url[n+1]
895                         sub(/\.gz$/,"",url[n])
896                 }
897                 if (url[n] ~ /\.zip$/) {
898                         url[n+1] = ".zip" url[n+1]
899                         sub(/\.zip$/,"",url[n])
900                 }
901                 if (url[n] ~ /\.tar$/) {
902                         url[n+1] = ".tar" url[n+1]
903                         sub(/\.tar$/,"",url[n])
904                 }
905                 if (url[n] ~ /\.patch$/) {
906                         url[n+1] = ".patch" url[n+1]
907                         sub(/\.patch$/,"",url[n])
908                 }
909                 if (url[n] ~ /\.bz2$/) {
910                         url[n+1] = ".bz2" url[n+1]
911                         sub(/\.bz2$/,"",url[n])
912                 }
913                 if (url[n] ~ /\.logrotate$/) {
914                         url[n+1] = ".logrotate" url[n+1]
915                         sub(/\.logrotate$/,"",url[n])
916                 }
917                 if (url[n] ~ /\.pamd$/) {
918                         url[n+1] = ".pamd" url[n+1]
919                         sub(/\.pamd$/,"",url[n])
920                 }
921
922                 # allow %{name} only in last url component
923                 s = ""
924                 for (i = 1; i <= n; i++) {
925                         url[i] = fixedsub("%{name}", name, url[i])
926                         if (s) {
927                                 s = s "/" url[i]
928                         } else {
929                                 s = url[i]
930                         }
931                 }
932                 $2 = s url[n+1]
933
934                 filename = url[n]
935                 if (name) {
936                         url[n] = fixedsub(name, "%{name}", url[n])
937                 }
938                 if (field ~ /source/) {
939                         if (version) {
940                                 url[n] = fixedsub(version, "%{version}", url[n])
941                         }
942                         if (_beta) {
943                                 url[n] = fixedsub(_beta, "%{_beta}", url[n])
944                         }
945                         if (_rc) {
946                                 url[n] = fixedsub(_rc, "%{_rc}", url[n])
947                         }
948                         if (_pre) {
949                                 url[n] = fixedsub(_pre, "%{_pre}", url[n])
950                         }
951                         if (_snap) {
952                                 url[n] = fixedsub(_snap, "%{_snap}", url[n])
953                         }
954                         if (subver) {
955                                 url[n] = fixedsub(subver, "%{subver}", url[n])
956                         }
957                 }
958                 # assigning to $2 kills preamble formatting
959                 $2 = fixedsub(filename, url[n], $2)
960
961                 $2 = unify_url($2)
962         }
963
964
965         if (field ~ /^source:/)
966                 $1 = "Source0:"
967
968         if (field ~ /^patch:/)
969                 $1 = "Patch0:"
970
971         kill_preamble_macros();
972         format_preamble()
973
974         if (field ~ /requires/) {
975                 # atrpms
976                 $0 = fixedsub("%{eversion}", "%{epoch}:%{version}-%{release}", $0);
977         }
978 }
979
980 /^%bcond_/ {
981         # do nothing
982         print
983         next
984 }
985
986 # sort BR/R!
987 #
988 # NOTES:
989 # - mixing BR/R and anything else confuses this (all will be sorted together)
990 #       so don't do that.
991 # - comments leading the BR/R can not be associated,
992 #       so don't adapterize when the BR/R are mixed with comments
993 ENVIRON["SKIP_SORTBR"] != 1 && preamble == 1 && $0 ~ PREAMBLE_TAGS ":", $0 ~ PREAMBLE_TAGS ":"{
994         if ($1 ~ /Pre[Rr]eq:/) {
995                 sub(/Pre[Rr]eq:/, "Requires:", $1);
996         }
997         if ($1 == "BR:" ) {
998                 $1 = "BuildRequires:"
999         }
1000         if ($1 == "R:" ) {
1001                 $1 = "Requires:"
1002         }
1003         format_preamble()
1004 #       kill_preamble_macros(); # breaks tabbing
1005
1006         b_idx++;
1007         l = substr($0, index($0, $2));
1008         b_ktmp = b_makekey($1, l);
1009         b_key[b_idx] = b_ktmp;
1010         b_val[b_ktmp] = $0;
1011
1012         next;
1013 }
1014
1015 preamble == 1 {
1016         if (b_idx > 0) {
1017                 isort(b_key, b_idx);
1018                 for (i = 1; i <= b_idx; i++) {
1019                         v = b_val[b_key[i]];
1020                         sub(/[ \t]+$/, "", v);
1021                         print "" v;
1022                 }
1023                 b_idx = 0
1024         }
1025 }
1026
1027 # main() ;-)
1028 {
1029         preamble = 1
1030
1031         sub(/[ \t]+$/, "")
1032         print
1033
1034         if (name_seen == 0 && name) {
1035                 print "Name:\t\t" name
1036                 name_seen = 1
1037         }
1038
1039         if (version_seen == 0 && version) {
1040                 print "Version:\t" version
1041                 version_seen = 1
1042         }
1043
1044         if (release_seen == 0 && release) {
1045                 print "Release:\t" release
1046                 release_seen = 1
1047         }
1048
1049         if (did_build_root == 0) {
1050 #               print "BuildRoot:\t%{tmpdir}/%{name}-%{version}-root-%(id -u -n)"
1051                 did_build_root = 1
1052         }
1053         if (did_groups == 0) {
1054 #               print "Group:\t\tunknown"
1055                 did_groups = 1
1056         }
1057 }
1058
1059
1060 END {
1061         if (do_not_touch_anything) {
1062                 exit(rc)
1063         }
1064
1065         # TODO: need to output these in proper place
1066         if (BR_count > 0) {
1067                 for (i = 0; i <= BR_count; i++) {
1068                         print BR[i];
1069                 }
1070         }
1071
1072         close(changelog_file)
1073         while ((getline < changelog_file) > 0)
1074                 print
1075         system("rm -f " changelog_file)
1076
1077         if (did_clean == 0) {
1078                 print ""
1079                 print "%clean"
1080                 print "rm -rf $RPM_BUILD_ROOT"
1081         }
1082
1083         if (date == 0) {
1084                 print ""
1085                 print "%define date\t%(echo `LC_ALL=\"C\" date +\"%a %b %d %Y\"`)"
1086         }
1087
1088         if (has_changelog == 0) {
1089                 print "%changelog"
1090         }
1091
1092         if (boc > 2) {
1093                 print "* %{date} PLD Team <feedback@pld-linux.org>"
1094         }
1095         if (boc > 1) {
1096                 printf "All persons listed below can be reached at "
1097                 print "<cvs_login>@pld-linux.org\n"
1098         }
1099         if (boc > 0) {
1100                 print "$" "Log:$"
1101         }
1102 }
1103
1104 # substitutes fixed strings (not regexps)
1105 function fixedsub(s1,s2,t, ind) {
1106         if (ind = index(t,s1))
1107                 t = substr(t, 1, ind-1) s2 substr(t, ind+length(s1))
1108         return t
1109 }
1110
1111 # replace s with s2 if it equals to s1
1112 function replace(s, s1, s2) {
1113         if (s == s1) {
1114                 return s2;
1115         } else {
1116                 return s;
1117         }
1118 }
1119
1120 # There should be one or two tabs after the colon.
1121 function format_preamble()
1122 {
1123         if (/^#/ || /^%bcond_with/) {
1124                 return;
1125         }
1126         sub(/:[ \t]*/, ":")
1127         if (match($0, /[A-Za-z0-9(),#_ \t.-]+[ \t]*:[ \t]*/) == 1) {
1128                 if (RLENGTH < 8) {
1129                         sub(/:/, ":\t\t")
1130                 } else {
1131                         sub(/:/, ":\t")
1132                 }
1133         }
1134 }
1135
1136 # Replace directly specified directories with macros
1137 function use_macros()
1138 {
1139         # -m, --skip-macros, --no-macros -- skip macros subst
1140         if (ENVIRON["SKIP_MACROS"]) {
1141                 return
1142         }
1143
1144         # leave inline sed lines alone
1145         if (/(%{__sed}|sed) -i -e/) {
1146                 return;
1147         }
1148
1149         sub("%{_defaultdocdir}", "%{_docdir}");
1150         sub("%{_bindir}/perl", "%{__perl}");
1151         sub("%{_bindir}/python", "%{__python}");
1152
1153         gsub(infodir, "%{_infodir}")
1154
1155         gsub(perl_sitearch, "%{perl_sitearch}")
1156         gsub(perl_archlib, "%{perl_archlib}")
1157         gsub(perl_privlib, "%{perl_privlib}")
1158         gsub(perl_vendorlib, "%{perl_vendorlib}")
1159         gsub(perl_vendorarch, "%{perl_vendorarch}")
1160         gsub(perl_sitelib, "%{perl_sitelib}")
1161         
1162         gsub(py_sitescriptdir, "%{py_sitescriptdir}")
1163         gsub(py_sitedir, "%{py_sitedir}")
1164         gsub(py_scriptdir, "%{py_scriptdir}")
1165
1166         gsub(py3_sitescriptdir, "%{py3_sitescriptdir}")
1167         gsub(py3_sitedir, "%{py3_sitedir}")
1168         gsub(py3_scriptdir, "%{py3_scriptdir}")
1169
1170         gsub(ruby_archdir, "%{ruby_archdir}")
1171         gsub(ruby_ridir, "%{ruby_ridir}")
1172         gsub(ruby_rubylibdir, "%{ruby_rubylibdir}")
1173         gsub(ruby_sitearchdir, "%{ruby_sitearchdir}")
1174         gsub(ruby_sitelibdir, "%{ruby_sitelibdir}")
1175         gsub(ruby_rdocdir, "%{ruby_rdocdir}")
1176
1177         gsub(systemdunitdir, "%{systemdunitdir}")
1178         gsub(systemdtmpfilesdir, "%{systemdtmpfilesdir}")
1179
1180         gsub("%{_datadir}/applications", "%{_desktopdir}")
1181         gsub("%{_datadir}/pixmaps", "%{_pixmapsdir}")
1182         gsub("%{_datadir}/java", "%{_javadir}")
1183
1184         gsub("%{_libdir}/pkgconfig", "%{_pkgconfigdir}")
1185         gsub(pkgconfigdir, "%{_pkgconfigdir}")
1186
1187         gsub("%{_datadir}/pkgconfig", "%{_npkgconfigdir}")
1188         gsub(npkgconfigdir, "%{_npkgconfigdir}")
1189
1190         gsub("%{_datadir}/locale", "%{_localedir}")
1191         gsub(localedir, "%{_localedir}")
1192
1193         gsub(libdir, "%{_libdir}")
1194         gsub(javadir, "%{_javadir}")
1195
1196         gsub(bindir, "%{_bindir}")
1197         gsub("%{prefix}/bin", "%{_bindir}")
1198         if (prefix"/bin" == bindir)
1199                 gsub("%{_prefix}/bin", "%{_bindir}")
1200
1201         for (c = 1; c <= NF; c++) {
1202                 if ($c ~ sbindir "/fix-info-dir")
1203                         continue;
1204                 if ($c ~ sbindir "/webapp")
1205                         continue;
1206                 if ($c ~ sbindir "/ldconfig")
1207                         continue;
1208                 if ($c ~ sbindir "/chsh")
1209                         continue;
1210                 if ($c ~ sbindir "/usermod")
1211                         continue;
1212                 if ($c ~ sbindir "/chkconfig")
1213                         continue;
1214                 if ($c ~ sbindir "/installzope(product|3package)")
1215                         continue;
1216                 gsub(sbindir, "%{_sbindir}", $c)
1217         }
1218
1219         gsub("%{prefix}/sbin", "%{_sbindir}")
1220         if (prefix"/sbin" == sbindir) {
1221                 gsub("%{_prefix}/sbin", "%{_sbindir}")
1222         }
1223
1224         for (c = 1; c <= NF; c++) {
1225                 if ($c ~ sysconfdir "/{?cron.")
1226                         continue;
1227                 if ($c ~ sysconfdir "/{?crontab.d")
1228                         continue;
1229                 if ($c ~ sysconfdir "/{?env.d")
1230                         continue;
1231                 if ($c ~ sysconfdir "/{?modprobe.(d|conf)")
1232                         continue;
1233                 if ($c ~ sysconfdir "/{?udev")
1234                         continue;
1235                 if ($c ~ sysconfdir "/{?hotplug")
1236                         continue;
1237                 if ($c ~ sysconfdir "/{?logrotate.d")
1238                         continue;
1239                 if ($c ~ sysconfdir "/{?pam.d")
1240                         continue;
1241                 if ($c ~ sysconfdir "/{?profile.d")
1242                         continue;
1243                 if ($c ~ sysconfdir "/{?rc.d")
1244                         continue;
1245                 if ($c ~ sysconfdir "/{?security")
1246                         continue;
1247                 if ($c ~ sysconfdir "/{?skel")
1248                         continue;
1249                 if ($c ~ sysconfdir "/{?sysconfig")
1250                         continue;
1251                 if ($c ~ sysconfdir "/{?shrc.d")
1252                         continue;
1253                 if ($c ~ sysconfdir "/{?certs")
1254                         continue;
1255                 if ($c ~ sysconfdir "/{?X11")
1256                         continue;
1257                 if ($c ~ sysconfdir "/{?ld.so.conf.d")
1258                         continue;
1259                 if ($c ~ sysconfdir "/{?rpm")
1260                         continue;
1261                 if ($c ~ sysconfdir "/{?bash_completion.d")
1262                         continue;
1263                 if ($c ~ sysconfdir "/{?samba")
1264                         continue;
1265                 if ($c ~ sysconfdir "/{?xdg")
1266                         continue;
1267                 if ($c ~ sysconfdir "/shells")
1268                         continue;
1269                 if ($c ~ sysconfdir "/inittab")
1270                         continue;
1271                 if ($c ~ sysconfdir "/init")
1272                         continue;
1273                 if ($c ~ sysconfdir "/ppp")
1274                         continue;
1275                 if ($c ~ sysconfdir "/dbus-1")
1276                         continue;
1277                 if ($c ~ sysconfdir "/tmpwatch")
1278                         continue;
1279                 if ($c ~ sysconfdir "/acpi")
1280                         continue;
1281                 if ($c ~ sysconfdir "/apm")
1282                         continue;
1283                 gsub(sysconfdir, "%{_sysconfdir}", $c)
1284         }
1285
1286         gsub(docdir, "%{_docdir}")
1287
1288         gsub(kdedocdir, "%{_kdedocdir}")
1289
1290         gsub(gtkdocdir, "%{_gtkdocdir}")
1291         gsub("%{_docdir}/gtk-doc/html", "%{_gtkdocdir}")
1292
1293         gsub(php_pear_dir, "%{php_pear_dir}")
1294         gsub(php_data_dir, "%{php_data_dir}")
1295
1296         for (c = 1; c <= NF; c++) {
1297                 if ($c ~ datadir "/automake")
1298                         continue;
1299                 if ($c ~ datadir "/unsermake")
1300                         continue;
1301                 if ($c ~ datadir "/file/magic.mime")
1302                         continue;
1303                 gsub(datadir, "%{_datadir}", $c)
1304         }
1305
1306         gsub("%{prefix}/share", "%{_datadir}")
1307         if (prefix"/share" == datadir)
1308                 gsub("%{_prefix}/share", "%{_datadir}")
1309
1310         # CFLAGS="-I/usr/include/ncurses is usually correct.
1311         if (!/-I\/usr\/include/) {
1312                 gsub(includedir, "%{_includedir}")
1313         }
1314
1315         gsub("%{prefix}/include", "%{_includedir}")
1316         if (prefix"/include" == includedir) {
1317                 gsub("%{_prefix}/include", "%{_includedir}")
1318         }
1319
1320         gsub(mandir, "%{_mandir}")
1321         if ($0 !~ "%{_datadir}/manual") {
1322                 gsub("%{_datadir}/man", "%{_mandir}")
1323         }
1324         gsub("%{_prefix}/share/man", "%{_mandir}")
1325         gsub("%{prefix}/share/man", "%{_mandir}")
1326         gsub("%{prefix}/man", "%{_mandir}")
1327         gsub("%{_prefix}/man", "%{_mandir}")
1328
1329         gsub(infodir, "%{_infodir}")
1330         gsub("%{prefix}/info", "%{_infodir}")
1331         gsub("%{_prefix}/info", "%{_infodir}")
1332
1333         if (prefix !~ "/X11R6") {
1334                 gsub("%{_datadir}/aclocal", "%{_aclocaldir}")
1335         }
1336
1337         gsub(examplesdir, "%{_examplesdir}")
1338
1339         if (prefix != "/") {
1340                 # leave --with-foo=/usr alone
1341                 if ($0 !~ "--with.*=.*" prefix) {
1342                         for (c = 1; c <= NF; c++) {
1343                                 if ($c ~ prefix "/sbin/fix-info-dir")
1344                                         continue;
1345                                 if ($c ~ prefix "/sbin/webapp")
1346                                         continue;
1347                                 if ($c ~ prefix "/sbin/chsh")
1348                                         continue;
1349                                 if ($c ~ prefix "/sbin/usermod")
1350                                         continue;
1351                                 if ($c ~ prefix "/sbin/installzope(product|3package)")
1352                                         continue;
1353                                 if ($c ~ prefix "/share/automake")
1354                                         continue;
1355                                 if ($c ~ prefix "/share/unsermake")
1356                                         continue;
1357                                 if ($c ~ prefix "/lib/sendmail")
1358                                         continue;
1359                                 if ($c ~ prefix "/lib/pkgconfig")
1360                                         continue;
1361
1362                                 # CFLAGS="-I/usr..." is usually correct.
1363                                 if (/-I\/usr/)
1364                                         continue;
1365                                 # same for LDFLAGS="-L/usr..."
1366                                 if (/-L\/usr/)
1367                                         continue;
1368
1369                                 gsub(prefix, "%{_prefix}", $c)
1370                         }
1371                 }
1372                 gsub("%{prefix}", "%{_prefix}")
1373         }
1374
1375         # replace back
1376         gsub("%{_includedir}/ncurses", "/usr/include/ncurses")
1377         gsub("%{_includedir}/freetype", "/usr/include/freetype")
1378
1379         gsub("%{PACKAGE_VERSION}", "%{version}")
1380         gsub("%{PACKAGE_NAME}", "%{name}")
1381
1382         gsub("^make$", "%{__make}")
1383         gsub("^make ", "%{__make} ")
1384         gsub("^gcc ", "%{__cc} ")
1385         gsub("^rm --interactive=never ", "%{__rm} ")
1386
1387         # fedora
1388         gsub("%{ruby_sitearch}", "%{ruby_sitearchdir}")
1389         gsub("%{python_sitearch}", "%{py_sitedir}")
1390         gsub("%{python_sitelib}", "%{py_sitescriptdir}")
1391
1392         # alt linux
1393         gsub("%_man1dir", "%{_mandir}/man1")
1394
1395         # mandrake specs
1396         gsub("^%make$", "%{__make}")
1397         gsub("^%make ", "%{__make} ")
1398         gsub("^%makeinstall_std", "%{__make} install \\\n\tDESTDIR=$RPM_BUILD_ROOT")
1399         gsub("^%{makeinstall}", "%{__make} install \\\n\tDESTDIR=$RPM_BUILD_ROOT")
1400         gsub("^%makeinstall", "%{__make} install \\\n\tDESTDIR=$RPM_BUILD_ROOT")
1401         gsub("^%{__rm} -rf %{buildroot}", "rm -rf $RPM_BUILD_ROOT")
1402         gsub("^%{__install}", "install")
1403         gsub("%optflags", "%{rpmcflags}")
1404         gsub("%{compat_perl_vendorarch}", "%{perl_vendorarch}")
1405
1406         gsub("^%{__make} install DESTDIR=\$RPM_BUILD_ROOT", "%{__make} install \\\n\tDESTDIR=$RPM_BUILD_ROOT")
1407         gsub("^fix-info-dir$", "[ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c %{_infodir} >/dev/null 2>\\&1")
1408         $0 = fixedsub("%buildroot", "$RPM_BUILD_ROOT", $0)
1409         $0 = fixedsub("%{buildroot}", "$RPM_BUILD_ROOT", $0)
1410         $0 = fixedsub("CXXFLAGS=%{rpmcflags} %configure", "CXXFLAGS=%{rpmcflags}\n%configure", $0);
1411         $0 = fixedsub("%__install", "install", $0);
1412
1413         # split configure line to multiple lines
1414         if (/%configure +$/) {
1415                 sub( / +$/, "" );
1416         } else if (/%configure / && !/\\$/) {
1417                 $0 = format_configure($0);
1418         }
1419
1420         gsub("%_bindir", "%{_bindir}")
1421         gsub("%_datadir", "%{_datadir}")
1422         gsub("%_iconsdir", "%{_iconsdir}")
1423         gsub("%_sbindir", "%{_sbindir}")
1424         gsub("%_mandir", "%{_mandir}")
1425         gsub("%name", "%{name}")
1426         gsub(/%__rm/, "rm");
1427         gsub(/%__mkdir_p/, "install -d");
1428         gsub(/%__cp/, "cp");
1429         gsub(/%__ln_s/, "ln -s");
1430         gsub(/%__sed/, "%{__sed}");
1431         gsub(/%__cat/, "cat");
1432         gsub(/%__chmod/, "chmod");
1433
1434         gsub("/usr/src/linux", "%{_kernelsrcdir}")
1435         gsub("%{_prefix}/src/linux", "%{_kernelsrcdir}")
1436
1437         if (/^ant / || /^%{ant}/) {
1438                 sub(/^ant/, "%ant")
1439                 sub(/^%{ant}/, "%ant")
1440                 add_br("BuildRequires:  jpackage-utils");
1441                 add_br("BuildRequires:  rpmbuild(macros) >= 1.300");
1442         }
1443
1444         $0 = fixedsub("%(%{__cc} -dumpversion)", "%{cc_version}", $0);
1445         $0 = fixedsub("%(%{__cxx} -dumpversion)", "%{cxx_version}", $0);
1446
1447         # kill the _class and _subclass pear macros
1448         if (pear_class) {
1449                 gsub("%{_class}", pear_class);
1450         }
1451         if (pear_subclass) {
1452                 gsub("%{_subclass}", pear_subclass);
1453         }
1454 }
1455
1456 function format_configure(line,         n, a, s) {
1457         n = split(line, a, / /);
1458         s = a[1] " \\\n";
1459         for (i = 2; i <= n; i++) {
1460                 s = s "\t" a[i] " \\\n"
1461         }
1462         return s
1463 }
1464
1465
1466 # insertion sort of A[1..n]
1467 # copied from mawk manual
1468 function isort(A,n,             i,j,hold) {
1469         for (i = 2; i <= n; i++) {
1470                 hold = A[j = i]
1471                 while (A[j-1] > hold) {
1472                         j-- ; A[j+1] = A[j]
1473                 }
1474                 A[j] = hold
1475         }
1476         # sentinel A[0] = "" will be created if needed
1477 }
1478
1479
1480 function use_files_macros(      i, n, t, a, l)
1481 {
1482         use_macros()
1483
1484         # skip comments
1485         if (/^#/) {
1486                 return 1;
1487         }
1488
1489         sub("^%doc %{_mandir}", "%{_mandir}")
1490
1491         gsub("^%{_sbindir}", "%attr(755,root,root) %{_sbindir}")
1492         gsub("^%{_bindir}", "%attr(755,root,root) %{_bindir}")
1493
1494         # uid/gid nobody is not valid in %files
1495         if (/%attr([^)]*nobody[^)]*)/ && !/FIXME/) {
1496                 $0 = $0 " # FIXME nobody user/group can't own files! -adapter.awk"
1497         }
1498
1499         # s[gu]id programs with globs are evil
1500         if (/%attr\([246]...,.*\*/ && !/FIXME/) {
1501                 $0 = $0 " # FIXME no globs for suid/sgid files"
1502         }
1503
1504         # replace back
1505         gsub("%{_sysconfdir}/cron\.d", "/etc/cron.d")
1506         gsub("%{_sysconfdir}/crontab\.d", "/etc/crontab.d")
1507         gsub("%{_sysconfdir}/logrotate\.d", "/etc/logrotate.d")
1508         gsub("%{_sysconfdir}/pam\.d", "/etc/pam.d")
1509         gsub("%{_sysconfdir}/profile\.d", "/etc/profile.d")
1510         gsub("%{_sysconfdir}/rc\.d", "/etc/rc.d")
1511         gsub("%{_sysconfdir}/security", "/etc/security")
1512         gsub("%{_sysconfdir}/skel", "/etc/skel")
1513         gsub("%{_sysconfdir}/sysconfig", "/etc/sysconfig")
1514         gsub("%{_sysconfdir}/certs", "/etc/certs")
1515         gsub("%{_sysconfdir}/init.d", "/etc/init.d")
1516         gsub("%{_sysconfdir}/dbus-1", "/etc/dbus-1")
1517         gsub("%{_sysconfdir}/pki", "/etc/pki")
1518         gsub("%{_sysconfdir}/tmpwatch", "/etc/tmpwatch")
1519
1520         # /etc/init.d -> /etc/rc.d/init.d
1521         if (!/^\/etc\/init\.d$/) {
1522                  gsub("/etc/init.d", "/etc/rc.d/init.d")
1523         }
1524
1525         if (/\/etc\/rc\.d\/init\.d\// && !/functions/) {
1526                 if (!/%attr.*\/etc\/rc\.d\/init\.d/) {
1527                         $0 = "%attr(754,root,root) " $0
1528                 }
1529                 if (/^%attr.*\/etc\/rc\.d\/init\.d/ && !/^%attr\(754 *,/) {
1530                         gsub("^%attr\\(... *,", "%attr(754,");
1531                 }
1532         }
1533
1534         if (/lib.+\.so\b/ && !/\.so$/ && !/^%attr.*/ && !/%exclude/) {
1535                 $0 = "%attr(755,root,root) " $0
1536         }
1537
1538         if (/%{perl_vendorarch}.*\.so$/ && !/^%attr.*/) {
1539                 $0 = "%attr(755,root,root) " $0
1540         }
1541
1542         # remove attrs from man pages
1543         if (/%{_mandir}/ && /^%attr/) {
1544                 sub("^%attr\\(.*\\) *", "");
1545         }
1546
1547         # /etc/sysconfig files
1548         # %attr(640,root,root) %config(noreplace) %verify(not size mtime md5) /etc/sysconfig/*
1549         # attr not required, allow default 644 attr
1550         if (!/network-scripts/ && !/%dir/ && !/\.d$/ && !/functions/ && !/\/etc\/sysconfig\/wmstyle/) {
1551                 if (/\/etc\/sysconfig\// && /%config/ && !/%config\(noreplace/) {
1552                         gsub("%config", "%config(noreplace)")
1553                 }
1554
1555                 if (/\/etc\/sysconfig\// && !/%config\(noreplace/) {
1556                         $NF = "%config(noreplace) " $NF
1557                 }
1558
1559                 if (/\/etc\/sysconfig\// && /%attr\(755/) {
1560                         gsub("^%attr\\(... *,", "%attr(640,");
1561                 }
1562
1563                 if (/\/etc\/sysconfig\// && !/%verify/) {
1564                         gsub("/etc/sysconfig", "%verify(not size mtime md5) /etc/sysconfig");
1565                 }
1566         }
1567
1568         # kill leading zeros
1569         if (/%attr\(0[1-9]/) {
1570                 gsub("%attr\\(0", "%attr(")
1571         }
1572
1573         # kill leading whitespace
1574         gsub(/^ +/, "");
1575
1576         # kill default attrs
1577         gsub(/%dir %attr\(755,root,root\)/, "%dir");
1578         gsub(/%attr\(755,root,root\) %dir/, "%dir");
1579         if (!/%dir/) {
1580                 gsub(/%attr\(644,root,root\) /, "");
1581         }
1582
1583         # sort %verify attrs
1584         if (match($0, /%verify\(not([^)]+)\)/)) {
1585                 t = substr($0, RSTART, RLENGTH)
1586                 # kill commas: %verify(not,md5,size,mtime)
1587                 gsub(/,/, " ", t);
1588
1589                 gsub(/^%verify\(not |\)$/, "", t)
1590                 n = split(t, a, / /)
1591                 isort(a, n)
1592
1593                 s = "%verify(not"
1594                 for (i = 1 ; i <= n; i++) {
1595                         s = s " " a[i]
1596                 }
1597                 s = s ")"
1598
1599                 gsub(/%verify\(not[^)]+\)/, s)
1600         }
1601
1602         if (/%{_mandir}/) {
1603                 gsub("\.gz$", "*")
1604                 gsub("%ext_man$", "*")
1605         }
1606
1607         # locale dir and no %lang -> bad
1608         if (/%{_datadir}\/locale\/.*\// && !/%(dir|lang)/) {
1609                 $(NF + 1) = "# FIXME consider using %find_lang"
1610         }
1611
1612         # python egg-infos
1613         if (match($0, "^%{py_site(script)?dir}/.+-py"py_ver".egg-info$")) {
1614                 # tests:
1615                 #%{py_sitedir}/*-py2.4.egg-info
1616                 #%{py_sitescriptdir}/GnuPGInterface-%{version}-py2.4.egg-info
1617                 #%{py_sitescriptdir}/python_mpd-%{version}-py2.4.egg-info
1618                 #%{py_sitescriptdir}/mechanize-0.1.6b-py2.4.egg-info
1619
1620                 l = index($0, "/");
1621                 t = substr($0, 0, l);
1622                 s = substr($0, l + 1, RLENGTH - l - length("-py"py_ver".egg-info"));
1623                 if (match(s, "[^-]+$")) {
1624                         if (RSTART > 1) {
1625                                 s = substr(s, 0, RSTART - 1);
1626                         }
1627                         print "%if \"%{py_ver}\" > \"2.4\""
1628                         gsub(t "/.+.egg-info", t "/" s "-*.egg-info");
1629                         print
1630                         print "%endif"
1631                         return 0;
1632                 }
1633         }
1634
1635         # atrpms
1636         $0 = fixedsub("%{perl_man1dir}", "%{_mandir}/man1", $0);
1637         $0 = fixedsub("%{perl_man3dir}", "%{_mandir}/man3", $0);
1638         $0 = fixedsub("%{perl_bin}", "%{_bindir}", $0);
1639
1640         gsub(libdir "/pkgconfig", "%{_pkgconfigdir}");
1641         gsub("%{_libdir}/pkgconfig", "%{_pkgconfigdir}");
1642         gsub("%{_prefix}/lib/pkgconfig", "%{_pkgconfigdir}");
1643
1644         gsub("%{_datadir}/applications", "%{_desktopdir}");
1645         gsub("%{_datadir}/icons", "%{_iconsdir}");
1646         gsub("%{_datadir}/pixmaps", "%{_pixmapsdir}");
1647         gsub("%{_datadir}/pear", "%{php_pear_dir}");
1648         gsub("%{_datadir}/php", "%{php_data_dir}");
1649
1650         return 1
1651 }
1652
1653 function use_script_macros()
1654 {
1655         if (gsub("/sbin/service", "%service")) {
1656                 sub(" >/dev/null 2>&1 \|\|:", "");
1657                 sub(" 2> /dev/null \|\| :", "");
1658         }
1659 }
1660
1661 function fill(ch, n, i) {
1662         for (i = 0; i < n; i++)
1663                 printf("%c", ch)
1664 }
1665
1666 function format_flush(line, indent, newline, word, first_word) {
1667         first_word = 1
1668         if (format_indent == -1)
1669                 newline = ""
1670         else
1671                 newline = fill(" ", format_indent) "- "
1672
1673         while (match(line, /[^\t ]+/)) {
1674                 word = substr(line, RSTART, RLENGTH)
1675                 if (length(newline) + length(word) + 1 > tw) {
1676                         print newline
1677
1678                         if (format_indent == -1)
1679                                 newline = ""
1680                         else
1681                                 newline = fill(" ", format_indent + 2)
1682                         first_word = 1
1683                 }
1684
1685                 if (first_word) {
1686                         newline = newline word
1687                         first_word = 0
1688                 } else
1689                         newline = newline " " word
1690
1691                 line = substr(line, RSTART + RLENGTH)
1692         }
1693         if (newline ~ /[^\t ]/) {
1694                 print newline
1695         }
1696 }
1697
1698 function cflags(var)
1699 {
1700         if ($0 == var "=\"$RPM_OPT_FLAGS\"") {
1701                 removed[var] = 1
1702                 return 0
1703         }
1704
1705         if (!/!\?debug/)
1706                 sub("\$RPM_OPT_FLAGS", "%{rpmcflags}")
1707         return 1
1708 }
1709
1710 # return whole matched pattern
1711 function matchstr(str, pat)
1712 {
1713         match(str, "[^/]+$");
1714         return substr(str, RSTART, RLENGTH);
1715 }
1716
1717 function unify_url(url)
1718 {
1719
1720         # sourceforge urls
1721         # Docs about sourceforge mirror system: http://sourceforge.net/apps/trac/sourceforge/wiki/Mirrors
1722
1723         # 1. unify domains
1724         sub("^http://prdownloads\.sourceforge\.net/", "http://downloads.sourceforge.net/", url)
1725         sub("^http://download\.sf\.net/", "http://downloads.sourceforge.net/", url)
1726         sub("^http://download\.sourceforge\.net/", "http://downloads.sourceforge.net/", url)
1727         sub("^http://dl\.sourceforge\.net/", "http://downloads.sourceforge.net/", url)
1728         sub("^http://.*\.dl\.sourceforge\.net/", "http://downloads.sourceforge.net/", url)
1729         sub("^http://dl\.sf\.net/", "http://downloads.sourceforge.net/", url)
1730         sub("^http://downloads\.sourceforge\.net/sourceforge/", "http://downloads.sourceforge.net/", url)
1731
1732         # 3. unify urls
1733         if (url ~ /sourceforge.net/) {
1734                 sub("[?&]big_mirror=.*$", "", url);
1735                 sub("[?&]modtime=.*$", "", url);
1736                 sub("[?]use_mirror=.*$", "", url);
1737                 sub("[?]download$", "", url);
1738                 sub("/download$", "", url);
1739         }
1740
1741         # SF: new style urls, strip "files/" between and prepend dl.
1742         if (match(url, "^http://sourceforge.net/projects/[^/]+/files/")) {
1743                 url = substr(url, 1, RLENGTH - length("files/")) substr(url, RSTART + RLENGTH);
1744                 sub("^http://sourceforge.net/projects/", "http://downloads.sourceforge.net/project/", url);
1745         }
1746
1747         # SF unify: http://downloads.sourceforge.net/PROJECT/TARBALL
1748         # http://downloads.sourceforge.net/project/PROJECT/FILE/VERSION/%{name}-%{version}.zip
1749         if (match(url, "^http://downloads.sourceforge.net/project/[^/]+")) {
1750                 url = sprintf("http://downloads.sourceforge.net/%s/%s", substr(url, 42, RLENGTH - 41), matchstr(url, "[^/]+$"));
1751         }
1752
1753         sub("^ftp://ftp\.gnome\.org/", "http://ftp.gnome.org/", url)
1754         sub("^http://ftp\.gnome\.org/pub/gnome/", "http://ftp.gnome.org/pub/GNOME/", url)
1755
1756         # apache urls
1757         sub("^http://apache.zone-h.org/", "http://www.apache.org/dist/", url)
1758
1759         # gnu.org
1760         sub("^ftp://ftp\.gnu\.org/", "http://ftp.gnu.org/", url)
1761         sub("^http://ftp\.gnu\.org/pub/gnu/", "http://ftp.gnu.org/gnu/", url)
1762
1763         # debian.org
1764         sub("^ftp://ftp\.[^.]+\.debian\.org/", "ftp://ftp.debian.org/", url)
1765         sub("^http://ftp\.[^.]+\.debian\.org/", "ftp://ftp.debian.org/", url)
1766         sub("^ftp://ftp\.debian\.org/pub/debian/", "ftp://ftp.debian.org/debian/", url)
1767
1768         return url
1769 }
1770
1771 function demacroize(str)
1772 {
1773         if (mod_name) {
1774                 sub("%{mod_name}", mod_name, str);
1775         }
1776         if (pearname) {
1777                 sub("%{_pearname}", pearname, str);
1778         }
1779         if (pearname) {
1780                 sub("%{pearname}", pearname, str);
1781         }
1782         if (name) {
1783                 sub("%{name}", name, str);
1784         }
1785         if (version) {
1786                 sub("%{version}", version, str);
1787         }
1788         if (_beta) {
1789                 sub("%{_beta}", _beta, str);
1790         }
1791         if (_rc) {
1792                 sub("%{_rc}", _rc, str);
1793         }
1794         if (_pre) {
1795                 sub("%{_pre}", _pre, str);
1796         }
1797         if (_snap) {
1798                 sub("%{_snap}", _snap, str);
1799         }
1800         if (subver) {
1801                 sub("%{subver}", subver, str);
1802         }
1803         return str;
1804 }
1805
1806 function kill_preamble_macros()
1807 {
1808         if ($1 ~ /^Obsoletes:/) {
1809                 # NB! assigning $2 a value breaks tabbing
1810                 $2 = demacroize($2);
1811         }
1812         if ($1 ~ /^URL:/) {
1813                 # NB! assigning $2 a value breaks tabbing
1814                 $2 = demacroize($2);
1815                 $2 = unify_url($2)
1816         }
1817
1818         # fedora extras
1819         if (/%{\?FE_USERADD_REQ}/) {
1820                 $0 = "";
1821                 print "BuildRequires:   rpmbuild(macros) >= 1.202"
1822                 print "Provides:        user(xxx)"
1823                 print "Requires(postun):        /usr/sbin/userdel"
1824                 print "Requires(pre):  /bin/id"
1825                 print "Requires(pre):  /usr/sbin/useradd"
1826         }
1827 }
1828
1829 function get_epoch(pkg, ver,    epoch)
1830 {
1831         return
1832 # should parse the BR lines more adequately:
1833 #       freetype = 2.0.0 -> correct
1834 #       freetype = 2.1.9 -> with epoch 1, as epoch 1 was added in 2.1.7
1835
1836         shell = "grep -o '^" pkg ":[^:]\+' ../PLD-doc/BuildRequires.txt | awk '{print $NF}'";
1837         shell | getline epoch;
1838         return epoch;
1839 }
1840
1841 function format_requires(tag, value,    n, p, i, deps, ndeps) {
1842         # skip any formatting for commented out items or some weird macros
1843         if (/^#/ || /%\(/) {
1844                 return tag "\t" value
1845         }
1846         n = split(value, p, / *,? */);
1847         for (i = 1; i <= n; i++) {
1848                 if (p[i+1] ~ /[<=>]/) {
1849                         # add epoch if the version doesn't have it but BuildRequires.txt has
1850                         if (p[i] ~ /^[a-z]/ && p[i+2] !~ /^[0-9]+:/) {
1851                                 epoch = get_epoch(p[i], p[i+2])
1852                                 if (epoch) {
1853                                         p[i+2] = epoch ":" p[i+2];
1854                                 }
1855                         }
1856                         deps[ndeps++] = p[i] " " p[i+1] " " p[i+2];
1857                         i += 2;
1858                 } else {
1859                         deps[ndeps++] = p[i];
1860                 }
1861         }
1862         s = ""
1863         for (i in deps) {
1864                 s = s sprintf("%s\t%s\n", tag, deps[i]);
1865         }
1866         return substr(s, 1, length(s)-1);
1867 }
1868
1869 function use_tabs()
1870 {
1871         # reverse vim: ts=4 sw=4 et
1872         gsub(/    /, "\t");
1873 }
1874
1875 function add_br(br)
1876 {
1877         BR[BR_count++] = br
1878 }
1879
1880 # Load rpm macros
1881 # you should update the list also in adapter when making changes here
1882 function import_rpm_macros(  v) {
1883         # File with rpm groups
1884         topdir = ENVIRON["_topdir"]
1885
1886         if (!topdir) {
1887                 print "adapter.awk should not not be invoked directly, but via adapter script" > "/dev/stderr"
1888                 do_not_touch_anything = 1
1889                 exit(rc = 1);
1890         }
1891
1892         # update this version dep each time some new macro export is added
1893         v = 1.49
1894         if (!ENVIRON["ADAPTER_REVISION"] || ENVIRON["ADAPTER_REVISION"] < v) {
1895                 printf("adapter shell script is outdated: Need %s, got %s. Please update it.\n", v, ENVIRON["ADAPTER_REVISION"]) > "/dev/stderr"
1896                 do_not_touch_anything = 1
1897                 exit(rc = 1);
1898         }
1899
1900         # get cvsaddress for changelog section
1901         # using rpm macros as too lazy to add ~/.adapterrc parsing support.
1902         _cvsmaildomain = ENVIRON["_cvsmaildomain"]
1903         _cvsmailfeedback = ENVIRON["_cvsmailfeedback"]
1904
1905         prefix = ENVIRON["_prefix"]
1906         bindir = ENVIRON["_bindir"]
1907         sbindir = ENVIRON["_sbindir"]
1908         libdir = ENVIRON["_libdir"]
1909         sysconfdir = ENVIRON["_sysconfdir"]
1910         datadir = ENVIRON["_datadir"]
1911         includedir = ENVIRON["_includedir"]
1912         mandir = ENVIRON["_mandir"]
1913         infodir = ENVIRON["_infodir"]
1914         examplesdir = ENVIRON["_examplesdir"]
1915         docdir = ENVIRON["_defaultdocdir"]
1916         kdedocdir = ENVIRON["_kdedocdir"]
1917         gtkdocdir = ENVIRON["_gtkdocdir"]
1918         desktopdir = ENVIRON["_desktopdir"]
1919         pixmapsdir = ENVIRON["_pixmapsdir"]
1920         javadir = ENVIRON["_javadir"]
1921         pkgconfigdir = ENVIRON["_pkgconfigdir"]
1922         npkgconfigdir = ENVIRON["_npkgconfigdir"]
1923         localedir = ENVIRON["_localedir"]
1924
1925         perl_sitearch = ENVIRON["perl_sitearch"]
1926         perl_archlib = ENVIRON["perl_archlib"]
1927         perl_privlib = ENVIRON["perl_privlib"]
1928         perl_vendorlib = ENVIRON["perl_vendorlib"]
1929         perl_vendorarch = ENVIRON["perl_vendorarch"]
1930         perl_sitelib = ENVIRON["perl_sitelib"]
1931
1932         py_sitescriptdir = ENVIRON["py_sitescriptdir"]
1933         py_sitedir = ENVIRON["py_sitedir"]
1934         py_scriptdir = ENVIRON["py_scriptdir"]
1935         py_ver = ENVIRON["py_ver"]
1936
1937         py3_sitescriptdir = ENVIRON["py3_sitescriptdir"]
1938         py3_sitedir = ENVIRON["py3_sitedir"]
1939         py3_scriptdir = ENVIRON["py3_scriptdir"]
1940         py3_ver = ENVIRON["py3_ver"]
1941
1942         ruby_archdir = ENVIRON["ruby_archdir"]
1943         ruby_ridir = ENVIRON["ruby_ridir"]
1944         ruby_rubylibdir = ENVIRON["ruby_rubylibdir"]
1945         ruby_sitearchdir = ENVIRON["ruby_sitearchdir"]
1946         ruby_sitelibdir = ENVIRON["ruby_sitelibdir"]
1947         ruby_rdocdir = ENVIRON["ruby_rdocdir"]
1948
1949         php_pear_dir = ENVIRON["php_pear_dir"]
1950         php_data_dir = ENVIRON["php_data_dir"]
1951         tmpdir = ENVIRON["tmpdir"]
1952
1953         systemdunitdir = ENVIRON["systemdunitdir"]
1954         systemdtmpfilesdir = ENVIRON["systemdtmpfilesdir"]
1955 }
1956
1957 # php virtual deps as discussed in devel-en
1958 function replace_php_virtual_deps() {
1959         pkg = $2
1960 #       if (pkg == "php-program") {
1961 #               $0 = $1 "\t/usr/bin/php"
1962 #               return
1963 #       }
1964
1965 #       if (pkg ~ /^php-[a-z]/ && pkg !~ /^php-(pear|common|cli|devel|fcgi|cgi|dirs|program|pecl-)/) {
1966 #               sub(/^php-/, "php(", pkg);
1967 #               sub(/$/, ") # verify this correctness -- it may be wanted to use specific not virtual dep", pkg);
1968 #               $2 = pkg
1969 #       }
1970
1971         if (pkg ~/^php$/) {
1972                 $2 = "webserver(php)";
1973                 if ($4 ~ /^[0-9]:/) {
1974                         $4 = substr($4, 3);
1975                 }
1976         }
1977
1978         if (pkg ~/^php4$/) {
1979                 $2 = "webserver(php)";
1980                 if ($4 ~ /^[0-9]:/) {
1981                         $4 = substr($4, 3);
1982                 }
1983         }
1984 }
1985
1986 function replace_groupnames(group) {
1987         group = replace(group, "Amusements/Games", "Applications/Games");
1988         group = replace(group, "Amusements/Games/Strategy/Real Time", "X11/Applications/Games/Strategy");
1989         group = replace(group, "Application/Multimedia", "Applications/Multimedia");
1990         group = replace(group, "Application/System", "Applications/System");
1991         group = replace(group, "Applications/Compilers", "Development/Languages");
1992         group = replace(group, "Applications/Daemons", "Daemons");
1993         group = replace(group, "Applications/Internet", "Applications/Networking");
1994         group = replace(group, "Applications/Internet/Peer to Peer", "Applications/Networking");
1995         group = replace(group, "Applications/Productivity", "X11/Applications");
1996         group = replace(group, "Applications/Security", "Applications/System");
1997         group = replace(group, "Applications/Web", "Applications/WWW");
1998         group = replace(group, "Database", "Applications/Databases");
1999         group = replace(group, "Development/C", "Development/Libraries");
2000         group = replace(group, "Development/Code Generators", "Development");
2001         group = replace(group, "Development/Docs", "Documentation");
2002         group = replace(group, "Development/Documentation", "Documentation");
2003         group = replace(group, "Development/Java", "Development/Languages/Java");
2004         group = replace(group, "Development/Languages/C and C++", "Libraries");
2005         group = replace(group, "Development/Languages/Other", "Development/Languages");;
2006         group = replace(group, "Development/Languages/Ruby", "Development/Languages");
2007         group = replace(group, "Development/Libraries/C and C++", "Development/Libraries");
2008         group = replace(group, "Development/Libraries/Java", "Development/Languages/Java");
2009         group = replace(group, "Development/Libraries/Python", "Development/Languages/Python");
2010         group = replace(group, "Development/Libraries/TCL", "Development/Languages/Tcl");;
2011         group = replace(group, "Development/Other", "Development");
2012         group = replace(group, "Development/Python", "Development/Languages/Python");
2013         group = replace(group, "Development/Testing", "Development");
2014         group = replace(group, "Editors", "Applications/Text");
2015         group = replace(group, "Emulators", "Applications/Emulators");
2016         group = replace(group, "File tools", "Applications/File");
2017         group = replace(group, "Games", "Applications/Games");
2018         group = replace(group, "Library/Development", "Development/Libraries");
2019         group = replace(group, "Networking/Deamons", "Networking/Daemons");
2020         group = replace(group, "Networking/Mail", "Applications/Mail");
2021         group = replace(group, "Networking/Other", "Networking");
2022         group = replace(group, "Productivity/Databases/Servers", "Applications/Databases");
2023         group = replace(group, "Productivity/Multimedia/Other", "X11/Applications/Multimedia");
2024         group = replace(group, "Productivity/Networking/Web/Servers", "Networking/Daemons/HTTP");;
2025         group = replace(group, "Shells", "Applications/Shells");
2026         group = replace(group, "System Environment/Base", "Base");
2027         group = replace(group, "System Environment/Daemons", "Daemons");
2028         group = replace(group, "System Environment/Kernel", "Base/Kernel");
2029         group = replace(group, "System Environment/Libraries", "Libraries");
2030         group = replace(group, "System Tools", "Applications/System");
2031         group = replace(group, "System", "Base");
2032         group = replace(group, "System/Base", "Base");
2033         group = replace(group, "System/Kernel and hardware", "Base/Kernel");
2034         group = replace(group, "System/Libraries", "Libraries");
2035         group = replace(group, "System/Servers", "Daemons");
2036         group = replace(group, "Text Processing/Markup/HTML", "Applications/Text");
2037         group = replace(group, "Text Processing/Markup/XML", "Applications/Text");
2038         group = replace(group, "Text tools", "Applications/Text");
2039         group = replace(group, "User Interface/Desktops", "X11/Applications");
2040         group = replace(group, "User Interface/X", "X11/Applications");
2041         group = replace(group, "Utilities/System", "Applications/System");
2042         group = replace(group, "Web/Database", "Applications/WWW");
2043         group = replace(group, "X11/GNOME", "X11/Applications");
2044         group = replace(group, "X11/GNOME/Applications", "X11/Applications");
2045         group = replace(group, "X11/GNOME/Development/Libraries", "X11/Development/Libraries");
2046         group = replace(group, "X11/Games", "X11/Applications/Games");
2047         group = replace(group, "X11/Games/Strategy", "X11/Applications/Games/Strategy");
2048         group = replace(group, "X11/Library", "X11/Libraries");
2049         group = replace(group, "X11/Utilities", "X11/Applications");
2050         group = replace(group, "X11/XFree86", "X11");
2051         group = replace(group, "X11/Xserver", "X11/Servers");
2052
2053         return group;
2054 }
2055
2056 function replace_requires() {
2057
2058         sub(/^python-setuptools-devel$/, "python-distribute", $2);
2059         sub(/^gcc-g77/, "gcc-fortran", $2);
2060
2061         # use virtual, not package name
2062         sub(/^rpm-build-macros$/, "rpmbuild(macros)", $2);
2063
2064         # bad package.xml, see http://pear.php.net/bugs/bug.php?id=17779
2065         sub(/^php-php-gtk/, "php-gtk2", $2);
2066
2067         # jpackages / fedora java packages
2068         sub(/^antlr3$/, "java-antlr3", $2);
2069         sub(/^aqute-bnd$/, "java-bnd", $2);
2070         sub(/^avalon-framework$/, "java-avalon-framework", $2);
2071         sub(/^avalon-logkit$/, "java-avalon-logkit", $2);
2072         sub(/^axis$/, "java-axis", $2);
2073         sub(/^bouncycastle$/, "java-bcprov", $2);
2074         sub(/^bouncycastle-mail$/, "java-bcmail", $2);
2075         sub(/^bouncycastle-pg$/, "java-bcpg", $2);
2076         sub(/^bouncycastle-tsp$/, "java-bctsp", $2);
2077         sub(/^bsf$/, "java-bsf", $2);
2078         sub(/^dom4j$/, "java-dom4j", $2);
2079         sub(/^flute$/, "java-flute", $2);
2080         sub(/^gnu-regexp$/, "java-gnu-regexp", $2);
2081         sub(/^gnu.regexp$/, "java-gnu-regexp", $2);
2082         sub(/^hamcrest$/, "java-hamcrest", $2);
2083         sub(/^itext$/, "java-itext", $2);
2084         sub(/^jaas$/, "java(jaas)", $2);
2085         sub(/^jaf$/, "java(jaf)", $2);
2086         sub(/^jakarta-ant$/, "ant", $2);
2087         sub(/^jakarta-commons-codec$/, "java-commons-codec", $2);
2088         sub(/^jakarta-commons-httpclient$/, "java-commons-httpclient", $2);
2089         sub(/^jakarta-commons-logging$/, "java-commons-logging", $2);
2090         sub(/^jakarta-log4j$/, "java-log4j", $2);
2091         sub(/^jakarta-oro$/, "java-oro", $2);
2092         sub(/^jakarta-servletapi$/, "java(servlet)", $2);
2093         sub(/^java-devel$/, "jdk", $2);
2094         sub(/^java\(JSP\)$/, "java(jsp)", $2);
2095         sub(/^java\(JavaServerFaces\)$/, "java(javaserverfaces)", $2);
2096         sub(/^java\(Portlet\)$/, "java(portlet)", $2);
2097         sub(/^java\(Servlet\)$/, "java(servlet)", $2);
2098         sub(/^javamail$/, "java(javamail)", $2);
2099         sub(/^jaxp$/, "java(jaxp)", $2);
2100         sub(/^jaxp_parser_impl$/, "java(jaxp_parser_impl)", $2);
2101         sub(/^jaxp_transform_impl$/, "java(jaxp_transform_impl)", $2);
2102         sub(/^jce$/, "java(jce)", $2);
2103         sub(/^jcommon$/, "java-jcommon", $2);
2104         sub(/^jdbc-stdext$/, "java(jdbc-stdext)", $2);
2105         sub(/^jdepend$/, "java-jdepend", $2);
2106         sub(/^jfreechart$/, "java-jfreechart", $2);
2107         sub(/^jmx$/, "java(jmx)", $2);
2108         sub(/^jndi$/, "java(jndi)", $2);
2109         sub(/^jsch$/, "java-jsch", $2);
2110         sub(/^jsse$/, "java(jsse)", $2);
2111         sub(/^jta$/, "java(jta)", $2);
2112         sub(/^junit$/, "java-junit", $2);
2113         sub(/^junit4$/, "java-junit", $2);
2114         sub(/^ldapjdk$/, "ldapsdk", $2);
2115         sub(/^libbase$/, "java-libbase", $2);
2116         sub(/^libfonts$/, "java-libfonts", $2);
2117         sub(/^libformula$/, "java-libformula", $2);
2118         sub(/^liblayout$/, "java-liblayout", $2);
2119         sub(/^libloader$/, "java-libloader", $2);
2120         sub(/^librepository$/, "java-librepository", $2);
2121         sub(/^libserializer$/, "java-libserializer", $2);
2122         sub(/^log4j$/, "java-log4j", $2);
2123         sub(/^logging-log4j$/, "java-log4j", $2);
2124         sub(/^oro$/, "java-oro", $2);
2125         sub(/^pdf-renderer$/, "java-pdf-renderer", $2);
2126         sub(/^pentaho-libxml$/, "java-libxml", $2);
2127         sub(/^rhino$/, "java-rhino", $2);
2128         sub(/^sac$/, "java-sac", $2);
2129         sub(/^saxon-scripts$/, "saxon", $2);
2130         sub(/^servlet$/, "java(servlet)", $2);
2131         sub(/^uddi4j$/, "java-uddi4j", $2);
2132         sub(/^ws-jaxme$/, "java-jaxme", $2);
2133         sub(/^wsdl4j$/, "java-wsdl4j", $2);
2134         sub(/^xalan-j$/, "java-xalan", $2);
2135         sub(/^xalan-j2$/, "java-xalan", $2);
2136         sub(/^xerces-j$/, "java-xerces", $2);
2137         sub(/^xerces-j2$/, "java-xerces", $2);
2138         sub(/^xml-commons-apis$/, "java-xml-commons", $2);
2139         sub(/^xml-commons-resolver$/, "java-xml-commons-resolver", $2);
2140         sub(/^xmldb-api$/, "java-xmldb", $2);
2141         sub(/^xmldb-api-sdk$/, "java-xmldb-sdk", $2);
2142
2143         # fedora / redhat
2144         sub(/^Django$/, "python-django", $2);
2145         sub(/^GitPython$/, "python-git", $2);
2146         sub(/^PyQt4-devel$/, "python-PyQt4-devel", $2);
2147         sub(/^PyQwt-devel$/, "python-PyQwt-devel", $2);
2148         sub(/^ccid$/, "pcsc-driver-ccid", $2);
2149         sub(/^chkconfig$/, "/sbin/chkconfig", $2);
2150         sub(/^db4-devel$/, "db-devel", $2);
2151         sub(/^dbus-python$/, "python-dbus", $2);
2152         sub(/^desktop-notification-daemon$/, "dbus(org.freedesktop.Notifications)", $2);
2153         sub(/^file-devel$/, "libmagic-devel", $2);
2154         sub(/^freetype2-devel$/, "freetype-devel", $2);
2155         sub(/^fuse-devel$/, "libfuse-devel", $2);
2156         sub(/^gamin-python$/, "python-gamin", $2);
2157         sub(/^gcc-c\+\+$/, "libstdc++-devel", $2);
2158         sub(/^gnome-desktop3-devel$/, "gnome-desktop-devel", $2);
2159         sub(/^gnome-python2-extras$/, "python-gnome-extras", $2);
2160         sub(/^gnome-python2-gconf$/, "python-gnome-gconf", $2);
2161         sub(/^gnome-python2-gnomekeyring$/, "python-gnome-desktop-keyring", $2);
2162         sub(/^gnome-python2-gtkspell$/, "python-gnome-extras-gtkspell", $2);
2163         sub(/^gtk-sharp2-devel$/, "dotnet-gtk-sharp2-devel", $2);
2164         sub(/^gtk2$/, "gtk+2", $2);
2165         sub(/^gtk2-devel$/, "gtk+2-devel", $2);
2166         sub(/^gtk3-devel$/, "gtk+3-devel", $2);
2167         sub(/^initscripts$/, "rc-scripts", $2);
2168         sub(/^iproute$/, "iproute2", $2);
2169         sub(/^iscsi-initiator-utils$/, "open-iscsi", $2);
2170         sub(/^keyutils-libs-devel$/, "keyutils-devel", $2);
2171         sub(/^libSM-devel$/, "xorg-lib-libSM-devel", $2);
2172         sub(/^libX11-devel$/, "xorg-lib-libX11-devel", $2);
2173         sub(/^libXScrnSaver-devel$/, "xorg-lib-libXScrnSaver-devel", $2);
2174         sub(/^libXau-devel$/, "xorg-lib-libXau-devel", $2);
2175         sub(/^libXcomposite-devel$/, "xorg-lib-libXcomposite-devel", $2);
2176         sub(/^libXcursor-devel$/, "xorg-lib-libXcursor-devel", $2);
2177         sub(/^libXdamage-devel$/, "xorg-lib-libXdamage-devel", $2);
2178         sub(/^libXext-devel$/, "xorg-lib-libXext-devel", $2);
2179         sub(/^libXft-devel$/, "xorg-lib-libXft-devel", $2);
2180         sub(/^libXinerama-devel$/, "xorg-lib-libXinerama-devel", $2);
2181         sub(/^libXrandr-devel$/, "xorg-lib-libXrandr-devel", $2);
2182         sub(/^libXrender-devel$/, "xorg-lib-libXrender-devel", $2);
2183         sub(/^libXxf86vm-devel$/, "xorg-lib-libXxf86vm-devel", $2);
2184         sub(/^libacl-devel$/, "acl-devel", $2);
2185         sub(/^libcurl-devel$/, "curl-devel", $2);
2186         sub(/^libgudev1-devel$/, "udev-glib-devel", $2);
2187         sub(/^libmx-devel$/, "mx-devel", $2);
2188         sub(/^libselinux-python$/, "python-selinux", $2);
2189         sub(/^libsrtp-devel$/, "srtp-devel", $2);
2190         sub(/^libtdb$/, "tdb", $2);
2191         sub(/^libtdb-devel$/, "tdb-devel", $2);
2192         sub(/^libtevent$/, "tevent", $2);
2193         sub(/^libtevent-devel$/, "tevent-devel", $2);
2194         sub(/^libusb1-devel$/, "libusb-devel", $2);
2195         sub(/^mod_wsgi$/, "apache-mod_wsgi", $2);
2196         sub(/^newt-python$/, "python-snack", $2);
2197         sub(/^notify-python$/, "python-pynotify", $2);
2198         sub(/^pcsc-lite-ccid$/, "pcsc-driver-ccid", $2);
2199         sub(/^pulseaudio-libs-devel$/, "pulseaudio-devel", $2);
2200         sub(/^pyOpenSSL$/, "python-pyOpenSSL", $2);
2201         sub(/^pycairo$/, "python-pycairo", $2);
2202         sub(/^pyflakes$/, "python-pyflakes", $2);
2203         sub(/^pygobject2$/, "python-pygobject", $2);
2204         sub(/^pygobject3-devel$/, "python-pygobject3-common-devel", $2);
2205         sub(/^pygtk2$/, "python-pygtk", $2);
2206         sub(/^pygtk2-devel$/, "python-pygtk-devel", $2);
2207         sub(/^pygtk2-libglade$/, "python-pygtk-glade", $2);
2208         sub(/^pysvn$/, "python-pysvn", $2);
2209         sub(/^pytalloc$/, "python-talloc", $2);
2210         sub(/^pytalloc-devel$/, "python-talloc-devel", $2);
2211         sub(/^python-cups$/, "python-pycups", $2);
2212         sub(/^python-enchant$/, "python-pyenchant", $2);
2213         sub(/^python-imaging$/, "python-PIL", $2);
2214         sub(/^python-imaging-tk$/, "python-PIL-tk", $2);
2215         sub(/^python-newt$/, "python-snack", $2);
2216         sub(/^python-pygtk$/, "python-pygtk-gtk", $2);
2217         sub(/^python-recaptcha-client$/, "python-recaptcha", $2);
2218         sub(/^python-twisted-core$/, "python-TwistedCore", $2);
2219         sub(/^python-twisted-core$/, "python-TwistedCore", $2);
2220         sub(/^python-twisted-names$/, "python-TwistedNames", $2);
2221         sub(/^python2-devel$/, "python-devel", $2);
2222         sub(/^pytz$/, "python-pytz", $2);
2223         sub(/^qt4-devel$/, "qt4-build", $2);
2224         sub(/^qt4-webkit-devel$/, "QtWebKit-devel", $2);
2225         sub(/^qtlockedfile-devel$/, "QtLockedFile-devel", $2);
2226         sub(/^qtsingleapplication-devel$/, "QtSingleApplication-devel", $2);
2227         sub(/^rpm-python$/, "python-rpm", $2);
2228         sub(/^sip-devel$/, "python-sip-devel", $2);
2229         sub(/^tftp-server$/, "tftpdaemon", $2);
2230         sub(/^tkinter$/, "python-tkinter", $2);
2231         sub(/^urw-fonts$/, "fonts-Type1-urw", $2);
2232         sub(/^webkitgtk3-devel$/, "gtk-webkit3-devel", $2);
2233         sub(/^xapian-bindings-python$/, "python-xapian", $2);
2234         sub(/^xorg-x11-server-sdk$/, "xorg-xserver-server-devel", $2);
2235
2236         # mandriva
2237         sub(/^python-gobject-devel$/, "python-pygobject-devel", $2);
2238         sub(/^python-pyrex$/, "python-Pyrex", $2);
2239         sub(/^webkitgtk-devel$/, "gtk-webkit-devel", $2);
2240         sub(/^python-curl$/, "python-pycurl", $2);
2241         sub(/^python-webkitgtk$/, "python-pywebkitgtk", $2);
2242         sub(/^pygtk2.0$/, "python-pygtk-gtk", $2);
2243         sub(/^gnome-python-gconf$/, "python-gnome-gconf", $2);
2244
2245         # debian / ubuntu
2246         sub(/^blkid-dev$/, "libblkid-devel", $2);
2247         sub(/^ext2fs-dev$/, "e2fsprogs-devel", $2);
2248         sub(/^libao-dev$/, "libao-devel", $2);
2249         sub(/^libboost-filesystem[0-9.]+-dev$/, "boost-devel", $2);
2250         sub(/^libboost-program-options[0-9.]+-dev$/, "boost-devel", $2);
2251         sub(/^libboost-regex[0-9.]+-dev$/, "boost-devel", $2);
2252         sub(/^libboost-thread[0-9.]+-dev$/, "boost-devel", $2);
2253         sub(/^libcurl4-openssl-dev$/, "curl-devel", $2);
2254         sub(/^libdnet-dev$/, "libdnet-devel", $2);
2255         sub(/^libesd0-dev$/, "esound-devel", $2);
2256         sub(/^libfishsound1-dev$/, "libfishsound-devel", $2);
2257         sub(/^libgconf2-dev$/, "GConf2-devel", $2);
2258         sub(/^libgl1-mesa-dev$/, "OpenGL-devel", $2);
2259         sub(/^libgl1-mesa-dri$/, "OpenGL", $2);
2260         sub(/^libglib2.0-dev$/, "glib2-devel", $2);
2261         sub(/^libglu1-mesa-dev$/, "OpenGL-GLU-devel", $2);
2262         sub(/^libgtk2.0-dev$/, "gtk+2-devel", $2);
2263         sub(/^libhunspell-dev$/, "hunspell-devel", $2);
2264         sub(/^libmcrypt-dev$/, "libmcrypt-devel", $2);
2265         sub(/^libmhash-dev$/, "mhash-devel", $2);
2266         sub(/^liboggz1-dev$/, "libggz-devel", $2);
2267         sub(/^libpango1.0-dev$/, "pango-devel", $2);
2268         sub(/^libqt4-dev$/, "qt4-build", $2);
2269         sub(/^libshout3-dev$/, "libshout-devel", $2);
2270         sub(/^libslp-dev$/, "openslp-devel", $2);
2271         sub(/^libsndfile1-dev$/, "libsndfile-devel", $2);
2272         sub(/^libspeex-dev$/, "speex-devel", $2);
2273         sub(/^libssl-dev$/, "openssl-devel", $2);
2274         sub(/^libvorbis-dev$/, "libvorbis-devel", $2);
2275         sub(/^libxslt1-dev$/, "libxslt-devel", $2);
2276         sub(/^libxss-dev$/, "xorg-lib-libXScrnSaver-devel", $2);
2277         sub(/^mesa-common-dev$/, "OpenGL-devel", $2);
2278         sub(/^libudev$/, "udev-libs", $2);
2279         sub(/^tcp_wrappers-devel$/, "libwrap-devel", $2);
2280         sub(/^vala-tools$/, "vala", $2);
2281         sub(/^vala-devel$/, "vala", $2);
2282
2283         # altlinux
2284         sub(/^libatk-devel$/, "atk-devel", $2);
2285         sub(/^libgit-devel$/, "git-core-devel", $2);
2286         sub(/^libgtk\+2-devel$/, "gtk+2-devel", $2);
2287         sub(/^libncurses-devel$/, "ncurses-devel", $2);
2288         sub(/^libncursesxx-devel$/, "ncurses-c++-devel", $2);
2289         sub(/^libpango-devel$/, "pango-devel", $2);
2290         sub(/^libpcre-devel$/, "pcre-devel", $2);
2291         sub(/^libpopt-devel$/, "popt-devel", $2);
2292         sub(/^libssl-devel$/, "openssl-devel", $2);
2293
2294         # suse
2295         sub(/^alsa-devel$/, "alsa-lib-devel", $2);
2296         sub(/^gtk-sharp2$/, "dotnet-gtk-sharp2", $2);
2297         sub(/^gtkmm2-devel$/, "gtkmm-devel", $2);
2298         sub(/^libexpat-devel$/, "expat-devel", $2);
2299         sub(/^libffmpeg-devel$/, "ffmpeg-devel", $2);
2300         sub(/^libopenssl-devel$/, "openssl-devel", $2);
2301         sub(/^libpulse-devel$/, "pulseaudio-devel", $2);
2302         sub(/^monodoc-core$/, "mono-monodoc", $2);
2303         sub(/^python-gtk$/, "python-pygtk-gtk", $2);
2304
2305         replace_php_virtual_deps()
2306 }
2307
2308 # vim:ts=4:sw=4
This page took 0.236099 seconds and 4 git commands to generate.