summaryrefslogtreecommitdiffstats
path: root/preps/perl.d/perl-dist
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 /preps/perl.d/perl-dist
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 'preps/perl.d/perl-dist')
-rwxr-xr-xpreps/perl.d/perl-dist47
1 files changed, 22 insertions, 25 deletions
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) = @_;