]> git.pld-linux.org Git - packages/rpm-build-tools.git/blob - adapter.awk
- drop Icon:
[packages/rpm-build-tools.git] / adapter.awk
1 #!/bin/awk -f
2 #
3 # This is adapter v0.27. Adapter adapts .spec files for PLD Linux.
4 #
5 # Copyright (C) 1999-2005 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 #       Elan Ruusamä¤e <glen@pld-linux.org>
13 #
14 # See cvs log adapter{,.awk} for list of contributors
15 #
16 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
17
18 # TODO
19 # - parse ../PLD-doc/BuildRequires.txt and setup proper BR epoches?
20 # - add "-nc" option to skip CVS interaction
21 # - sort Summary(XX)
22 # - sort Requires, BuildRequires
23 # - check if %description (lang=C) contains 8bit
24 # - desc wrapping is totally fucked up on global.spec,1.25, dosemu.spec,1.115-
25
26 BEGIN {
27         RPM_SECTIONS = "package|build|changelog|clean|description|install|post|posttrans|postun|pre|prep|pretrans|preun|triggerin|triggerpostun|triggerun"
28         SECTIONS = "^%(" RPM_SECTIONS ")"
29
30         PREAMBLE_TAGS = "(Summary|Name|Version|Release|License|Group|URL|BuildArch|BuildRoot|Obsoletes|Conflicts|Provides|ExclusiveArch|ExcludeArch|PreReq|(Build)?Requires)"
31
32         preamble = 1            # Is it part of preamble? Default - yes
33         boc = 4                 # Beginning of %changelog
34         bod = 0                 # Beginning of %description
35         tw = 70                 # Descriptions width
36
37         b_idx = 0               # index of BR/R arrays
38
39         # If variable removed, then 1 (for removing it from export)
40         removed["LDFLAGS"] = 0
41         removed["CFLAGS"] = 0
42         removed["CXXFLAGS"] = 0
43
44         # get cvsaddress for changelog section
45         # using rpm macros as too lazy to add ~/.adapterrc parsing support.
46         "rpm --eval '%{?_cvsmaildomain}%{!?_cvsmaildomain:@pld-linux.org}'" | getline _cvsmaildomain
47         "rpm --eval '%{?_cvsmailfeedback}%{!?_cvsmailfeedback:PLD Team <feedback@pld-linux.org>}'" | getline _cvsmailfeedback
48
49         # If 1, we are inside of comment block (started with /^#%/)
50         comment_block = 0
51
52         # File with rpm groups
53         "rpm --eval %_sourcedir" | getline groups_file
54         groups_file = groups_file "/rpm.groups"
55         system("cd `rpm --eval %_sourcedir`; [ -f rpm.groups ] || cvs up rpm.groups >/dev/null")
56
57         # Temporary file for changelog section
58         changelog_file = ENVIRON["HOME"] "/tmp/adapter.changelog"
59
60         # Load rpm macros
61         "rpm --eval %_prefix"   | getline prefix
62         "rpm --eval %_bindir"   | getline bindir
63         "rpm --eval %_sbindir"  | getline sbindir
64         "rpm --eval %_libdir"   | getline libdir
65         "rpm --eval %_sysconfdir" | getline sysconfdir
66         "rpm --eval %_datadir"  | getline datadir
67         "rpm --eval %_includedir" | getline includedir
68         "rpm --eval %_mandir"   | getline mandir
69         "rpm --eval %_infodir"  | getline infodir
70         "rpm --eval %_examplesdir"      | getline examplesdir
71         "rpm --eval %_defaultdocdir"    | getline docdir
72
73         "rpm --eval %perl_sitearch" | getline perl_sitearch
74         "rpm --eval %perl_archlib" | getline perl_archlib
75         "rpm --eval %perl_privlib" | getline perl_privlib
76         "rpm --eval %perl_vendorlib" | getline perl_vendorlib
77         "rpm --eval %perl_vendorarch" | getline perl_vendorarch
78         "rpm --eval %perl_sitelib" | getline perl_sitelib
79
80         "rpm --eval %py_sitescriptdir" | getline py_sitescriptdir
81 }
82
83 # There should be a comment with CVS keywords on the first line of file.
84 FNR == 1 {
85         if (!/# \$Revision:/)   # If this line is already OK?
86                 print "# $" "Revision:$, " "$" "Date:$" # No
87         else {
88                 print $0                                # Yes
89                 next            # It is enough for first line
90         }
91 }
92
93 # If the latest line matched /%files/
94 defattr == 1 {
95         if (ENVIRON["SKIP_DEFATTR"] != 1) {
96                 if ($0 !~ /defattr/) {  # If no %defattr
97                         print "%defattr(644,root,root,755)"     # Add it
98                 } else {
99                         $0 = "%defattr(644,root,root,755)"      # Correct mistakes (if any)
100                 }
101         }
102         defattr = 0
103 }
104
105 function b_makekey(a, b,        s) {
106         s = a "" b;
107         # kill bcond
108     gsub(/[#%]+{[!?]+[_a-zA-Z0-9]+:/, "", s);
109
110         # kill commented out items
111     gsub(/^#[ \t]*/, "", s);
112
113         # force order
114     gsub(/^Summary\(/, "11Summary(", s);
115     gsub(/^Summary/, "10Summary", s);
116     gsub(/^Name/, "2Name", s);
117     gsub(/^Version/, "3Version", s);
118     gsub(/^Release/, "4Release", s);
119     gsub(/^License/, "5License", s);
120     gsub(/^Group/, "6Group", s);
121     gsub(/^URL/, "7URL", s);
122
123     gsub(/^BuildRequires/, "B1BuildRequires", s);
124     gsub(/^BuildConflicts/, "B2BuildConflicts", s);
125     gsub(/^Provides/, "X1Provides", s);
126     gsub(/^Obsoletes/, "X2Obsoletes", s);
127     gsub(/^Conflicts/, "X3Conflicts", s);
128     gsub(/^BuildArch/, "X4BuildArch", s);
129     gsub(/^ExclusiveArch/, "X6ExclusiveArch", s);
130     gsub(/^ExcludeArch/, "X7ExcludeArch", s);
131     gsub(/^BuildRoot/, "X9BuildRoot", s);
132
133 #       printf("%s -> %s\n", a""b, s);
134         return s;
135 }
136
137 # Comments
138 /^#/ && (description == 0) {
139         if (/This file does not like to be adapterized!/) {
140                 print                   # print this message
141                 while (getline)         # print the rest of spec as it is
142                         print
143                 do_not_touch_anything = 1 # do not touch anything in END()
144                 exit 0
145         }
146
147         # Generally, comments are printed without touching
148         sub(/[ \t]+$/, "")
149
150         if (/Source.*md5/) {
151                 print $0
152                 next
153         }
154 }
155
156 /^%define/ {
157         # Remove defining _applnkdir (this macro has been included in rpm-3.0.4)
158         if ($2 == "_applnkdir") {
159                 next
160         }
161         if ($2 == "date") {
162                 date = 1
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                 libdir = $3
181         if ($2 ~ /_sysconfdir/) {
182                 if ($3 ~ /^%\(/) {
183                         # TODO: should escape for latter checks like: ($c ~ sysconfdir "/{?cron.")
184                         sysconfdir = "%%%%%%%%%%%%%%"
185                 } else {
186                         sysconfdir = $3
187                 }
188         }
189         if ($2 ~ /_datadir/)
190                 datadir = $3
191         if ($2 ~ /_includedir/)
192                 includedir = $3
193         if ($2 ~ /_mandir/)
194                 mandir = $3
195         if ($2 ~ /_infodir/)
196                 infodir = $3
197         if ($2 ~ /_docdir/)
198                 docdir = $3
199
200         # version related macros
201         if ($2 ~ /^_beta$/)
202                 _beta = $3
203         if ($2 ~ /^_rc$/)
204                 _rc = $3
205         if ($2 ~ /^_snap$/)
206                 _snap = $3
207
208         # these are used usually when adapterizing external spec
209         if ($2 ~ /^name$/)
210                 name = $3
211         if ($2 ~ /^version$/)
212                 version = $3
213         if ($2 ~ /^release$/)
214                 release = $3
215
216         if ($2 ~ /^mod_name$/)
217                 mod_name = $3
218
219         # do nothing further, otherwise adapter thinks we're at preamble
220         print
221         next
222 }
223
224 # Obsolete
225 /^%include.*\/usr\/lib\/rpm\/macros\.python$/ {
226         next
227 }
228
229 ################
230 # %description #
231 ################
232 /^%description/, (!/^%description/ && $0 ~ SECTIONS) {
233         preamble = 0
234
235         if (/^%description/) {
236                 bod++
237                 format_line = ""
238                 format_indent = -1
239         }
240
241         # Format description
242         if (ENVIRON["SKIP_DESC"] != 1 && description == 1 && !/^%[a-z]+/ && !/^%description/) {
243                 if (/^[ \t]*$/) {
244                         format_flush(format_line, format_indent)
245                         print ""
246                         format_line = ""
247                         format_indent = -1
248                 } else if (/^[ \t]*[-\*][ \t]*/) {
249                         format_flush(format_line, format_indent)
250                         match($0, /^[ \t]*/)
251                         format_indent = RLENGTH
252                         match($0, /^[ \t]*[-\*][ \t]/)
253                         format_line = substr($0, RLENGTH)
254                 } else
255                         format_line = format_line " " $0
256                 next
257         }
258
259         if (/^%[a-z]+/ && (!/^%description/ || bod == 2)) {
260                 if (NF > 3 && $2 == "-l") {
261                         ll = $1
262                         for (i = 4; i <= NF; i++)
263                                 ll = ll " " $i
264                         $0 = ll " -l " $3
265                 }
266                 format_flush(format_line, format_indent)
267                 if (bod == 2) {
268                         bod = 1
269                         description = 1
270                 } else {
271                         bod = 0
272                         description = 0
273                 }
274         } else
275                 description = 1
276 }
277
278 #########
279 # %prep #
280 #########
281 /^%prep/, (!/^%prep/ && $0 ~ SECTIONS) {
282         preamble = 0
283
284         use_macros()
285
286         # Add '-q' to %setup
287         if (/^%setup/ && !/-q/) {
288                 sub(/^%setup/, "%setup -q")
289         }
290
291         if (/^%setup/) {
292                 $0 = fixedsub(name, "%{name}", $0);
293                 $0 = fixedsub(version, "%{version}", $0);
294                 if (_beta) {
295                         $0 = fixedsub(_beta, "%{_beta}", $0);
296                 }
297                 if (_rc) {
298                         $0 = fixedsub(_rc, "%{_rc}", $0);
299                 }
300                 if (_snap) {
301                         $0 = fixedsub(_snap, "%{_snap}", $0);
302                 }
303         }
304
305         if (/^%setup/ && /-n %{name}-%{version}( |$)/) {
306                 $0 = fixedsub(" -n %{name}-%{version}", "", $0)
307         }
308
309         # invalid in %prep
310         sub("^rm -rf \$RPM_BUILD_ROOT.*", "");
311 }
312
313 ##########
314 # %build #
315 ##########
316 /^%build/, (!/^%build/ && $0 ~ SECTIONS) {
317         preamble = 0
318
319         use_macros()
320
321         if (/^automake$/)
322                 sub(/$/, " -a -c")
323
324         if (/LDFLAGS/) {
325                 if (/LDFLAGS="-s"/) {
326                         removed["LDFLAGS"] = 1
327                         next
328                 } else {
329                         split($0, tmp, "LDFLAGS=")
330                         count = split(tmp[2], flags, "\"")
331                         if (flags[1] != "" && flags[1] !~ "!?debug") {
332                                 sub(/-s[" ]?/, "%{rpmldflags} ", flags[1])
333                                 $0 = tmp[1] line[1] "LDFLAGS=" flags[1] "\""
334                                 for (i = 2; i < count; i++)
335                                         $0 = $0 flags[i] "\""
336                         }
337                 }
338         }
339
340         if (/CFLAGS=/)
341                 if (cflags("CFLAGS") == 0)
342                         next
343
344         if (/CXXFLAGS=/)
345                 if (cflags("CXXFLAGS") == 0)
346                         next
347
348         if (/^export /) {
349                 if (removed["LDFLAGS"])
350                         sub(" LDFLAGS", "")
351                 if (removed["CFLAGS"])
352                         sub(" CFLAGS", "")
353                 if (removed["CXXFLAGS"])
354                         sub(" CXXFLAGS", "")
355                 # Is there still something?
356                 if (/^export[ ]*$/)
357                         next
358         }
359
360         # quote CC
361         if (/CC=%{__cc} /) {
362                 sub("CC=%{__cc}", "CC=\"%{__cc}\"")
363         }
364         
365         # use PLD Linux macros
366         $0 = fixedsub("glib-gettextize --copy --force","%{__glib_gettextize}", $0);
367         $0 = fixedsub("intltoolize --copy --force", "%{__intltoolize}", $0);
368         $0 = fixedsub("automake --add-missing --copy", "%{__automake}", $0);
369         $0 = fixedsub("libtoolize -c -f --automake", "%{__libtoolize}", $0);
370         $0 = fixedsub("automake -a -c --foreign", "%{__automake}", $0);
371
372         sub(/^aclocal$/, "%{__aclocal}");
373         sub(/^autoheader$/, "%{__autoheader}");
374         sub(/^autoconf$/, "%{__autoconf}");
375         sub(/^automake$/, "%{__automake}");
376
377         # atrpms
378         $0 = fixedsub("%perl_configure", "%{__perl} Makefile.PL \\\n\tINSTALLDIRS=vendor", $0);
379         $0 = fixedsub("%perl_makecheck", "%{?with_tests:%{__make} test}", $0);
380 }
381
382 ##########
383 # %clean #
384 ##########
385 /^%clean/, (!/^%clean/ && $0 ~ SECTIONS) {
386         did_clean = 1
387
388         # prevent next section header like "%post -p /sbin/ldconfig" being adapterized
389         if (!/^%/) {
390                 use_macros()
391         }
392 }
393
394 ############
395 # %install #
396 ############
397 /^%install/, (!/^%install/ && $0 ~ SECTIONS) {
398
399         preamble = 0
400
401         if (/^[ \t]*rm([ \t]+-[rf]+)*[ \t]+\${?RPM_BUILD_ROOT}?/ && did_rmroot==0) {
402                 did_rmroot=1
403                 print "rm -rf $RPM_BUILD_ROOT"
404                 next
405         }
406
407         if (!/^(#?[ \t]*)$/ && !/^%install/ && did_rmroot==0) {
408                 print "rm -rf $RPM_BUILD_ROOT"
409                 did_rmroot=1
410         }
411
412         use_macros()
413
414         # 'install -d' instead 'mkdir -p'
415         if (/mkdir -p/)
416                 sub(/mkdir -p/, "install -d")
417
418         # 'install' instead 'cp -p'
419         if (/cp -p\b/)
420                 sub(/cp -p/, "install")
421
422         # No '-u root' or '-g root' for 'install'
423         if (/^install/ && /-[ug][ \t]*root/)
424                 gsub(/-[ug][ \t]*root /, "")
425
426         if (/^install/ && /-m[ \t]*[0-9]+/)
427                 gsub(/-m[ \t]*[0-9]+ /, "")
428
429         # No lines contain 'chown' or 'chgrp' if owner/group is 'root'
430         if (($1 ~ /chown/ && $2 ~ /root\.root/) || ($1 ~ /chgrp/ && $2 ~ /root/))
431                 next
432
433         # No lines contain 'chmod' if it sets the modes to '644'
434         if ($1 ~ /chmod/ && $2 ~ /644/)
435                 next
436
437         # foreign rpms
438         $0 = fixedsub("%buildroot", "$RPM_BUILD_ROOT", $0)
439         $0 = fixedsub("%{buildroot}", "$RPM_BUILD_ROOT", $0)
440
441         # atrpms
442         $0 = fixedsub("%perl_makeinstall", "%{__make} pure_install \\\n\tDESTDIR=$RPM_BUILD_ROOT", $0);
443 }
444
445 ##########
446 # %files #
447 ##########
448 /^%files/, (!/^%files/ && $0 ~ SECTIONS) {
449         preamble = 0
450
451         if ($0 ~ /^%files/)
452                 defattr = 1
453
454         use_files_macros()
455 }
456
457 ##############
458 # %changelog #
459 ##############
460 /^%changelog/, (!/^%changelog/ && $0 ~ SECTIONS) {
461         preamble = 0
462         has_changelog = 1
463         skip = 0
464         # There should be some CVS keywords on the first line of %changelog.
465         if (boc == 3) {
466                 if ($0 !~ _cvsmailfeedback)
467                         print "* %{date} " _cvsmailfeedback > changelog_file
468                 else
469                         skip = 1
470                 boc = 2
471         }
472         if (boc == 2 && !skip) {
473                 if (!/All persons listed below/) {
474                         printf "All persons listed below can be reached at " > changelog_file
475                         print "<cvs_login>" _cvsmaildomain "\n" > changelog_file
476                 } else
477                         skip = 1
478                 boc = 1
479         }
480         if (boc == 1 && !skip) {
481                 if (!/^$/) {
482                         if (!/\$.*Log:.*\$/)
483                                 print "$" "Log:$" > changelog_file
484                         boc = 0
485                 }
486         }
487         # Define date macro.
488         if (boc == 4) {
489                 if (date == 0) {
490                         printf "%%define date\t%%(echo `LC_ALL=\"C\"" > changelog_file
491                         print " date +\"%a %b %d %Y\"`)" > changelog_file
492                         date = 1
493                 }
494                 boc = 3
495         }
496
497         sub(/[ \t]+$/, "")
498         if (!/^%[a-z]+$/ || /changelog/)
499                 print > changelog_file
500         else
501                 print
502         next
503 }
504
505 ###########
506 # SCRIPTS #
507 ###########
508 /^%pre/, (!/^%pre/ && $0 ~ SECTIONS) {
509         preamble = 0
510
511         # %useradd and %groupadd may not be wrapped
512         if (/%(useradd|groupadd).*\\$/) {
513                 a = $0; getline;
514                 sub(/^[\s\t]*/, "");
515                 $0 = substr(a, 1, length(a) - 1) $0;
516         }
517 }
518
519 /^%post/, (!/^%post/ && $0 ~ SECTIONS) {
520         preamble = 0
521         use_macros()
522 }
523 /^%preun/, (!/^%preun/ && $0 ~ SECTIONS) {
524         preamble = 0
525 }
526 /^%postun/, (!/^%postun/ && $0 ~ SECTIONS) {
527         preamble = 0
528 }
529 /^%triggerin/, (!/^%triggerin/ && $0 ~ SECTIONS) {
530         preamble = 0
531 }
532 /^%triggerun/, (!/^%triggerun/ && $0 ~ SECTIONS) {
533         preamble = 0
534 }
535 /^%triggerpostun/, (!/^%triggerpostun/ && $0 ~ SECTIONS) {
536         preamble = 0
537 }
538 /^%pretrans/, (!/^%pretrans/ && $0 ~ SECTIONS) {
539         preamble = 0
540 }
541 /^%posttrans/, (!/^%posttrans/ && $0 ~ SECTIONS) {
542         preamble = 0
543 }
544
545 #############
546 # PREAMBLES #
547 #############
548 preamble == 1 {
549         # There should not be a space after the name of field
550         # and before the colon.
551         sub(/[ \t]*:/, ":")
552
553         if (/^%perl_module_wo_prefix/) {
554                 name = $2
555                 version = $3
556                 release = "0." fixedsub(".%{disttag}.at", "", $4)
557         }
558
559         field = tolower($1)
560         fieldnlower = $1
561         if (field ~ /summary:/ && !/etc\.$/) {
562                 sub(/\.$/, "", $0);
563         }
564         if (field ~ /group(\([^)]+\)):/)
565                 next
566         if (field ~ /group:/) {
567                 format_preamble()
568                 group = $0;
569                 sub(/^[^ \t]*[ \t]*/, "", group);
570
571                 sub(/^Utilities\//,"Applications/", group)
572                 sub(/^Games/,"Applications/Games", group)
573                 sub(/^X11\/Games/,"X11/Applications/Games", group)
574                 sub(/^X11\/GNOME\/Development\/Libraries/,"X11/Development/Libraries", group)
575                 sub(/^X11\/GNOME\/Applications/,"X11/Applications", group)
576                 sub(/^X11\/GNOME/,"X11/Applications", group)
577                 sub(/^X11\/Utilities/,"X11/Applications", group)
578                 sub(/^X11\/Games\/Strategy/,"X11/Applications/Games/Strategy", group)
579                 sub(/^Shells/,"Applications/Shells", group)
580                 sub(/^System Environment\/Libraries$/, "Libraries", group)
581                 sub(/^System Environment\/Daemons$/, "Daemons", group)
582                 sub(/^Applications\/Internet$/, "Applications/Networking", group)
583                 sub(/^Applications\/Daemons$/, "Daemons", group)
584                 sub(/^Application\/Multimedia$/, "Applications/Multimedia", group)
585                 sub(/^System\/Servers$/, "Daemons", group)
586                 sub(/^X11\/Xserver$/, "X11/Servers", group)
587                 sub(/^X11\/XFree86/, "X11", group)
588                 sub(/^Applications\/Compilers$/, "Development/Languages", group)
589                 sub(/^Applications\/Internet\/Peer to Peer/, "Applications/Networking", group)
590                 sub(/^Networking\/Deamons$/, "Networking/Daemons", group)
591                 sub(/^Development\/Docs$/, "Documentation", group)
592
593                 $0 = "Group:\t\t" group
594
595                 if (group ~ /^X11/ && x11 == 0) # Is it X11 application?
596                         x11 = 1
597
598                 byl_plik_z_groupmi = 0
599                 byl_opis_grupy = 0
600                 while ((getline linia_grup < groups_file) > 0) {
601                         byl_plik_z_groupmi = 1
602                         if (linia_grup == group) {
603                                 byl_opis_grupy = 1
604                                 break
605                         }
606                 }
607
608                 if (!byl_plik_z_groupmi)
609                         print "######\t\t" groups_file ": no such file"
610                 else if (!byl_opis_grupy)
611                         print "######\t\t" "Unknown group!"
612
613                 close(groups_file)
614         }
615
616         if (field ~ /prereq:/) {
617                 sub(/PreReq:/, "Requires:", $1);
618         }
619
620         # split (build)requires, obsoletes on commas
621         if (field ~ /(obsoletes|requires):/ && NF > 2) {
622                 value = substr($0, index($0, $2));
623                 $0 = format_requires($1, value);
624         }
625
626         # obsolete/unwanted tags
627         if (field ~ /packager:|distribution:|docdir:|prefix:|icon:/) {
628                 next
629         }
630
631         if (field ~ /buildroot:/)
632                 $0 = $1 "%{tmpdir}/%{name}-%{version}-root-%(id -u -n)"
633
634         # Use "License" instead of "Copyright" if it is (L)GPL or BSD
635         if (field ~ /copyright:/ && $2 ~ /GPL|BSD/)
636                 $1 = "License:"
637
638         if (field ~ /name:/) {
639                 if ($2 == "%{name}" && name) {
640                         $2 = name
641                 }
642                 name = $2
643                 name_seen = 1;
644         }
645
646         if (field ~ /version:/) {
647                 if ($2 == "%{version}" && version) {
648                         $2 = version
649                 }
650                 version = $2
651                 version_seen = 1;
652         }
653
654         if (field ~ /release:/) {
655                 if ($2 == "%{release}" && release) {
656                         $2 = release
657                 }
658                 release = $2
659                 release_seen = 1;
660         }
661
662         if (field ~ /serial:/)
663                 $1 = "Epoch:"
664
665         # proper caps
666         if (field ~ /^url:$/)
667                 $1 = "URL:"
668
669         # Use %{name} and %{version} in the filenames in "Source:"
670         if (field ~ /^source/ || field ~ /patch/) {
671                 n = split($2, url, /\//)
672                 if (url[n] ~ /\.gz$/) {
673                         url[n+1] = ".gz" url[n+1]
674                         sub(/\.gz$/,"",url[n])
675                 }
676                 if (url[n] ~ /\.zip$/) {
677                         url[n+1] = ".zip" url[n+1]
678                         sub(/\.zip$/,"",url[n])
679                 }
680                 if (url[n] ~ /\.tar$/) {
681                         url[n+1] = ".tar" url[n+1]
682                         sub(/\.tar$/,"",url[n])
683                 }
684                 if (url[n] ~ /\.patch$/) {
685                         url[n+1] = ".patch" url[n+1]
686                         sub(/\.patch$/,"",url[n])
687                 }
688                 if (url[n] ~ /\.bz2$/) {
689                         url[n+1] = ".bz2" url[n+1]
690                         sub(/\.bz2$/,"",url[n])
691                 }
692                 if (url[n] ~ /\.logrotate$/) {
693                         url[n+1] = ".logrotate" url[n+1]
694                         sub(/\.logrotate$/,"",url[n])
695                 }
696                 if (url[n] ~ /\.pamd$/) {
697                         url[n+1] = ".pamd" url[n+1]
698                         sub(/\.pamd$/,"",url[n])
699                 }
700
701                 # allow %{name} only in last url component
702                 s = ""
703                 for (i = 1; i <= n; i++) {
704                         url[i] = fixedsub("%{name}", name, url[i])
705                         if (s) {
706                                 s = s "/" url[i]
707                         } else {
708                                 s = url[i]
709                         }
710                 }
711                 $2 = s url[n+1]
712
713                 filename = url[n]
714                 if (name) {
715                         url[n] = fixedsub(name, "%{name}", url[n])
716                 }
717                 if (field ~ /source/) {
718                         if (version) {
719                                 url[n] = fixedsub(version, "%{version}", url[n])
720                         }
721                         if (_beta) {
722                                 url[n] = fixedsub(_beta, "%{_beta}", url[n])
723                         }
724                         if (_rc) {
725                                 url[n] = fixedsub(_rc, "%{_rc}", url[n])
726                         }
727                         if (_snap) {
728                                 url[n] = fixedsub(_snap, "%{_snap}", url[n])
729                         }
730                 }
731                 $2 = fixedsub(filename, url[n], $2)
732
733                 # sourceforge urls
734                 sub("[?]use_mirror=.*$", "", $2);
735                 sub("[?]download$", "", $2);
736                 sub("^http://prdownloads\.sourceforge\.net/", "http://dl.sourceforge.net/", $2)
737
738                 sub("^http://.*\.dl\.sourceforge\.net/", "http://dl.sourceforge.net/", $2)
739                 sub("^http://dl\.sourceforge\.net/sourceforge/", "http://dl.sourceforge.net/", $2)
740                 sub("^http://dl\.sf\.net/", "http://dl.sourceforge.net/", $2)
741         }
742
743
744         if (field ~ /^source:/)
745                 $1 = "Source0:"
746
747         if (field ~ /^patch:/)
748                 $1 = "Patch0:"
749
750         kill_preamble_macros();
751         format_preamble()
752
753         if (field ~ /requires/) {
754                 # atrpms
755                 $0 = fixedsub("%{eversion}", "%{epoch}:%{version}-%{release}", $0);
756         }
757 }
758
759
760 # sort BR/R!
761 #
762 # NOTES:
763 # - mixing BR/R and anything else confuses this (all will be sorted together)
764 #   so don't do that.
765 # - comments leading the BR/R can not be associated,
766 #   so don't adapterize when the BR/R are mixed with comments
767 ENVIRON["SKIP_SORTBR"] != 1 && preamble == 1 && $0 ~ PREAMBLE_TAGS, $0 ~ PREAMBLE_TAGS {
768         if ($1 ~ /PreReq:/) {
769                 sub(/PreReq:/, "Requires:", $1);
770         }
771         format_preamble()
772 #       kill_preamble_macros(); # breaks tabbing
773
774         b_idx++;
775         l = substr($0, index($0, $2));
776         b_ktmp = b_makekey($1, l);
777         b_key[b_idx] = b_ktmp;
778         b_val[b_ktmp] = $0;
779
780         next;
781 }
782
783 /^%bcond_/ {
784         # do nothing
785         print
786         next
787 }
788
789 preamble == 1 {
790         if (b_idx > 0) {
791                 isort(b_key, b_idx);
792                 for (i = 1; i <= b_idx; i++) {
793                         print "" b_val[b_key[i]];
794                 }
795                 b_idx = 0
796         }
797 }
798
799 # main() ;-)
800 {
801         preamble = 1
802
803         sub(/[ \t]+$/, "")
804         print
805
806         if (name_seen == 0 && name) {
807                 print "Name:\t" name
808                 name_seen = 1
809         }
810
811         if (version_seen == 0 && version) {
812                 print "Version:\t" version
813                 version_seen = 1
814         }
815
816         if (release_seen == 0 && release) {
817                 print "Release:\t" release
818                 release_seen = 1
819         }
820 }
821
822
823 END {
824         if (do_not_touch_anything)
825                 exit 0
826
827         close(changelog_file)
828         while ((getline < changelog_file) > 0)
829                 print
830         system("rm -f " changelog_file)
831
832         if (did_clean == 0) {
833                 print ""
834                 print "%clean"
835                 print "rm -rf $RPM_BUILD_ROOT"
836         }
837
838         if (date == 0) {
839                 print ""
840                 print "%define date\t%(echo `LC_ALL=\"C\" date +\"%a %b %d %Y\"`)"
841         }
842
843         if (has_changelog == 0)
844                 print "%changelog"
845
846         if (boc > 2)
847                 print "* %{date} PLD Team <feedback@pld-linux.org>"
848         if (boc > 1) {
849                 printf "All persons listed below can be reached at "
850                 print "<cvs_login>@pld-linux.org\n"
851         }
852         if (boc > 0)
853                 print "$" "Log:$"
854 }
855
856 function fixedsub(s1,s2,t, ind) {
857 # substitutes fixed strings (not regexps)
858         if (ind = index(t,s1))
859                 t = substr(t, 1, ind-1) s2 substr(t, ind+length(s1))
860         return t
861 }
862
863 # There should be one or two tabs after the colon.
864 function format_preamble()
865 {
866         sub(/:[ \t]*/, ":")
867         if (match($0, /[A-Za-z0-9(),#_ \t]+[ \t]*:[ \t]*/) == 1) {
868                 if (RLENGTH < 8)
869                         sub(/:/, ":\t\t")
870                 else
871                         sub(/:/, ":\t")
872         }
873 }
874
875 # Replace directly specified directories with macros
876 function use_macros()
877 {
878         # -m, --skip-macros, --no-macros -- skip macros subst
879         if (ENVIRON["SKIP_MACROS"]) {
880                 return
881         }
882
883         gsub(perl_sitearch, "%{perl_sitearch}")
884         gsub(perl_archlib, "%{perl_archlib}")
885         gsub(perl_privlib, "%{perl_privlib}")
886         gsub(perl_vendorlib, "%{perl_vendorlib}")
887         gsub(perl_vendorarch, "%{perl_vendorarch}")
888         gsub(perl_sitelib, "%{perl_sitelib}")
889         
890         gsub(py_sitescriptdir, "%{py_sitescriptdir}")
891
892         gsub(bindir, "%{_bindir}")
893         gsub("%{prefix}/bin", "%{_bindir}")
894         if(prefix"/bin" == bindir)
895                 gsub("%{_prefix}/bin", "%{_bindir}")
896
897         for (c = 1; c <= NF; c++) {
898                 if ($c ~ sbindir "/fix-info-dir")
899                         continue;
900                 if ($c ~ sbindir "/webapp")
901                         continue;
902                 if ($c ~ sbindir "/chsh")
903                         continue;
904                 if ($c ~ sbindir "/usermod")
905                         continue;
906                 gsub(sbindir, "%{_sbindir}", $c)
907         }
908
909         gsub("%{prefix}/sbin", "%{_sbindir}")
910         if (prefix"/sbin" == sbindir)
911                 gsub("%{_prefix}/sbin", "%{_sbindir}")
912
913         for (c = 1; c <= NF; c++) {
914                 if ($c ~ sysconfdir "/{?cron.")
915                         continue;
916                 if ($c ~ sysconfdir "/{?crontab.d")
917                         continue;
918                 if ($c ~ sysconfdir "/{?env.d")
919                         continue;
920                 if ($c ~ sysconfdir "/{?logrotate.d")
921                         continue;
922                 if ($c ~ sysconfdir "/{?pam.d")
923                         continue;
924                 if ($c ~ sysconfdir "/{?profile.d")
925                         continue;
926                 if ($c ~ sysconfdir "/{?rc.d")
927                         continue;
928                 if ($c ~ sysconfdir "/{?security")
929                         continue;
930                 if ($c ~ sysconfdir "/{?skel")
931                         continue;
932                 if ($c ~ sysconfdir "/{?sysconfig")
933                         continue;
934                 if ($c ~ sysconfdir "/{?shrc.d")
935                         continue;
936                 if ($c ~ sysconfdir "/{?certs")
937                         continue;
938                 if ($c ~ sysconfdir "/{?X11")
939                         continue;
940                 if ($c ~ sysconfdir "/{?ld.so.conf.d")
941                         continue;
942                 if ($c ~ sysconfdir "/{?rpm")
943                         continue;
944                 if ($c ~ sysconfdir "/{?httpd") # temp
945                         continue;
946                 gsub(sysconfdir, "%{_sysconfdir}", $c)
947         }
948
949         gsub(docdir, "%{_docdir}")
950
951         for (c = 1; c <= NF; c++) {
952                 if ($c ~ datadir "/automake")
953                         continue;
954                 if ($c ~ datadir "/unsermake")
955                         continue;
956                 if ($c ~ datadir "/file/magic.mime")
957                         continue;
958                 gsub(datadir, "%{_datadir}", $c)
959         }
960
961         gsub("%{prefix}/share", "%{_datadir}")
962         if (prefix"/share" == datadir)
963                 gsub("%{_prefix}/share", "%{_datadir}")
964
965         # CFLAGS="-I/usr/include/ncurses is usually correct.
966         if (!/-I\/usr\/include/) {
967                 gsub(includedir, "%{_includedir}")
968         }
969
970         gsub("%{prefix}/include", "%{_includedir}")
971         if (prefix"/include" == includedir) {
972                 gsub("%{_prefix}/include", "%{_includedir}")
973         }
974
975         gsub(mandir, "%{_mandir}")
976         if ($0 !~ "%{_datadir}/manual") {
977                 gsub("%{_datadir}/man", "%{_mandir}")
978         }
979         gsub("%{_prefix}/share/man", "%{_mandir}")
980         gsub("%{prefix}/share/man", "%{_mandir}")
981         gsub("%{prefix}/man", "%{_mandir}")
982         gsub("%{_prefix}/man", "%{_mandir}")
983
984         gsub(infodir, "%{_infodir}")
985         gsub("%{prefix}/info", "%{_infodir}")
986         gsub("%{_prefix}/info", "%{_infodir}")
987
988         if (prefix !~ "/X11R6") {
989                 gsub("%{_datadir}/aclocal", "%{_aclocaldir}")
990         }
991
992         gsub(examplesdir, "%{_examplesdir}")
993
994         if (prefix != "/") {
995                 # leave --with-foo=/usr alone
996                 if ($0 !~ "--with.*=.*" prefix) {
997                         for (c = 1; c <= NF; c++) {
998                                 if ($c ~ prefix "/sbin/fix-info-dir")
999                                         continue;
1000                                 if ($c ~ prefix "/sbin/webapp")
1001                                         continue;
1002                                 if ($c ~ prefix "/sbin/chsh")
1003                                         continue;
1004                                 if ($c ~ prefix "/sbin/usermod")
1005                                         continue;
1006                                 if ($c ~ prefix "/share/automake")
1007                                         continue;
1008                                 if ($c ~ prefix "/share/unsermake")
1009                                         continue;
1010                                 if ($c ~ prefix "/lib/sendmail")
1011                                         continue;
1012                                 if ($c ~ prefix "/lib/pkgconfig")
1013                                         continue;
1014
1015                                 # CFLAGS="-I/usr..." is usually correct.
1016                                 if (/-I\/usr/)
1017                                         continue;
1018                                 # same for LDFLAGS="-L/usr..."
1019                                 if (/-L\/usr/)
1020                                         continue;
1021
1022                                 gsub(prefix, "%{_prefix}", $c)
1023                         }
1024                 }
1025                 gsub("%{prefix}", "%{_prefix}")
1026         }
1027
1028         # replace back
1029         gsub("%{_includedir}/ncurses", "/usr/include/ncurses")
1030         gsub("%{_includedir}/freetype", "/usr/include/freetype")
1031
1032         gsub("%{PACKAGE_VERSION}", "%{version}")
1033         gsub("%{PACKAGE_NAME}", "%{name}")
1034
1035         gsub("^make$", "%{__make}")
1036         gsub("^make ", "%{__make} ")
1037         gsub("^gcc ", "%{__cc} ")
1038
1039         # mandrake specs
1040         gsub("^%make$", "%{__make}")
1041         gsub("^%make ", "%{__make} ")
1042         gsub("^%makeinstall_std", "%{__make} install \\\n\tDESTDIR=$RPM_BUILD_ROOT")
1043         gsub("^%{makeinstall}", "%{__make} install \\\n\tDESTDIR=$RPM_BUILD_ROOT")
1044         gsub("^%makeinstall", "%{__make} install \\\n\tDESTDIR=$RPM_BUILD_ROOT")
1045         gsub("^%{__rm} -rf %{buildroot}", "rm -rf $RPM_BUILD_ROOT")
1046         gsub("^%{__install}", "install")
1047         gsub("^%{__rm}", "rm")
1048         gsub("%optflags", "%{rpmcflags}")
1049         gsub("%{compat_perl_vendorarch}", "%{perl_vendorarch}")
1050
1051         gsub("^%{__make} install DESTDIR=\$RPM_BUILD_ROOT", "%{__make} install \\\n\tDESTDIR=$RPM_BUILD_ROOT")
1052         gsub("^fix-info-dir$", "[ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c %{_infodir} >/dev/null 2>\&1")
1053         $0 = fixedsub("%buildroot", "$RPM_BUILD_ROOT", $0)
1054         $0 = fixedsub("%{buildroot}", "$RPM_BUILD_ROOT", $0)
1055         $0 = fixedsub("CXXFLAGS=%{rpmcflags} %configure", "CXXFLAGS=%{rpmcflags}\n%configure", $0);
1056
1057         # split configure line to multiple lines
1058         if (/%configure / && !/\\$/) {
1059                 $0 = format_configure($0);
1060         }
1061
1062         gsub("%_bindir", "%{_bindir}")
1063         gsub("%_datadir", "%{_datadir}")
1064         gsub("%_iconsdir", "%{_iconsdir}")
1065         gsub("%_sbindir", "%{_sbindir}")
1066         gsub("%_mandir", "%{_mandir}")
1067         gsub("%name", "%{name}")
1068
1069         gsub("/usr/src/linux", "%{_kernelsrcdir}")
1070         gsub("%{_prefix}/src/linux", "%{_kernelsrcdir}")
1071 }
1072
1073 function format_configure(line,         n, a, s) {
1074         n = split(line, a, / /);
1075         s = a[1] " \\\n";
1076         for (i = 2; i <= n; i++) {
1077                 s = s "\t" a[i] " \\\n"
1078         }
1079         return s
1080 }
1081
1082
1083 # insertion sort of A[1..n]
1084 # copied from mawk manual
1085 function isort(A,n,             i,j,hold) {
1086         for (i = 2; i <= n; i++) {
1087                 hold = A[j = i]
1088                 while (A[j-1] > hold) {
1089                         j-- ; A[j+1] = A[j]
1090                 }
1091                 A[j] = hold
1092         }
1093         # sentinel A[0] = "" will be created if needed
1094 }
1095
1096
1097 function use_files_macros(      i, n, t, a)
1098 {
1099         use_macros()
1100
1101         # skip comments
1102         if (/^#/) {
1103                 return;
1104         }
1105
1106         gsub("^%{_sbindir}", "%attr(755,root,root) %{_sbindir}")
1107         gsub("^%{_bindir}", "%attr(755,root,root) %{_bindir}")
1108
1109         # uid/gid nobody is not valid in %files
1110         if (/%attr([^)]*nobody[^)]*)/ && !/FIXME/) {
1111                 $0 = $0 " # FIXME nobody user/group can't own files! -adapter.awk"
1112         }
1113
1114         # s[gu]id programs with globs are evil
1115         if (/%attr\([246]...,.*\*/ && !/FIXME/) {
1116                 $0 = $0 " # FIXME no globs for suid/sgid files"
1117         }
1118
1119         # replace back
1120         gsub("%{_sysconfdir}/cron\.d", "/etc/cron.d")
1121         gsub("%{_sysconfdir}/crontab\.d", "/etc/crontab.d")
1122         gsub("%{_sysconfdir}/logrotate\.d", "/etc/logrotate.d")
1123         gsub("%{_sysconfdir}/pam\.d", "/etc/pam.d")
1124         gsub("%{_sysconfdir}/profile\.d", "/etc/profile.d")
1125         gsub("%{_sysconfdir}/rc\.d", "/etc/rc.d")
1126         gsub("%{_sysconfdir}/security", "/etc/security")
1127         gsub("%{_sysconfdir}/skel", "/etc/skel")
1128         gsub("%{_sysconfdir}/sysconfig", "/etc/sysconfig")
1129         gsub("%{_sysconfdir}/certs", "/etc/certs")
1130         gsub("%{_sysconfdir}/init.d", "/etc/init.d")
1131
1132         # /etc/init.d -> /etc/rc.d/init.d
1133         if (!/^\/etc\/init\.d$/) {
1134                  gsub("/etc/init.d", "/etc/rc.d/init.d")
1135         }
1136
1137         if (/\/etc\/rc\.d\/init\.d\// && !/functions/) {
1138                 if (!/%attr.*\/etc\/rc\.d\/init\.d/) {
1139                         $0 = "%attr(754,root,root) " $0
1140                 }
1141                 if (/^%attr.*\/etc\/rc\.d\/init\.d/ && !/^%attr\(754 *,/) {
1142                         gsub("^%attr\\(... *,", "%attr(754,");
1143                 }
1144         }
1145
1146         if (/lib.+\.so/ && !/\.so$/ && !/^%attr.*/ && !/%exclude/) {
1147                 $0 = "%attr(755,root,root) " $0
1148         }
1149
1150         if (/%{perl_vendorarch}.*\.so$/ && !/^%attr.*/) {
1151                 $0 = "%attr(755,root,root) " $0
1152         }
1153
1154         # /etc/sysconfig files
1155         # %attr(640,root,root) %config(noreplace) %verify(not size mtime md5) /etc/sysconfig/*
1156         # attr not required, allow default 644 attr
1157         if (!/network-scripts/ && !/%dir/ && !/\.d$/ && !/functions/ && !/\/etc\/sysconfig\/wmstyle/) {
1158                 if (/\/etc\/sysconfig\// && /%config/ && !/%config\(noreplace\)/) {
1159                         gsub("%config", "%config(noreplace)")
1160                 }
1161
1162                 if (/\/etc\/sysconfig\// && !/%config\(noreplace\)/) {
1163                         $NF = "%config(noreplace) " $NF
1164                 }
1165
1166                 if (/\/etc\/sysconfig\// && /%attr\(755/) {
1167                         gsub("^%attr\\(... *,", "%attr(640,");
1168                 }
1169
1170                 if (/\/etc\/sysconfig\// && !/%verify/) {
1171                         gsub("/etc/sysconfig", "%verify(not size mtime md5) /etc/sysconfig");
1172                 }
1173         }
1174
1175         # kill leading zeros
1176         if (/%attr\(0[1-9]/) {
1177                 gsub("%attr\\(0", "%attr(")
1178         }
1179
1180         # sort %verify attrs
1181         if (match($0, /%verify\(not([^)]+)\)/)) {
1182                 t = substr($0, RSTART, RLENGTH)
1183                 # kill commas: %verify(not,md5,size,mtime)
1184                 gsub(/,/, " ", t);
1185
1186                 gsub(/^%verify\(not |\)$/, "", t)
1187                 n = split(t, a, / /)
1188                 isort(a, n)
1189
1190                 s = "%verify(not"
1191                 for (i = 1 ; i <= n; i++) {
1192                         s = s " " a[i]
1193                 }
1194                 s = s ")"
1195
1196                 gsub(/%verify\(not[^)]+\)/, s)
1197         }
1198
1199         if (/%{_mandir}/) {
1200                 gsub("\.gz$", "*")
1201         }
1202
1203         # locale dir and no %lang -> bad
1204         if (/%{_datadir}\/locale\/.*\// && !/%(dir|lang)/) {
1205                 $(NF + 1) = "# FIXME consider using %find_lang"
1206         }
1207
1208         # atrpms
1209         $0 = fixedsub("%{perl_man1dir}", "%{_mandir}/man1", $0);
1210         $0 = fixedsub("%{perl_man3dir}", "%{_mandir}/man3", $0);
1211         $0 = fixedsub("%{perl_bin}", "%{_bindir}", $0);
1212
1213         gsub(libdir "/pkgconfig", "%{_pkgconfigdir}");
1214         gsub("%{_libdir}/pkgconfig", "%{_pkgconfigdir}");
1215         gsub("%{_prefix}/lib/pkgconfig", "%{_pkgconfigdir}");
1216
1217         gsub("%{_datadir}/applications", "%{_desktopdir}");
1218         gsub("%{_datadir}/icons", "%{_iconsdir}");
1219         gsub("%{_datadir}/pixmaps", "%{_pixmapsdir}");
1220 }
1221
1222 function fill(ch, n, i) {
1223         for (i = 0; i < n; i++)
1224                 printf("%c", ch)
1225 }
1226
1227 function format_flush(line, indent, newline, word, first_word) {
1228         first_word = 1
1229         if (format_indent == -1)
1230                 newline = ""
1231         else
1232                 newline = fill(" ", format_indent) "- "
1233
1234         while (match(line, /[^\t ]+/)) {
1235                 word = substr(line, RSTART, RLENGTH)
1236                 if (length(newline) + length(word) + 1 > tw) {
1237                         print newline
1238
1239                         if (format_indent == -1)
1240                                 newline = ""
1241                         else
1242                                 newline = fill(" ", format_indent + 2)
1243                         first_word = 1
1244                 }
1245
1246                 if (first_word) {
1247                         newline = newline word
1248                         first_word = 0
1249                 } else
1250                         newline = newline " " word
1251
1252                 line = substr(line, RSTART + RLENGTH)
1253         }
1254         if (newline ~ /[^\t ]/) {
1255                 print newline
1256         }
1257 }
1258
1259 function cflags(var)
1260 {
1261         if ($0 == var "=\"$RPM_OPT_FLAGS\"") {
1262                 removed[var] = 1
1263                 return 0
1264         }
1265
1266         if (!/!\?debug/)
1267                 sub("\$RPM_OPT_FLAGS", "%{rpmcflags}")
1268         return 1
1269 }
1270
1271 function demacroize(str)
1272 {
1273         if (mod_name) {
1274                 sub("%{mod_name}", mod_name, str);
1275         }
1276         if (name) {
1277                 sub("%{name}", name, str);
1278         }
1279         if (version) {
1280                 sub("%{version}", version, str);
1281         }
1282         if (_beta) {
1283                 sub("%{_beta}", _beta, str);
1284         }
1285         if (_rc) {
1286                 sub("%{_rc}", _rc, str);
1287         }
1288         if (_snap) {
1289                 sub("%{_snap}", _snap, str);
1290         }
1291         return str;
1292 }
1293
1294 function kill_preamble_macros()
1295 {
1296         if ($1 ~ /^URL:/ || $1 ~ /^Obsoletes:/) {
1297                 # NB! assigning $2 a value breaks tabbing
1298                 $2 = demacroize($2);
1299                 # unify sourceforge url
1300                 sub("\.sf\.net/$", ".sourceforge.net/", $2);
1301         }
1302 }
1303
1304 function format_requires(tag, value,    n, p, i, deps, ndeps) {
1305         # skip any formatting for commented out items
1306         if (/^#/) {
1307                 return tag "\t" value
1308         }
1309         n = split(value, p, / *,? */);
1310         for (i = 1; i <= n; i++) {
1311                 if (p[i+1] ~ /[<=>]/) {
1312                         deps[ndeps++] = p[i] " " p[i+1] " " p[i+2];
1313                         i += 2;
1314                 } else {
1315                         deps[ndeps++] = p[i];
1316                 }
1317         }
1318         s = ""
1319         for (i in deps) {
1320                 s = s sprintf("%s\t%s\n", tag, deps[i]);
1321         }
1322         return substr(s, 1, length(s)-1);
1323 }
This page took 0.223787 seconds and 4 git commands to generate.