diff options
author | EuAndreh <eu@euandre.org> | 2023-03-23 09:26:59 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2023-03-23 09:27:34 -0300 |
commit | 6ac20cd3f258cdd235eb2f07c6e8170e6d57683e (patch) | |
tree | 3240300b0f6a1ca4cc9e44ba660b5cbd5c0eafff | |
parent | src/bin/paku.in: Allow dependency mapping to change in number (diff) | |
download | package-repository-6ac20cd3f258cdd235eb2f07c6e8170e6d57683e.tar.gz package-repository-6ac20cd3f258cdd235eb2f07c6e8170e6d57683e.tar.xz |
src/bin/paku.in: Enable license mapping to be extended or overriden from paku.lock
-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"; |