diff options
author | Justin Davis <jrcd83@gmail.com> | 2011-10-21 22:46:21 +0200 |
---|---|---|
committer | Justin Davis <jrcd83@gmail.com> | 2011-10-21 22:46:21 +0200 |
commit | 879bbf01560e348d93c6903786fabae0607a59e6 (patch) | |
tree | dddf7f119a44d9754a1600edb42dfdcb4f1a21ff /bin/templ/pbfields | |
parent | 623989ed692a74f40a162bb7a198ac8ffaf8215e (diff) | |
download | genpkg-879bbf01560e348d93c6903786fabae0607a59e6.tar.gz genpkg-879bbf01560e348d93c6903786fabae0607a59e6.tar.xz |
Create lib/ directory for meta generator and template scripts.
Diffstat (limited to 'bin/templ/pbfields')
-rwxr-xr-x | bin/templ/pbfields | 91 |
1 files changed, 0 insertions, 91 deletions
diff --git a/bin/templ/pbfields b/bin/templ/pbfields deleted file mode 100755 index 247b18c..0000000 --- a/bin/templ/pbfields +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/awk -f - -BEGIN { - fieldstr = "pkgname pkgver pkgrel pkgdesc epoch" \ - " *arch *license *options" \ - " install changelog" \ - " *depends *makedepends *checkdepends *optdepends" \ - " *conflicts *provides" \ - " url *source *noextract *md5sums *sha512sums" - max = split(fieldstr, fields) - for(i=1; i<=max; i++) { - if(sub(/^[*]/, "", fields[i])) arrfield[fields[i]] = 1; - else strfield[fields[i]] = 1; - } - - COLS = 78; FS = "\n"; RS = "" -} - -NF < 2 { next } - -$1 == "packager" { packager = $2 } - -$1 == "maintainer" { maintainer = $2 } - -$1 ~ /depends$|conflicts|provides|source/ { quotevals() } - -$1 == "pkgdesc" { - gsub(/[$"`]/, "\\\\&", $2) - $2 = sprintf("\"%s\"", $2) -} - -strfield[$1] { output[$1] = $2 } - -arrfield[$1] { - output[$1] = wraparray(length($1) + 2) -} - -END { - if(!maintainer && !packager) { packager = "Anonymous" } - if(maintainer) print "# Maintainer: " maintainer - else if(packager) print "# Packager: " packager - print "" - - OFS = "="; ORS = "\n"; - for(i=1; i<=max; i++) { - name = fields[i] - if(name in output) print name, output[name] - } -} - -function wraparray (indent) -{ - if(NF == 1) return "()" # this shouldn't happen but just in case. - - line = "" - delete lines - linecount = 0 - - i = 2 - while(i <= NF) { - linelen = length(line) - - if((indent + linelen + 1 + length($i) > COLS) && linelen > 0) { - lines[++linecount] = line - line = "" - } else { - if(linelen == 0) line = $(i++) - else line = line " " $(i++) - } - } - - if(length(line) > 0) lines[++linecount] = line - - indtxt = sprintf("%" indent "s", "") - txt = "(" lines[1] - for(i=2; i<=linecount; i++) txt = txt "\n" indtxt lines[i] - txt = txt ")" - - return txt -} - -function quotevals () -{ - for(i=2; i<=NF; i++) $i = bashquote($i) -} - -function bashquote (val) -{ - if(val ~ /[$]/) return sprintf("\"%s\"", val) - return sprintf("'%s'", val) -} |