diff options
-rwxr-xr-x | Master/texmf-dist/scripts/texlive/tlmgr.pl | 10 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLPOBJ.pm | 5 |
2 files changed, 12 insertions, 3 deletions
diff --git a/Master/texmf-dist/scripts/texlive/tlmgr.pl b/Master/texmf-dist/scripts/texlive/tlmgr.pl index 7dd33fd6d0d..9354d9f8658 100755 --- a/Master/texmf-dist/scripts/texlive/tlmgr.pl +++ b/Master/texmf-dist/scripts/texlive/tlmgr.pl @@ -3617,11 +3617,15 @@ sub show_one_package_json { my $is_installed = (defined($loctlp) ? 1 : 0); my $is_available = (defined($remtlp) ? 1 : 0); if (!($is_installed || $is_available)) { - tlwarn("$prg: package $p not found neither locally nor remote!\n"); - return($F_WARNING); + # output proper JSON for unavailable packages + print "{ \"name\":\"$p\", \"available\":false }\n"; + #tlwarn("$prg: package $p not found neither locally nor remote!\n"); + #return($F_WARNING); + return($F_OK); } my $tlp = ($is_installed ? $loctlp : $remtlp); - my $str = $tlp->as_json(); + my $str = $tlp->as_json(available => ($is_available ? $JSON::true : $JSON::false), + installed => ($is_installed ? $JSON::true : $JSON::false)); print $str, "\n"; return($F_OK); } diff --git a/Master/tlpkg/TeXLive/TLPOBJ.pm b/Master/tlpkg/TeXLive/TLPOBJ.pm index 3e603bc99a3..95c5adeffbf 100644 --- a/Master/tlpkg/TeXLive/TLPOBJ.pm +++ b/Master/tlpkg/TeXLive/TLPOBJ.pm @@ -422,6 +422,7 @@ sub writeout_simple { sub as_json { my $self = shift; + my %addargs = @_; require JSON; #my $json = JSON::PP->new->utf8; my %foo = %{$self}; @@ -441,6 +442,10 @@ sub as_json { $foo{'relocated'} = $JSON::false; } } + # set the additional args + for my $k (keys %addargs) { + $foo{$k} = $addargs{$k}; + } my $utf8_encoded_json_text = JSON::encode_json(\%foo); # $json->encode(\%foo); return $utf8_encoded_json_text; } |