aboutsummaryrefslogtreecommitdiff
path: root/src/bin/paku
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2023-03-21 13:45:08 -0300
committerEuAndreh <eu@euandre.org>2023-03-21 13:45:08 -0300
commitdc9c64fce26afda37c0c80fe5b68cca6f0b16d73 (patch)
treeac4935dde87065ac0f55b4534dae2680e3ae759e /src/bin/paku
parentsrc/bin/paku: General cleanup and tidyness (diff)
downloadpackage-repository-dc9c64fce26afda37c0c80fe5b68cca6f0b16d73.tar.gz
package-repository-dc9c64fce26afda37c0c80fe5b68cca6f0b16d73.tar.xz
src/bin/paku: Turn value of $dir into Make variable $(DIR)
Diffstat (limited to '')
-rwxr-xr-xsrc/bin/paku56
1 files changed, 29 insertions, 27 deletions
diff --git a/src/bin/paku b/src/bin/paku
index 262d0c8..8acb991 100755
--- a/src/bin/paku
+++ b/src/bin/paku
@@ -316,18 +316,18 @@ sub emit_debian() {
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 @{$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}:
+ \$(DIR)/tarballs/$pkg->{fname}:
mkdir -p \$(\@D)
wget -O \$\@ \\
'$pkg->{url}'
- $dir/checkouts/$pkg->{name}-$pkg->{version}: $dir/tarballs/$pkg->{fname}
+ \$(DIR)/checkouts/$pkg->{name}-$pkg->{version}: \$(DIR)/tarballs/$pkg->{fname}
mkdir -p \$(\@D)
- tar -C $dir/checkouts/ -xf $dir/tarballs/$pkg->{fname}
+ tar -C \$(DIR)/checkouts/ -xf \$(DIR)/tarballs/$pkg->{fname}
touch \$\@
EOF
@@ -335,10 +335,10 @@ 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 @{$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";
my $ver = $pkg->{type} eq 'latest' ? '0.' . $pkg->{version} . '.latest' : $pkg->{version};
$ver =~ s/^v//;
@@ -347,16 +347,16 @@ sub emit_debian() {
my $long_desc_b64 = MIME::Base64::encode_base64 $pkg->{'long-description'}, '';
push @targets, <<~EOF;
- $dir/debian-destdir/$pkg->{name}-$pkg->{version}/DEBIAN: $dir/checkouts/$pkg->{name}-$pkg->{version}
+ \$(DIR)/debian-destdir/$pkg->{name}-$pkg->{version}/DEBIAN: \$(DIR)/checkouts/$pkg->{name}-$pkg->{version}
\$(MAKE) \\
- -C $dir/checkouts/$pkg->{name}-$pkg->{version} \\
+ -C \$(DIR)/checkouts/$pkg->{name}-$pkg->{version} \\
install \\
PREFIX=/usr \\
- DESTDIR="\$\$PWD"/$dir/debian-destdir/$pkg->{name}-$pkg->{version}
+ DESTDIR="\$\$PWD"/\$(DIR)/debian-destdir/$pkg->{name}-$pkg->{version}
mkdir -p \$\@
touch \$\@
- $dir/debian-destdir/$pkg->{name}-$pkg->{version}/DEBIAN/control: $dir/debian-destdir/$pkg->{name}-$pkg->{version}/DEBIAN
+ \$(DIR)/debian-destdir/$pkg->{name}-$pkg->{version}/DEBIAN/control: \$(DIR)/debian-destdir/$pkg->{name}-$pkg->{version}/DEBIAN
printf '' > \$\@
printf 'Package: $pkg->{name}\\n' >> \$\@
printf 'Version: $ver\\n' >> \$\@
@@ -380,18 +380,20 @@ sub emit_debian() {
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)/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/debian/$pkg->{name}_$pkg->{version}_all.deb: $dir/debian-destdir/$pkg->{name}-$pkg->{version}.deb
+ \$(DIR)/debian/$pkg->{name}_$pkg->{version}_all.deb: \$(DIR)/debian-destdir/$pkg->{name}-$pkg->{version}.deb
mkdir -p \$(\@D)
- cp $dir/debian-destdir/$pkg->{name}-$pkg->{version}.deb \$\@
+ cp \$(DIR)/debian-destdir/$pkg->{name}-$pkg->{version}.deb \$\@
EOF
}
+ print "DIR = $dir\n\n";
+
print
@{$vars{tarballs}}, "\n",
@{$vars{checkouts}}, "\n",
@@ -404,25 +406,25 @@ sub emit_debian() {
GPGKEY = '$json->{maintainer}'
- all: $dir/debian/InRelease $dir/debian/Release.gpg $dir/debian/public-key.asc
+ all: \$(DIR)/debian/InRelease \$(DIR)/debian/Release.gpg \$(DIR)/debian/public-key.asc
public-dir:
- \@printf '$dir/debian'
+ \@printf '\$(DIR)/debian'
- $dir/debian/Packages: \$(debs)
+ \$(DIR)/debian/Packages: \$(debs)
cd \$(\@D) && dpkg-scanpackages -m . > \$(\@F)
- $dir/debian/Release: $dir/debian/Packages
- perl src/bin/paku debian-release $dir/debian/Packages > \$\@
+ \$(DIR)/debian/Release: \$(DIR)/debian/Packages
+ perl src/bin/paku debian-release \$(DIR)/debian/Packages > \$\@
- $dir/debian/Release.gpg: $dir/debian/Release
- gpg -abs -o \$\@ $dir/debian/Release
+ \$(DIR)/debian/Release.gpg: \$(DIR)/debian/Release
+ gpg -abs -o \$\@ \$(DIR)/debian/Release
- $dir/debian/InRelease: $dir/debian/Release
- gpg --default-key \$(GPGKEY) -a --clear-sign -o \$\@ $dir/debian/Release
+ \$(DIR)/debian/InRelease: \$(DIR)/debian/Release
+ gpg --default-key \$(GPGKEY) -a --clear-sign -o \$\@ \$(DIR)/debian/Release
- $dir/debian/public-key.asc: $dir/debian/Release
+ \$(DIR)/debian/public-key.asc: \$(DIR)/debian/Release
gpg --armour --export \$(GPGKEY) > \$\@