diff options
-rw-r--r-- | paku.lock | 8 | ||||
-rwxr-xr-x | src/bin/paku.in | 16 |
2 files changed, 14 insertions, 10 deletions
@@ -7,9 +7,11 @@ }, "mappings": { "guix": { - "guile": [ - "guile-3.0" - ] + "packages": { + "guile": [ + "guile-3.0" + ] + } } }, "namespace": "org.euandre", diff --git a/src/bin/paku.in b/src/bin/paku.in index a19b3e5..d1d7939 100755 --- a/src/bin/paku.in +++ b/src/bin/paku.in @@ -99,8 +99,8 @@ my $licenses = { 'AGPL-3.0-or-later' => 'agpl3Plus', }, }; -sub license_for($target, $id) { - return $licenses->{$target}->{$id}; +sub license_for($target, $mappings, $id) { + return $mappings->{$id} || $licenses->{$target}->{$id} || $id; } sub inputs_for($mappings, @inputs) { @@ -195,10 +195,11 @@ sub emit_nix() { self: super: { $ns = rec { EOF + my $license_mapping = $json->{mappings}{nix}{licenses}; for my $pkg (@{$json->{packages}}) { my $long = $pkg->{'long-description'}; $long =~ s/^(.)/ $1/gm; - my $license = license_for 'nix', $pkg->{license}; + my $license = license_for 'nix', $license_mapping, $pkg->{license}; my $suffix = $pkg->{label} eq 'latest' ? '' : "-$pkg->{label}"; print <<~EOF; @@ -279,13 +280,14 @@ sub emit_guix() { EOF - my $mappings = $json->{mappings}{guix}; + my $pkg_mapping = $json->{mappings}{guix}{packages}; + my $license_mapping = $json->{mappings}{guix}{licenses}; my @pkgs = (); for my $pkg (@{$json->{packages}}) { my $long = $pkg->{'long-description'}; $long =~ s/^(.)/ $1/gm; my $ver = $pkg->{version} =~ s/^v//r; - my $license = license_for 'guix', $pkg->{license}; + my $license = license_for 'guix', $license_mapping, $pkg->{license}; my $name = $pkg->{name} . ( $pkg->{label} eq 'latest' ? '' : "-$pkg->{label}" @@ -307,14 +309,14 @@ sub emit_guix() { EOF print ' (list'; - for (inputs_for $mappings, @{$pkg->{'native-inputs'}}) { + for (inputs_for $pkg_mapping, @{$pkg->{'native-inputs'}}) { print "\n $_"; } print "))\n"; print " (inputs\n"; print ' (list'; - for (inputs_for $mappings, @{$pkg->{inputs}}) { + for (inputs_for $pkg_mapping, @{$pkg->{inputs}}) { print "\n $_"; } print "))\n"; |