From 2b4c681d78064c9f1f9ebcadd934c746347a9109 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 14 Jul 2007 00:20:30 +0000 Subject: TeXLive::TeXCatalogue: don't use, we only want to require XML::DOM at update time. (allfiles): beginnings. move other fns around. git-svn-id: svn://tug.org/texlive/trunk@4582 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/TeXLive/TLPOBJ.pm | 98 ++++++++++++++++++++++-------------------- 1 file changed, 51 insertions(+), 47 deletions(-) diff --git a/Master/tlpkg/TeXLive/TLPOBJ.pm b/Master/tlpkg/TeXLive/TLPOBJ.pm index 2e88e1c9825..35a989d6527 100644 --- a/Master/tlpkg/TeXLive/TLPOBJ.pm +++ b/Master/tlpkg/TeXLive/TLPOBJ.pm @@ -7,7 +7,8 @@ package TeXLive::TLPOBJ; use TeXLive::TLUtils; -use TeXLive::TeXCatalogue; +#use TeXLive::TeXCatalogue; -- requires XML::DOM, we only want it at +#update time. use File::Path; use Cwd; use TeXLive::TLTREE; @@ -530,6 +531,38 @@ sub update_from_catalogue { } } + +# Helpers. +# +sub add_files { + my ($self,$type,@files) = @_; + die("Cannot use add_files for binfiles, we need that arch!") + if ($type eq "bin"); + &TeXLive::TLUtils::push_uniq(\@{ $self->{"${type}files"} }, @files); +} + +sub remove_files { + my ($self,$type,@files) = @_; + die("Cannot use remove_files for binfiles, we need that arch!") + if ($type eq "bin"); + my @finalfiles; + foreach my $f (@{$self->{"${type}files"}}) { + if (not(&TeXLive::TLUtils::member($f,@files))) { + push @finalfiles,$f; + } + } + $self->{"${type}files"} = [ @finalfiles ]; +} + +sub all_files { + my ($self) = shift; + my @ret = (); + + push (@ret, $self->docfiles); + push (@ret, $self->runfiles); + push (@ret, $self->srcfiles); +} + # member access functions # @@ -643,22 +676,6 @@ sub remove_runfiles { my ($self,@files) = @_; $self->remove_files("run",@files); } -sub add_files { - my ($self,$type,@files) = @_; - die("Cannot use add_files for binfiles, we need that arch!") if ($type eq "bin"); - &TeXLive::TLUtils::push_uniq(\@{ $self->{"${type}files"} }, @files); -} -sub remove_files { - my ($self,$type,@files) = @_; - die("Cannot use remove_files for binfiles, we need that arch!") if ($type eq "bin"); - my @finalfiles; - foreach my $f (@{$self->{"${type}files"}}) { - if (not(&TeXLive::TLUtils::member($f,@files))) { - push @finalfiles,$f; - } - } - $self->{"${type}files"} = [ @finalfiles ]; -} sub depends { my $self = shift; if (@_) { @{ $self->{'depends'} } = @_ } @@ -669,7 +686,6 @@ sub executes { if (@_) { @{ $self->{'executes'} } = @_ } return @{ $self->{'executes'} }; } - sub zipdir { my @self = shift; if (@_) { $_zipdir = $_[0] } @@ -716,14 +732,13 @@ all last changed revision of files contained in the package, and anything starting with C specifying information coming from the TeX Catalogue. -All these keys have in common that the are followed by a list of files +All these keys have in common that they are followed by a list of files B by one space. They differ only in the first line itself (described below). =over =item C, C - each of these three items contains in addition the sum of sizes of the single files (currently in byte, but this may change). @@ -731,7 +746,6 @@ single files (currently in byte, but this may change). runfiles size=NNNNNN =item C - The docfiles line itself is similar to the C and C lines above: @@ -749,7 +763,6 @@ But the lines listing the files are allowed to have additional tags: Currently only the tags C
and C are allowed. =item C - Since C are different for the different architectures one C file can contain C lines for different architectures. The architecture is specified on the C using the C tag. Thus, @@ -777,7 +790,6 @@ Thus a typical entry for runfiles looks like this: | bin/win32/pkfix.exe |... - =head1 PACKAGE VARIABLES TeXLive::TLPOBJ has one package wide variable which is C where @@ -800,17 +812,18 @@ TeX Catalogue Data the function returns and takes as argument a hash. Arguments and return values for C, C, C, -C, C, C are single scalars. -Arguments and return values for C, C are lists. -Arguments and return values for C is a hash with the architectures -as keys. +C, C, C are single scalars. Arguments +and return values for C, C are lists. Arguments and +return values for C, C, C are lists. +Arguments and return values for C is a hash with the +architectures as keys. -Other functions which work quite similar are: +The size values are handled with these functions: $tlpobj->docsize - $tlpobj->srcsize $tlpobj->runsize - $tlpobj->binsize + $tlpobj->srcsize + $tlpobj->binsize("arch1", ...) which set or get the current value of the respective sizes. Note that also the C function returns (and takes as argument) a hash with the @@ -823,7 +836,6 @@ The following functions can be called for an C object: =over =item C - (constructor) returns a new C object. The arguments to the C constructor can be in the usual hash representation for the different keys above: @@ -831,14 +843,12 @@ above: $tlpobj = TLPOBJ->new ( name => "foobar", shortdesc => "The foobar package" ); =item C - reads a C file. $tlpobj = new TLPOBJ; $tlpobj->from_file("path/to/the/tlpobj/file"); =item C - read the textual representation of a TLPOBJ from an already opened file handle. If C<$multi> is undefined (ie not given) then multiple tlpobj in the same file are treated as errors. If C<$multi> is defined then returns @@ -847,7 +857,6 @@ after reading one tlpobj. Returns 1 if it found a tlpobj, otherwise 0 =item C - writes the textual representation of a C object to stdout, or the filehandle if given: @@ -855,11 +864,9 @@ filehandle if given: $tlpsrc->writeout(\*FILEHANDLE); =item C - debugging function for comparison with tpm/tlps, will go away. =item C - creates a zip file of the arch B files in the TLPOBJ in $destdir (if not defined then TLPOBJ->zipdir is used). The file name of the created zipfile is $zipname (if not @@ -876,42 +883,39 @@ so C<$zipname.zip> does contain this tlpobj file, while C<$zipname.$arch.zip> does NOT. =item C - recomputes the sizes based on the information present in C<$tltree>. =item C - recomputes the revision based on the information present in C<$tltree>. =item C - adds information from a C object (currently license, version, url, and updates docfiles with details and languages tags if present in the Catalogue) =item C - returns 1 if there are C, otherwise 0. =item C +If no argument is given returns the sum of C, C, +C. -If no argument is given returns the sum of C, C, C - -If and argumen is given it returns the sum of the above increased by the -sum of sizes of C for the architectures given as argument. +If arguments are given, they are assumed to be architecture names, and +it returns the above plus the sum of sizes of C for those +architectures. =item C<{add,remove}_{src,run,doc}files ( @files )> - adds or removes files to the respective list of files =item C<{add,remove}_binfiles ($arch, @files)> - adds or removes files from the list of C for the given architecture =item C<{add,remove}_files ($type, $files)> - adds or removes files for the given type (only for C, C, C). +=item C +returns a list of all files of all types. + =back =head1 SEE ALSO -- cgit v1.2.3