]> git.pld-linux.org Git - packages/adapter.git/commitdiff
adapter: replace common macros
authorElan Ruusamäe <glen@delfi.ee>
Fri, 11 Jul 2014 21:26:46 +0000 (00:26 +0300)
committerElan Ruusamäe <glen@delfi.ee>
Fri, 11 Jul 2014 21:26:46 +0000 (00:26 +0300)
adapter.awk

index a68309b5253b9465f4f009e0812305e7b91a3099..3df9b266fc1cc95c928071bcb2ec358f23550b79 100644 (file)
@@ -252,6 +252,7 @@ function b_makekey(a, b,    s) {
 
 # %package part
 /^%package/, (!/^%package/ && $0 ~ SECTIONS) {
+       # FIXME: this breaks \t indenting in preamble?
        gsub(/\t/, " ")
 }
 
@@ -690,7 +691,7 @@ preamble == 1 {
                $0 = format_requires($1, value)
        }
 
-       # BR: tar (and others) is to common (rpm-build requires it)
+       # BR: tar (and others) are too common (rpm-build requires it)
        if (field == "buildrequires:") {
                l = substr($0, index($0, $2))
                if (l == "awk" ||
@@ -961,6 +962,7 @@ ENVIRON["SKIP_SORTBR"] != 1 && preamble == 1 && $0 ~ PREAMBLE_TAGS ":", $0 ~ PRE
        if ($1 == "R:" ) {
                $1 = "Requires:"
        }
+       common_macros()
        format_preamble()
 #      kill_preamble_macros(); # breaks tabbing
 
@@ -1053,6 +1055,23 @@ function replace(s, s1, s2) {
        }
 }
 
+# replace common macros
+function common_macros() {
+       gsub(/%name/, "%{name}")
+       gsub(/%version/, "%{version}")
+       gsub(/%release/, "%{release}")
+       gsub(/%epoch/, "%{epoch}")
+       gsub(/%_sysconfdir/, "%{_sysconfdir}")
+       gsub(/%_unitdir/, "%{systemdunitdir}")
+       gsub(/%_initdir/, "/etc/rc.d/init.d")
+       gsub(/%_man1dir/, "%{_mandir}/man1")
+       gsub(/%_man2dir/, "%{_mandir}/man2")
+       gsub(/%_man3dir/, "%{_mandir}/man3")
+       gsub(/%_man5dir/, "%{_mandir}/man5")
+       gsub(/%_man8dir/, "%{_mandir}/man8")
+
+}
+
 # There should be one or two tabs after the colon.
 function format_preamble()
 {
@@ -1087,6 +1106,8 @@ function use_macros()
                return
        }
 
+       common_macros()
+
        sub("%{_defaultdocdir}", "%{_docdir}")
        sub("%{_datadir}/doc", "%{_docdir}")
        sub("%{_bindir}/perl", "%{__perl}")
@@ -2035,6 +2056,7 @@ function replace_groupnames(group) {
        group = replace(group, "System Tools", "Applications/System")
        group = replace(group, "System", "Base")
        group = replace(group, "System/Base", "Base")
+       group = replace(group, "System/Configuration/Networking", "Applications/Networking")
        group = replace(group, "System/Kernel and hardware", "Base/Kernel")
        group = replace(group, "System/Libraries", "Libraries")
        group = replace(group, "System/Servers", "Daemons")
This page took 0.040895 seconds and 4 git commands to generate.