diff options
-rw-r--r-- | paku.lock | 5 | ||||
-rwxr-xr-x | src/bin/paku.in | 48 |
2 files changed, 24 insertions, 29 deletions
@@ -90,6 +90,7 @@ "description-b64" : "R2l0IGV4dGVuc2lvbiB0byBnZW5lcmF0ZSB3ZWIgcGVybWFsaW5rcyBvZiBmaWxlcyBpbiBhIHJlcG9zaXRvcnk=", "downloads-page" : "https://euandre.org/s/git-permalink/#releases", "fname" : "git-permalink-v0.1.0.tar.xz", + "full-name" : "git-permalink-0-1-0", "homepage" : "https://euandre.org/s/git-permalink/", "i18n" : false, "inputs" : [], @@ -123,6 +124,7 @@ "description-b64" : "R2l0IGV4dGVuc2lvbiB0byBnZW5lcmF0ZSB3ZWIgcGVybWFsaW5rcyBvZiBmaWxlcyBpbiBhIHJlcG9zaXRvcnk=", "downloads-page" : "https://euandre.org/s/git-permalink/#releases", "fname" : "git-permalink-v0.2.0.tar.xz", + "full-name" : "git-permalink-0-2-0", "homepage" : "https://euandre.org/s/git-permalink/", "i18n" : false, "inputs" : [], @@ -156,6 +158,7 @@ "description-b64" : "TWluaW1hbGlzdGljIGJ1ZyB0cmFja2VyIENMSQ==", "downloads-page" : "https://euandre.org/s/td/#releases", "fname" : "td-4a8a7a2662c94b2581f587e9a4b81feba4f5e7d8.tar.xz", + "full-name" : "td", "homepage" : "https://euandre.org/s/td/", "i18n" : true, "inputs" : [], @@ -177,7 +180,7 @@ "url" : "https://euandre.org/git/td/snapshot/td-4a8a7a2662c94b2581f587e9a4b81feba4f5e7d8.tar.xz", "version" : "main", "vlabel" : "4a8a7a2662c94b2581f587e9a4b81feba4f5e7d8", - "vname" : "4a8a7a2662c94b2581f587e9a4b81feba4f5e7d8", + "vname" : "latest", "vversion" : "4a8a7a2662c94b2581f587e9a4b81feba4f5e7d8" } ], diff --git a/src/bin/paku.in b/src/bin/paku.in index d2900f2..71f29c2 100755 --- a/src/bin/paku.in +++ b/src/bin/paku.in @@ -247,9 +247,8 @@ sub emit_nix() { $long =~ s/^(.)/ $1/gm; my $license = license_for 'nix', $license_mapping, $pkg->{license}; - my $suffix = $pkg->{label} eq 'latest' ? '' : "-$pkg->{label}"; print <<~EOF; - $pkg->{name}$suffix = pkgs.stdenv.mkDerivation rec { + $pkg->{'full-name'} = pkgs.stdenv.mkDerivation rec { name = "$pkg->{name}"; version = "$pkg->{vlabel}"; @@ -334,12 +333,9 @@ sub emit_guix() { $long =~ s/^(.)/ $1/gm; my $license = license_for 'guix', $license_mapping, $pkg->{license}; - my $name = $pkg->{name} . ( - $pkg->{label} eq 'latest' ? '' : "-$pkg->{label}" - ); - push @pkgs, $name; + push @pkgs, $pkg->{'full-name'}; print <<~EOF; - (define-public $name + (define-public $pkg->{'full-name'} (package (name "$pkg->{name}") (version "$pkg->{vlabel}") @@ -533,9 +529,7 @@ sub emit_alpine() { my $date = $pkg->{date} =~ s/-//gr; my $ver = $pkg->{label} eq 'latest' ? "0.0.1_git$date" : $pkg->{vversion}; - my $dir = "$d/$pkg->{name}" . ( - $pkg->{label} eq 'latest' ? '' : "-$pkg->{label}" - ); + my $dir = "$d/$pkg->{'full-name'}"; mkdir "$dir"; open(my $fh, '>', "$dir/APKBUILD"); print $fh <<~EOF; @@ -588,9 +582,7 @@ sub emit_alpine() { my $date = $pkg->{date} =~ s/-//gr; my $ver = $pkg->{label} eq 'latest' ? "0.0.1_git$date" : $pkg->{vversion}; - my $recipe_dir = "src/alpine/$pkg->{name}" . ( - $pkg->{label} eq 'latest' ? '' : "-$pkg->{label}" - ) . '/'; + my $recipe_dir = "src/alpine/$pkg->{'full-name'}/"; my $apk_name = "$pkg->{name}-$ver-r0.apk"; my $apk_path = "\$(DIR)/alpine/REPODEST/alpine/x86_64/$apk_name"; @@ -647,11 +639,8 @@ sub emit_homebrew() { my $d = $ARGV[0] or die 'Missing "Formula/" directory'; my $json = load_json(); for my $pkg (@{$json->{pkgs}}) { - my $name = $pkg->{name} . ( - $pkg->{label} eq 'latest' ? '' : "-$pkg->{label}" - ); - open(my $fh, '>', "$d/$name.rb"); - my $class_name = pascal_case $name; + open(my $fh, '>', "$d/$pkg->{'full-name'}.rb"); + my $class_name = pascal_case $pkg->{'full-name'}; print $fh <<~EOF; class $class_name < Formula desc '$pkg->{description}' @@ -741,19 +730,17 @@ sub emit_html() { EOF for my $pkg (@{$json->{pkgs}}) { - my $guix_suffix = $pkg->{label} eq 'latest' ? '' : '@' . $pkg->{label} =~ s/-/./gr; - my $suffix = $pkg->{label} eq 'latest' ? '' : "-$pkg->{label}"; - my $apt_suffix = $suffix =~ s/-/=/r; + my $guix_suffix = $pkg->{label} eq 'latest' ? '' : "\@$pkg->{version}"; + my $apt_suffix = $pkg->{label} eq 'latest' ? '' : "=$pkg->{label}"; my $id = $pkg->{name} . ( $pkg->{label} eq 'latest' ? '' : "-$pkg->{vversion}" ); - my $label = $pkg->{label} eq 'latest' ? 'latest' : $pkg->{vversion}; print <<~EOF; <li id="$id"> <details> <summary> <a href="#$id">$pkg->{name}</a> - ($label) - $pkg->{description} + ($pkg->{vname}) - $pkg->{description} </summary> <p> <a href="$pkg->{homepage}">Homepage</a> @@ -802,11 +789,11 @@ sub emit_html() { to include this repository as an overlay, you can launch a shell that includes this package: </p> - <pre><code>\$ nix-shell -p $pkg->{name}$suffix</code></pre> + <pre><code>\$ nix-shell -p $pkg->{'full-name'}</code></pre> <p> Alternatively, you can install it imperatively: </p> - <pre><code>\$ nix-env -i $pkg->{name}$suffix</code></pre> + <pre><code>\$ nix-env -i $pkg->{'full-name'}</code></pre> </section> <section> <h2>Homebrew</h2> @@ -816,7 +803,7 @@ sub emit_html() { to include this repository as a <code>tap</code>, you can install it with: </p> - <pre><code>\$ brew install $pkg->{name}$suffix</code></pre> + <pre><code>\$ brew install $pkg->{'full-name'}</code></pre> </section> </details> </li> @@ -1063,7 +1050,7 @@ sub emit_refresh() { type => 'branch', vversion => $revision, version => $_, - vname => $revision, + vname => $label, vlabel => $revision, label => $label, ); @@ -1077,6 +1064,11 @@ sub emit_refresh() { architectures => 'any', }; + my $full_name = $pkg->{name} . ( + $pkg->{label} eq 'latest' ? '' : "-$pkg->{label}" + ); + $pkg->{'full-name'} = $full_name; + my $revision = `git -C '$dir' rev-parse '$pkg->{vversion}'`; die if $?; chomp $revision; @@ -1084,7 +1076,7 @@ sub emit_refresh() { `git -C '$dir' checkout '$pkg->{vversion}'`; die if $?; - my $url = run_template($package->{name}, $pkg->{vname}, $out->{defaults}{templates}{tarball}); + my $url = run_template($package->{name}, $pkg->{vversion}, $out->{defaults}{templates}{tarball}); $pkg->{url} = $url; my $date = `git -C '$dir' log -1 --format=%cs`; |