aboutsummaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2023-03-28 12:21:20 -0300
committerEuAndreh <eu@euandre.org>2023-03-28 19:51:09 -0300
commit8ff13c6ba6cc3eb35ca92682634425e2229486a6 (patch)
tree5ab70b5c0a4d1e45ec195f37d9ff70c207410862 /src/bin
parentsrc/bin/paku.in, Makefile: Use "debian.out.txt" to communicate output files (diff)
downloadpackage-repository-8ff13c6ba6cc3eb35ca92682634425e2229486a6.tar.gz
package-repository-8ff13c6ba6cc3eb35ca92682634425e2229486a6.tar.xz
src/bin/paku.in: Add WIP version of Alpine support, based off of Debian
Diffstat (limited to 'src/bin')
-rwxr-xr-xsrc/bin/paku.in154
1 files changed, 154 insertions, 0 deletions
diff --git a/src/bin/paku.in b/src/bin/paku.in
index 3b2d221..e7c43f3 100755
--- a/src/bin/paku.in
+++ b/src/bin/paku.in
@@ -32,6 +32,7 @@ sub help($fh) {
ACTION what to emit, one of:
- guix
- debian
+ - alpine
- nix
- html
- guix-channel-key
@@ -499,6 +500,127 @@ sub emit_debian() {
print @targets;
}
+sub emit_alpine() {
+ my $json = load_json();
+ my @apks = ();
+ my @targets = ();
+
+ for my $pkg (@{$json->{packages}}) {
+ push @targets, <<~EOF;
+ \$(DIR)/tarballs/$pkg->{fname}:
+ mkdir -p \$(\@D)
+ wget -O \$\@ \\
+ '$pkg->{url}'
+
+ \$(DIR)/checkouts/$pkg->{name}-$pkg->{version}: \$(DIR)/tarballs/$pkg->{fname}
+ mkdir -p \$(\@D)
+ tar -C \$(\@D) -xf \$(DIR)/tarballs/$pkg->{fname}
+ touch \$\@
+
+ EOF
+
+
+ next if $pkg->{architectures} ne 'any';
+
+
+ my $deb_name = "$pkg->{name}_" . (
+ $pkg->{label} eq 'latest' ? 'latest' : $pkg->{version}
+ ) . "_all.deb";
+ my $deb_path = "\$(DIR)/debian/$deb_name";
+
+ push @apks, "\t$deb_path \\\n";
+
+ my $ver = $pkg->{label} eq 'latest' ? '0.' . $pkg->{version} . '.latest' : $pkg->{version};
+ $ver =~ s/^v//;
+
+ push @targets, <<~EOF;
+ \$(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"/\$(\@D)
+ mkdir -p \$\@
+ touch \$\@
+
+ \$(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 '$pkg->{"maintainer-b64"}' | base64 -d >> \$\@
+ printf '\\n' >> \$\@
+
+ printf 'Description: ' >> \$\@
+ printf '$pkg->{"description-b64"}' | base64 -d >> \$\@
+ printf '\\n' >> \$\@
+
+ printf '$pkg->{'long-description-b64'}' | \\
+ base64 -d | \\
+ sed 's|^\$\$|.|' | \\
+ sed 's|^| |' >> \$\@
+ printf '\\n' >> \$\@
+
+ \$(DIR)/builddirs/$pkg->{name}-$pkg->{version}.deb: \$(DIR)/builddirs/$pkg->{name}-$pkg->{version}/DEBIAN/control
+ dpkg-deb --build \$(DIR)/builddirs/$pkg->{name}-$pkg->{version}
+
+ $deb_path: \$(DIR)/builddirs/$pkg->{name}-$pkg->{version}.deb
+ mkdir -p \$(\@D)
+ cp \$(DIR)/builddirs/$pkg->{name}-$pkg->{version}.deb \$\@
+
+
+ EOF
+ }
+
+
+ print <<~EOF;
+ .POSIX:
+
+ DIR = $json->{datadir}
+
+ apks = \\
+ EOF
+
+ # print @apks, "\n";
+ print "\n\n";
+ print <<~EOF;
+ RSAKEY = '$json->{maintainer}{email}'
+
+
+ all: \$(DIR)/alpine/public/x86_64/APKINDEX.tar.gz \$(DIR)/alpine/public/\$(RSAKEY).rsa.pub
+
+ public-dir:
+ \@printf '\$(DIR)/alpine/public'
+
+
+ \$(DIR)/alpine/x86_64/APKINDEX: \$(apks)
+ mkdir -p \$(\@D) # FIXME
+ touch \$\@
+
+ \$(DIR)/alpine/x86_64/DESCRIPTION: \$(DIR)/alpine/x86_64/APKINDEX
+ echo xablau > \$\@
+
+ \$(DIR)/alpine/public/x86_64/APKINDEX.tar.gz: \$(DIR)/alpine/x86_64/APKINDEX \\
+ \$(DIR)/alpine/x86_64/DESCRIPTION
+ mkdir -p \$(\@D) # FIXME
+ tar -C \$(DIR)/alpine/x86_64 -cvf \$\@ APKINDEX DESCRIPTION
+
+
+ \$(DIR)/alpine/public/\$(RSAKEY).rsa.pub: \$(apks)
+ mkdir -p \$(\@D) # FIXME
+ gpg --export-ssh-key \$(RSAKEY) | ssh-keygen -f/dev/stdin -e -m pem > \$\@
+
+
+ EOF
+ # print @targets;
+}
+
sub pascal_case($s) {
return join('', map(ucfirst, split '-', $s))
}
@@ -641,6 +763,17 @@ sub emit_html() {
<pre><code># apt install $pkg->{name}$apt_suffix</code></pre>
</section>
<section>
+ <h2>Alpine</h2>
+ <p>
+ After folowwing the
+ <a href="#alpine-instructions">Alpine instructions</a>
+ to include this repository to
+ <code>/etc/apk/repositories</code>, you can
+ install it:
+ </p>
+ <pre><code># apk add $pkg->{name}</code></pre>
+ </section>
+ <section>
<h2>Nix</h2>
<p>
After following the
@@ -723,6 +856,26 @@ sub emit_html() {
be available.
</p>
</article>
+ <article id="alpine-instructions">
+ <h2>Alpine instructions</h2>
+ <p>
+ Get my public key used to sign the repository:
+ </p>
+ <pre><code>\$ wget -qO- $json->{'base-url'}/alpine/$json->{maintainer}{email}.rsa.pub |
+ doas tee /etc/apk/keys/$json->{maintainer}{email}.rsa.pub</code></pre>
+ <p>
+ Then include this repository in the
+ <code>apk-repositories(5)</code> list that
+ <code>apk(8)</code> uses to retrive package files for
+ installation:
+ </p>
+ <pre><code>\$ echo '$json->{'base-url'}/alpine' |
+ doas tee -a /etc/apk/repositories</code></pre>
+ <p>
+ After that the packages frmo this repository will be
+ available.
+ </p>
+ </article>
<article id="nix-instructions">
<h2>Nix instructions</h2>
<p>
@@ -793,6 +946,7 @@ my %actions = (
guix => \&emit_guix,
'guix-channel-key' => \&emit_guix_channel_key,
debian => \&emit_debian,
+ alpine => \&emit_alpine,
homebrew => \&emit_homebrew,
html => \&emit_html,
);