From f743e5375a0cf6ae12b3a7137584eb7f3b8eab7b Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Wed, 30 Apr 2008 14:30:05 +0000 Subject: speed up reading of TLPOBJ by moving often used line checks to the top git-svn-id: svn://tug.org/texlive/trunk@7742 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/TeXLive/TLPOBJ.pm | 102 ++++++++++++++++++++--------------------- 1 file changed, 51 insertions(+), 51 deletions(-) (limited to 'Master/tlpkg') diff --git a/Master/tlpkg/TeXLive/TLPOBJ.pm b/Master/tlpkg/TeXLive/TLPOBJ.pm index 57284e31ba6..67d4f8b9789 100644 --- a/Master/tlpkg/TeXLive/TLPOBJ.pm +++ b/Master/tlpkg/TeXLive/TLPOBJ.pm @@ -82,7 +82,7 @@ sub from_fh { die("No empty line allowed within tlpobj files!"); } } - if ($line =~ /^ /) { + if ($line =~ /^ /o) { if ( ($lastcmd eq "runfiles") || ($lastcmd eq "binfiles") || ($lastcmd eq "docfiles") || @@ -94,7 +94,7 @@ sub from_fh { die("Continuation of $lastcmd not allowed, please fix tlpobj: line = $line!\n"); } } - if ($line =~ /^name\s*([-.\w]+)$/) { + if ($line =~ /^name\s*([-.\w]+)$/o) { $name = "$1"; $lastcmd = "name"; $self->name("$name"); @@ -102,48 +102,10 @@ sub from_fh { $started = 1; } else { $started || die("First directive needs to be 'name', not $line"); - if ($line =~ /^shortdesc\s+(.*)$/) { - $self->{'shortdesc'} .= "$1"; - $lastcmd = "shortdesc"; - next; - } elsif ($line =~ /^longdesc\s+(.*)$/) { - if (defined($self->{'longdesc'})) { - $self->{'longdesc'} .= " $1"; - } else { - $self->{'longdesc'} = "$1"; - } - $lastcmd = "longdesc"; - next; - } elsif ($line =~ /^category\s+$CategoriesRegexp$/o) { - $self->{'category'} = "$1"; - $lastcmd = "category"; - next; - } elsif ($line =~ /^revision\s+(.*)$/) { - $self->{'revision'} = "$1"; - $lastcmd = "revision"; - next; - } elsif ($line =~ /^catalogue\s+(.*)$/) { - $self->catalogue("$1"); - $lastcmd = "catalogue"; - next; - } elsif ($line =~ /^(doc|src|run)files\s+/) { - my $type = $1; - my @words = split ' ',$line; - # first entry is "XXXfiles", shift it away - $lastcmd = shift @words; - while (@words) { - $_ = shift @words; - if (/^size=(.*)$/) { - $size=$1; - } else { - die "Unknown tag: $line"; - } - } - if (defined($size)) { - $self->{"${type}size"} = $size; - } + if ($line =~ /^(src|run)filescontinued\s+(.*)$/o) { + push @{$self->{$1."files"}}, "$2"; next; - } elsif ($line =~ /^docfilescontinued\s+(.*)$/) { + } elsif ($line =~ /^docfilescontinued\s+(.*)$/o) { # docfiles can have tags my @words = &TeXLive::TLUtils::quotewords('\s+', 0, "$1"); # the first entry is the file @@ -160,10 +122,10 @@ sub from_fh { } } next; - } elsif ($line =~ /^(src|run)filescontinued\s+(.*)$/) { - push @{$self->{$1."files"}}, "$2"; + } elsif ($line =~ /^binfilescontinued\s+(.*)$/o) { + push @{$self->{'binfiles'}{$arch}}, "$1"; next; - } elsif ($line =~ /^binfiles\s+/) { + } elsif ($line =~ /^binfiles\s+/o) { my @words = split ' ',$line; # first entry is "binfiles", shift it away shift @words; @@ -182,19 +144,57 @@ sub from_fh { } $lastcmd = "binfiles"; next; - } elsif ($line =~ /^binfilescontinued\s+(.*)$/) { - push @{$self->{'binfiles'}{$arch}}, "$1"; + } elsif ($line =~ /^longdesc\s+(.*)$/o) { + if (defined($self->{'longdesc'})) { + $self->{'longdesc'} .= " $1"; + } else { + $self->{'longdesc'} = "$1"; + } + $lastcmd = "longdesc"; next; - } elsif ($line =~ /^execute(continued)?\s*(.*)$/) { + } elsif ($line =~ /^category\s+$CategoriesRegexp$/o) { + $self->{'category'} = "$1"; + $lastcmd = "category"; + next; + } elsif ($line =~ /^revision\s+(.*)$/o) { + $self->{'revision'} = "$1"; + $lastcmd = "revision"; + next; + } elsif ($line =~ /^catalogue\s+(.*)$/o) { + $self->catalogue("$1"); + $lastcmd = "catalogue"; + next; + } elsif ($line =~ /^(doc|src|run)files\s+/o) { + my $type = $1; + my @words = split ' ',$line; + # first entry is "XXXfiles", shift it away + $lastcmd = shift @words; + while (@words) { + $_ = shift @words; + if (/^size=(.*)$/) { + $size=$1; + } else { + die "Unknown tag: $line"; + } + } + if (defined($size)) { + $self->{"${type}size"} = $size; + } + next; + } elsif ($line =~ /^execute(continued)?\s*(.*)$/o) { push @{$self->{'executes'}}, "$2" unless "$2" eq ""; $lastcmd = "execute"; next; - } elsif ($line =~ /^depend(continued)?\s*(.*)$/) { + } elsif ($line =~ /^depend(continued)?\s*(.*)$/o) { push @{$self->{'depends'}}, "$2" unless "$2" eq ""; $lastcmd = "depend"; next; - } elsif ($line =~ /^catalogue-([^\s]+)\s+(.*)$/) { + } elsif ($line =~ /^catalogue-([^\s]+)\s+(.*)$/o) { $self->{'cataloguedata'}{$1} = "$2"; + } elsif ($line =~ /^shortdesc\s+(.*)$/o) { + $self->{'shortdesc'} .= "$1"; + $lastcmd = "shortdesc"; + next; } else { die("Unknown directive ...$line... , please fix it!"); } -- cgit v1.2.3