diff options
author | Justin Davis <jrcd83@gmail.com> | 2011-08-30 19:43:21 +0200 |
---|---|---|
committer | Justin Davis <jrcd83@gmail.com> | 2011-08-30 19:43:21 +0200 |
commit | 73e420c3a8f63f81484eb0c02214e91140a82451 (patch) | |
tree | 3cb81daa9c4784edbd3c771a11ec39b8e7a2dceb /bin | |
parent | 71e4b4382cae262daa445dd2f5b38a6d7cf4bbe5 (diff) | |
download | genpkg-73e420c3a8f63f81484eb0c02214e91140a82451.tar.gz genpkg-73e420c3a8f63f81484eb0c02214e91140a82451.tar.xz |
Move var munge-ing to mungevars sub. Add !emptydirs options.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/templ/perl-pkg | 20 |
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); } |