summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorJustin Davis <jrcd83@gmail.com>2011-08-30 19:43:21 +0200
committerJustin Davis <jrcd83@gmail.com>2011-08-30 19:43:21 +0200
commit73e420c3a8f63f81484eb0c02214e91140a82451 (patch)
tree3cb81daa9c4784edbd3c771a11ec39b8e7a2dceb /bin
parent71e4b4382cae262daa445dd2f5b38a6d7cf4bbe5 (diff)
downloadgenpkg-73e420c3a8f63f81484eb0c02214e91140a82451.tar.gz
genpkg-73e420c3a8f63f81484eb0c02214e91140a82451.tar.xz
Move var munge-ing to mungevars sub. Add !emptydirs options.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/templ/perl-pkg20
1 files changed, 14 insertions, 6 deletions
diff --git a/bin/templ/perl-pkg b/bin/templ/perl-pkg
index 3886a71..b09dc3f 100755
--- a/bin/templ/perl-pkg
+++ b/bin/templ/perl-pkg
@@ -69,6 +69,19 @@ sub bashify
return $txt
}
+sub mungevars
+{
+ my ($vars) = @_;
+ $vars->{'options'} = [ '!emptydirs' ];
+
+ # Replace version string in 'source' entry & 'distdir' with
+ # $pkgver parameter.
+ my $ver = $vars->{'pkgver'}[0];
+ s/\Q$ver\E/\${pkgver}/g for ($vars->{'source'}[0], $vars->{'distdir'}[0]);
+
+ return;
+}
+
sub printpb
{
my ($btype, $pbvars) = @_;
@@ -79,10 +92,6 @@ sub printpb
printf $PBBEG, $pkger, $pbvars->{'pbjver'}[0];
print "\n";
- # Replace version string in first 'source' entry with $pkgver parameter.
- my $ver = $pbvars->{'pkgver'}[0];
- s/\Q$ver\E/\${pkgver}/g for $pbvars->{'source'}[0];
-
# 'pbfields' will recognize and PKGBUILD fields in the data
# and print them out in order, wordwrapping arrays.
open my $pbfields, '|pbfields' or die "failed to pipe to pbfields: $!";
@@ -93,9 +102,7 @@ sub printpb
}
close $pbfields;
- # Replace version string in _distdir with $pkgver parameter.
my $distdir = $pbvars->{'distdir'}[0];
- $distdir =~ s/\Q$ver\E/\${pkgver}/;
print qq{_distdir="\${srcdir}/$distdir"\n};
print "\n";
@@ -122,6 +129,7 @@ sub main
{
my ($type) = @_;
my $vars = readvars();
+ mungevars($vars);
printpb($type, $vars);
}