3 # This is adapter v0.27. Adapter adapts .spec files for PLD.
5 # Copyright (C) 1999-2003 PLD-Team <feedback@pld-linux.org>
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 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
16 # - parse ../PLD-doc/BuildRequires.txt and setup proper BR epoches?
17 # - add "-nc" option to skip CVS interaction
19 # - sort Requires, BuildRequires
22 preamble = 1 # Is it part of preamble? Default - yes
23 boc = 4 # Beggining of %changelog
24 bod = 0 # Beggining of %description
25 tw = 70 # Descriptions width
27 b_idx = 0 # index of BR/R arrays
29 # If variable removed, then 1 (for removing it from export)
30 removed["LDFLAGS"] = 0
32 removed["CXXFLAGS"] = 0
34 # get cvsaddress for changelog section
35 # using rpm macros as too lazy to add ~/.adapterrc parsing support.
36 "rpm --eval '%{?_cvsmaildomain}%{!?_cvsmaildomain:@pld-linux.org}'" | getline _cvsmaildomain
37 "rpm --eval '%{?_cvsmailfeedback}%{!?_cvsmailfeedback:PLD Team <rpm@cvs.delfi.ee>}'" | getline _cvsmailfeedback
39 # If 1, we are inside of comment block (started with /^#%/)
42 # File with rpm groups
43 "rpm --eval %_sourcedir" | getline groups_file
44 groups_file = groups_file "/rpm.groups"
45 system("cd `rpm --eval %_sourcedir`; cvs up rpm.groups >/dev/null")
47 # Temporary file for changelog section
48 changelog_file = ENVIRON["HOME"] "/tmp/adapter.changelog"
51 "rpm --eval %_prefix" | getline prefix
52 "rpm --eval %_bindir" | getline bindir
53 "rpm --eval %_sbindir" | getline sbindir
54 "rpm --eval %_libdir" | getline libdir
55 "rpm --eval %_sysconfdir" | getline sysconfdir
56 "rpm --eval %_datadir" | getline datadir
57 "rpm --eval %_includedir" | getline includedir
58 "rpm --eval %_mandir" | getline mandir
59 "rpm --eval %_infodir" | getline infodir
60 "rpm --eval %_examplesdir" | getline examplesdir
62 "rpm --eval %perl_sitearch" | getline perl_sitearch
63 "rpm --eval %perl_archlib" | getline perl_archlib
64 "rpm --eval %perl_privlib" | getline perl_privlib
65 "rpm --eval %perl_vendorlib" | getline perl_vendorlib
66 "rpm --eval %perl_vendorarch" | getline perl_vendorarch
67 "rpm --eval %perl_sitelib" | getline perl_sitelib
69 "rpm --eval %py_sitescriptdir" | getline py_sitescriptdir
72 # There should be a comment with CVS keywords on the first line of file.
74 if (!/# \$Revision:/) # If this line is already OK?
75 print "# $" "Revision:$, " "$" "Date:$" # No
78 next # It is enough for first line
82 # If the latest line matched /%files/
84 if ($0 !~ /defattr/) # If no %defattr
85 print "%defattr(644,root,root,755)" # Add it
87 $0 = "%defattr(644,root,root,755)" # Correct mistakes (if any)
91 function b_makekey(a, b, s) {
94 gsub("%{\\?[_a-zA-Z0-9]+:", "", s);
101 # - mixing BR/R and anything else confuses this (all will be sorted together)
103 # - comments leading the BR/R can not be associated,
104 # so don't adapterize when the BR/R are mixed with comments
105 ENVIRON["SORTBR"] == 1 && preamble == 1 && /(Build)?Requires/, /(Build)?Requires/ { # && !/^%/) {
107 l = substr($0, index($0, $2));
108 b_ktmp = b_makekey($1, l);
109 b_key[b_idx] = b_ktmp;
118 for (i = 1; i <= b_idx; i++) {
119 print "" b_val[b_key[i]];
126 /^#/ && (description == 0) {
127 if (/This file does not like to be adapterized!/) {
128 print # print this message
129 while (getline) # print the rest of spec as it is
131 do_not_touch_anything = 1 # do not touch anything in END()
135 # Generally, comments are printed without touching
141 # Remove defining _applnkdir (this macro has been included in rpm-3.0.4)
143 if ($2 == "_applnkdir")
150 /^%include.*\/usr\/lib\/rpm\/macros\.python$/ {
157 /^%description/, (/^%[a-z]+/ && !/^%description/ && !/^%((end)?if|else)/) {
160 if (/^%description/) {
167 if (description == 1 && !/^%[a-z]+/ && !/^%description/) {
169 format_flush(format_line, format_indent)
173 } else if (/^[ \t]*[-\*][ \t]*/) {
174 format_flush(format_line, format_indent)
176 format_indent = RLENGTH
177 match($0, /^[ \t]*[-\*][ \t]/)
178 format_line = substr($0, RLENGTH)
180 format_line = format_line " " $0
184 if (/^%[a-z]+/ && (!/^%description/ || bod == 2)) {
185 if (NF > 3 && $2 == "-l") {
187 for (i = 4; i <= NF; i++)
191 format_flush(format_line, format_indent)
206 /^%prep/, (/^%[a-z]+$/ && !/^%prep/ && !/^%((end)?if|else)/) {
212 if (/^%setup/ && !/-q/) {
213 sub(/^%setup/, "%setup -q")
217 gsub(name, "%{name}");
218 gsub(version, "%{version}");
220 gsub(_beta, "%{_beta}");
226 gsub(_snap, "%{_snap}");
230 if (/^%setup/ && /-n %{name}-%{version}( |$)/) {
231 sub(/ -n %{name}-%{version}/, "")
235 sub("^rm -rf \$RPM_BUILD_ROOT.*", "");
241 /^%build/, (/^%[a-z]+$/ && !/^%build/ && !/^%((end)?if|else)/) {
250 if (/LDFLAGS="-s"/) {
251 removed["LDFLAGS"] = 1
254 split($0, tmp, "LDFLAGS=")
255 count = split(tmp[2], flags, "\"")
256 if (flags[1] != "" && flags[1] !~ "!?debug") {
257 sub(/-s[" ]?/, "%{rpmldflags} ", flags[1])
258 $0 = tmp[1] line[1] "LDFLAGS=" flags[1] "\""
259 for (i = 2; i < count; i++)
260 $0 = $0 flags[i] "\""
266 if (cflags("CFLAGS") == 0)
270 if (cflags("CXXFLAGS") == 0)
274 if (removed["LDFLAGS"])
276 if (removed["CFLAGS"])
278 if (removed["CXXFLAGS"])
280 # Is there still something?
286 $0 = fixedsub("glib-gettextize --copy --force","%{__glib_gettextize}", $0);
287 $0 = fixedsub("intltoolize --copy --force", "%{__intltoolize}", $0);
290 $0 = fixedsub("%perl_configure", "%{__perl} Makefile.PL \\\n\tINSTALLDIRS=vendor", $0);
291 $0 = fixedsub("%perl_makecheck", "%{?with_tests:%{__make} test}", $0);
297 /^%clean/, (/^%[a-z]+$/ && !/^%clean/ && !/^%((end)?if|else)/) {
305 /^%install/, (/^%[a-z]+$/ && !/^%install/ && !/^%((end)?if|else)/) {
309 if (/^[ \t]*rm([ \t]+-[rf]+)*[ \t]+\${?RPM_BUILD_ROOT}?/ && did_rmroot==0) {
311 print "rm -rf $RPM_BUILD_ROOT"
315 if (!/^(#?[ \t]*)$/ && !/^%install/ && did_rmroot==0) {
316 print "rm -rf $RPM_BUILD_ROOT"
322 # 'install -d' instead 'mkdir -p'
324 sub(/mkdir -p/, "install -d")
326 # 'install' instead 'cp -p'
328 sub(/cp -p/, "install")
330 # No '-u root' or '-g root' for 'install'
331 if (/^install/ && /-[ug][ \t]*root/)
332 gsub(/-[ug][ \t]*root /, "")
334 if (/^install/ && /-m[ \t]*[0-9]+/)
335 gsub(/-m[ \t]*[0-9]+ /, "")
337 # No lines contain 'chown' or 'chgrp' if owner/group is 'root'
338 if (($1 ~ /chown/ && $2 ~ /root\.root/) || ($1 ~ /chgrp/ && $2 ~ /root/))
341 # No lines contain 'chmod' if it sets the modes to '644'
342 if ($1 ~ /chmod/ && $2 ~ /644/)
346 $0 = fixedsub("%buildroot", "$RPM_BUILD_ROOT", $0)
347 $0 = fixedsub("%{buildroot}", "$RPM_BUILD_ROOT", $0)
350 $0 = fixedsub("%perl_makeinstall", "%{__make} pure_install \\\n\tDESTDIR=$RPM_BUILD_ROOT", $0);
356 /^%files/, (/^%[a-z \-]+$/ && !/^%files/ && !/^%((end)?if|else)/) {
369 /^%changelog/, (/^%[a-z]+$/ && !/^%changelog/) {
373 # There should be some CVS keywords on the first line of %changelog.
375 if ($0 !~ _cvsmailfeedback)
376 print "* %{date} " _cvsmailfeedback > changelog_file
381 if (boc == 2 && !skip) {
382 if (!/All persons listed below/) {
383 printf "All persons listed below can be reached at " > changelog_file
384 print "<cvs_login>" _cvsmaildomain "\n" > changelog_file
389 if (boc == 1 && !skip) {
392 print "$" "Log:$" > changelog_file
399 printf "%%define date\t%%(echo `LC_ALL=\"C\"" > changelog_file
400 print " date +\"%a %b %d %Y\"`)" > changelog_file
407 if (!/^%[a-z]+$/ || /changelog/)
408 print > changelog_file
417 /^%pre/, (/^%[a-z]+$/ && !/^%pre/) {
420 /^%post/, (/^%[a-z]+$/ && !/^%post/) {
423 /^%preun/, (/^%[a-z]+$/ && !/^%preun/) {
426 /^%postun/, (/^%[a-z]+$/ && !/^%postun/) {
429 /^%triggerin/, (/^%[a-z]+$/ && !/^%triggerin/) {
432 /^%triggerun/, (/^%[a-z]+$/ && !/^%triggerun/) {
435 /^%triggerpostun/, (/^%[a-z]+$/ && !/^%triggerpostun/) {
438 /^%pretrans/, (/^%[a-z]+$/ && !/^%pretrans/) {
441 /^%posttrans/, (/^%[a-z]+$/ && !/^%posttrans/) {
449 # There should not be a space after the name of field
450 # and before the colon.
453 if (/^%perl_module_wo_prefix/) {
456 release = "0." fixedsub(".%{disttag}.at", "", $4)
461 if (field ~ /group(\([^)]+\)):/)
463 if (field ~ /group:/) {
465 sub(/^Utilities\//,"Applications/",$2)
466 sub(/^Games/,"Applications/Games",$2)
467 sub(/^X11\/Games/,"X11/Applications/Games",$2)
468 sub(/^X11\/GNOME\/Development\/Libraries/,"X11/Development/Libraries",$2)
469 sub(/^X11\/GNOME\/Applications/,"X11/Applications",$2)
470 sub(/^X11\/GNOME/,"X11/Applications",$2)
471 sub(/^X11\/Utilities/,"X11/Applications",$2)
472 sub(/^X11\/Games\/Strategy/,"X11/Applications/Games/Strategy",$2)
473 sub(/^Shells/,"Applications/Shells",$2)
475 sub(/^[^ \t]*[ \t]*/,"")
478 print "Group:\t\t" Grupa
479 if (Grupa ~ /^X11/ && x11 == 0) # Is it X11 application?
482 byl_plik_z_grupami = 0
484 while ((getline linia_grup < groups_file) > 0) {
485 byl_plik_z_grupami = 1
486 if (linia_grup == Grupa) {
492 if (!byl_plik_z_grupami)
493 print "######\t\t" groups_file ": no such file"
494 else if (!byl_opis_grupy)
495 print "######\t\t" "Unknown group!"
501 if (field ~ /prereq:/) {
503 $(NF + 1) = " # FIXME add Requires(scriptlet) -adapter.awk"
506 # split (build)requires on commas
507 if (field ~ /requires:/ && $0 ~ /,/) {
508 l = substr($0, index($0, $2));
509 n = split(l, p, / *, */);
511 printf("%s\t%s\n", $1, p[i]);
516 if (field ~ /packager:|distribution:|docdir:|prefix:/)
519 if (field ~ /buildroot:/)
520 $0 = $1 "%{tmpdir}/%{name}-%{version}-root-%(id -u -n)"
522 # Use "License" instead of "Copyright" if it is (L)GPL or BSD
523 if (field ~ /copyright:/ && $2 ~ /GPL|BSD/)
526 if (field ~ /name:/) {
531 if (field ~ /version:/) {
536 if (field ~ /release:/) {
541 if (field ~ /serial:/)
544 # Use %{name} and %{version} in the filenames in "Source:"
545 if (field ~ /^source/ || field ~ /patch/) {
546 n = split($2, url, /\//)
547 if (url[n] ~ /\.gz$/) {
548 url[n+1] = ".gz" url[n+1]
549 sub(/\.gz$/,"",url[n])
551 if (url[n] ~ /\.zip$/) {
552 url[n+1] = ".zip" url[n+1]
553 sub(/\.zip$/,"",url[n])
555 if (url[n] ~ /\.tar$/) {
556 url[n+1] = ".tar" url[n+1]
557 sub(/\.tar$/,"",url[n])
559 if (url[n] ~ /\.patch$/) {
560 url[n+1] = ".patch" url[n+1]
561 sub(/\.patch$/,"",url[n])
563 if (url[n] ~ /\.bz2$/) {
564 url[n+1] = ".bz2" url[n+1]
565 sub(/\.bz2$/,"",url[n])
567 if (url[n] ~ /\.logrotate$/) {
568 url[n+1] = ".logrotate" url[n+1]
569 sub(/\.logrotate$/,"",url[n])
571 if (url[n] ~ /\.pamd$/) {
572 url[n+1] = ".pamd" url[n+1]
573 sub(/\.pamd$/,"",url[n])
576 # allow %{name} just in last url component
578 for (i = 1; i <= n; i++) {
579 url[i] = fixedsub("%{name}", name, url[i])
590 url[n] = fixedsub(name, "%{name}", url[n])
592 if (field ~ /source/) {
594 url[n] = fixedsub(version, "%{version}", url[n])
597 url[n] = fixedsub(_beta, "%{_beta}", url[n])
600 url[n] = fixedsub(_rc, "%{_rc}", url[n])
603 url[n] = fixedsub(_snap, "%{_snap}", url[n])
606 $2 = fixedsub(filename, url[n], $2)
609 sub("[?]use_mirror=.*$", "", $2);
610 sub("[?]download$", "", $2);
611 sub("^http://prdownloads\.sourceforge\.net/", "http://dl.sourceforge.net/", $2)
613 sub("^http://.*\.dl\.sourceforge\.net/", "http://dl.sourceforge.net/", $2)
614 sub("^http://dl\.sourceforge\.net/sourceforge/", "http://dl.sourceforge.net/", $2)
618 if (field ~ /^source:/)
621 if (field ~ /patch:/)
626 if ($1 ~ /%define/) {
627 # Do not add %define of _prefix if it already is.
628 if ($2 ~ /^_prefix/) {
629 sub("^"prefix, $3, bindir)
630 sub("^"prefix, $3, sbindir)
631 sub("^"prefix, $3, libdir)
632 sub("^"prefix, $3, datadir)
633 sub("^"prefix, $3, includedir)
636 if ($2 ~ /_bindir/ && !/_sbindir/)
642 if ($2 ~ /_sysconfdir/ && $3 !~ /^%\(/)
646 if ($2 ~ /_includedir/)
661 if (field ~ /requires/) {
663 $0 = fixedsub("%{eversion}", "%{epoch}:%{version}-%{release}", $0);
674 if (name_seen == 0 && name) {
679 if (version_seen == 0 && version) {
680 print "Version:\t" version
684 if (release_seen == 0 && release) {
685 print "Release:\t" release
692 if (do_not_touch_anything)
695 close(changelog_file)
696 while ((getline < changelog_file) > 0)
698 system("rm -f " changelog_file)
702 if (did_clean == 0) {
705 print "rm -rf $RPM_BUILD_ROOT"
710 print "%define date\t%(echo `LC_ALL=\"C\" date +\"%a %b %d %Y\"`)"
713 if (has_changelog == 0)
717 print "* %{date} PLD Team <feedback@pld-linux.org>"
719 printf "All persons listed below can be reached at "
720 print "<cvs_login>@pld-linux.org\n"
726 function fixedsub(s1,s2,t, ind) {
727 # substitutes fixed strings (not regexps)
728 if (ind = index(t,s1))
729 t = substr(t, 1, ind-1) s2 substr(t, ind+length(s1))
733 # There should be one or two tabs after the colon.
734 function format_preamble()
737 if (match($0, /[A-Za-z0-9(),#_ \t]+[ \t]*:[ \t]*/) == 1) {
745 # Replace directly specified directories with macros
746 function use_macros()
748 gsub(perl_sitearch, "%{perl_sitearch}")
749 gsub(perl_archlib, "%{perl_archlib}")
750 gsub(perl_privlib, "%{perl_privlib}")
751 gsub(perl_vendorlib, "%{perl_vendorlib}")
752 gsub(perl_vendorarch, "%{perl_vendorarch}")
753 gsub(perl_sitelib, "%{perl_sitelib}")
755 gsub(py_sitescriptdir, "%{py_sitescriptdir}")
757 gsub(bindir, "%{_bindir}")
758 gsub("%{prefix}/bin", "%{_bindir}")
759 if(prefix"/bin" == bindir)
760 gsub("%{_prefix}/bin", "%{_bindir}")
762 for (c = 1; c <= NF; c++) {
763 if ($c ~ sbindir "/fix-info-dir")
765 gsub(sbindir, "%{_sbindir}", $c)
768 gsub("%{prefix}/sbin", "%{_sbindir}")
769 if (prefix"/sbin" == sbindir)
770 gsub("%{_prefix}/sbin", "%{_sbindir}")
772 for (c = 1; c <= NF; c++) {
773 if ($c ~ sysconfdir "/{?cron.")
775 if ($c ~ sysconfdir "/{?crontab.d")
777 if ($c ~ sysconfdir "/{?logrotate.d")
779 if ($c ~ sysconfdir "/{?pam.d")
781 if ($c ~ sysconfdir "/{?profile.d")
783 if ($c ~ sysconfdir "/{?rc.d")
785 if ($c ~ sysconfdir "/{?security")
787 if ($c ~ sysconfdir "/{?skel")
789 if ($c ~ sysconfdir "/{?sysconfig")
791 if ($c ~ sysconfdir "/{?certs")
793 gsub(sysconfdir, "%{_sysconfdir}", $c)
796 for (c = 1; c <= NF; c++) {
797 if ($c ~ datadir "/automake")
799 if ($c ~ datadir "/unsermake")
801 gsub(datadir, "%{_datadir}", $c)
805 gsub("%{prefix}/share", "%{_datadir}")
806 if (prefix"/share" == datadir)
807 gsub("%{_prefix}/share", "%{_datadir}")
809 gsub(includedir, "%{_includedir}")
810 gsub("%{prefix}/include", "%{_includedir}")
811 if (prefix"/include" == includedir)
812 gsub("%{_prefix}/include", "%{_includedir}")
814 gsub(mandir, "%{_mandir}")
815 if ($0 !~ "%{_datadir}/manual")
816 gsub("%{_datadir}/man", "%{_mandir}")
817 gsub("%{_prefix}/share/man", "%{_mandir}")
818 gsub("%{prefix}/share/man", "%{_mandir}")
819 gsub("%{prefix}/man", "%{_mandir}")
820 gsub("%{_prefix}/man", "%{_mandir}")
822 gsub(infodir, "%{_infodir}")
823 gsub("%{prefix}/info", "%{_infodir}")
824 gsub("%{_prefix}/info", "%{_infodir}")
826 if (prefix !~ "/X11R6") {
827 gsub("%{_datadir}/aclocal", "%{_aclocaldir}")
830 gsub(examplesdir, "%{_examplesdir}")
833 for (c = 1; c <= NF; c++) {
834 if ($c ~ prefix "/sbin/fix-info-dir")
836 if ($c ~ prefix "/share/automake")
838 if ($c ~ prefix "/share/unsermake")
840 gsub(prefix, "%{_prefix}", $c)
842 gsub("%{prefix}", "%{_prefix}")
845 gsub("%{PACKAGE_VERSION}", "%{version}")
846 gsub("%{PACKAGE_NAME}", "%{name}")
848 # we can move files between the dirs below
849 if ($0 !~ "%{_applnkdir}") {
850 gsub("%{_datadir}/gnome/apps", "%{_applnkdir}")
853 gsub("^make$", "%{__make}")
854 gsub("^make ", "%{__make} ")
857 gsub("^%make$", "%{__make}")
858 gsub("^%make ", "%{__make} ")
859 gsub("^%makeinstall_std", "%{__make} install \\\n\tDESTDIR=$RPM_BUILD_ROOT")
860 gsub("^%{__rm} -rf %{buildroot}", "rm -rf $RPM_BUILD_ROOT")
861 gsub("%optflags", "%{rpmcflags}")
862 gsub("%{compat_perl_vendorarch}", "%{perl_vendorarch}")
864 gsub("^%{__make} install DESTDIR=\$RPM_BUILD_ROOT", "%{__make} install \\\n\tDESTDIR=$RPM_BUILD_ROOT")
865 gsub("^fix-info-dir$", "[ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c %{_infodir} >/dev/null 2>\&1")
866 $0 = fixedsub("%buildroot", "$RPM_BUILD_ROOT", $0)
867 $0 = fixedsub("%{buildroot}", "$RPM_BUILD_ROOT", $0)
868 gsub("%_bindir", "%{_bindir}")
869 gsub("%_datadir", "%{_datadir}")
870 gsub("%_iconsdir", "%{_iconsdir}")
872 gsub("/usr/src/linux", "%{_kernelsrcdir}")
873 gsub("%{_prefix}/src/linux", "%{_kernelsrcdir}")
877 # insertion sort of A[1..n]
878 # copied from mawk manual
879 function isort(A,n, i,j,hold) {
880 for (i = 2; i <= n; i++) {
882 while (A[j-1] > hold) {
887 # sentinel A[0] = "" will be created if needed
891 function use_files_macros( i, n, t, a)
893 gsub("^%{_sbindir}", "%attr(755,root,root) %{_sbindir}")
894 gsub("^%{_bindir}", "%attr(755,root,root) %{_bindir}")
897 gsub("%{_sysconfdir}/cron\.d", "/etc/cron.d")
898 gsub("%{_sysconfdir}/crontab\.d", "/etc/cron.d")
899 gsub("%{_sysconfdir}/logrotate\.d", "/etc/logrotate.d")
900 gsub("%{_sysconfdir}/pam\.d", "/etc/pam.d")
901 gsub("%{_sysconfdir}/profile\.d", "/etc/profile.d")
902 gsub("%{_sysconfdir}/rc\.d", "/etc/rc.d")
903 gsub("%{_sysconfdir}/security", "/etc/security")
904 gsub("%{_sysconfdir}/skel", "/etc/skel")
905 gsub("%{_sysconfdir}/sysconfig", "/etc/sysconfig")
906 gsub("%{_sysconfdir}/certs", "/etc/certs")
907 gsub("%{_sysconfdir}/init.d", "/etc/init.d")
909 # /etc/init.d -> /etc/rc.d/init.d
910 if (!/^\/etc\/init\.d$/) {
911 gsub("/etc/init.d", "/etc/rc.d/init.d")
914 if (/\/etc\/rc\.d\/init\.d\// && !/functions/) {
915 if (!/%attr.*\/etc\/rc\.d\/init\.d/) {
916 $0 = "%attr(754,root,root) " $0
918 if (/^%attr.*\/etc\/rc\.d\/init\.d/ && !/^%attr\(754 *,/) {
919 gsub("^%attr\\(... *,", "%attr(754,");
923 if (/lib.+\.so/ && !/^%attr.*/) {
924 $0 = "%attr(755,root,root) " $0
927 # /etc/sysconfig files
928 # %attr(640,root,root) %config(noreplace) %verify(not size mtime md5) /etc/sysconfig/*
929 # attr not required, allow default 644 attr
930 if (!/network-scripts/) {
931 if (/\/etc\/sysconfig\// && /%config/ && !/%config\(noreplace\)/) {
932 gsub("%config", "%config(noreplace)")
935 if (/\/etc\/sysconfig\// && !/%config\(noreplace\)/) {
936 $NF = "%config(noreplace) " $NF
939 if (/\/etc\/sysconfig\// && /%attr\(755/) {
940 gsub("^%attr\\(... *,", "%attr(640,");
943 if (/\/etc\/sysconfig\// && !/%verify/) {
944 gsub("/etc/sysconfig", "%verify(not size mtime md5) /etc/sysconfig");
950 gsub("%attr\\(0", "%attr(")
953 if (match($0, /%verify\(not([^)]+)\)/)) {
954 t = substr($0, RSTART, RLENGTH)
955 gsub(/^%verify\(not |\)$/, "", t)
960 for (i = 1 ; i <= n; i++) {
965 gsub(/%verify\(not[^)]+\)/, s)
973 $0 = fixedsub("%{perl_man1dir}", "%{_mandir}/man1", $0);
974 $0 = fixedsub("%{perl_man3dir}", "%{_mandir}/man3", $0);
975 $0 = fixedsub("%{perl_bin}", "%{_bindir}", $0);
978 function fill(ch, n, i) {
979 for (i = 0; i < n; i++)
983 function format_flush(line, indent, newline, word, first_word) {
985 if (format_indent == -1)
988 newline = fill(" ", format_indent) "- "
990 while (match(line, /[^\t ]+/)) {
991 word = substr(line, RSTART, RLENGTH)
992 if (length(newline) + length(word) + 1 > tw) {
995 if (format_indent == -1)
998 newline = fill(" ", format_indent + 2)
1003 newline = newline word
1006 newline = newline " " word
1008 line = substr(line, RSTART + RLENGTH)
1010 if (newline ~ /[^\t ]/) {
1015 function cflags(var)
1017 if ($0 == var "=\"$RPM_OPT_FLAGS\"") {
1023 sub("\$RPM_OPT_FLAGS", "%{rpmcflags}")