aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2023-03-23 09:26:59 -0300
committerEuAndreh <eu@euandre.org>2023-03-23 09:27:34 -0300
commit6ac20cd3f258cdd235eb2f07c6e8170e6d57683e (patch)
tree3240300b0f6a1ca4cc9e44ba660b5cbd5c0eafff
parentsrc/bin/paku.in: Allow dependency mapping to change in number (diff)
downloadpackage-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.lock8
-rwxr-xr-xsrc/bin/paku.in16
2 files changed, 14 insertions, 10 deletions
diff --git a/paku.lock b/paku.lock
index 73a8e32..82231fd 100644
--- a/paku.lock
+++ b/paku.lock
@@ -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";