diff options
Diffstat (limited to '')
-rw-r--r-- | paku.lock | 5 | ||||
-rwxr-xr-x | src/bin/paku | 45 |
2 files changed, 17 insertions, 33 deletions
@@ -19,6 +19,7 @@ "native-inputs": [], "inputs": [], "version": "v0.1.0", + "label": "0-1-0", "sha256": "1jb0rgcj5b4bkm5gds3l0dymf3gd644r2njmirs9345vf54if45y", "sha256base32": "07waci3y0xdlbr8gl1lzdbsiz0csnrshcm6f18cdzn7y97irhb15", "url": "https://euandre.org/git/git-permalink/snapshot/git-permalink-v0.1.0.tar.xz", @@ -35,6 +36,7 @@ "native-inputs": [], "inputs": [], "version": "v0.2.0", + "label": "0-2-0", "sha256": "1bzx4gdfc87jfshaqifxpc3llp2j98wkzjjslzwbrqn59jzakxc9", "sha256base32": "10qiigp29jamb23mdrf1yp0gqmihlsg931ibpiqpf4pn28l5d9ly", "url": "https://euandre.org/git/git-permalink/snapshot/git-permalink-v0.2.0.tar.xz", @@ -51,6 +53,7 @@ "native-inputs": [], "inputs": [], "version": "v0.1.2", + "label": "0-1-2", "sha256": "1mrkyfcgz77hw7mpgqrnsaws9qng2awf8flslzf1s1gikk3zljns", "sha256base32": "1syzn41w4f754ihblwxcv3wn653lh92cgg6g06db1qrx3m2zvw5v", "url": "https://euandre.org/git/remembering/snapshot/remembering-v0.1.2.tar.xz", @@ -67,6 +70,7 @@ "native-inputs": [], "inputs": [], "version": "4a8a7a2662c94b2581f587e9a4b81feba4f5e7d8", + "label": "latest", "sha256": "1xqr2vc270jydk508pbkhcchmbg74w4bf83ch2d85nqja14r64n9", "sha256base32": "01g1vnlz1kch8j9zzaxyixih04azdvrfabfzg7xqny32h2p62md2", "url": "https://euandre.org/git/td/snapshot/td-4a8a7a2662c94b2581f587e9a4b81feba4f5e7d8.tar.xz", @@ -94,6 +98,7 @@ ], "type": "latest", "version": "065435cdce609604e33b879b9be3e81ab89f3e7b", + "label": "latest", "sha256": "179qq17mgi4kakhj9w1dk26afljh5yad4j9ih9d8wms70x6h211m", "sha256base32": "1y1110bg4ki0dvn8hggxy34wg7ig4r3377nc84isnj3dydqm2vjd", "url": "https://euandre.org/git/guile-heredoc/snapshot/guile-heredoc-065435cdce609604e33b879b9be3e81ab89f3e7b.tar.xz", diff --git a/src/bin/paku b/src/bin/paku index 6ba6d04..cbc8df0 100755 --- a/src/bin/paku +++ b/src/bin/paku @@ -87,19 +87,6 @@ my $json_str = do { 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; @@ -149,11 +136,7 @@ sub emit_nix() { $ns = rec { EOF for my $pkg (@{$json->{packages}}) { - my $ver = $pkg->{version}; - $ver =~ s/^v//; - $ver =~ s/\./-/g; - if ($pkg->{type} eq 'latest') { - $ver = 'latest'; + if ($pkg->{label} eq 'latest') { print <<~EOF; $pkg->{name} = $pkg->{name}-latest; EOF @@ -163,7 +146,7 @@ sub emit_nix() { $long =~ s/^(.)/ $1/gm; print <<~EOF; - $pkg->{name}-$ver = pkgs.stdenv.mkDerivation rec { + $pkg->{name}-$pkg->{label} = pkgs.stdenv.mkDerivation rec { name = "$pkg->{name}"; version = "$pkg->{version}"; @@ -241,22 +224,18 @@ sub emit_guix() { my @pkgs = (); for my $pkg (@{$json->{packages}}) { - my $ver = $pkg->{version}; - $ver =~ s/^v//; - $ver =~ s/\./-/g; - if ($pkg->{type} eq 'latest') { + if ($pkg->{label} eq 'latest') { push @pkgs, "$pkg->{name}"; - $ver = 'latest'; } my $long = $pkg->{'long-description'}; $long =~ s/^(.)/ $1/gm; - push @pkgs, "$pkg->{name}-$ver"; + push @pkgs, "$pkg->{name}-$pkg->{label}"; print <<~EOF; - (define-public $pkg->{name}-$ver + (define-public $pkg->{name}-$pkg->{label} (package - (name "$pkg->{name}-$ver") + (name "$pkg->{name}-$pkg->{label}") (version "$pkg->{version}") (source (origin @@ -352,7 +331,7 @@ sub emit_debian() { 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}; + my $ver = $pkg->{label} eq 'latest' ? '0.' . $pkg->{version} . '.latest' : $pkg->{version}; $ver =~ s/^v//; my $maintainer_b64 = MIME::Base64::encode_base64 $pkg->{maintainer}, ''; my $desc_b64 = MIME::Base64::encode_base64 $pkg->{description}, ''; @@ -479,14 +458,14 @@ sub emit_html() { EOF for my $pkg (@{$json->{packages}}) { - my ($ver, $suffix) = pretty_version $pkg; - my $apt_suffix = $suffix eq '' ? '' : "=$ver"; + my $suffix = $pkg->{label} eq 'latest' ? '' : "-$pkg->{label}"; + my $apt_suffix = $suffix =~ s/-/=/r; print <<~EOF; - <li id="$pkg->{name}-$ver"> + <li id="$pkg->{name}-$pkg->{label}"> <details> <summary> - <a href="#$pkg->{name}-$ver">$pkg->{name}</a> - ($ver) - $pkg->{description} + <a href="#$pkg->{name}-$pkg->{label}">$pkg->{name}</a> + ($pkg->{label}) - $pkg->{description} </summary> <p> <a href="$pkg->{'base-url'}/">Homepage</a> |