From 673226a47f5ebe6f3083c449dd005589f2769a0b Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 22 Mar 2023 16:56:10 -0300 Subject: Remove redundant "-latest" variants of packages in Guix and Nix --- src/bin/paku | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) (limited to 'src/bin/paku') diff --git a/src/bin/paku b/src/bin/paku index 55372b6..94f8d38 100755 --- a/src/bin/paku +++ b/src/bin/paku @@ -172,17 +172,12 @@ sub emit_nix() { $ns = rec { EOF for my $pkg (@{$json->{packages}}) { - if ($pkg->{label} eq 'latest') { - print <<~EOF; - $pkg->{name} = $pkg->{name}-latest; - EOF - } - my $long = $pkg->{'long-description'}; $long =~ s/^(.)/ $1/gm; + my $suffix = $pkg->{label} eq 'latest' ? '' : "-$pkg->{label}"; print <<~EOF; - $pkg->{name}-$pkg->{label} = pkgs.stdenv.mkDerivation rec { + $pkg->{name}$suffix = pkgs.stdenv.mkDerivation rec { name = "$pkg->{name}"; version = "$pkg->{version}"; @@ -261,18 +256,17 @@ sub emit_guix() { my @pkgs = (); for my $pkg (@{$json->{packages}}) { - if ($pkg->{label} eq 'latest') { - push @pkgs, "$pkg->{name}"; - } - my $long = $pkg->{'long-description'}; $long =~ s/^(.)/ $1/gm; - push @pkgs, "$pkg->{name}-$pkg->{label}"; + my $name = $pkg->{name} . ( + $pkg->{label} eq 'latest' ? '' : "-$pkg->{label}" + ); + push @pkgs, $name; print <<~EOF; - (define-public $pkg->{name}-$pkg->{label} + (define-public $name (package - (name "$pkg->{name}-$pkg->{label}") + (name "$name") (version "$pkg->{version}") (source (origin @@ -313,16 +307,6 @@ sub emit_guix() { (license licenses:agpl3+))) EOF - if ($pkg->{type} eq 'latest') { - print <<~EOF; - (define-public $pkg->{name} - (package - (inherit $pkg->{name}-latest) - (name "$pkg->{name}"))) - - - EOF - } } print '(list'; for (@pkgs) { -- cgit v1.2.3