summaryrefslogtreecommitdiff
path: root/Master/tlpkg/TeXLive/TLPOBJ.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/TeXLive/TLPOBJ.pm')
-rw-r--r--Master/tlpkg/TeXLive/TLPOBJ.pm98
1 files 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;
@@ -531,6 +532,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
#
sub name {
@@ -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<catalogue-> 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<intended> by one space. They differ only in the first line itself
(described below).
=over
=item C<srcfiles>, C<runfiles>
-
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<docfiles>
-
The docfiles line itself is similar to the C<srcfiles> and C<runfiles> lines
above:
@@ -749,7 +763,6 @@ But the lines listing the files are allowed to have additional tags:
Currently only the tags C<details> and C<language> are allowed.
=item C<runfiles>
-
Since C<runfiles> are different for the different architectures one C<tlpobj>
file can contain C<runfiles> lines for different architectures. The
architecture is specified on the C<binfiles> using the C<arch=XXX> 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<zipdir> where
@@ -800,17 +812,18 @@ TeX Catalogue Data the function
returns and takes as argument a hash.
Arguments and return values for C<name>, C<category>, C<shortdesc>,
-C<longdesc>, C<catalogue>, C<revision> are single scalars.
-Arguments and return values for C<depends>, C<executes> are lists.
-Arguments and return values for C<binfiles> is a hash with the architectures
-as keys.
+C<longdesc>, C<catalogue>, C<revision> are single scalars. Arguments
+and return values for C<depends>, C<executes> are lists. Arguments and
+return values for C<docfiles>, C<runfiles>, C<srcfiles> are lists.
+Arguments and return values for C<binfiles> 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<binsize> function returns (and takes as argument) a hash with the
@@ -823,7 +836,6 @@ The following functions can be called for an C<TLPOBJ> object:
=over
=item C<new>
-
(constructor) returns a new C<TLPSRC> object. The arguments to the C<new>
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<from_file("filename")>
-
reads a C<tlpobj> file.
$tlpobj = new TLPOBJ;
$tlpobj->from_file("path/to/the/tlpobj/file");
=item C<from_fh($filehandle [, $multi] )>
-
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<writeout>
-
writes the textual representation of a C<TLPOBJ> object to stdout, or the
filehandle if given:
@@ -855,11 +864,9 @@ filehandle if given:
$tlpsrc->writeout(\*FILEHANDLE);
=item C<writeout_simple>
-
debugging function for comparison with tpm/tlps, will go away.
=item C<make_zip($tltree[,$destdir[,$zipname]])>
-
creates a zip file of the arch B<independent> 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<recompute_sizes ($tltree)>
-
recomputes the sizes based on the information present in C<$tltree>.
=item C<recompute_revision ($tltree)>
-
recomputes the revision based on the information present in C<$tltree>.
=item C<update_from_catalogue ($texcatalogue)>
-
adds information from a C<TeXCatalogue> object
(currently license, version, url, and updates docfiles with details and
languages tags if present in the Catalogue)
=item C<is_arch_dependent>
-
returns 1 if there are C<binfiles>, otherwise 0.
=item C<total_size>
+If no argument is given returns the sum of C<srcsize>, C<docsize>,
+C<runsize>.
-If no argument is given returns the sum of C<srcsize>, C<docsize>, C<runsize>
-
-If and argumen is given it returns the sum of the above increased by the
-sum of sizes of C<binsize> 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<binsize> 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<binfiles> for the given architecture
=item C<{add,remove}_files ($type, $files)>
-
adds or removes files for the given type (only for C<run>, C<src>, C<doc>).
+=item C<all_files>
+returns a list of all files of all types.
+
=back
=head1 SEE ALSO