aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2023-03-23 09:19:13 -0300
committerEuAndreh <eu@euandre.org>2023-03-23 09:19:13 -0300
commitd4a585d02efb587e822d9ec4a9846098b6717ec9 (patch)
tree08dfaadc853412451389b6ca66added93d7258d2 /src
parentsrc/bin/paku.in: Simplify Debian using less variables (diff)
downloadpackage-repository-d4a585d02efb587e822d9ec4a9846098b6717ec9.tar.gz
package-repository-d4a585d02efb587e822d9ec4a9846098b6717ec9.tar.xz
src/bin/paku.in: Allow dependency mapping to change in number
Diffstat (limited to 'src')
-rwxr-xr-xsrc/bin/paku.in23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/bin/paku.in b/src/bin/paku.in
index a93ea82..a19b3e5 100755
--- a/src/bin/paku.in
+++ b/src/bin/paku.in
@@ -103,6 +103,18 @@ sub license_for($target, $id) {
return $licenses->{$target}->{$id};
}
+sub inputs_for($mappings, @inputs) {
+ my @out = ();
+ for (@inputs) {
+ if (!$mappings->{$_}) {
+ push @out, $_;
+ } else {
+ push @out, @{$mappings->{$_}};
+ }
+ }
+ return @out;
+}
+
sub emit_packages() {
for (@ARGV) {
my $fh;
@@ -267,6 +279,7 @@ sub emit_guix() {
EOF
+ my $mappings = $json->{mappings}{guix};
my @pkgs = ();
for my $pkg (@{$json->{packages}}) {
my $long = $pkg->{'long-description'};
@@ -294,17 +307,15 @@ sub emit_guix() {
EOF
print ' (list';
- for my $input (@{$pkg->{'native-inputs'}}) {
- my $name = $json->{mappings}{$input}{guix} || $input;
- print "\n $name";
+ for (inputs_for $mappings, @{$pkg->{'native-inputs'}}) {
+ print "\n $_";
}
print "))\n";
print " (inputs\n";
print ' (list';
- for my $input (@{$pkg->{inputs}}) {
- my $name = $json->{mappings}{$input}{guix} || $input;
- print "\n $name";
+ for (inputs_for $mappings, @{$pkg->{inputs}}) {
+ print "\n $_";
}
print "))\n";