summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
Diffstat (limited to 'Master')
-rwxr-xr-xMaster/texmf-dist/scripts/texlive/tlmgr.pl2
-rw-r--r--Master/tlpkg/TeXLive/TLPDB.pm81
-rw-r--r--Master/tlpkg/doc/JSON-formats.txt81
3 files changed, 87 insertions, 77 deletions
diff --git a/Master/texmf-dist/scripts/texlive/tlmgr.pl b/Master/texmf-dist/scripts/texlive/tlmgr.pl
index 422accead84..b9ebe94dd6b 100755
--- a/Master/texmf-dist/scripts/texlive/tlmgr.pl
+++ b/Master/texmf-dist/scripts/texlive/tlmgr.pl
@@ -7862,7 +7862,7 @@ but are not currently set to any value.
Both forms take an option C<--json> in which case the options are dumped
in JSON format. In addition, with C<--json> the two forms dump the same
data. For the format of JSON output see C<tlpkg/doc/JSON-formats.txt>,
-format definition C<TLOPTIONS>.
+format definition C<TLOPTION>.
In the third form, if I<value> is not given, the setting for I<key> is
displayed. If I<value> is present, I<key> is set to I<value>.
diff --git a/Master/tlpkg/TeXLive/TLPDB.pm b/Master/tlpkg/TeXLive/TLPDB.pm
index 68644527b6b..834920a8a48 100644
--- a/Master/tlpkg/TeXLive/TLPDB.pm
+++ b/Master/tlpkg/TeXLive/TLPDB.pm
@@ -500,39 +500,78 @@ sub options_as_json {
my $self = shift;
die("calling _as_json on virtual is not supported!") if ($self->is_virtual);
my $opts = $self->options;
+ my @opts;
for my $k (keys %TeXLive::TLConfig::TLPDBOptions) {
- if ($TeXLive::TLConfig::TLPDBOptions{$k}[0] =~ m/^n/) {
- $opts->{$k} += 0 if (exists($opts->{$k}));
- } elsif ($TeXLive::TLConfig::TLPDBOptions{$k}[0] eq "b") {
- $opts->{$k} = ($opts->{$k} ? TeXLive::TLUtils::True() : TeXLive::TLUtils::False()) if (exists($opts->{$k}));
- } elsif ($k eq "location") {
+ my %foo;
+ $foo{'name'} = $k;
+ $foo{'tlmgrname'} = $TeXLive::TLConfig::TLPDBOptions{$k}[2];
+ $foo{'description'} = $TeXLive::TLConfig::TLPDBOptions{$k}[3];
+ $foo{'format'} = $TeXLive::TLConfig::TLPDBOptions{$k}[0];
+ $foo{'default'} = "$TeXLive::TLConfig::TLPDBOptions{$k}[1]";
+ # if ($TeXLive::TLConfig::TLPDBOptions{$k}[0] =~ m/^n/) {
+ # if (exists($opts->{$k})) {
+ # $foo{'value'} = $opts->{$k};
+ # $foo{'value'} += 0;
+ # }
+ # $foo{'default'} += 0;
+ # } elsif ($TeXLive::TLConfig::TLPDBOptions{$k}[0] eq "b") {
+ # if (exists($opts->{$k})) {
+ # $foo{'value'} = ($opts->{$k} ? TeXLive::TLUtils::True() : TeXLive::TLUtils::False());
+ # }
+ # $foo{'default'} = ($foo{'default'} ? TeXLive::TLUtils::True() : TeXLive::TLUtils::False());
+ # } elsif ($k eq "location") {
+ # my %def;
+ # $def{'main'} = $TeXLive::TLConfig::TLPDBOptions{$k}[1];
+ # $foo{'default'} = \%def;
+ # if (exists($opts->{$k})) {
+ # my %repos = TeXLive::TLUtils::repository_to_array($opts->{$k});
+ # $foo{'value'} = \%repos;
+ # }
+ # } elsif ($TeXLive::TLConfig::TLPDBOptions{$k}[0] eq "p") {
+ # # strings/path
+ # if (exists($opts->{$k})) {
+ # $foo{'value'} = $opts->{$k};
+ # }
+ # } else {
+
+ # TREAT ALL VALUES AS STRINGS, otherwise not parsable JSON
+ # treat as strings
if (exists($opts->{$k})) {
- my %foo = TeXLive::TLUtils::repository_to_array($opts->{$k});
- delete($opts->{$k});
- for my $u (keys %foo) {
- $opts->{$k}{$u} = $foo{$u};
- }
+ $foo{'value'} = $opts->{$k};
}
- }
- # the last else is plain strings, nothing to do
+ # }
+ push @opts, \%foo;
}
- return(TeXLive::TLUtils::encode_json($opts));
+ return(TeXLive::TLUtils::encode_json(\@opts));
}
sub settings_as_json {
my $self = shift;
die("calling _as_json on virtual is not supported!") if ($self->is_virtual);
my $sets = $self->settings;
+ my @json;
for my $k (keys %TeXLive::TLConfig::TLPDBSettings) {
- if ($TeXLive::TLConfig::TLPDBSettings{$k} eq "b") {
- $sets->{$k} = ($sets->{$k} ? TeXLive::TLUtils::True() : TeXLive::TLUtils::False()) if (exists($sets->{$k}));
- } elsif ($TeXLive::TLConfig::TLPDBSettings{$k} eq "available_architectures") {
- delete($sets->{$k});
- @{$sets->{$k}} = $self->available_architectures;
- }
- # else are strings
+ my %foo;
+ $foo{'name'} = $k;
+ $foo{'type'} = $TeXLive::TLConfig::TLPDBSettings{$k}[0];
+ $foo{'description'} = $TeXLive::TLConfig::TLPDBSettings{$k}[1];
+ # if ($TeXLive::TLConfig::TLPDBSettings{$k}[0] eq "b") {
+ # if (exists($sets->{$k})) {
+ # $foo{'value'} = ($sets->{$k} ? TeXLive::TLUtils::True() : TeXLive::TLUtils::False());
+ # }
+ # } elsif ($TeXLive::TLConfig::TLPDBSettings{$k} eq "available_architectures") {
+ # if (exists($sets->{$k})) {
+ # my @lof = $self->available_architectures;
+ # $foo{'value'} = \@lof;
+ # }
+ # } else {
+ if (exists($sets->{$k})) {
+ $foo{'value'} = "$sets->{$k}";
+ }
+ # }
+ push @json, \%foo;
}
- return(TeXLive::TLUtils::encode_json($sets));
+ return(TeXLive::TLUtils::encode_json(\@json));
}
sub configs_as_json {
diff --git a/Master/tlpkg/doc/JSON-formats.txt b/Master/tlpkg/doc/JSON-formats.txt
index 3447a819f4d..b44966bacf4 100644
--- a/Master/tlpkg/doc/JSON-formats.txt
+++ b/Master/tlpkg/doc/JSON-formats.txt
@@ -65,34 +65,11 @@ TLPDBSINGLE
-----------
JSON object with the following fields:
* Object type:
- - options: keys are the tlmgr names of %TLConfig::TLPDBOptions, that is
- . Number type: autobackup, fileassocs
- . Boolean type: formats, desktop_integration, generate_updmap, docfiles,
- srcfiles, postcode, w32_multi_user
- . String type: backupdir, location, sys_bin, sys_info, sys_man
- . Object type: repository: keys are tags, values are Strings
- if there is only one location then the tag is "main"
- Example:
- "options": {
- "autobackup": 2,
- "formats": false,
- "postcode": true,
- "backupdir": "/backup/tl",
- "repository": {
- "main": "http://mirror.ctan.org/systems/texlive/tlnet",
- "tlcontrib": "..."
- }
- }
-
- - settings: keys are the names of %TLConfig::TLPDBSettings, that is
- . Boolean type: usertree
- . String type: platform
- . Array type: available_architectures (Strings)
-
+ - options: see TLOPTION below
+ - settings: see TLSETTING below
- configs: keys are the names of %TLConfig::TLPDBConfigs, that is
. Boolean type: container_split_src_files, container_split_doc_files
. String type: container_format, minrelease, release
-
* Array type:
- tlpkgs: JSON array of TLPOBJs in JSON format
@@ -152,35 +129,29 @@ Example for one element of the array:
}
-TLOPTIONS
----------
-one object with keys are the option names and values are as follows:
-- String for options: sys_bin, sys_info, sys_man, backupdir
-- Boolean: install_srcfiles, install_docfiles, generate_updmap,
- w32_multi_user, desktop_integration, create_formats, post_code
-- Number: file_assocs, autobackup
-- Object: location: keys are tags, values are URLs (Strings)
-Example:
-{
- "sys_bin" : "/usr/local/bin",
- "sys_info" : "/usr/local/share/info",
- "sys_man" : "/usr/local/share/man",
- "file_assocs" : 1,
- "location" : {
- "main" : "/home/norbert/public_html/tlnet",
- "tlcritical" : "/home/norbert/public_html/tlcritical",
- },
- "autobackup" : 1,
- "install_srcfiles" : true,
- "post_code" : true,
- "create_formats" : true,
- "backupdir" : "tlpkg/backups",
- "w32_multi_user" : true,
- "desktop_integration" : true,
- "generate_updmap" : false,
- "install_docfiles" : true
-}
+TLOPTION / TLSETTING
+--------------------
+each option/setting is an object with the following keys, values
+are all strings(!)
+for TLOPTIONS:
+ name, tlmgrname, description, format, default, value (optional)
+for TLSETTING:
+ name, description, format, value (optional)
+Example TLOPTIONS:
+ {
+ "format" : "b",
+ "description" : "Install source files",
+ "tlmgrname" : "srcfiles",
+ "value" : "1",
+ "default" : "1",
+ "name" : "install_srcfiles"
+ },
+Example TLSETTING
+ {
+ "type" : "b",
+ "description" : "This tree acts as user tree",
+ "name" : "usertree"
+ },
+
-TODO
- UPDATE JSON format