summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorJustin Davis <jrcd83@gmail.com>2012-04-22 03:55:56 +0200
committerJustin Davis <jrcd83@gmail.com>2012-04-22 03:55:56 +0200
commitd64d4cff8f9b3e0b5ecad63969c496f0258ec944 (patch)
treeea13ac39469c27dc0cb14b2a16567a604441b64f /bin
parent1cfaf4f7c1e7fb7c6ea4f9a0f6493fdc75eec53b (diff)
downloadgenpkg-d64d4cff8f9b3e0b5ecad63969c496f0258ec944.tar.gz
genpkg-d64d4cff8f9b3e0b5ecad63969c496f0258ec944.tar.xz
Add _distdir var to perl PKGBUILDs.
pbfields now recognizes a customvars field which names other fields it should print in the PKGBUILD header. These field names are prefixed with an underscore ("_").
Diffstat (limited to 'bin')
-rwxr-xr-xbin/pbfields30
1 files changed, 24 insertions, 6 deletions
diff --git a/bin/pbfields b/bin/pbfields
index 5e7844c..5bbf9c6 100755
--- a/bin/pbfields
+++ b/bin/pbfields
@@ -31,16 +31,30 @@ $1 == "pkgdesc" {
$1 == "pkgverfmt" { pkgverfmt = $2 }
-strfield[$1] { output[$1] = $2 }
+$1 == "customvars" {
+ for(i = 2; i <= NF; i++){
+ customvars[i - 1] = $i
+ }
+ customlen = NF - 1
+}
-arrfield[$1] {
- output[$1] = wraparray(length($1) + 2)
+{
+ if(strfield[$1]){
+ output[$1] = $2
+ }else {
+ arrtxt = wraparray(length($1) + 2)
+ if(arrfield[$1]){
+ output[$1] = arrtxt
+ }else{
+ unk[$1] = arrtxt
+ }
+ }
}
END {
- if(pkgverfmt){
- output["pkgver"] = sprintf(pkgverfmt, output["pkgver"])
- }
+ if(pkgverfmt){
+ output["pkgver"] = sprintf(pkgverfmt, output["pkgver"])
+ }
if(!maintainer && !packager) { packager = "Anonymous" }
if(maintainer) print "# Maintainer: " maintainer
@@ -54,6 +68,10 @@ END {
print name, output[name]
}
}
+ for(i = 1; i <= customlen; i++){
+ v = customvars[i]
+ print "_" v, unk[v]
+ }
}
function wraparray (indent)