diff options
author | Karl Berry <karl@freefriends.org> | 2011-05-16 18:27:55 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-05-16 18:27:55 +0000 |
commit | 417e91d078352571aefe2bffd3cc2c1e5cc08f60 (patch) | |
tree | 5ff0763cb3062bb1527744c0a3e989d72a5ea7dd /Master | |
parent | 7e20b5c1b0433cf03f5a823a225eb847df52bb65 (diff) |
TLPOBJ.pm (from_fh): do not remove trailing whitespace; turns out this
takes consequential time, and the creation programs should not ever
produce it. Also added trailing-whitespace check to cron job for master
tlpdb creation. With this change, tlpdb-read-test time is reduced from
~2.4sec to ~1.2sec.
TeXCatalogue.pm (beautify): remove trailing whitespace. Looks like this
can matter in <caption>s which we turn into shortdescs, but nowhere else.
dev/tlpdb-read-test: trivial test script to read tlpdb and nothing else.
git-svn-id: svn://tug.org/texlive/trunk@22498 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/tlpkg/TeXLive/TLPOBJ.pm | 7 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TeXCatalogue.pm | 17 | ||||
-rw-r--r-- | Master/tlpkg/dev/README | 25 | ||||
-rwxr-xr-x | Master/tlpkg/dev/tlpdb-read-test | 18 |
4 files changed, 45 insertions, 22 deletions
diff --git a/Master/tlpkg/TeXLive/TLPOBJ.pm b/Master/tlpkg/TeXLive/TLPOBJ.pm index b73ee0e3cff..9713c87b90a 100644 --- a/Master/tlpkg/TeXLive/TLPOBJ.pm +++ b/Master/tlpkg/TeXLive/TLPOBJ.pm @@ -83,7 +83,11 @@ sub from_fh { my $size; while (my $line = <$fh>) { + # we do not worry about whitespace at the end of a line; + # that would be a bug in the db creation, and it takes some + # noticeable time to get rid of it. So just chomp. chomp($line); + # we call tllog only when something will be logged, to speed things up. # this is the inner loop bounding the time to read tlpdb. dddebug("reading line: >>>$line<<<\n") if ($::opt_verbosity >= 3); @@ -111,8 +115,7 @@ sub from_fh { die("Continuation of $lastcmd not allowed, please fix tlpobj: line = $line!\n"); } } - # remove white space at the end of a line - $line =~ s/\s*$//; + if ($line =~ /^name\s*([-.\w]+)/o) { $name = "$1"; $lastcmd = "name"; diff --git a/Master/tlpkg/TeXLive/TeXCatalogue.pm b/Master/tlpkg/TeXLive/TeXCatalogue.pm index 95ba60442a1..34f7a7f512b 100644 --- a/Master/tlpkg/TeXLive/TeXCatalogue.pm +++ b/Master/tlpkg/TeXLive/TeXCatalogue.pm @@ -1,6 +1,6 @@ # $Id$ # TeXLive::TeXCatalogue - module for accessing the TeX Catalogue -# Copyright 2007, 2008, 2009, 2010 Norbert Preining +# Copyright 2007, 2008, 2009, 2010, 2011 Norbert Preining # This file is licensed under the GNU General Public License version 2 # or any later version. # @@ -88,15 +88,15 @@ sub initialize { } } -sub beautify -{ +sub beautify { my ($txt) = @_; - $txt =~ s/\n/ /g; - $txt =~ s/^[[:space:]]*//g; - $txt =~ s/[[:space:]][[:space:]]*/ /g; + $txt =~ s/\n/ /g; # make one line + $txt =~ s/^\s+//g; # rm leading whitespace + $txt =~ s/\s+$//g; # rm trailing whitespace + $txt =~ s/\s\s+/ /g; # multiple spaces to one # transliterate to ascii: it allows the final tlpdb to be pure ascii, # avoiding problems since we don't control the user's terminal encoding - return(Text::Unidecode::unidecode($txt)); + return Text::Unidecode::unidecode($txt); } sub name { @@ -197,8 +197,7 @@ sub initialize { # Copy every catalogue $entry under the name $entry->{'texlive'} # if it makes sense. # -sub quest4texlive -{ +sub quest4texlive { my $self = shift; # The catalogue has a partial mapping from catalogue entries to diff --git a/Master/tlpkg/dev/README b/Master/tlpkg/dev/README index 62ce79ed5e2..bee33f3e2c1 100644 --- a/Master/tlpkg/dev/README +++ b/Master/tlpkg/dev/README @@ -1,20 +1,20 @@ $Id$ (Public domain.) -lib - tlpkg libraries in other languages, none usable +check-tk-used-font.pl + ? -dev.tempfile-for-tlpdb.patch - trial to make symlink attacks harder by using tmpfiles instead - of the always same filename when downloading the tlpdb.xz +dev.multi-source-support + Multiple repositories. Needs serious testing. + +dev.update-tlpdb-option-on-the-fly + ? makeself-runscript.sh a run.sh for a makeself (tlmgr-update-latest.sh) that even allows installation of texlive by installing the bare bone minimal (texlive.infra) and then bootstrapping into some - minimal env - - Needs work, both on the script and tlmgr itself + minimal env. Needs work, both on the script and tlmgr itself. mktextex.pl Simple mktextex program that can be used to query the tlpdb @@ -22,12 +22,15 @@ mktextex.pl Probably not useable in real life, only for testing. mktexupd.texlua - rewrite of mktexupd in texlua + Rewrite of mktexupd in texlua. srclist.txt List of duplicated files to keep in sync. Read by cron.tl. tlnet-disabled-packages.txt - this file specifies packages that should NOT be updated in - tlnet. It is read by tl-update-containers. + This file specifies packages that should NOT be updated in + tlnet. Read by tl-update-containers. +tlpdb-read-test + Minimal script to exercise tlpdb reading and nothing else, + for testing/optimization. diff --git a/Master/tlpkg/dev/tlpdb-read-test b/Master/tlpkg/dev/tlpdb-read-test new file mode 100755 index 00000000000..30ac0d05b15 --- /dev/null +++ b/Master/tlpkg/dev/tlpdb-read-test @@ -0,0 +1,18 @@ +#!/usr/bin/env perl +# Public domain. (Originally written by Karl Berry, 2011.) +# This script does nothing but read TLPDB so we can work +# on optimizing the inner loop, TLPOBJ::from_fh. + +our $mydir; + +BEGIN { + $^W = 1; + ($mydir = $0) =~ s,/[^/]*$,,; + unshift (@INC, "$mydir/.."); +} + +use strict; +use TeXLive::TLPDB; + +chomp (my $Master = `cd $mydir/../.. && pwd`); +my $tlpdb = TeXLive::TLPDB->new ("root" => $Master); |