From 31c5b9454b5c8be82772c10a5fdf4a1bc1074112 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 21 Mar 2023 15:18:04 -0300 Subject: src/bin/paku: First-ish version of HTML output --- paku.lock | 1 + src/bin/paku | 172 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 173 insertions(+) diff --git a/paku.lock b/paku.lock index f89a9fb..4ac3b22 100644 --- a/paku.lock +++ b/paku.lock @@ -12,6 +12,7 @@ }, "namespace": "org.euandre", "maintainer": "EuAndreh ", + "name": "EuAndreh", "packages": [ { "name": "git-permalink", diff --git a/src/bin/paku b/src/bin/paku index 8acb991..6ba6d04 100755 --- a/src/bin/paku +++ b/src/bin/paku @@ -88,6 +88,18 @@ my $json = JSON::decode_json($json_str); my $action = $ARGV[0] or die "Missing ACTION"; +sub pretty_version($pkg) { + if ($pkg->{type} eq 'latest') { + return ('latest', ''); + } else { + my $ver = $pkg->{version}; + $ver =~ s/^v//; + $ver =~ s/\./-/g; + return ($ver, "-$ver"); + } +} + + sub emit_release() { my $f = $ARGV[1]; my $name = File::Basename::basename $f; @@ -434,7 +446,167 @@ sub emit_debian() { } sub emit_html() { + print <<~EOF; + + + + + + + $json->{name} package index + + + + +
+

+ $json->{name} package index +

+
    + EOF + + for my $pkg (@{$json->{packages}}) { + my ($ver, $suffix) = pretty_version $pkg; + my $apt_suffix = $suffix eq '' ? '' : "=$ver"; + print <<~EOF; +
  • +
    + + $pkg->{name} + ($ver) - $pkg->{description} + +

    + Homepage +

    +
    +

    Guix

    +

    + After following the + Guix instructions + to include this channel, you can launch a shell + that includes this package: +

    +
    \$ guix shell $pkg->{name}$suffix
    +

    + Alternatively, you can install it imperatively: +

    +
    \$ guix install $pkg->{name}$suffix
    +
    +
    +

    Debian

    +

    + After following the + Debian instructions + to include this repository to + /etc/apt/sources.list, you can + install it: +

    +
    # apt install $pkg->{name}$apt_suffix
    +
    +
    +

    Nix

    +

    + After following the + Nix instructions + to include this repository as an overlay, you + can launch a shell that includes this package: +

    +
    \$ nix-shell -p $pkg->{name}$suffix
    +

    + Alternatively, you can install it imperatively: +

    +
    \$ nix-env -i $pkg->{name}$suffix
    +
    +
    +
  • + EOF + } + print <<~EOF; +
+
+

Guix instructions

+

+ Add this channel to your + ~/.config/guix/channels.scm: +

+
(cons*
+		 (channel
+		  (name 'org-euandre)
+		  (url "git://euandre.org/package-repository")
+		  (branch "main")
+		  (introduction
+		   (make-channel-introduction
+		    "d749e053e6db365069cb9b2ef47a78b06f9e7361"
+		    (openpgp-fingerprint
+		     "5BDA E9B8 B2F6 C6BC BB0D  6CE5 81F9 0EC3 CD35 6060"))))
+		 %default-channels)
+

+ Afterwards, do a guix pull to make the + packages in this channel available to your profile. +

+

+ See also the + Guix manual on channels + for more information. +

+
+
+

Debian instructions

+

+ Include my public key for validating the repository + signatures: + ~/.config/guix/channels.scm: +

+
\$ wget -qO- https://euandre.org/s/package-repository/debian/public-key.asc | sudo tee /etc/apt/trusted.gpg.d/euandre.org.asc
+

+ Afterwards, include this repository to the list of + repositories that apt uses for sources + by adding its URL to + /etc/apt/sources.list: +

+
\$ sudo apt-add-repository 'deb https://euandre.org/s/package-repository/debian ./'
+

+ apt-add-repository will already perform + an apt update, so the packages from the + new repository will already be available. +

+
+
+

Nix instructions

+

+ Add this repository as an overlay to your + /etc/nixos/configuration.nix: +

+
  nixpkgs = {
+		    overlays = [
+		      (import (fetchTarball {
+		        url = "https://euandre.org/git/package-repository/snapshot/package-repository-main.tar.gz";
+		      }) { inherit pkgs; })
+		    ];
+		  };
+

+ All the packages live under the + org-euandre attribute set. +

+
+
+ + + EOF } -- cgit v1.2.3