diff options
author | EuAndreh <eu@euandre.org> | 2023-03-21 11:24:48 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2023-03-21 11:24:48 -0300 |
commit | cf2497468334c00c9f376c7218443d789809832d (patch) | |
tree | 786ddfd57d4c6c2e5523904d39f37266d62bc6d0 /src/bin/paku | |
parent | Use stripped "-latest" name in package official name too (diff) | |
download | package-repository-cf2497468334c00c9f376c7218443d789809832d.tar.gz package-repository-cf2497468334c00c9f376c7218443d789809832d.tar.xz |
src/bin/paku: Use list of strings over multiple loops
Diffstat (limited to 'src/bin/paku')
-rwxr-xr-x | src/bin/paku | 159 |
1 files changed, 59 insertions, 100 deletions
diff --git a/src/bin/paku b/src/bin/paku index 82e1572..e4f0b83 100755 --- a/src/bin/paku +++ b/src/bin/paku @@ -315,109 +315,23 @@ if ($action eq 'guix') { } -print <<~EOF; - tarballs = \\ - EOF -for my $package (@{$json->{packages}}) { - for my $version (@{$package->{versions}}) { - print "\t$dir/tarballs/$version->{fname} \\\n"; - } -} -print "\n"; - - -print <<~EOF; - checkouts = \\ - EOF -for my $package (@{$json->{packages}}) { - for my $version (@{$package->{versions}}) { - print "\t$dir/checkouts/$package->{name}-$version->{name} \\\n"; - } -} -print "\n"; - - -print <<~EOF; - debian-destdirs = \\ - EOF -for my $package (@{$json->{packages}}) { - for my $version (@{$package->{versions}}) { - next if $version->{architectures} ne 'any'; - print "\t$dir/debian-destdir/$package->{name}-$version->{name}/DEBIAN \\\n"; - } -} -print "\n"; - - -print <<~EOF; - control-files = \\ - EOF -for my $package (@{$json->{packages}}) { - for my $version (@{$package->{versions}}) { - next if $version->{architectures} ne 'any'; - print "\t$dir/debian-destdir/$package->{name}-$version->{name}/DEBIAN/control \\\n"; - } -} -print "\n"; +my %vars = ( + tarballs => ["tarballs = \\\n"], + checkouts => ["checkouts = \\\n"], + destdirs => ["debian-destdirs = \\\n"], + ctrlfiles => ["control-files = \\\n"], + destdebs => ["destdir-debs = \\\n"], + debs => ["debs = \\\n"], +); +my @targets = (); -print <<~EOF; - destdir-debs = \\ - EOF for my $package (@{$json->{packages}}) { for my $version (@{$package->{versions}}) { - next if $version->{architectures} ne 'any'; - print "\t$dir/debian-destdir/$package->{name}-$version->{name}.deb \\\n"; - } -} -print "\n"; - - -print <<~EOF; - debs = \\ - EOF -for my $package (@{$json->{packages}}) { - for my $version (@{$package->{versions}}) { - next if $version->{architectures} ne 'any'; - print "\t$dir/debian/$package->{name}_$version->{name}_all.deb \\\n"; - } -} -print "\n"; - - -print <<~EOF; - FIXME = eu\@euandre.org - - - all: $dir/debian/InRelease $dir/debian/Release.gpg $dir/debian/public-key.asc - - public-dir: - \@printf '$dir/debian' - - - $dir/debian/Packages: \$(debs) - cd \$(\@D) && dpkg-scanpackages -m . > \$(\@F) - - $dir/debian/Release: $dir/debian/Packages - perl src/bin/paku release $dir/debian/Packages > \$\@ - - $dir/debian/Release.gpg: $dir/debian/Release - gpg -abs -o \$\@ $dir/debian/Release - - $dir/debian/InRelease: $dir/debian/Release - gpg --default-key \$(FIXME) -a --clear-sign -o \$\@ $dir/debian/Release - - $dir/debian/public-key.asc: $dir/debian/Release - gpg --armour --export \$(FIXME) > \$\@ - + push @{$vars{tarballs}}, "\t$dir/tarballs/$version->{fname} \\\n"; + push @{$vars{checkouts}}, "\t$dir/checkouts/$package->{name}-$version->{name} \\\n"; - EOF - - - -for my $package (@{$json->{packages}}) { - for my $version (@{$package->{versions}}) { - print <<~EOF; + push @targets, <<~EOF; $dir/tarballs/$version->{fname}: mkdir -p \$(\@D) wget -O \$\@ \\ @@ -430,15 +344,21 @@ for my $package (@{$json->{packages}}) { EOF + next if $version->{architectures} ne 'any'; + + push @{$vars{destdirs}}, "\t$dir/debian-destdir/$package->{name}-$version->{name}/DEBIAN \\\n"; + push @{$vars{ctrlfiles}}, "\t$dir/debian-destdir/$package->{name}-$version->{name}/DEBIAN/control \\\n"; + push @{$vars{destdebs}}, "\t$dir/debian-destdir/$package->{name}-$version->{name}.deb \\\n"; + push @{$vars{debs}}, "\t$dir/debian/$package->{name}_$version->{name}_all.deb \\\n"; + my $ver = $version->{type} eq 'latest' ? '0.' . $version->{name} . '.latest' : $version->{name}; $ver =~ s/^v//; my $maintainer_b64 = MIME::Base64::encode_base64 $version->{maintainer}, ''; my $desc_b64 = MIME::Base64::encode_base64 $version->{description}, ''; my $long_desc_b64 = MIME::Base64::encode_base64 $version->{'long-description'}, ''; - - print <<~EOF; + push @targets, <<~EOF; $dir/debian-destdir/$package->{name}-$version->{name}/DEBIAN: $dir/checkouts/$package->{name}-$version->{name} \$(MAKE) \\ -C $dir/checkouts/$package->{name}-$version->{name} \\ @@ -483,3 +403,42 @@ for my $package (@{$json->{packages}}) { EOF } } + + +print + @{$vars{tarballs}}, "\n", + @{$vars{checkouts}}, "\n", + @{$vars{destdirs}}, "\n", + @{$vars{ctrlfiles}}, "\n", + @{$vars{destdebs}}, "\n", + @{$vars{debs}}, "\n"; + +print <<~EOF; + FIXME = eu\@euandre.org + + + all: $dir/debian/InRelease $dir/debian/Release.gpg $dir/debian/public-key.asc + + public-dir: + \@printf '$dir/debian' + + + $dir/debian/Packages: \$(debs) + cd \$(\@D) && dpkg-scanpackages -m . > \$(\@F) + + $dir/debian/Release: $dir/debian/Packages + perl src/bin/paku release $dir/debian/Packages > \$\@ + + $dir/debian/Release.gpg: $dir/debian/Release + gpg -abs -o \$\@ $dir/debian/Release + + $dir/debian/InRelease: $dir/debian/Release + gpg --default-key \$(FIXME) -a --clear-sign -o \$\@ $dir/debian/Release + + $dir/debian/public-key.asc: $dir/debian/Release + gpg --armour --export \$(FIXME) > \$\@ + + + EOF + +print @targets; |