summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/pbfields30
-rwxr-xr-xpreps/perl.d/perl-dist47
2 files changed, 46 insertions, 31 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)
diff --git a/preps/perl.d/perl-dist b/preps/perl.d/perl-dist
index 365968f..67616cd 100755
--- a/preps/perl.d/perl-dist
+++ b/preps/perl.d/perl-dist
@@ -377,8 +377,21 @@ use Pod::Select (); # search POD for description
sub printdata
{
my($pbvars) = @_;
+
+ while(my($name, $val) = each %$pbvars) {
+ if(!defined $val || $val eq q{}) {
+ warn "$PROG: warning: $name is undefined\n";
+ $val = q{};
+ }
+ print $name, "\n";
+ print "$_\n" for (ref $val ? @$val : $val);
+ print "\n";
+ }
+
+ # TODO: autodetect license type
+ printf("license\n%s\n\n", join "\n", qw/PerlArtistic GPL/);
print "options\n!emptydirs\n\n";
- printmeta($pbvars);
+
return;
}
@@ -413,13 +426,14 @@ sub main
my($name, $ver) = Convert::dist2pkg(@{$info}{'name', 'ver'});
my $deps = Convert::prereqs($name, $meta->{'prereqs'});
- my %pbvars =
- ('pkgver' => $ver,
- 'pkgdesc' => $meta->{'abstract'},
- 'arch' => (xsdist($distdir) ? ['i686', 'x86_64'] : 'any'),
- 'distdir' => $distdir,
- %$deps,
- );
+ my %pbvars = (
+ 'pkgver' => $ver,
+ 'pkgdesc' => $meta->{'abstract'},
+ 'arch' => (xsdist($distdir) ? ['i686', 'x86_64'] : 'any'),
+ 'distdir' => qq{"\$srcdir/$distdir"},
+ 'customvars' => 'distdir',
+ %$deps,
+ );
chdir $dir or die "chdir: $!";
@@ -481,23 +495,6 @@ sub extractdist
return $dirs[0];
}
-sub printmeta
-{
- my($pbvars) = @_;
- while(my($name, $val) = each %$pbvars) {
- if(!defined $val || $val eq q{}) {
- warn "$PROG: warning: $name is undefined\n";
- $val = q{};
- }
- print $name, "\n";
- print "$_\n" for (ref $val ? @$val : $val);
- print "\n";
- }
-
- # TODO: autodetect license type
- printf("license\n%s\n\n", join "\n", qw/PerlArtistic GPL/);
-}
-
sub loadmeta
{
my($distdir) = @_;