From 92e971ebe60f39f8244c1c8796219ad878b1617e Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 1 Feb 2013 23:42:25 +0000 Subject: ltxfileinfo shell script (1feb13) git-svn-id: svn://tug.org/texlive/trunk@29005 c570f23f-e606-0410-a88d-b1316a301751 --- .../source/texk/texlive/linked_scripts/Makefile.am | 1 + .../source/texk/texlive/linked_scripts/Makefile.in | 1 + .../texlive/linked_scripts/ltxfileinfo/ltxfileinfo | 385 +++++++++++++++++++++ .../texk/texlive/linked_scripts/texlive/tlmgr.pl | 35 +- 4 files changed, 419 insertions(+), 3 deletions(-) create mode 100755 Build/source/texk/texlive/linked_scripts/ltxfileinfo/ltxfileinfo (limited to 'Build/source') diff --git a/Build/source/texk/texlive/linked_scripts/Makefile.am b/Build/source/texk/texlive/linked_scripts/Makefile.am index 89dc0ad8307..b54181caf53 100644 --- a/Build/source/texk/texlive/linked_scripts/Makefile.am +++ b/Build/source/texk/texlive/linked_scripts/Makefile.am @@ -64,6 +64,7 @@ texmf_dist_shell_scripts = \ latexfileversion/latexfileversion \ listbib/listbib \ listings-ext/listings-ext.sh \ + ltxfileinfo/ltxfileinfo \ lua2dox/lua2dox_lua \ pdfjam/pdf180 \ pdfjam/pdf270 \ diff --git a/Build/source/texk/texlive/linked_scripts/Makefile.in b/Build/source/texk/texlive/linked_scripts/Makefile.in index 79defdf5590..747ae7e9412 100644 --- a/Build/source/texk/texlive/linked_scripts/Makefile.in +++ b/Build/source/texk/texlive/linked_scripts/Makefile.in @@ -247,6 +247,7 @@ texmf_dist_shell_scripts = \ latexfileversion/latexfileversion \ listbib/listbib \ listings-ext/listings-ext.sh \ + ltxfileinfo/ltxfileinfo \ lua2dox/lua2dox_lua \ pdfjam/pdf180 \ pdfjam/pdf270 \ diff --git a/Build/source/texk/texlive/linked_scripts/ltxfileinfo/ltxfileinfo b/Build/source/texk/texlive/linked_scripts/ltxfileinfo/ltxfileinfo new file mode 100755 index 00000000000..f701a598b16 --- /dev/null +++ b/Build/source/texk/texlive/linked_scripts/ltxfileinfo/ltxfileinfo @@ -0,0 +1,385 @@ +#!/bin/bash + +<&1 | grep invalid )" != "" ] ; then + date=`mark $date` + fi + fi + + # version should be 1.2 or 1.2.3, maybe prefixed with v and suffixed with zero or more lower case letters + if [[ ! "$vers" =~ ^v?[[:digit:]]+.[[:digit:]]+(.[[:digit:]]+)?[[:lower:]]*$ ]]; then vers=`mark $vers`; fi + + if [ ! "$key" ]; then + if [ $flat ]; then + echo -e "$file\t$date\t$vers\t$info" + else + cat <<-EOF + file: $file + date: $date + vers: $vers + info: $info + loca: $loca + EOF + fi + else + eval "echo \$$key" + fi +} + +if ! options=$(getopt -o hdvlifcsD \ + -l help,date,version,location,info,flat,star,color,debug -- "$@"); then exit 1; fi +eval set -- "$options" + +while [ $# -gt 0 ]; do + case $1 in + -h|--help) help;; + -d|--date) key=date;; + -v|--version) key=vers;; + -i|--info) key=info;; + -l|--location) key=loca;; + -f|--flat) flat=1;; + -s|--star) mark1=''; mark2='*';; + -c|--color) mark1=''; mark2='';; + -D|--debug) debug=1;; + (--) shift; break;; + (*) break;; + esac + shift +done + +arg=$1 +test "$arg" = "" && help +loca=`kpsewhich "$arg"` +test "$loca" = "" && die not found by kpsewhich +prov=`grep '\\\\Provides' "$loca"` +test "$prov" = "" && die no \\Provides... +test "$prov" = "${prov/ProvidesExplPackage//}" || die 'Latex3 package (not handled yet)' + +# the file must contain a \ProvidesXXX statement, where XXX is Class, Package, or File: +for i in Class Package File; do + if [[ "$prov" =~ \\Provides$i[[:space:]]*\{ ]]; then found=1; break; fi +done +test $found || die Found no \\ProvidesClass/Package/File statement + +# readprov.sty does not work on .mbs and .bst files: special treatment; +# \ProvideFile statements in them mostly refer to merlin.mbs, or other names +if [[ $arg =~ \.mbs$ || $arg =~ \.bst$ ]]; then dombsbst; fi + +DIR=`mktemp -d` +test $debug || trap "rm -rf $DIR" 0 1 2 15 +test $debug && echo $DIR +cp "$loca" $DIR +cd $DIR + +# The following code is mostly from Uwe Lueck's readprov.sty: +echo ' +\makeatletter +\def\GetFileInfo#1{% + \def\filename{#1}% + \def\@tempb##1 ##2 ##3\relax##4\relax{% + \def\filedate{##1}% + \def\fileversion{##2}% + \def\fileinfo{##3}}% + \read@file@info\@tempb{#1}} +\newcommand*{\read@file@info}[2]{% + \expandafter \expandafter \expandafter + #1\csname ver@#2\endcsname \relax? ? \relax\relax} +\newcommand*{\ReadFileInfos}[1]{% + \begingroup + \let\RP@@provfile\@providesfile + \def\@providesfile##1[##2]{\RP@@provfile{##1}[{##2}]\endinput}% + \def\ProvidesClass ##1{\ProvidesFile{##1.\@clsextension}}% + \def\ProvidesPackage##1{\ProvidesFile{##1.\@pkgextension}}% + \@for\@tempa:=#1\do{% + \edef\@tempa{\expandafter\read@no@spaces\@tempa\@nil}% + \input{\@tempa}% + \global\let\@gtempa\@tempa}% + \endgroup + \GetFileInfo\@gtempa% +} +\def\read@no@spaces#1#2\@nil{#1#2}% +\def\NeedsTeXFormat#1{\expandafter\@needsformat} +\ReadFileInfos{'$loca'} +\endinput +' > ltxfileinfo.tex + +pdflatex -interaction=batchmode ltxfileinfo.tex >& /dev/null + +IFS= # do not remove any whitespace +base=${arg%.*} # strip the extension +shopt -s nocasematch # MS people don't pay attention to case differences in file names... +while read line; do + if [[ "$line" =~ ^File:.$base ]]; then + out="$line" + while [ ${#line} -eq 79 ]; do # gather continuation lines + read line + out="$out$line" + done + fi +done setting("available_architectures",@newarchs); $localtlpdb->save; } + } elsif ($what =~ m/^set$/i) { + return if !check_on_writable(); + my $arg = shift @ARGV; + die "Missing argument to platform set" unless defined($arg); + my @already_installed_arch = $localtlpdb->available_architectures; + if ($arg =~ m/^auto$/i) { + info("Setting platform detection to auto mode.\n"); + $localtlpdb->setting('-clear', 'platform'); + $localtlpdb->save; + } else { + if (!TeXLive::TLUtils::member($arg, @already_installed_arch)) { + tlwarn("cannot set platform to a not installed one.\n"); + return; + } + $localtlpdb->setting('platform', $arg); + $localtlpdb->save; + } } else { die "Unknown option for platform: $what"; } @@ -6438,6 +6455,10 @@ those extra settings at present. =head2 platform list|add|remove I... +=head2 platform set I + +=head2 platform set auto + C lists the TeX Live names of all the platforms (a.k.a. architectures), (C, ...) available at the package repository. @@ -6449,6 +6470,14 @@ C I... removes the executables for each given platform I from the installation, but keeps the currently running platform in any case. +C I switches TeX Live to always use the given +platform instead of auto detection. + +C switches TeX Live to auto detection mode for platform. + +Platform detection is needed to select the proper C, C and +C binaries that are shipped with TeX Live. + C is a synonym for C. Options: -- cgit v1.2.3