summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/pbfields50
-rwxr-xr-xpreps/perl.d/perl-dist2
-rwxr-xr-xpreps/perl.d/perl-pkgbuild2
3 files changed, 32 insertions, 22 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]
}
}
diff --git a/preps/perl.d/perl-dist b/preps/perl.d/perl-dist
index c6fa2e3..0310fa4 100755
--- a/preps/perl.d/perl-dist
+++ b/preps/perl.d/perl-dist
@@ -402,7 +402,7 @@ sub main
'pkgver' => $ver,
'pkgdesc' => $meta->{'abstract'},
'arch' => (xsdist($distdir) ? ['i686', 'x86_64'] : 'any'),
- 'dir' => "\$srcdir/$distdir",
+ '_ddir' => $distdir,
%$deps,
);
diff --git a/preps/perl.d/perl-pkgbuild b/preps/perl.d/perl-pkgbuild
index 47a39ea..3708bc5 100755
--- a/preps/perl.d/perl-pkgbuild
+++ b/preps/perl.d/perl-pkgbuild
@@ -31,7 +31,7 @@ sub startfunc
return <<"ENDTXT";
${name}()
(
- cd "\$_dir"
+ cd "\$srcdir/\$_ddir"
ENDTXT
}