genlinks (1461B)
1 {% extends "base" %} 2 {%- block body -%} 3 {%- block script %} 4 {% endblock %} 5 cd "$pthbs_destdir{{versions}}/$pthbs_package" 6 find -type d -o -print | awk -F/ ' 7 BEGIN { 8 {%- block genlinks_begin %} 9 {% endblock -%} 10 } 11 12 function r1(s) { 13 sub("^[.]/[^/]*", ".", s) 14 return s 15 } 16 function s1(repl, s) { 17 sub("^[.]/[^/]*", "./"repl, s) 18 return s 19 } 20 function link(src) { 21 x[$0]=0 22 printf "%s\t%s\n", $0, src 23 printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr" 24 } 25 $1!="."{exit 1} 26 27 {% block rules %} 28 {% endblock -%} 29 $2 == "command" { link($0); next } 30 $2 == "bin" { link(s1("command", $0)); next } 31 32 $2 == "library.so" { link($0); next } 33 $2 == "library" { link($0); next } 34 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next } 35 $2 == "lib" && $NF ~ /\.so(|\..*)$/ { link(s1("library.so", $0)); next } 36 37 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next } 38 39 $2 == "man" { link($0); next } 40 $2 == "info" { link($0); next } 41 $2 == "doc" { link($0); next } 42 $2 == "icons" { link($0); next } 43 $2 == "terminfo" { link($0); next } 44 $2 == "data" { link($0); next } 45 $2 == "include" { link($0); next } 46 47 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" } 48 49 END { 50 for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" } 51 for(fname in x) { 52 if(x[fname]) { 53 printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr" 54 exit 3 55 } 56 } 57 }' >.install-links.new 58 mv .install-links.new .install-links 59 {% endblock %}