aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2023-03-23 08:55:42 -0300
committerEuAndreh <eu@euandre.org>2023-03-23 08:55:42 -0300
commit0680074fd3c39d135fd75a1585e30e9470fbc785 (patch)
tree1a380b4d96a05b5735d387ee029a2630b4a78d78 /src
parentsrc/bin/paku.in: Add dark-mode CSS (diff)
downloadpackage-repository-0680074fd3c39d135fd75a1585e30e9470fbc785.tar.gz
package-repository-0680074fd3c39d135fd75a1585e30e9470fbc785.tar.xz
src/bin/paku.in: Simplify Debian using less variables
Diffstat (limited to 'src')
-rwxr-xr-xsrc/bin/paku.in73
1 files changed, 25 insertions, 48 deletions
diff --git a/src/bin/paku.in b/src/bin/paku.in
index 7c240f7..a93ea82 100755
--- a/src/bin/paku.in
+++ b/src/bin/paku.in
@@ -332,21 +332,10 @@ sub emit_guix() {
sub emit_debian() {
my $json = load_json();
- my %vars = (
- tarballs => ["tarballs = \\\n"],
- checkouts => ["checkouts = \\\n"],
- destdirs => ["debian-destdirs = \\\n"],
- ctrlfiles => ["control-files = \\\n"],
- destdebs => ["destdir-debs = \\\n"],
- debs => ["debs = \\\n"],
- );
-
+ my @debs = ("debs = \\\n");
my @targets = ();
for my $pkg (@{$json->{packages}}) {
- push @{$vars{tarballs}}, "\t\$(DIR)/tarballs/$pkg->{fname} \\\n";
- push @{$vars{checkouts}}, "\t\$(DIR)/checkouts/$pkg->{name}-$pkg->{version} \\\n";
-
push @targets, <<~EOF;
\$(DIR)/tarballs/$pkg->{fname}:
mkdir -p \$(\@D)
@@ -355,7 +344,7 @@ sub emit_debian() {
\$(DIR)/checkouts/$pkg->{name}-$pkg->{version}: \$(DIR)/tarballs/$pkg->{fname}
mkdir -p \$(\@D)
- tar -C \$(DIR)/checkouts/ -xf \$(DIR)/tarballs/$pkg->{fname}
+ tar -C \$(\@D) -xf \$(DIR)/tarballs/$pkg->{fname}
touch \$\@
EOF
@@ -363,54 +352,51 @@ sub emit_debian() {
next if $pkg->{architectures} ne 'any';
- push @{$vars{destdirs}}, "\t\$(DIR)/debian-destdir/$pkg->{name}-$pkg->{version}/DEBIAN \\\n";
- push @{$vars{ctrlfiles}}, "\t\$(DIR)/debian-destdir/$pkg->{name}-$pkg->{version}/DEBIAN/control \\\n";
- push @{$vars{destdebs}}, "\t\$(DIR)/debian-destdir/$pkg->{name}-$pkg->{version}.deb \\\n";
- push @{$vars{debs}}, "\t\$(DIR)/debian/$pkg->{name}_$pkg->{version}_all.deb \\\n";
+ push @debs, "\t\$(DIR)/debian/$pkg->{name}_$pkg->{version}_all.deb \\\n";
my $ver = $pkg->{label} eq 'latest' ? '0.' . $pkg->{version} . '.latest' : $pkg->{version};
$ver =~ s/^v//;
push @targets, <<~EOF;
- \$(DIR)/debian-destdir/$pkg->{name}-$pkg->{version}/DEBIAN: \$(DIR)/checkouts/$pkg->{name}-$pkg->{version}
+ \$(DIR)/builddirs/$pkg->{name}-$pkg->{version}/DEBIAN: \$(DIR)/checkouts/$pkg->{name}-$pkg->{version}
\$(MAKE) \\
-C \$(DIR)/checkouts/$pkg->{name}-$pkg->{version} \\
install \\
PREFIX=/usr \\
- DESTDIR="\$\$PWD"/\$(DIR)/debian-destdir/$pkg->{name}-$pkg->{version}
+ DESTDIR="\$\$PWD"/\$(\@D)
mkdir -p \$\@
touch \$\@
- \$(DIR)/debian-destdir/$pkg->{name}-$pkg->{version}/DEBIAN/control: \$(DIR)/debian-destdir/$pkg->{name}-$pkg->{version}/DEBIAN
+ \$(DIR)/builddirs/$pkg->{name}-$pkg->{version}/DEBIAN/control: \$(DIR)/builddirs/$pkg->{name}-$pkg->{version}/DEBIAN
printf '' > \$\@
- printf 'Package: $pkg->{name}\\n' >> \$\@
- printf 'Version: $ver\\n' >> \$\@
- printf 'Section: custom\\n' >> \$\@
- printf 'Depends:\\n' >> \$\@
- printf 'Priority: optional\\n' >> \$\@
- printf 'Architecture: all\\n' >> \$\@
- printf 'Essential: no\\n' >> \$\@
-
- printf 'Maintainer: ' >> \$\@
+ printf 'Package: $pkg->{name}\\n' >> \$\@
+ printf 'Version: $ver\\n' >> \$\@
+ printf 'Section: custom\\n' >> \$\@
+ printf 'Depends:\\n' >> \$\@
+ printf 'Priority: optional\\n' >> \$\@
+ printf 'Architecture: all\\n' >> \$\@
+ printf 'Essential: no\\n' >> \$\@
+
+ printf 'Maintainer: ' >> \$\@
printf '$pkg->{"maintainer-b64"}' | base64 -d >> \$\@
- printf '\\n' >> \$\@
+ printf '\\n' >> \$\@
- printf 'Description: ' >> \$\@
+ printf 'Description: ' >> \$\@
printf '$pkg->{"description-b64"}' | base64 -d >> \$\@
- printf '\\n' >> \$\@
+ printf '\\n' >> \$\@
printf '$pkg->{'long-description-b64'}' | \\
base64 -d | \\
sed 's|^\$\$|.|' | \\
- sed 's|^| |' >> \$\@
- printf '\\n' >> \$\@
+ sed 's|^| |' >> \$\@
+ printf '\\n' >> \$\@
- \$(DIR)/debian-destdir/$pkg->{name}-$pkg->{version}.deb: \$(DIR)/debian-destdir/$pkg->{name}-$pkg->{version}/DEBIAN/control
- dpkg-deb --build \$(DIR)/debian-destdir/$pkg->{name}-$pkg->{version}
+ \$(DIR)/builddirs/$pkg->{name}-$pkg->{version}.deb: \$(DIR)/builddirs/$pkg->{name}-$pkg->{version}/DEBIAN/control
+ dpkg-deb --build \$(DIR)/builddirs/$pkg->{name}-$pkg->{version}
- \$(DIR)/debian/$pkg->{name}_$pkg->{version}_all.deb: \$(DIR)/debian-destdir/$pkg->{name}-$pkg->{version}.deb
+ \$(DIR)/debian/$pkg->{name}_$pkg->{version}_all.deb: \$(DIR)/builddirs/$pkg->{name}-$pkg->{version}.deb
mkdir -p \$(\@D)
- cp \$(DIR)/debian-destdir/$pkg->{name}-$pkg->{version}.deb \$\@
+ cp \$(DIR)/builddirs/$pkg->{name}-$pkg->{version}.deb \$\@
EOF
@@ -418,15 +404,7 @@ sub emit_debian() {
print "DIR = $dir\n\n";
-
- print
- @{$vars{tarballs}}, "\n",
- @{$vars{checkouts}}, "\n",
- @{$vars{destdirs}}, "\n",
- @{$vars{ctrlfiles}}, "\n",
- @{$vars{destdebs}}, "\n",
- @{$vars{debs}}, "\n";
-
+ print @debs, "\n";
print <<~EOF;
GPGKEY = '$json->{maintainer}'
@@ -454,7 +432,6 @@ sub emit_debian() {
EOF
-
print @targets;
}