]> git.pld-linux.org Git - packages/adapter.git/commitdiff
- sort %verify attrs
authorElan Ruusamäe <glen@pld-linux.org>
Sun, 13 Feb 2005 20:40:00 +0000 (20:40 +0000)
committerElan Ruusamäe <glen@pld-linux.org>
Sun, 13 Feb 2005 20:40:00 +0000 (20:40 +0000)
Changed files:
    adapter.awk -> 1.126

adapter.awk

index a247e08a0e5ca736ced49f1a26a0efb8e567be67..ba927b4f96f5c7b63392bc1ddb31c770efb21d9f 100644 (file)
@@ -627,10 +627,41 @@ function use_macros()
        gsub("%{_prefix}/src/linux", "%{_kernelsrcdir}")
 }
 
-function use_files_macros()
+
+# insertion sort of A[1..n]
+# copied from mawk manual
+function isort(A,n,            i,j,hold) {
+       for (i = 2; i <= n; i++) {
+               hold = A[j = i]
+               while (A[j-1] > hold) {
+                       j-- ; A[j+1] = A[j]
+               }
+               A[j] = hold
+       }
+       # sentinel A[0] = "" will be created if needed
+}
+
+
+function use_files_macros(     i, n, t, a)
 {
        gsub("^%{_sbindir}", "%attr(755,root,root) %{_sbindir}")
        gsub("^%{_bindir}", "%attr(755,root,root) %{_bindir}")
+
+       # sort %verify attrs
+       if (match($0, /%verify\(not (.*)\)/)) {
+               t = substr($0, RSTART, RLENGTH)
+               gsub(/^%verify\(not |\)$/, "", t)
+               n = split(t, a, / /)
+               isort(a, n)
+
+               s = "%verify(not"
+               for (i = 1 ; i <= n; i++) {
+                       s = s " " a[i]
+               }
+               s = s ")"
+
+               gsub(/%verify\(not .*\)/, s)
+       }
 }
 
 function fill(ch, n, i) {
This page took 0.0349 seconds and 4 git commands to generate.