summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-12-17 23:19:22 +0000
committerKarl Berry <karl@freefriends.org>2017-12-17 23:19:22 +0000
commit94ab5957bdfc3dd468fa519f27795333d9f04dff (patch)
tree80d0689cdf2c74438bef34f01654ee818051ea4e /Build
parentf95f2dab244cf167851907d2f86f66d059993afd (diff)
sync,doc
git-svn-id: svn://tug.org/texlive/trunk@46086 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/tests/TeXLive/TLConfig.pm4
-rw-r--r--Build/source/texk/tests/TeXLive/TLUtils.pm221
-rw-r--r--Build/source/texk/texlive/tl_scripts/ChangeLog4
-rwxr-xr-xBuild/source/texk/texlive/tl_scripts/texconfig.sh90
4 files changed, 281 insertions, 38 deletions
diff --git a/Build/source/texk/tests/TeXLive/TLConfig.pm b/Build/source/texk/tests/TeXLive/TLConfig.pm
index 02aa86504b6..1873ed3b822 100644
--- a/Build/source/texk/tests/TeXLive/TLConfig.pm
+++ b/Build/source/texk/tests/TeXLive/TLConfig.pm
@@ -5,7 +5,7 @@
package TeXLive::TLConfig;
-my $svnrev = '$Revision: 44018 $';
+my $svnrev = '$Revision: 45617 $';
my $_modulerevision = ($svnrev =~ m/: ([0-9]+) /) ? $1 : "unknown";
sub module_revision { return $_modulerevision; }
@@ -107,12 +107,14 @@ our $DefaultContainerFormat = "xz";
our $DefaultContainerExtension = "tar.$DefaultContainerFormat";
# archive (not user) settings.
+# these can be overriden by putting them into 00texlive.config.tlpsrc
our %TLPDBConfigs = (
"container_split_src_files" => 1,
"container_split_doc_files" => 1,
"container_format" => $DefaultContainerFormat,
"minrelease" => $MinRelease,
"release" => $ReleaseYear,
+ "frozen" => 0,
);
# definition of the option strings and their value types
diff --git a/Build/source/texk/tests/TeXLive/TLUtils.pm b/Build/source/texk/tests/TeXLive/TLUtils.pm
index 5b603cf52f1..e2d8789e918 100644
--- a/Build/source/texk/tests/TeXLive/TLUtils.pm
+++ b/Build/source/texk/tests/TeXLive/TLUtils.pm
@@ -5,7 +5,7 @@
package TeXLive::TLUtils;
-my $svnrev = '$Revision: 44872 $';
+my $svnrev = '$Revision: 46045 $';
my $_modulerevision = ($svnrev =~ m/: ([0-9]+) /) ? $1 : "unknown";
sub module_revision { return $_modulerevision; }
@@ -98,6 +98,13 @@ C<TeXLive::TLUtils> -- utilities used in TeX Live infrastructure
TeXLive::TLUtils::mktexupd();
TeXLive::TLUtils::setup_sys_user_mode($optsref,$tmfc, $tmfsc, $tmfv, $tmfsv);
TeXLive::TLUtils::prepend_own_path();
+ TeXLive::TLUtils::repository_to_array($str);
+
+=head2 JSON
+
+ TeXLive::TLUtils::encode_json($ref);
+ TeXLive::TLUtils::True();
+ TeXLive::TLUtils::False();
=head1 DESCRIPTION
@@ -112,6 +119,7 @@ use vars qw(
$TeXLive::TLDownload::net_lib_avail
$::checksum_method $::gui_mode $::machinereadable $::no_execute_actions
$::regenerate_all_formats
+ $JSON::false $JSON::true
);
BEGIN {
@@ -185,6 +193,10 @@ BEGIN {
&nulldev
&get_full_line
&sort_archs
+ &repository_to_array
+ &encode_json
+ &True
+ &False
);
@EXPORT = qw(setup_programs download_file process_logging_options
tldie tlwarn info log debug ddebug dddebug debug_hash
@@ -1933,7 +1945,7 @@ sub add_remove_symlinks {
# man
my $top_man_dir = "$Master/texmf-dist/doc/man";
debug("$mode symlinks for man pages to $sys_man from $top_man_dir\n");
- if (! -d $top_man_dir && $mode eq "add") {
+ if (! -d $top_man_dir) {
; # better to be silent?
#info("skipping add of man symlinks, no source directory $top_man_dir\n");
} else {
@@ -3187,7 +3199,7 @@ package.
sub debug {
my $str = "D:" . join("", @_);
return if ($::opt_verbosity < 1);
- logit(\*STDOUT, 1, $str);
+ logit(\*STDERR, 1, $str);
for my $i (@::debug_hook) {
&{$i}($str);
}
@@ -3209,7 +3221,7 @@ each package, in addition to the first level.
sub ddebug {
my $str = "DD:" . join("", @_);
return if ($::opt_verbosity < 2);
- logit(\*STDOUT, 2, $str);
+ logit(\*STDERR, 2, $str);
for my $i (@::ddebug_hook) {
&{$i}($str);
}
@@ -3231,7 +3243,7 @@ levels.
sub dddebug {
my $str = "DDD:" . join("", @_);
return if ($::opt_verbosity < 3);
- logit(\*STDOUT, 3, $str);
+ logit(\*STDERR, 3, $str);
for my $i (@::dddebug_hook) {
&{$i}($str);
}
@@ -4128,8 +4140,207 @@ sub prepend_own_path {
}
+sub repository_to_array {
+ my $r = shift;
+ my %r;
+ my @repos = split ' ', $r;
+ if ($#repos == 0) {
+ # only one repo, this is the main one!
+ $r{'main'} = $repos[0];
+ return %r;
+ }
+ for my $rr (@repos) {
+ my $tag;
+ my $url;
+ # decode spaces and % in reverse order
+ $rr =~ s/%20/ /g;
+ $rr =~ s/%25/%/g;
+ $tag = $url = $rr;
+ if ($rr =~ m/^([^#]+)#(.*)$/) {
+ $tag = $2;
+ $url = $1;
+ }
+ $r{$tag} = $url;
+ }
+ return %r;
+}
+
+=item C<encode_json($ref)>
+
+Returns the JSON representation of the object C<$ref> is pointing at.
+This tries to load the C<JSON> Perl module, and uses it if available,
+otherwise falls back to module internal conversion.
+
+The used backend can be selected by setting the environment variable
+C<TL_JSONMODE> to either C<json> or C<texlive> (all other values are
+ignored). If C<json> is requested and the C<JSON> module cannot be loaded
+the program terminates.
+
+=cut
+
+my $TLTrueValue = 1;
+my $TLFalseValue = 0;
+my $TLTrue = \$TLTrueValue;
+my $TLFalse = \$TLFalseValue;
+bless $TLTrue, 'TLBOOLEAN';
+bless $TLFalse, 'TLBOOLEAN';
+
+our $jsonmode = "";
+
+=item C<True()>
+=item C<False()>
+
+these two function must be used to get proper JSON C<true> and C<false>
+in the output independent of the backend used.
+
+=cut
+
+sub True {
+ ensure_json_available();
+ if ($jsonmode eq "json") {
+ return($JSON::true);
+ } else {
+ return($TLTrue);
+ }
+}
+sub False {
+ ensure_json_available();
+ if ($jsonmode eq "json") {
+ return($JSON::false);
+ } else {
+ return($TLFalse);
+ }
+}
+
+sub ensure_json_available {
+ return if ($jsonmode);
+ # check the environment for mode to use:
+ # $ENV{'TL_JSONMODE'} = texlive | json
+ my $envdefined = 0;
+ if ($ENV{'TL_JSONMODE'}) {
+ $envdefined = 1;
+ if ($ENV{'TL_JSONMODE'} eq "texlive") {
+ $jsonmode = "texlive";
+ debug("texlive json module used!\n");
+ return;
+ } elsif ($ENV{'TL_JSONMODE'} eq "json") {
+ # nothing to do
+ } else {
+ tlwarn("Unsupported mode \'$ENV{TL_JSONMODE}\' set in TL_JSONMODE, ignoring it!");
+ $envdefined = 0;
+ }
+ }
+ return if ($jsonmode); # was set to texlive
+ eval { require JSON; };
+ if ($@) {
+ # that didn't work out, use home-grown json
+ if ($envdefined) {
+ # environment asks for JSON but cannot be loaded, die!
+ tldie("env variable TL_JSONMODE request JSON module but cannot be load!\n");
+ }
+ $jsonmode = "texlive";
+ debug("texlive json module used!\n");
+ } else {
+ $jsonmode = "json";
+ my $json = JSON->new;
+ debug("JSON " . $json->backend . " used!\n");
+ }
+}
+
+sub encode_json {
+ my $val = shift;
+ ensure_json_available();
+ if ($jsonmode eq "json") {
+ my $utf8_encoded_json_text = JSON::encode_json($val);
+ return $utf8_encoded_json_text;
+ } else {
+ my $type = ref($val);
+ if ($type eq "") {
+ tldie("encode_json: accept only refs: $val");
+ } elsif ($type eq 'SCALAR') {
+ return(scalar_to_json($$val));
+ } elsif ($type eq 'ARRAY') {
+ return(array_to_json($val));
+ } elsif ($type eq 'HASH') {
+ return(hash_to_json($val));
+ } elsif ($type eq 'REF') {
+ return(encode_json($$val));
+ } elsif (Scalar::Util::blessed($val)) {
+ if ($type eq "TLBOOLEAN") {
+ return($$val ? "true" : "false");
+ } else {
+ tldie("encode_json: unsupported blessed object");
+ }
+ } else {
+ tldie("encode_json: unsupported format $type");
+ }
+ }
+}
+
+sub scalar_to_json {
+ sub looks_like_numeric {
+ # code from JSON/backportPP.pm
+ my $value = shift;
+ no warnings 'numeric';
+ # detect numbers
+ # string & "" -> ""
+ # number & "" -> 0 (with warning)
+ # nan and inf can detect as numbers, so check with * 0
+ return unless length((my $dummy = "") & $value);
+ return unless 0 + $value eq $value;
+ return 1 if $value * 0 == 0;
+ return -1; # inf/nan
+ }
+ my $val = shift;
+ if (defined($val)) {
+ if (looks_like_numeric($val)) {
+ return("$val");
+ } else {
+ return(string_to_json($val));
+ }
+ } else {
+ return("null");
+ }
+}
+
+sub string_to_json {
+ my $val = shift;
+ my %esc = (
+ "\n" => '\n',
+ "\r" => '\r',
+ "\t" => '\t',
+ "\f" => '\f',
+ "\b" => '\b',
+ "\"" => '\"',
+ "\\" => '\\\\',
+ "\'" => '\\\'',
+ );
+ $val =~ s/([\x22\x5c\n\r\t\f\b])/$esc{$1}/g;
+ return("\"$val\"");
+}
+
+sub hash_to_json {
+ my $hr = shift;
+ my @retvals;
+ for my $k (keys(%$hr)) {
+ my $val = $hr->{$k};
+ push @retvals, "\"$k\":" . encode_json(\$val);
+ }
+ my $ret = "{" . join(",", @retvals) . "}";
+ return($ret);
+}
+
+sub array_to_json {
+ my $hr = shift;
+ my $ret = "[" . join(",", map { encode_json(\$_) } @$hr) . "]";
+ return($ret);
+}
+
+
+
=back
=cut
+
1;
__END__
diff --git a/Build/source/texk/texlive/tl_scripts/ChangeLog b/Build/source/texk/texlive/tl_scripts/ChangeLog
index 0334ba7567f..e8bdfc9a452 100644
--- a/Build/source/texk/texlive/tl_scripts/ChangeLog
+++ b/Build/source/texk/texlive/tl_scripts/ChangeLog
@@ -1,3 +1,7 @@
+2017-12-18 Karl Berry <karl@tug.org>
+
+ * texconfig.sh: more updates from Norbert to use tlmgr (from 45882).
+
2017-04-24 Paul Vojta <vojta@math.berkeley.edu>
* texconfig.sh: xdvi paper size updates (also in TLPaper.pm).
diff --git a/Build/source/texk/texlive/tl_scripts/texconfig.sh b/Build/source/texk/texlive/tl_scripts/texconfig.sh
index b73e3262a2e..94ec3fffced 100755
--- a/Build/source/texk/texlive/tl_scripts/texconfig.sh
+++ b/Build/source/texk/texlive/tl_scripts/texconfig.sh
@@ -188,6 +188,18 @@ setupTmpDir()
}
###############################################################################
+# setupTexmfroot() - get value for MT_TEXMFROOT (with caching)
+#
+setupTexmfroot()
+{
+ case $MT_TEXMFROOT in
+ "") MT_TEXMFROOT=`kpsewhich -var-value=TEXMFROOT`;;
+ *) return;;
+ esac
+}
+
+
+###############################################################################
# setupTexmfmain() - get value for MT_TEXMFMAIN (with caching)
#
setupTexmfmain()
@@ -537,8 +549,9 @@ checkElemInList()
showDistVersionInfo()
{
# TeX Live file.
- test -f $MT_TEXMFMAIN/../release-texlive.txt \
- && sed 1q $MT_TEXMFMAIN/../release-texlive.txt
+ setupTexmfroot
+ test -f $MT_TEXMFROOT/release-texlive.txt \
+ && sed 1q $MT_TEXMFROOT/release-texlive.txt
# no harm in continuing to look for the teTeX files.
test -f $MT_TEXMFMAIN/release-tetex-src.txt \
@@ -560,7 +573,7 @@ the TeX installation.
Usage: $progname conf (show configuration information)
$progname dvipdfmx paper PAPER (dvipdfmx paper size)
$progname dvips [OPTION...] (dvips options)
- $progname faq (show teTeX faq)
+ $progname faq (show pointer to TeX Live docs)
$progname findprog PROG... (show locations of PROGs, a la which)
$progname font vardir DIR
$progname font ro
@@ -633,7 +646,9 @@ Valid PAPER settings:
paper)
case $3 in
letter|legal|ledger|tabloid|a4|a3)
- fmgrConfigReplace dvipdfmx.cfg '^p' "p $3";;
+ tlmgr dvipdfmx paper $3
+ ;;
+ # fmgrConfigReplace dvipdfmx.cfg '^p' "p $3";;
"") echo "$help" >&2; rc=1;;
*)
echo "$progname: unknown PAPER \`$3' given as argument for \`$progname dvipdfmx paper'" >&2
@@ -781,7 +796,8 @@ Valid PAPER settings:
;;
*)
if grep "@ $tcBatchDvipsPaper " $configPsFile >/dev/null 2>&1; then
- setupDvipsPaper "$tcBatchDvipsPaper"
+ tlmgr dvips paper $tcBatchDvipsPaper
+ # setupDvipsPaper "$tcBatchDvipsPaper"
else
echo "$progname: paper \`$tcBatchDvipsPaper' not found in file \`$configPsFile'" >&2; rc=1
fi
@@ -857,14 +873,17 @@ Valid MODE settings:"
;;
faq)
- setupTexmfmain
- if test -f $MT_TEXMFMAIN/doc/tetex/teTeX-FAQ; then
- <$MT_TEXMFMAIN/doc/tetex/teTeX-FAQ eval ${PAGER-more}
- else
- echo "$progname: faq not found (usually in \$TEXMFMAIN/doc/tetex/teTeX-FAQ)" >&2
- rc=1
- fi
+ echo "Please see https://tug.org/texlive/doc/ for the documentation"
+ echo "available in TeX Live."
;;
+ # setupTexmfmain
+ # if test -f $MT_TEXMFMAIN/doc/tetex/teTeX-FAQ; then
+ # <$MT_TEXMFMAIN/doc/tetex/teTeX-FAQ eval ${PAGER-more}
+ # else
+ # echo "$progname: faq not found (usually in \$TEXMFMAIN/doc/tetex/teTeX-FAQ)" >&2
+ # rc=1
+ # fi
+ # ;;
findprog)
shift
@@ -873,6 +892,7 @@ Valid MODE settings:"
# handle "texconfig font"
font)
+ setupTexmfroot
help="Usage: $progname font vardir DIR
$progname font ro
$progname font rw
@@ -899,7 +919,9 @@ For more information about these \`features', consult the teTeX manual
;;
*)
tcBatchFontVardir=$3
- tfc=`kpsewhich texmf.cnf`
+ # tfc=`kpsewhich texmf.cnf`
+ tfc="$MT_TEXMFROOT/texmf.cnf"
+ touch "$tfc"
if test -n "$tfc"; then
if test -w "$tfc"; then
configReplace "$tfc" '^VARTEXFONTS' "VARTEXFONTS = $tcBatchFontVardir"
@@ -1240,25 +1262,28 @@ Valid PAPER settings:
paper)
case $3 in
- letter)
- w="8.5 true in"; h="11 true in"
- setupTmpDir
- fmgrConfigReplace pdftexconfig.tex pdfpagewidth '\pdfpagewidth='"$w"
- wChanged=$fmgrConfigReplaceChanged
- fmgrConfigReplace pdftexconfig.tex pdfpageheight '\pdfpageheight='"$h"
- if $wChanged || $fmgrConfigReplaceChanged; then
- fmtutil --refresh
- fi
- ;;
- a4)
- w="210 true mm"; h="297 true mm"
- fmgrConfigReplace pdftexconfig.tex pdfpagewidth '\pdfpagewidth='"$w"
- wChanged=$fmgrConfigReplaceChanged
- fmgrConfigReplace pdftexconfig.tex pdfpageheight '\pdfpageheight='"$h"
- if $wChanged || $fmgrConfigReplaceChanged; then
- fmtutil --refresh
- fi
+ letter|a4)
+ tlmgr pdftex paper $3
;;
+ #letter)
+ # w="8.5 true in"; h="11 true in"
+ # setupTmpDir
+ # fmgrConfigReplace pdftexconfig.tex pdfpagewidth '\pdfpagewidth='"$w"
+ # wChanged=$fmgrConfigReplaceChanged
+ # fmgrConfigReplace pdftexconfig.tex pdfpageheight '\pdfpageheight='"$h"
+ # if $wChanged || $fmgrConfigReplaceChanged; then
+ # fmtutil --refresh
+ # fi
+ # ;;
+ #a4)
+ # w="210 true mm"; h="297 true mm"
+ # fmgrConfigReplace pdftexconfig.tex pdfpagewidth '\pdfpagewidth='"$w"
+ # wChanged=$fmgrConfigReplaceChanged
+ # fmgrConfigReplace pdftexconfig.tex pdfpageheight '\pdfpageheight='"$h"
+ # if $wChanged || $fmgrConfigReplaceChanged; then
+ # fmtutil --refresh
+ # fi
+ # ;;
"") echo "$help" >&2; rc=1;;
*)
echo "$progname: unknown PAPER \`$3' given as argument for \`$progname pdftex paper'" >&2
@@ -1378,7 +1403,8 @@ Valid PAPER settings:
paper)
case $3 in
[abc][0-9]|[abc]10|[abc][0-9]r|[abc]10r|us|letter|ledger|tabloid|usr|legal|legalr|foolscap|foolscapr)
- fmgrConfigReplace XDvi paper: "*paper: $3"
+ tlmgr xdvi paper $3
+ # fmgrConfigReplace XDvi paper: "*paper: $3"
;;
"") echo "$help" >&2; rc=1;;
*)