summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorJustin Davis <jrcd83@gmail.com>2013-04-11 13:33:35 +0200
committerJustin Davis <jrcd83@gmail.com>2013-04-11 13:33:35 +0200
commitea8184012874f11d4ef9eed6e7fcc8cd5a1bf848 (patch)
treed708ecf730aac31a5941f9c3889107b2ae1278ae /bin
parent418be7247234652f2a09cf20cbbb892edceed49c (diff)
downloadgenpkg-ea8184012874f11d4ef9eed6e7fcc8cd5a1bf848.tar.gz
genpkg-ea8184012874f11d4ef9eed6e7fcc8cd5a1bf848.tar.xz
Perl mod pkgbuilds use $_ddir now.
With pacman 4.1 $srcdir is no longer set outside of PKGBUILD functions. Yipee! This breaks all of my PKGBUILDs. Now we switch to storing the distribution's tarballed directory in the _ddir custom variable. We cd into $srcdir/$_ddir at the beginning of every func. Custom variable mechanics have changed in bin/pbfields as well. Instead of hard-coding _dir as an accepted field, any PKGDATA entry with a name starting with underscore (_) is considered a custom variable and printed in the PKGBUILD.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/pbfields50
1 files changed, 30 insertions, 20 deletions
diff --git a/bin/pbfields b/bin/pbfields
index 281fc88..052c643 100755
--- a/bin/pbfields
+++ b/bin/pbfields
@@ -6,19 +6,16 @@ BEGIN {
" install changelog" \
" *depends *makedepends *checkdepends *optdepends" \
" *conflicts *provides" \
- " url *source *noextract *md5sums *sha512sums" \
- " _dir"
- fieldcnt = split(fieldstr, fields)
- for(i = 1; i <= fieldcnt; i++){
+ " url *source *noextract *md5sums *sha512sums"
+ fcount = split(fieldstr, fields)
+ for(i = 1; i <= fcount; i++){
f = fields[i]
if(sub(/^[*]/, "", f)){
+ fields[i] = f
arrfield[f] = 1
- }else if(sub(/^_/, "", f)){
- cfield[f] = 1
}else{
strfield[f] = 1
}
- fields[i] = f
}
COLS = 78; FS = "\n"; RS = ""
@@ -31,16 +28,20 @@ $1 == "packager" { packager = $2; next }
$1 == "maintainer" { maintainer = $2; next }
# pkgdesc has the only value where parameters do not expand.
-$1 == "pkgdesc" { output[$1] = qnoexpand($2); next }
+$1 == "pkgdesc" { values[$1] = qnoexpand($2); next }
{
for(i = 2; i <= NF; i++) $i = qexpand($i)
- if(($1 in strfield) || ($1 in cfield)){
- output[$1] = $2
- }else {
- arrtxt = wraparray(length($1) + 2)
- if(arrfield[$1]){
- output[$1] = arrtxt
+ if($1 in strfield){
+ values[$1] = $2
+ }else if($1 in arrfield){
+ values[$1] = wraparray(length($1) + 2)
+ }else if($1 ~ /^_/){
+ vars[++vcount] = $1
+ if(NF > 2){
+ values[$1] = wraparray(length($1) + 2)
+ }else{
+ values[$1] = $2
}
}
}
@@ -54,14 +55,23 @@ END {
print "# Packager: Anonymous\n"
}
- OFS = "="; ORS = "\n";
+ ORS = "\n";
- for(i = 1; i <= fieldcnt; i++){
+ # Loop through our list of PKGBUILD field names so they are always
+ # printed in the same order, matching the PKGBUILD manpage.
+ for(i = 1; i <= fcount; i++){
f = fields[i]
- if(!(f in output)) continue
- v = output[f]
- if(f in cfield) f = "_" f
- print f, v
+ if(!(f in values)){
+ continue
+ }
+ v = values[f]
+ print f "=" v
+ }
+
+ # Print our custom variables in the order they appeared.
+ for(i = 1; i <= vcount; i++){
+ v = vars[i]
+ print v "=" values[v]
}
}